Home

AN10652 - NXP Semiconductors

image

Contents

1. 5 60 0 014 ms 4 2 ms For simplicity we now assume that the ambient temperature for the crystal RTC is constant and 45 C In that case every 5 minutes adds 4 2 ms time lag and it would take 239 measurements for the accumulated value to exceed 1 s Now the registers in the RTC will be updated and the accumulated value reset A day has 1440 minutes 239 measurements every 5 minutes equals 1195 minutes In this case the RTC would be updated a bit more often than once per day The more the temperature deviates from the room temperature the more frequent an update would be necessary Still a small error remains The moment that the RTC time is shifted by 1s updated the actual time lag was 239 4 2 ms 1 0038 seconds Every 1195 minutes an error of 3 8 ms remains excluding the production spread errors in To and for In ppm 3 8 10 e O55 1195 60 L AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 13 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor This is not meant to claim that this degree of accuracy can be achieved There will be errors in the measurements there will be the production spread of the crystals In this theoretical example though the deviation as a function of temperature was reduced from 14 00 ppm to 0 053 ppm and in a practical situation a considerable improvement can be achieved as well 5 3 Step 3 Updati
2. 8 hen BLOCK is reset two things happen 1 Start condition 2 PC read ts detected 3 At next 1Hz clock No C activity a BLOCK signal goes a Clock is blocked a First the watchdog counter and watchdog RTC is counting normally active time does not signal are reset The 1Hz clock at B is lost b Watchdog counter is increment b Second the clock generator generates the therefore the time is 1second no longer reset b Watchdog counter 1Hz signal that was blocked at A and updates behind The 1Hz clock at A was increments the time remembered Time 01 10 47 PX KX otto Xma Xogos 1Hz clock BLOCK ae a a ee ee be eae counter a ee a C watchdog active low hg J Watchdog About 10n _ clamped in reset Because the interfape clock when no FC read is asynchronous to the internal RTC clock this period may be anything from 1 gt T gt 0 seconds Fig 6 Sequence of events example READ From this follows e Al C read must be terminated within one second of initiation e The RTC will automatically terminate the read if it remains active for longer than one second e Each time auto termination occurs the RTC looses one second AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 15 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor e The signa
3. OF Hex timer lt timer countdown value gt For more detailed information about these registers and how to set them please refer to the PCF8563 datasheet which is available at www nxp com 4 4 Initial calibration In order to achieve highest accuracy it is possible to tune the frequency before any temperature compensation is implemented Thus it is possible to compensate for variations in To and fo in order to ensure that the crystal runs at near 32 768 kHz at room temperature The PCF8563 has the option to output the buffered crystal frequency to the pin CLKOUT Operation is controlled by the CLKOUT control register at address ODyex CLKOUT is an open drain output and enabled at power on If disabled it becomes high impedance In order to output the buffered crystal frequency at output CLKOUT set the register ODuex CLKOUT control to 804ex The frequency can now be tuned by adjusting the variable capacitor as indicated in Fig 3 below Note Touching the adjustment screw often causes the capacitance and thus the frequency to shift AN10652_1 NXP B V 2007 All rights reserved 8 of 20 Application note Rev 01 01 2 November 2007 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor CLKOUT PCF8563 Fig 3 Oscillator tuning If the required accuracy is within 1 second per day you need at least an 8 digit frequency counter with an accuracy of 1 ppm Here 1 ppm e
4. a guideline to implement an algorithm to compensate for varying temperatures when other NXP real time clocks are used Designed for a range of demanding applications these real time clocks calendars are driven by a low power 32 768 kHz quartz oscillator use the SPI or C bus for serial data transfer and typically consume less than 1 yW of power This means that all these RTCs can be powered by a very small battery or a small super cap The RTCs most similar to the PCF8563 are PCA8565 PCF8583 and PCF8593 Besides this range the product line includes the PCA2125 and will soon be extended with PCF2124 and PCF2128 release end of 2007 Thus the product line includes the following e PCF8563 with I C interface for low power applications e PCA8565 with I C interface for high temperature applications e PCF8583 with I C interface 10 ms resolution where additional scratch pad RAM is required e PCF8593 with I C interface and 10 ms resolution e PCF2124 with SPI interface for low power applications e PCA2125 with SPI interface for high temperature applications e PCA2128 with I C and SPI interface TCXO with high accuracy Addresses and data are transferred serially via an SPI bus with a maximum speed of 7 0 Mbps PCF2124 PCA2125 or via a two line bidirectional 12C bus that operates at a maximum speed of 400 kbps PCF8563 and PCA8565 or 100 kbps PCF8583 The PCF2128 contains both a SPI and an I C interface The built in word address regi
5. be cleared by software The asserted TF can be used to generate an interrupt INT The interrupt may be generated as a pulsed signal every countdown period or as a permanently active signal which follows the condition of TF Bit TI TP is used to control this mode selection When reading the timer the current countdown value is returned If we would like to generate based on the example described before an interrupt to the microcontroller every 5 minutes the timer control register at address OEyex would have to be loaded with 83 ex This sets bit 7 TE to enable the timer and it sets bits 1 and 0 TD1 and TDO to select source clock frequency 1 60 Hz which results in a clock giving one pulse per minute The value written to the timer countdown register at address OF Hex represents then the interval in minutes In this case it would have to be programmed with O5nex NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 10 of 20 NXP Semiconductors AN1 0652 AN10652_1 Improved timekeeping accuracy using external temperature sensor Determine time deviation resulting from measured temperature and interval 2 Add time deviation to accumulated value Tac in uC memory Read Time Tarc from RTC Add accumulated deviation to RTC time Tare Tatc T acc Write new value Tarc in PCF8563 registers Reset accumulated deviation Tac 0 3 Fig 4 Flow chart of procedure to upda
6. is the nominal frequency as specified and for the offset from this nominal frequency which is a result of production spread both at room temperature f fam fa 4 807 1 ne Gee hae oe 2 For the frequency deviation in ppm we can now write From From A A _air 1 i a r 7 1 w 5 i 001aag901 deviation Af fo i PA ppm t 20 pest 100 140 40 30 20 10 0 10 20 30 40 50 60 70 80 90 T C Fig 1 The deviation in frequency vs temperature of a typical 32 768 kHz crystal In equation 1 above there are three variables that influence the frequency response as a function of temperature These are the parabolic coefficient B the turnover temperature To and the room temperature offset fon The crystal manufacturer specifies these parameters and typical values are T 25 C ATo 5 C and fog 30ppm The coefficient B has a very small spread for various crystals of one type but it has the largest effect on the parabolic nature of the frequency deviation as a function of temperature Variation in the turnover temperature To will shift the deviation curve left or right variation in the offset at room temperature will shift it up or down In practice the combination of variation in To and offset at room temperature easily results in an accuracy of 30 ppm at room temperature which equates to a time deviation of aroun
7. this characteristic to implement a compensation mechanism It includes a temperature sensor which measures temperature at certain intervals The device includes a lookup table and the temperature measurements in combination with the lookup table result in an output signal to apply a load capacitance value for the integrated 32 768 kHz crystal to achieve high accuracy It has the effect of flattening the parabolic curve ideally to a perfectly straight horizontal line By using an off the shelf TCXO high accuracy can be achieved without development or calibration effort Temperature compensation always implies measuring the temperature at which the crystal operates at regular intervals Then according to the measured temperature some action needs to be taken like adjustment of the crystal loading to the clock source as implemented in conventional TCXOs or using an algorithm which reads and updates registers in the RTC The latter is the approach used in this application note for the NXP PCF8563 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 5 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor 4 The PCF8563 RTC Since this application note deals specifically with the PCF8563 below an introduction to this device is given In section 7 some further information about other NXP real time clocks and implementation of temperature compensation is give
8. 47 0 035 25 50 87 50 2 87 0 035 20 45 70 88 2 32 0 035 15 40 56 00 1 84 0 035 10 35 42 88 1 40 0 035 5 30 31 50 1 03 0 035 0 25 21 88 0 72 0 035 5 20 14 00 0 46 0 035 10 15 7 88 0 26 AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 12 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor Parabolic Temperature T Temperature Deviation Deviation Coefficient B Offset Aff Aff ppm C C C ppm Hz 0 035 15 10 3 50 0 11 0 035 20 5 0 88 0 03 0 035 25 0 0 00 0 00 0 035 30 5 0 88 0 03 0 035 35 10 3 50 0 11 0 035 40 15 7 88 0 26 0 035 45 20 14 00 0 46 0 035 50 25 21 88 0 72 0 035 55 30 31 50 1 03 0 035 60 35 42 88 1 40 0 035 65 40 56 00 1 84 0 035 70 45 70 88 2 32 0 035 75 50 87 50 2 87 0 035 80 55 105 88 3 47 0 035 85 60 126 00 4 13 0 035 90 65 147 88 4 88 Example Suppose the interval time is 5 minutes The temperature measured is 45 C According to the table now Af f 14 00 ppm The crystal frequency has slowed and after division by 2 is not 1Hz anymore but 0 999986 Now the 1Hz clock period does not take 1s but 1 0000140002 s Every second time lags by an additional 0 014 ms The corrective value to be added to the accumulated value for this measurement would be the number of seconds multiplied by the time lag per second
9. AN10652 Improved timekeeping accuracy with PCF8563 using external temperature sensor Rev 01 01 2 Document information November 2007 Application note Info Keywords Abstract Content PCF8563 RTC Accuracy Timekeeping Temperature Sensor Temperature Compensation Crystal 32 768 kHz The temperature dependent characteristics of quartz crystals prevent time keeping with state of the art real time clocks from being highly accurate over a wide temperature range unless corrective measures are implemented This application note describes how the use of an external temperature sensor placed in a location which will be at or near the same temperature as the quartz crystal attached to the PCF8563 RTC can improve accuracy considerably If the application is already using a temperature sensor for some reason all that is needed is some extra firmware without adding to the Bill Of Material BOM founded by Philips NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor Revision history Rev Date Description 01 20071102 First Official Release Contact information For additional information please visit http www nxp com For sales office addresses please send an email to salesaddresses nxp com AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 2 of 20 NXP Semiconductors AN1 0652 Improved timekeeping ac
10. curacy using external temperature sensor 1 Introduction Real time clocks RTC have been around for a long time and many electronic systems include one for functions like keeping calendar time tariff switching time stamping or waking up a system periodically to initiate certain actions for example doing some measurements Not all applications need the same level of accuracy but when high accuracy is necessary like in applications that rely on real time data where accuracy better than 5 ppm is needed a standard RTC does not fulfil these Time keeping can only be as accurate as its reference Several environmental factors like humidity vibration and pressure can influence RTC accuracy but it is mainly the inferior characteristics of a quartz crystal over temperature which result in deviations if temperature is changing Many techniques have been used to improve the timekeeping accuracy achieved using 32 768 kHz crystals This application note describes how the use of an external temperature sensor placed in a location which will be at or near the same temperature as the PCF8563 RTC and its crystal can improve accuracy considerably If the application is already using a temperature sensor all that is needed is some extra firmware without adding to the Bill Of Material BOM 2 The problem when using an RTC without temperature compensation AN10652_1 Time keeping can often be done using the built in oscillator in the system microcontrol
11. d 15 minutes per year In addition there is the effect of temperature Typical values for B range from 0 035 ppm C to 0 04 ppm C In a real application and using B 0 04 this means that a clock built using a regular 32 768 kHz tuning fork crystal will at room temperature only have the frequency deviation resulting from the variations in To and fot however will lose an additional two minutes per year at 10 degrees Celsius above or below room AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 4 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor temperature and will lose an additional eight minutes per year at 20 degrees Celsius above or below room temperature To give a better feeling of the relationship between real time and ppm a clock running 1s day too fast has an accuracy of 1 3600 24 11 57ppm and a deviation of 1s week means 1 65ppm 3 Possible solutions AN10652_1 Not many options have been available to improve upon the inaccuracies Timekeeping accuracy can for example be improved through crystal screening integrated crystals keeping the crystal RTC at a well specified temperature or by using a Temperature Compensated Crystal Oscillator TXCO Crystal screening here means selecting only those crystals for which the offset for falls within a narrower range than the normal production spread This would
12. del MM per JESD22 A115 and 2000 V Charged Device Model CDM per JESD22 C101 Latch up testing is done to JEDEC standard JESD78 which exceeds 100 mA NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 7 of 20 AN10652 Improved timekeeping accuracy using external temperature sensor NXP Semiconductors 4 3 Register organization Table 1 Register overview Bit positions labelled as x are not implemented Bit positions labelled with 0 should always be written with logic 0 if read they could be either logic 0 or logic 1 Address Register name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 O0HeEx control status 1 TESTI 0 STOP 0 TESTC 0 0 0 O1HEx control status 2 0 0 0 TI TP AF TF AIE TIE 02HEx seconds VL lt seconds 00 to 59 coded in BCD gt O3HEx minutes x lt minutes 00 to 59 coded in BCD gt 04HEx hours x X lt hours 00 to 23 coded in BCD gt O5HEx days x X lt days 01 to 31 coded in BCD gt O6HEx weekdays x x x X x lt weekdays 0 to 6 gt O7HEx months century C X x lt months 01 to 12 coded in BCD gt O8HeEx years lt years 00 to 99 coded in BCD gt O9nHEx minute alarm AE lt minute alarm 00 to 59 coded in BCD gt OAneEx hour alarm AE x lt hour alarm 00 to 23 coded in BCD gt OBhHex day alarm AE x lt day alarm 01 to 31 coded in BCD gt OCHex weekday alarm AE x X x x lt weekday alarm 0 to 6 gt ODuex CLKOUT control FE x x x x x FD1 FDO OEHex timer control TE x x x x x TD1 TDO
13. e the RTC as soon as the accumulated value exceeds 1s This is also an easily testable criterion The algorithm will then compensate the time lost due to the temperature variations by reading the time according to the PCF8563 from its registers add the accumulated value and write it back into the PCF8563 Hereafter the stored accumulated time deviation will be reset to 0 since now the time in the RTC has just been corrected The flow chart implementing this is given in Fig 4 on the next page This is not a one time event but needs to be repeated every time a temperature measurement needs to be done In order to implement all steps correctly details that have to be taken into account for the practical implementation are described in sections 5 1 until 5 3 The steps that need more attention have been indicated in the flow chart with 1 2 and 3 Step 1 Setting the timer The first step is to decide at which intervals the microcontroller should measure the temperature and set the timer accordingly The 8 bit countdown timer at address OF yex can be used for this and is controlled by the timer control register at address OEnex refer to Table 1 The timer control register determines one of 4 source clock frequencies for the timer 4096 Hz 64 Hz 1 Hz or 1 60 Hz and enables or disables the timer The timer counts down from a software loaded 8 bit binary value At the end of every countdown the timer sets the Timer Flag TF The TF may only
14. en an update is done AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 16 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor 6 NXP Demonstration board kit 1 C 2005 1 A fast way to start developing an algorithm and test its working is possible using the NXP IC demonstration board kit 12C 2005 1 This includes a PCB populated with 1 C devices power supplies connectors and LEDs The kit contains a USB cable and via download a copy of Win I2CUSB Lite software can be obtained The board has twelve general purpose 1 C logic devices in the following categories I O expander LED blinker LED dimmer EEPROM temperature sensor real time clock multiplexer switch and bus master selector The board s hardware connects to the USB port of a PC and uses the 1 C protocol to provide bi directional communications with the 1 C devices Power is provided by the PC s USB port so there is no need for an additional external power supply The real time clock present on the board is the PCF8563TD the temperature sensor is the SA56004ED With both the RTC and temperature sensor onboard it is easy to start developing your application and implementing the algorithm as described here 7 Other NXP Real time clocks AN10652_1 This application note deals specifically with the PCF8563 RTC but can with small modifications also be used as
15. hts reserved For more information please visit http www nxp com For sales office addresses email to salesaddresses nxp com Date of release 2 November 2007 Document identifier AN10652_1
16. keeping accuracy using external temperature sensor increment because the registers have been frozen However the watchdog counter increments now Thus the increase in time is recorded and after the read operation has completed BLOCK goes low again Now the stored clock in the watchdog is used to give an extra pulse to the time counters to make sure that correct time is kept Also the watchdog will be reset The maximum watchdog value is 2 If at the second rising edge of the 1 Hz clock after a read operation was initiated the reading operation has not been completed yet BLOCK will still be high The time counters don t increase and the watchdog counter increases and reaches its maximum value Its output is set active which resets the I C interface which in turn resets the BLOCK signal Again one pulse not two is send to the time counters and the watchdog is reset But now two rising edges of the 1Hz clock didn t reach the time counters and only one was compensated for The RTC looses one second The exact sequence of events is depicted below Real time 10 01 10 48 10 10 10 210 FC state IDLE READ INITIATED READ TERMINATED BY RTC INTERFACE IS NOVY IDLE 4 At next 1Hz clock time does not increment because it s still blocked 1Hz clock increments the watchdog counter 6 The watch dog reaches it max value and set the ZC watchdog signal active 7 The IC watchdog signal resets the BLOCK signal and resets the FC bus
17. l BLOCK is also active during a write A write must also last less than one second e BLOCK is necessary for a write since the registers must not update whilst new data is being written That is impossible anyway since the clock is switched from the 1 Hz clock to the internal I C clock The whole purpose of using a temperature sensor to compensate for varying temperatures is to increase accuracy Of course we would not want to introduce even more deviations by exceeding this one second limit Besides that in order for the procedure to work in this case reading the registers adding the compensation value to it this will also be one second but this has in principle no relation with the fact that a read write operation needs to be completed within one second and writing the new values back into the RTC must all be completed within one second of initiating the read operation While doing that the internal BLOCK signal must remain high until the new updated value has been written into the RTC to be sure that updating actually takes place If the BLOCK signal is high it will become low either upon receiving the STOP condition or when the read or write operation takes longer than one second From this we can see the two conditions for successful updating 1 Do not send a STOP condition after the read before the write 2 Make sure that the whole operation will be finished within one second To summarize once the accumulated time deviation exceed
18. ler In certain situations though using an RTC is unavoidable Using an RTC has several benefits e Low power consumption e Frees the main system for time critical tasks e Higher timekeeping accuracy However even when using an RTC the time can only be as accurate as the reference used A crystal s frequency characteristic depends on the shape or cut of the crystal A manufacturer can control the crystal turnover frequency by the angle the crystal is cut However having to manufacture crystals with different cutting angles adds complexity and cost A tuning fork crystal is usually cut such that its frequency over temperature is a parabolic curve centered around 25 C see Fig 1 This means that a tuning fork crystal oscillator will resonate close to its target frequency at room temperature but will slow down when the temperature either increases or decreases from room temperature The frequency of a typical crystal at a specific temperature T is given by pasar Here f is the frequency fo is the frequency at room temperature B is the parabolic coefficient T is the temperature and To is the turnover temperature the top of the parabolic curve Further f can be considered to consist of two components as fo From Fog NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 3 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor Here from
19. lication note Rev 01 01 2 November 2007 9 of 20 NXP Semiconductors AN1 0652 AN10652_1 5 1 Improved timekeeping accuracy using external temperature sensor time deviation as a function of temperature The narrower the time intervals the better the approximation of the integral will be but if temperature changes only slowly larger time intervals can be chosen It is now assumed that the temperature was constant during the past interval and equal to the value measured This measured temperature is used to calculate the time deviation in ppm using a lookup table or equation that occurred over the interval and the result the time to be compensated is stored in a memory location in the system microcontroller All values calculated for each interval passed are accumulated Since the internal clock is divided to have internal 1Hz pulses and since the register with the highest resolution in the PCF8563 is the seconds register it is not possible to execute a compensation when the accumulated value is still in the order of micro seconds or milliseconds Compensation can only be done once the accumulated value comes close to 1s PCF8583 and PCF8593 have a 10ms counter see section 7 Other NXP real time clocks Since the compensation value that can be written into the RTC will be an integer in seconds an update must be done when the accumulated value is as close to an integer in seconds as possible A practical approach would be to updat
20. n 4 1 General Description The PCF8563 is a CMOS real time clock calendar optimized for low power consumption It contains sixteen 8 bit registers with an auto incrementing address register an on chip 32 768 kHz oscillator with one integrated capacitor a frequency divider which provides the source clock for the Real Time Clock calendar RTC a programmable clock output a timer an alarm a voltage low detector and a 400 kHz l C bus interface The block diagram is shown in Fig 2 All 16 registers are designed as addressable 8 bit parallel registers although not all bits are implemented The registers can be both read from and written to The first two registers memory address OOyex and 01x are used as control and or status registers The memory addresses 02 ex through O8yex are used as counters for the clock function seconds up to years counters Address locations 09 ex through OCyex contain alarm registers which define the conditions for an alarm CLKOUT i CONTROL STATUS 1 OSCILLATOR CONTROL STATUS 2 32 768 kHz OSCO SECONDS VL a Vss VOLTAGE DETECTOR WEEKDAYS OSCILLATOR CONTROL MONTHS CENTURY MONITOR YEARS MINUTE ALARM HOUR ALARM DAY ALARM SCL 2C BUS WEEKDAY ALARM INTERFACE ADDRESS SDA REGISTER CLKOUT CONTROL TMmMDUADWFAAN DA KWH OC TIMER fi PCF8563 mgm662 Fig 2 Block diagram of PCF8563 Address 0Dyex controls the CLKOUT output frequency OEHEX and OFHEx a
21. nd trademarks are property of their respective owners NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 19 of 20 NXP Semiconductors AN10652 Improved timekeeping accuracy using external temperature sensor 10 Contents Introduction sisiccssscstccssecneessesssesesesssersscncansssescneneans 3 The problem when using an RTC without temperature compensation cssessseeseeee 3 Possible SOIUtIONS cccssseeeseeeeesseeeeeenseeenenseeeee The PCF8563 RUC sv ccisscecsccssiscesacecacscscesecscsevescesces General Description Features ccccceeeseeeeees Register organization Initial calibration 00 ccceeceeeeceeeeeeeeeeeeeeeeeeeeees Procedure to correct time deviations due to Varying temperature ccecssseesseeeessseeeensseeees Step 1 Setting the timer Step 2 Find the time deviation Step 3 Updating the time eeeeeeeeeeees NXP Demonstration board kit I C 2005 1 17 Other NXP Real time clocks RelerenCes wii iiivkeesciiiceeiceintiistiaies Legal information Definitions 000008 DISCIAIME Soniri enoii i teeeets Trademarks ccccccccccccccecccececeeececeeeeeeeeeeeeeeeeseeess Contents founded by Please be aware that important notices concerning this document and the product s described herein have been included in the section Legal information NXP B V 2007 All rig
22. need to be done by the crystal manufacturer and limits the vertical shift of the parabolic curve within a narrower range Besides adding to the cost it does not alter the parabolic nature of the crystal s frequency curve and only provides a small accuracy improvement at room temperature Integrating the crystal in the same package as the RTC is a way of supplying RTC s of which the performance is known Usually a crystal screening will have taken place It is also possible to measure fo during production and correct for it by programming a dedicated register in the RTC if such a register is implemented It makes life for the system designer a bit easier but as the previous option it does nothing to alleviate the frequency deviation as a result of changing temperatures It only reduces the initial error at room temperature Keeping the crystal within a narrow temperature range can be done by mounting the crystal in a temperature controlled container but this will add considerable cost and complexity to the system Another option is to use a 32 768 kHz temperature compensated crystal oscillator TCXO as the clock source for a stand alone RTC but obviously this will add cost too The principle on which TCXOs are based is simple Every crystal is optimized for a particular load capacitance The value of this capacitance is included in the datasheet and deviations from this value will result in a shift in frequency of the oscillator A TCXO uses
23. ng the time It is necessary for correct time keeping that a read operation from the PCF8563 or a write operation into the PCF8563 is finished within one second of initiating it The datasheet from the PCF8563 states When one of the RTC registers is read the contents of all counters are frozen Therefore faulty reading of the clock calendar during a carry condition is prevented But what does this mean exactly and why is this necessary In Fig 5 a block diagram representing some blocks in the PCF8563 has been drawn and in Fig 6 a sequence of events is given when a read operation starts This signal stops the time counters from counting It is generated when an I C READ or WRITE is initiated C interface BLOCK Time counters Pre scaler Watchdog C watchdog active low This signal resets the I C interface if BLOCK remains active for too long Fig 5 Block diagram IC interface and Time counters When there is no I C activity the RTC is counting normally Once an I C read or write operation is initiated the I C interface asserts the signal BLOCK This signal stops the time counters registers 02 ex to O8yex from counting Further this results in the watchdog no longer being reset At the next rising edge of the 1 Hz clock time does not AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 14 of 20 NXP Semiconductors AN1 0652 Improved time
24. ow power consumption The PCF2128 has 512 bytes of general purpose static RAM a selectable C and SPI interface a backup battery switch over circuit a programmable watchdog function a timestamp function and many other features Obviously implementation of the procedure described in this application note does not apply to the PCF2128 8 References The documents listed below provide further useful information They are available at NXP s website www nxp com 1 Product data sheet PCF8563 2 AN_pcf8563 73 83 93_real_time_clock Application Note for the Real Time Clocks PCF8563 73 83 93 September 1 1999 3 _UM10204_3 I C bus specification and user manual Rev 3 19 June 2007 AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 18 of 20 NXP Semiconductors AN10652 Improved timekeeping accuracy using external temperature sensor 9 Legal information 9 1 Definitions Draft The document is a draft version only The content is still under internal review and subject to formal approval which may result in modifications or additions NXP Semiconductors does not give any representations or warranties as to the accuracy or completeness of information included herein and shall have no liability for the consequences of use of such information 9 2 Disclaimers General Information in this document is believed to be accurate and reliable However NXP Semiconduc
25. quals 32 768 mHz and thus if the clock is running at a nominal 32 768 kHz e 1 ppm 32768 0327 Hz e 1 ppm 32767 9673 Hz 1 day has 86400 s 1s day 11 6 ppm Tune the oscillator at the turnover temperature To of the crystal 5 Procedure to correct time deviations due to varying temperature AN10652_1 In order to implement the temperature compensation algorithm described in this application note a microcontroller the system microcontroller as well as an external temperature sensor to measure the ambient temperature is required The temperature sensor must be located such that the measured temperature is a good representation of the crystal temperature How often the temperature needs to be measured depends on the application and is a parameter to be chosen by the system designer The RTC needs to send an interrupt to the microcontroller on regular intervals telling it to measure the temperature If it is a low power application where the microcontroller may be in standby waking up the microcontroller obviously will increase power consumption so how often this is done is a compromise between accuracy requirements and power consumption The interval should be chosen such that the temperature is not expected to change much during the chosen timeframe A value could be once per minute or once per five minutes This method is an approximation of taking the integral over time of the NXP B V 2007 All rights reserved App
26. re the timer control and timer registers respectively The seconds minutes hours days weekdays months years as well as the minute alarm hour alarm day alarm and weekday alarm registers are all coded in BCD format When one of the RTC registers is read the contents of all counters are frozen Thus faulty reading of the clock calendar during a carry condition is prevented however under the condition that a read operation is AN10652_1 NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 6 of 20 NXP Semiconductors AN1 0652 AN10652_1 Improved timekeeping accuracy using external temperature sensor completed within 1 second of initiation Detailed information about this is provided in section 5 3 Step 3 Updating the time 4 2 Features Provides year month day weekday hours minutes and seconds based on a 32 768 kHz quartz crystal Century flag Clock operating voltage 1 8 V to 5 5 V Low backup current typical 0 25 uA at Vpp 3 0 V and Tamb 25 C 400 kHz two wire l C bus interface at Vno 1 8 V to 5 5 V Programmable clock output for peripheral devices 32 768 kHz 1024 Hz 32 Hz and 1 Hz Alarm and timer functions One integrated oscillator capacitor Internal power on reset C bus slave address read A34ex and write A2 ex Open drain interrupt pin Electrostatic Discharge ESD protection exceeds 2000 V Human Body model HBM per JESD22 A114 200 V Machine Mo
27. s 1s Do not Initiate and execute a read operation send the stop condition which would result in the BLOCK signal going low add the accumulated time deviation as indicated in the flow of Fig 4 and then initiate and execute a write operation to update the registers in the PCF8563 It is very well possible that while reading the registers a clock edge was missed which will be corrected in the RTC once the read operation is finished as described above Since we would not be aware of this the outdated value would be compensated and thus a wrong value written back into the RTC This wrong value would be the same as already present in the RTC since the counter freeze operation added one second too This would thus not result in an extra loss of time but the intended temperature compensation would effectively not be done Do Instead a read needs to be initiated and executed without sending the stop condition Then add the accumulated time deviation to the RTC time as indicated in the flow of Fig 4 Now that the values to be written back in the RTC registers are known a repeated start condition needs to be sent after which the data is written in the RTC registers and a stop condition is sent This whole operation needs to be completed within 1 second of initiating it Since the I C bus is considered busy after the start condition and will only be considered free again after the stop condition has been completed the 1 C bus will be busy wh
28. ster is incremented automatically after each data byte is written or read NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 17 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor With the PCF8583 the address pin AO is used to program the software address so two devices can be connected to the bus without additional hardware Each RTC has an internal power on reset and a programmable clock output with open drain configuration to drive peripheral devices A low voltage detector not included on the PCF8583 and PCF8593 ensures the integrity of all clock functions Power consumption is kept to a minimum in all the devices The PCF2124 and PCF8563 are optimized for battery powered applications and consume as little as 250 nA at 3 V The PCA8565 and PCA2125 oscillator operates over a wider temperature range 125 C maximum and is suitable for use in the harsh environments found within automobiles Power consumption remains low only 700 nA at 2 V The requirement that read and write operations to the device need to be finalized within one second of initiating is valid for all these devices too For applications where very accurate time keeping is necessary the PCF2128 is a CMOS real time clock calendar with an integrated temperature compensated crystal oscillator TCXO and a 32 768 kHz quartz crystal optimized for very high accuracy and very l
29. te the time 5 2 Step 2 Find the time deviation In order to find the time deviation that must be compensated a lookup table or a second order equation parabola derived from measurements done can be used This table equation should contain the deviation in ppm relative to the nominal conditions and is specific for the crystal used If the type of crystal is changed a new lookup table equation is necessary This correction method uses no feedback so it is important to have a precise table or equation since any errors in this input will result in errors in the compensation values How to create such a table or equation NXP B V 2007 All rights reserved Application note Rev 01 01 2 November 2007 11 of 20 NXP Semiconductors AN1 0652 Improved timekeeping accuracy using external temperature sensor If the datasheet of the crystal used incorporates the parabolic curve and a table with these deviations this can be used under the condition that the resolution of the data is high enough Otherwise a high resolution frequency counter is necessary to measure and record how long a nominal 1s period out of the RTC actually takes when the crystal RTC combination is subject to varying temperatures In order to cover the whole temperature range for which the PCF8563 is specified measurements should be done from 40 C to 85 C It is time consuming but more reliable than attaching the frequency meter to the OSCO pin which
30. tors does not give any representations or warranties expressed or implied as to the accuracy or completeness of such information and shall have no liability for the consequences of use of such information Right to make changes NXP Semiconductors reserves the right to make changes to information published in this document including without limitation specifications and product descriptions at any time and without notice This document supersedes and replaces all information supplied prior to the publication hereof AN10652_1 Suitability for use NXP Semiconductors products are not designed authorized or warranted to be suitable for use in medical military aircraft space or life support equipment nor in applications where failure or malfunction of a NXP Semiconductors product can reasonably be expected to result in personal injury death or severe property or environmental damage NXP Semiconductors accepts no liability for inclusion and or use of NXP Semiconductors products in such equipment or applications and therefore such inclusion and or use is for the customer s own risk Applications Applications that are described herein for any of these products are for illustrative purposes only NXP Semiconductors makes no representation or warranty that such applications will be suitable for the specified use without further testing or modification 9 3 Trademarks Notice All referenced brands product names service names a
31. would add capacitance to this pin and thus detune the frequency with a delta f that has to be compensated as well After the data has been collected it can be input into an Excel spreadsheet from where the equation can be generated A less time consuming method is to use the second order equation and the value for B given in the crystal s datasheet The production spread of B for a certain type of crystal is small From formula 1 on page 4 the frequency deviation for a given temperature follows and from there the correction value can be calculated The microcontroller could calculate the deviation from this equation and the temperature measured Alternatively the designer can create a lookup table from which the deviations are read Below such a lookup table is given for a crystal with B 0 035 ppm C and Ty 25 C for temperatures from 40 C to 85 C in steps of 5 C Tolerances in To and fo have not been taken into account and thus the formula used to calculate Af f in Table 2 reduces to equation 2 below For the lookup table only columns 2 and 4 are relevant ae B T T 2 nom l 0 Table 2 Example Lookup Table Only columns 2 and 4 Temperature T and resulting Af f in ppm need to be included Parabolic Temperature T Temperature Deviation Deviation Coefficient B Offset Af f Af f ppm C C C ppm Hz 0 035 40 65 147 88 4 85 0 035 35 60 126 00 4 13 0 035 30 55 105 88 3

Download Pdf Manuals

image

Related Search

Related Contents

Manuel d`utilisation du PCE  # 200-580 INSTALLATION INSTRUCTIONS 96-05 Chevrolet  pH-metro portátil sensION+ PH1DL  PMC-205L  ASUS CP6230 I7729 User's Manual  User`s Manual  SecureManager Manual (操作説明書/約235KB)  MANUEL D`UTILISATION  MANUALE ISTRUZIONE  MD Building Products 01586 Installation Guide : Free Download, Borrow, and Streaming : Internet Archive  

Copyright © All rights reserved.
Failed to retrieve file