Abstract:
A method for testing the accuracy of real time clocks is disclosed. The method includes the steps of: setting test parameters for testing the accuracy of real time clocks (RTCs), the test parameters comprising a test time length, a test time sampling interval, and an acceptable margin; synchronizing the time of an RTC IC and an RTC to be tested via a UUT; reading a current time of the RTC IC and the RTC via the UUT at each test time sampling interval; calculating a time difference between the current time of the RTC IC and the RTC via the UUT, and measuring whether the absolute value of the time difference is less than the acceptable margin; detecting whether the test time length is over; repeating the test process if the test time length is not over, or outputting test pass information if the test time length is over. A related system is also disclosed.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention is related to a system and method for testing the accuracy of real time clocks. 
         [0003]    2. Description of Related Art 
         [0004]    Real time clocks (RTCs) are used in many electronic products such as personal computers, mobile phones, and computer servers. The accuracy of the real time clock is important to high performance requirements of the electronic products such as the computer servers. For this reason, it is common to test the accuracy of the real time clocks configured in such electronic products. 
         [0005]    There are two methods to test the accuracy of the real time clock configured in a motherboard of a computer server on a product line. The first ways is as follows: an operator corrects the time of the RTC to be tested according to a standard RTC, calculates a time difference between the current time of the tested RTC and the standard RTC at a specified interval, and judges whether the time difference is less than an acceptable margin. If the time difference is less than the acceptable margin, the quality of the tested RTC is regarded as good. However, this kind of method may cause low efficiency and errors. Because there are only two records of time (i.e., at the beginning and the end), if the time difference is more than the acceptable margin between the beginning and the end, this kind of method does not detect the error. The quality of the tested RTC is regarded as good if the time difference is less than the acceptable margin at the end. 
         [0006]    The second ways is as follows: reading time of a standard RTC from a sever via an application software through a network, reading time of a tested RTC in the motherboard of a computer server via the application software, and calculating a time difference between the read time of the tested RTC and the standard RTC. However, if the connection between the server and the network is intermitted or delayed, the accuracy of the test result will decline. 
         [0007]    Therefore, what is needed is a system and method for automatically testing the accuracy of real time clocks. 
       SUMMARY OF THE INVENTION 
       [0008]    A system for testing the accuracy of real time clocks is provided in accordance with a preferred embodiment. The system includes a unit under test (UUT). The UUT includes a real time clock (RTC) to be tested. The system further includes a fixture and a database connected to the UUT. The fixture includes an RTC integrated circuit (IC), a microcontroller, and a data converting chip. The microcontroller is configured for reading the initial time of the RTC IC, and sending the initial time to the data converting chip. The data converting chip is configured for converting the initial time sent from the microcontroller to data recognizable by the UUT, and sending the converted data to the UUT. The UUT further includes a test program, the test program includes: a parameters setting module being configured for setting test parameters for testing the accuracy of the RTC, and storing the test parameters in the database, the test parameters comprising a test time length, a test time sampling interval, and an acceptable margin for a time difference; a synchronizing module being configured for synchronizing the time of the RTC IC and the RTC when the test process has started; an obtaining module being configured for reading a current time of the RTC IC and the RTC at each test time sampling interval; an analyzing module being configured for calculating a time difference between the current time of the RTC IC and the current time of the RTC, and determining whether the accuracy of the RTC is satisfactory by measuring whether the absolute value of the time difference is less than the acceptable margin within the test time length. 
         [0009]    A method for testing the accuracy of real time clocks is also provided. The method includes the steps of: (a) setting test parameters for testing the accuracy of real time clocks (RTCs), and storing the test parameters in a database, the test parameters comprising a test time length, a test time sampling interval, and an acceptable margin for a time difference; (b) reading the initial time of an RTC integrated circuit (IC) via a microcontroller when the test process has started, and sending the initial time to a data converting chip; (c) converting the initial time via the data converting chip to data recognizable by a unit under test (UUT), and sending the converted data to the UUT, the UUT comprising an RTC to be tested; (d) synchronizing the time of the RTC IC and the RTC via the UUT; (e) reading a current time of the RTC IC and the RTC via the UUT at each test time sampling interval; (f) calculating a time difference between the current time of the RTC IC and the current time of the RTC via the UUT, and measuring whether the absolute value of the time difference is less than the acceptable margin; (g) detecting whether the test time length is over if the absolute value of the time difference is less than the acceptable margin; (h) returning to step (e) if the test time length is not over, or outputting test pass information if the test time length is over. 
         [0010]    Other systems, methods, features, and advantages of the present invention will become apparent to one with skill in the art upon examination of the following drawings and detailed description. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0011]      FIG. 1  is a schematic diagram of hardware configuration of a system for testing the accuracy of real time clocks in accordance with a preferred embodiment; 
           [0012]      FIG. 2  is a schematic diagram showing function modules of a test program of  FIG. 1 ; and 
           [0013]      FIG. 3  is a flowchart of a preferred method for testing the accuracy of real time clocks in accordance with one embodiment. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0014]      FIG. 1  is a schematic diagram of hardware configuration of a system for testing the accuracy of real time clocks (hereinafter, “the system”) in accordance with a preferred embodiment. The system typically includes a fixture  1 , a unit under test (UUT)  2 , and a database  3 . The fixture  1  may connect with the UUT  2  through an external I/O serial bus (e.g., RS232, IEEE1394, or USB). The UUT  2  may connect with the database  3  through a database connection. The database connection may be an open database connectivity (ODBC) or a java database connectivity (JDBC). The fixture  1  typically includes a real time clock (RTC) integrated circuit (IC)  10 , a microcontroller  11 , and a data converting chip (e.g., an I/O bridge chip)  12 . The microcontroller  11  may connect with the RTC IC  10  and the data converting chip  12  through a multi-master serial computer bus (e.g., I2C or SPI). The data converting chip  12  connects with the UUT  2  through the external I/O serial bus. The RTC IC  10  can provide a reference time for the RTC. The microcontroller  11  is configured for reading the time of the RTC IC  10 , and sending the time to the data converting chip  12 . The data converting chip  12  converts the time sent from the microcontroller  11  to data recognizable by the UUT  2 . That is to say, the data converting chip  12  converts multi-master serial computer bus data to external I/O serial bus data, and sends the external I/O serial bus data to the UUT  2 . 
         [0015]    The UUT  2  typically includes a test program  20  and an RTC  21  to be tested. The test program  20  is an application software for controlling/performing the test. 
         [0016]      FIG. 2  is a schematic diagram showing function modules of the test program  20  of  FIG. 1 . The test program  20  may include a parameters setting module  201 , a synchronizing module  202 , an obtaining module  203 , an analyzing module  204 , and an outputting module  205 . 
         [0017]    The parameters setting module  201  is configured for setting test parameters for testing the accuracy of the RTC  21 , and storing the test parameters in the database  3 . The test parameters may include a test time length, a test time sampling interval, and an acceptable margin. 
         [0018]    The synchronizing module  202  is configured for synchronizing the time of the base RTC IC  10  and the RTC  21 . A detailed description is as follows. At first, the microcontroller  11  reads the initial time of the RTC IC  10  when the test process has started, and sends the initial time to the data converting chip  12 . The data converting chip  12  converts the initial time to the external I/O serial bus data, and sends the external I/O serial bus data to the synchronizing module  202 . Then, the synchronizing module  202  adjusts the time of the RTC  21  according to the initial time, thereby completing the time synchronization between the RTC IC  10  and the RTC  21 . 
         [0019]    The obtaining module  203  is configured for reading a current time of the RTC IC  10  and the RTC  21  at each test time sampling interval. A detailed description is as follows. The obtaining module  203  sends a read time command to the fixture  1  at each test time sampling interval within the test time length. Then, the microcontroller  11  reads the current time of the RTC IC  10 , and sends the current time to the data converting chip  12 . The data converting chip  12  converts the current time to the external I/O serial bus data, and sends the external I/O serial bus data to the obtaining module  203 . At the same time, the obtaining module  203  reads the current time of the RTC  21 . 
         [0020]    The analyzing module  204  is configured for calculating a time difference between the current time of the RTC IC  10  and the current time of the RTC  21 , and measuring whether the absolute value of the time difference is less than the acceptable margin. If the absolute value of the time difference is less than the acceptable margin, the analyzing module  204  further measures whether an elapsed test time between the current time and the initial time is equal to or greater than the test time length (i.e., detects whether the test time length is over). If the test time length is not over (i.e., the elapsed test time between the current time and the initial time is less than the test time length), the test program continues, and the obtaining module  203  obtains a current time of the RTC IC  10  and the RTC  21  at the next test time sampling interval. 
         [0021]    The outputting module  205  is configured for outputting test failure information if the absolute value of the time difference is greater than or equal to the acceptable margin, and outputting test pass information if the absolute value of the time difference is less than the acceptable margin within the test time length. 
         [0022]    An example of testing the accuracy of real time clocks using the aforementioned system is as follows. At first, a user sets test parameters for testing the accuracy of the RTC  21  through the parameters setting module  201 , and stores the test parameters in the database  3 . The test parameters may include test time length, a test time sampling interval, and an acceptable margin. In the example, the test time length is one minute, the test time sampling interval is 5 seconds, and the acceptable margin is 0.05 seconds. 
         [0023]    The microcontroller  11  reads the initial time of the RTC IC  10  when the test process has started, and sends the initial time to the data converting chip  12 . The data converting chip  12  converts the initial time to the external I/O serial bus data, and sends the external I/O serial bus data to the synchronizing module  202 . Then, the synchronizing module  202  adjusts the time of the RTC  21  according to the initial time, thereby completing the time synchronization between the RTC IC  10  and the RTC  21 . 
         [0024]    After five seconds, the obtaining module  203  reads the current time of the RTC IC  10  and the RTC  21 . A detailed description is as follows. The obtaining module  203  sends the read time command to the fixture  1 . Then, the microcontroller  11  reads the current time of the RTC IC  10 , and sends the current time to the data converting chip  12 . The data converting chip  12  converts the current time to the external I/O serial bus data, and sends the external I/O serial bus data to the obtaining module  203 . At the same time, the obtaining module  203  reads the current time of the RTC  21 . 
         [0025]    The analyzing module  204  calculates a time difference between the current time of the RTC IC  10  and the current time of the RTC  21 , and measures whether the absolute value of the time difference is less than 0.05 seconds. If the absolute value of the time difference is greater than or equal to 0.05 seconds, the outputting module  205  outputs the test failure information. If the absolute value of the time difference is less than 0.05 seconds, the analyzing module  204  further measures whether the elapsed test time between the current time and the initial time is equal to or greater than one minute (i.e., detects whether the test time length is over). If the test time length is not over (i.e., the elapsed test time between the current time and the initial time is less than one minute), the test program continues, and the obtaining module  203  obtains a current time of the RTC IC  10  and the RTC  21  at another five seconds. If the absolute value of the time difference is less than 0.05 seconds at each test time sampling interval within one minute, the outputting module  205  outputs the test pass information. 
         [0026]      FIG. 3  is a flowchart of a preferred method for testing the accuracy of real time clocks in accordance with one embodiment. In step S 401 , the user sets the test parameters for testing the accuracy of the RTC  21  through the parameters setting module  201 , and storing the test parameters in the database  3 . The test parameters may include the test time length, the test time sampling interval, and the acceptable margin. 
         [0027]    In step S 402 , the synchronizing module  202  synchronizes the time of the base RTC IC  10  and the RTC  21 . A detailed description is as follows. At first, the microcontroller  11  reads the initial time of the RTC IC  10  when the test process has started, and sends the initial time to the data converting chip  12 . The data converting chip  12  converts the initial time to the external I/O serial bus data, and sends the external I/O serial bus data to the synchronizing module  202 . Then, the synchronizing module  202  adjusts the time of the RTC  21  according to the initial time, thereby completing the time synchronization between the RTC IC  10  and the RTC  21 . 
         [0028]    In step S 403 , the obtaining module  203  reads the current time of the RTC IC  10  and the RTC  21  at each test time sampling interval. A detailed description is as follows. The obtaining module  203  sends the read time command to the fixture  1  at each test time sampling interval within the test time length. Then, the microcontroller  11  reads the current time of the RTC IC  10 , and sends the current time to the data converting chip  12 . The data converting chip  12  converts the current time to the external I/O serial bus data, and sends the external I/O serial bus data to the obtaining module  203 . At the same time, the obtaining module  203  reads the current time of the RTC  21 . 
         [0029]    In step S 404 , the analyzing module  204  calculates the time difference between the current time of the RTC IC  10  and the current time of the RTC  21 . 
         [0030]    In step S 405 , the analyzing module  204  measures whether the absolute value of the time difference is less than the acceptable margin. 
         [0031]    In step S 406 , if the absolute value of the time difference is greater than or equal to the acceptable margin, the outputting module  205  outputs the test failure information, and the procedure ends. 
         [0032]    In step S 407 , if the absolute value of the time difference is less than the acceptable margin, the analyzing module  204  further measures whether the elapsed test time between the current time and the initial time is equal to or greater than the test time length (i.e., detects whether the test time length is over). If the absolute value of the time difference is less than the acceptable margin and the test time length is not over (i.e., the elapsed test time between the current time and the initial time is less than the test time length), the procedure goes to step S 403 . 
         [0033]    In step S 408 , if the test time length is over, the outputting module  205  outputs the test pass information. 
         [0034]    It should be emphasized that the above-described embodiments of the present invention, particularly, any preferred embodiments, are merely possible examples of implementations, merely set forth for a clear understanding of the principles of the invention. Many variations and modifications may be made to the above-described embodiment(s) of the invention without departing substantially from the spirit and principles of the invention. All such modifications and variations are intended to be included herein within the scope of this disclosure and the present invention and protected by the following claims.