This application claims the priority of Korean Patent Application No. 10-2010-0134519 filed on Dec. 24, 2010, in the Korean Intellectual Property Office, the disclosure of which is incorporated herein by reference.
1. Field of the Invention
The present invention relates to an apparatus for detecting a real time clock frequency offset and a method thereof.
2. Description of the Related Art
In general, a crystal oscillator can be used in systems or apparatuses using a real time clock to create the real time clock. The crystal oscillator has an initial frequency offset value, depending on the quality thereof, which may cause an error in the created real time clock. Therefore, it is required to find out the real time clock frequency offset, as the error in the real time clock needs to be corrected in order to increase the accuracy thereof.
A frequency error has previously been manually determined by comparing a reference signal with a real time clock that is created by a reference signal generator and a frequency comparator or the like, to detect a frequency offset of a real time clock in the related art.
However, detecting the real time clock frequency offset according to the related art requires relatively expensive equipment, such as the frequency comparator or the like, to acquire a real time clock frequency offset value, and is performed by hand, such that an error is likely to occur and the automation thereof is difficult to be implemented.
An object of the present invention is to provide an apparatus automatically detecting a real time clock frequency offset, without the use of expensive equipment, such as a frequency comparator or the like, and a method thereof.
The aspect of the present invention provides an apparatus for detecting a real time clock frequency offset, the apparatus including: an overlap detecting unit detecting an overlap signal having overlap information of a predetermined reference clock and a predetermined real time clock; an envelope signal creating unit creating an envelope signal having envelope information of the overlap signal; and a frequency counter unit calculating a frequency of the envelope signal that is a frequency offset of the real time clock, by using a first clock number created by counting the reference clock for one period of the envelope signal and a frequency of the reference clock.
Further, the apparatus may further include: a first counter creating a second clock number by counting the reference clock for a predetermined time; a second counter creating a third clock number by counting the real time clock for a predetermined time; and an offset sign determining unit determining a sign of the frequency offset of the real time clock by comparing the second clock number with the third clock number.
Further, the frequency counter unit may include: a rising edge detector detecting rising edges of the envelope signal; a third counter creating the first clock number by counting the reference clock between one rising edge and the next rising edge of the envelope signal; and a calculator calculating the frequency of the envelope signal that is the frequency offset of the real time clock, by using the first clock number and the frequency of the reference clock.
Further, the third counter may receive the rising edges through a reset terminal thereof.
Further, the frequency offset of the real time clock may be calculated by the following formula:
where Δf is the frequency offset of the real time clock, N is the first clock number, and f is the frequency of the reference clock.
Further, the overlap detecting unit may include an AND gate performing an AND-operation on the reference clock and the real time clock.
Another aspect of the present invention provides a method for detecting a real time clock frequency offset, the method includes: detecting an overlap signal having overlap information of a predetermined reference clock and a predetermined real time clock; creating an envelope signal having envelope information of the overlap signal; and calculating a frequency of the envelope signal that is a frequency offset of the real time clock, by using a first clock number counting the reference clock for one period of the envelope signal and a frequency of the reference clock.
Further, the method may further include: counting the reference clock and the real time clock for a predetermined time; and determining a sign of the frequency offset of the real time clock by comparing a second clock number created by counting the reference clock with a third clock number created by counting the real time clock.
Further, the calculating of the frequency of the envelope signal may include: detecting rising edges of the envelope signal; creating the first clock number by counting the reference clock between one rising edge and the next rising edge of the envelope signal; and calculating the frequency of the envelope signal that is the frequency offset of the real time clock, by using the first clock number and the frequency of the reference clock.
Further, the creating of the first clock number may include resetting the counting of the reference clock at the rising edge.
Further, the frequency offset of the real time clock may be calculated by the following formula:
where Δf is the frequency offset of the real time clock, N is the first clock number, and f is the frequency of the reference clock.
Further, the detecting of the overlap signal may include performing an AND-operation on the reference clock and the real time clock.
The above and other aspects, features and other advantages of the present invention will be more clearly understood from the following detailed description taken in conjunction with the accompanying drawings, in which:
Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings.
The present invention is not limited to the embodiments described herein and the embodiments of the present invention are provided to help understand the spirit of the present invention. The components having substantially the same configurations and functions are designated by the same reference numerals in the accompanying drawing of the present invention.
Referring to
An overlap detecting unit 100 may receive the reference clock CLKref that may be inputted from the outside and a real time clock CLKrtc created by a crystal oscillator and overlap the two clocks, thereby creating an overlap signal Sov having the overlap information of the two clocks. In detail, referring to
An envelope signal creating unit 200 may receive the overlap signal Sov created by the overlap detecting unit 100 and detect an envelope of the overlap signal Sov to create an envelope signal. In detail, since the overlap signal Sov has periodicity, an envelope signal Sev corresponding to the detected envelope also has periodicity.
A frequency counter unit 300 may calculate the frequency of the envelope signal Sev by receiving the reference clock CLKref and the envelope signal Sev detected by the envelope signal creating unit 200. In detail, the frequency counter unit 300 may acquire the frequency of the envelope signal Sev by counting the number of pulses of the reference clock CLKref for a period of the envelope signal Sev. The frequency of the envelope signal Sev has the same value as the frequency offset of the real time clock CLKrtc.
In detail, referring to
A first counter 500 may count a second clock number Nref for a predetermined time by receiving the reference clock CLKref that may be inputted from the outside. Further, a second counter 510 may count a third clock number Nrtc for a predetermined time by receiving the real time clock CLKrtc created from the crystal oscillator.
An offset sign determining unit 400 receives the frequency of the envelope signal Sev acquired by the frequency counter unit 300, that is, the frequency offset of Δf of the real time clock CLKrtc and receives the second clock number Nref counted by the first counter 500 and the third clock number Nrtc counted by the second counter 510. The sign of the frequency offset value of the real time clock CLKrtc may be determined by comparing the respective clock numbers. Therefore, an accurate frequency offset Δf of the real time clock may be detected.
Referring to
Referring to
Further, An operation (S300) of calculating the frequency of the envelope signal Sev by using the frequency of the reference clock and the first clock number N created by counting the reference clock for a period of the envelope signal Sev includes detecting the rising edges of the envelope signal Sev (S310), creating the first clock number N by counting the reference clock between one rising edge to the next rising edge (S320), and calculating the frequency of the envelope signal Sev from the first clock number N (S330).
Further, an operation (S400) of counting the reference clock CLKref and the real time clock CLKrtc and an operation (S500) of determining the sign of the frequency offset of the real time clock CLKrtc by comparing the second clock number Nref and the third clock number Nrtc are sequentially shown in
The operations and effects of the present invention are described hereafter in detail with reference to the accompanying drawings.
The apparatus for detecting a real time clock frequency offset according to an embodiment of the present invention is described with reference to
In
The overlap detecting unit 100 detects the overlap signal Sov formed of the overlapping portion of the reference clock CLKref and the real time clock CLKrtc overlap. More specifically, the reference clock CLKref and the real time clock CLKrtc are pulse trains having different frequencies in which low states and high states are periodically repeated and the overlap detecting unit 100 creates the overlap signal Sov having a high level in a time period where the high states of the two clocks are overlapped. In detail, referring to
The envelope signal creating unit 200 may receive the overlap signal Sov and detect the envelope thereof to create the envelope signal Sev. Referring to
The frequency counter unit 300 may calculate the frequency of the envelope signal Sev, that is, the frequency offset Δf of the real time clock, by receiving the reference clock CLKref and the envelope signal Sev detected by the envelope signal creating unit 200.
In detail, referring to
The third counter 200 receives the output signal Seg of the rising edge detector 310 through the reset terminal Rst thereof and creates the first clock number N by counting the reference clock CLKref for one period of the envelope signal Sev while receiving the reference clock CLKref. In detail, referring to
The calculator 330 calculates the frequency of the envelope signal Sev, that is, the real time clock frequency offset, by using the first clock number N. In more detail, since the period of the reference clock CLKref can be confirmed, it is possible to determine the period of the envelope signal Sev by multiplying the period of the reference clock CLKref by the first clock number N. It is possible to acquire the frequency of the envelope signal Sev by inverting the period of the envelope signal Sev. The frequency of the envelope signal Sev, which is acquired as described above, is the same as the real time clock frequency offset Δf, and as a result, the output of the calculator 330 is the real time clock frequency offset Δf.
The calculation is expressed by the following Formula:
where Δf is the real time clock frequency offset, N is the first clock number, which is the clock number of the reference clock CLKref for one period of the envelope signal Sev calculated by the third counter 320, and f is the frequency of the reference clock CLKref.
The first counter 500 receives the reference clock CLKref generated from a signal generator outside a system or apparatus that uses a real time clock and counts the received reference clock for a predetermined time to create the second clock number Nref. Further, the second counter 510 creates the third clock number Nrtc by receiving the real time clock generated from a crystal oscillator in a system or apparatus which uses a real time clock and counting the real time clock for a time equally set to the counting time of the first counter 500.
The offset sign determining unit 400 determines an accurate real time clock frequency offset by receiving the real time clock frequency offset, which is the output from the frequency counter unit 300, and the outputs from the first counter 500 and second counter 510, and determining the sign Δf of the real time clock frequency offset.
More specifically, it is possible to confirm that which of the frequency of the reference clock CLKref and the frequency of the real time clock CLKrtc is larger, by comparing the second clock number Nret created by the first counter 500 with the third clock number Nrtc created by the second counter 510. For example, when the second clock number Nref counted by the first counter 500 is larger than the third clock number Nrtc counted by the second counter 510, it means that the frequency of the reference clock CLKref is larger than the frequency of the real time clock CLKrtc, such that the real time clock frequency offset has a minus (−) sign.
Referring to
Further, it can be seen that the calculating of the frequency of the envelope signal Sev by using the first clock number N created by counting the reference clock CLKref for one period of the envelope signal Sev (S300) includes detecting the rising edges of the envelope signal Sev (S310), creating the first clock number N by counting the reference clock CLKref between one rising edge and the next rising edge (S320), and calculating the frequency of the envelope signal Sev by using the frequency of the reference clock CLKref and the first clock number N (S330).
The detailed descriptions for explaining the processes are the same as that in the case of
As described above, according to the present invention, it is possible to automatically detect an accurate real time clock frequency offset, without using expensive equipment such as a frequency comparator or the like. Further, since an accurate real time clock frequency offset may be provided during the correcting of the real time clock, necessity of using an expensive crystal oscillator is decreased and manufacturing costs can be reduced.
While the present invention has been shown and described in connection with the exemplary embodiments, it will be apparent to those skilled in the art that modifications and variations can be made without departing from the spirit and scope of the invention as defined by the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
1020100134519 | Dec 2010 | KR | national |