UM10301 User Manual for NXP Real Time Clocks PCF85x3, PCA8565 and PCF2123, PCA2125 Rev. 01 — 23 December 2008 User manual Document information Info Content Keywords PCF8563, PCF8573, PCF8583, PCF8593, PCA8565, PCF2123, PCA2125, PCF2120, RTC, real time clock, timekeeping, crystal, 32.768 kHz, backup. Abstract This application note aims to assist a user of above mentioned Real Time Clocks in achieving succesful design-in and application.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Revision history Rev Date Description 01 20081223 Initial version. This application note / user manual is a complete update of a previous publication titled: “Application note for the Philips Real Time Clocks PCF8563,73,83,93” which did not have an official AN/UM number and is superseded by this document. The contents were revised with lots of additional information added and errors in the examples corrected.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 1. Introduction The real time clocks from NXP (previously Philips Semiconductors) have a long tradition and are used in numerous application fields.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 2. Features The NXP real-time clock portfolio includes types for low power, types for automotive and other high temperature applications and applications that need additional RAM. A third family of highly accurate temperature compensated real time clocks will be dealt with in a separate application note. Designed for a range of demanding applications, these realtime clocks/calendars are driven by a low-power 32.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 In BCD every digit of the decimal system is represented by a 4-bit group. For example: 15710 = 0001 0101 0111BCD This is not the same as binary representation. It is clear that BCD is not the most efficient way of coding since every 4-bit group (nibble) could represent numbers 0 through 15, but in BCD never represents numbers bigger than 9.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 The PCA8565 and PCA2125 oscillators operate over a wider temperature range (up to 125 ºC) and are suitable for use in the harsh environments found within automobiles. Power consumption remains low — only 700 nA at 2 V. Serial interface is I2C or SPI. All the RTCs have ESD protection that exceeds 2000 V HBM per JESD22-A114, 200 V MM per JESD22-A115. Charge Device Model values vary from 500 V to 2000 V CDM per JESD22-C101.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Table 2.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 4. Power-on reset (POR) Traditionally a power-on reset circuit is a circuit that generates a reset pulse once the supply voltage has reached a certain value upon power-up. The purpose is to ensure a defined behavior at start-up. This type of power-on reset is not present in these RTCs.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 The implementation in the PCF2123 is slightly different. There a bit OS (Oscillator Stopped) is present instead of VL. The OS flag is set whenever the oscillator is stopped, and therefore also when this is due to the supply voltage dropping too low. The flag can only be cleared by software and only if the oscillator is running again.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 CSTRAY is a result of parasitic capacitances due to PCB traces, IC pins etc. and is directly in parallel with C0 of the crystal. In a practical situation care needs to be taken to keep these parasitic capacitances as low as possible since it will add to the load capacitance and this load capacitance must meet the specified value for the crystal that is being used.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 The values used in practice will be a bit smaller than the theoretically required values due to parasitic capacitances present in the application which add to the external physical capacitor. For the PCF2123 the integrated CIN and COUT are dimensioned for a crystal which requires a load capacitance of 7 pF. If a crystal with required load capacitance of 12.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 capacitances. The external components of the oscillator have to be chosen such that the actual value of CL matches the specified value of CL. If there is mismatch the crystal will not run exactly at its specified frequency resulting in the clock running slow or fast. The crystal manufacturer can manufacture crystals for any load capacitance, but in practice some standard values are used.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Now in order to determine the value of CL resulting from CIN, COUT (plus CT if mounted) and CSTRAY it is necessary to realize that seen from the crystal, CIN and COUT are effectively in series; the 32 kHz signal goes from OSCI through CIN to ground, via ground to COUT and then through COUT to OSCO. In parallel with this series circuit is CSTRAY.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Taking the numbers from Table 4 yields for L1 and Q: L1 = Q= 1 (2π ⋅ f 0 ) 2 ⋅ C1 = 1 (2π ⋅ 32768)2 ⋅ 2.1 ⋅ 10−15 = 11234 H 1 1 = = 42053 (2π ⋅ f 0 ) ⋅ C1 ⋅ R1 (2π ⋅ 32768 ) ⋅ 2.1 ⋅10 −15 ⋅ 55 ⋅10 3 This L of around 11000 H resulting in a Q of around 42000 explains why starting up the oscillator as well as stopping it can easily take more than a second.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 6.1 Oscillation allowance Fig 4 shows the Pierce oscillator schematic with the external crystal. For an oscillation to take place the real component of the oscillator impedance has to be larger than the motional resistance R1 (sometimes called RS or ESR). If R1 is too large no oscillation will take place since no operating point can be reached.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 levels can be tuned such that they are similar to those when the internal oscillator is used. Suppose that the RTC is supplied with 3.3 V and that the amplitude of the external CLK is 5 V (from 0 V to 5 V). Using 1 M and 220 k resistors the signal could be reduced to (220 / 1220) x 5 V = 0.9 V.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 value is really too high start up problems may occur, but up to 100 kΩ no start up problems are expected. See 6.1”Oscillation allowance”. The frequency accuracy of the oscillator depends mainly on the accuracy of the crystal and on how well the crystal is matched to the oscillator capacitive load (CL).
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 The frequency of a typical crystal at a specific temperature T is given by: [ f = f 0 1 + B (T − T0 ) 2 ] Further f0 can be considered to consist of two components as f 0 = f nom + f off Here fnom is the nominal frequency as specified and foff the offset from this nominal frequency which is a result of production spread, both at room temperature.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 handle this temperature. Generally metal can quartzes are not recommended for high temperatures because the termal cycling (expansion of package) will cause leakages in the hermetically sealed package. Micro Crystal of Switzerland manufactures a wide range of crystals which include crystals designed to operate up to 125 °C. 8.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 to +80 %. Its only redeeming feature is its high permittivity which allows high capacitance values, typically ranging from 1 nF to 4.7 µF. Good for bypass and coupling applications. It has low price, small size and low temperature stability. Conclusion: For the oscillator only C0G types should be used. This will almost always automatically be the case since the other types are usually not available in such small values.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Fig 8. Influences on time accuracy The various influences indicated in Fig 8 are described below: 1. The line at the top indicates the frequency tolerance of the crystal in this example. The distance between two vertical lines represents (at the top) 1 s/day or 11.57 ppm. The crystal spread covers about 8.5 lines and thus indicates a spread of about 100 ppm. 2.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 5. Tuning CT will increase the initial accuracy, indicated by reducing the range covered to the spread of CIN. Depending on how well CT is tuned, the initial spread can be well compensated for. 6. Here the influence on accuracy due to aging of the crystal is given. This shift occurs mainly during the first year of the crystal’s life and in the graph a range of about 420 ms/day to 850 ms/day is indicated (±10 ppm).
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Fig 9. Oscillator tuning Accuracy: In order to be able to adjust the clock with accuracy better than 1 s/day, the frequency counter used to check the output at CLKOUT should have at least an 8 digit reading with an accuracy of 1 ppm. Given a nominal frequency of 32.768 kHz, 1 ppm = 32.728 mHz (milli Hertz). Therefore +1 ppm = 32768.0327 Hz, -1 ppm = 32767.9673 Hz.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 • In the datasheets of PCF8583 and PCF8593 the following method is described: Using the alarm function (via the I2C-bus) a signal faster than 1 Hz can be generated at the interrupt output for fast setting of a trimmer. Procedure: Power-on; Initialization (alarm functions). Routine: Set clock to time T and set alarm to time T + ∆T At time (T + ∆T) (Interrupt) repeat the routine.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 11. Century and leap year, Daylight Saving Time For details on how to implement century tracking and year / leap year tracking, please refer to the datasheets of the respective RTC since register set up differs from type to type. The product comparison in Table 2 shows which parts include century, year and leap year tracking. 11.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 12. Initialization and setting of alarm and timer Setting the clock is a straightforward procedure, setting first the mode and then the actual time. This example is for the PCF8563 and for reference its block diagram is given in Fig 10 which shows the registers and their addresses.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Table 5.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Binary (BCD) HEX Register Address Comments 0000 1001 09 0001 0101 15 09 minute alarm enabled and set to 15 minutes 1000 0000 80 0A hour alarm is disabled 1000 0000 80 0B day alarm is disabled 1000 0000 80 0C weekday alarm is disabled word address 9 for minute alarm generate I2C start condition (repeated start) 1010 0010 A2 I2C slave address, write 0000 0001 01 word address 1, next bytes are data 0000
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 12.3 Setting the timer The internal timer is an 8-bit countdown timer which is controlled by the timer control register. The timer counts down from a software-loaded 8-bit binary value. It can be clocked by four different source clock frequencies: 4096 Hz, 64 Hz, 1 Hz or 1/60 Hz. This example for the PCF8563 generates an interrupt after 10 ms: • Clock to be used 4096 Hz; • Number of clock pulses needed = 0.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 13. Backup power supply A real time clock is a clock that keeps track of the time as humans use it (hours, minutes, seconds, years etc.) and usually even when the rest of the system is turned off. Therefore in order to be able to always represent Real Time, real time clocks need a power supply even if the rest of the system is off. This backup power supply is often a dedicated battery or super capacitor.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 The mentioned IEC/UL standard states that circuits employing lithium batteries shall be designed to prevent forced charge and discharge if this would result in a hazard. Practically this means that the application must ensure that both charging and discharging currents will be limited to safe values under any circumstances in order for the application to pass Underwriters Laboratories safety approval, or other similar standards.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 evaporation can be neglected. At elevated temperatures of for example 60 °C electrolyte evaporation will be much higher. Refer to the manufacturer’s datasheet. Vendors of lithium batteries include Panasonic, Sanyo and Varta. 13.2 NiCd and NiMH secondary batteries The well known Nickel-Cadmium and Nickel-Metal Hydride batteries can also be used to provide backup power to an RTC.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 The recommended trickle charge current for a NiCd or NiMH is expressed as a fraction of C and is typically in the range C/50…C/20. Refer to the datasheet of the selected battery. A too small trickle current will not properly keep the battery fully charged, a too high current leads to overcharging and this will limit the life time of the battery.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 If backup is only needed for a few minutes to deal with short interruptions in power, it is possible to use a small inexpensive electrolytic capacitor. Supercaps can not be bought from as many vendors as ordinary electrolytic capacitors. They are available from such vendors as Panasonic, AVX and Cornell Dubilier. Important specifications are working voltage and leakage current.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Using C·V = I·t: tbackup = ( C ⋅ VCbackupstart − VCbackupend ) I RTC Assuming that the PCF8563 is used, that VCbackupstart = 3.3 V, that the RTC current consumption is 250 nA and a backup capacitor value of 0.47 F it is possible to estimate the available backup time. The oscillator stops running when VDD drops to 1.0 V. t backup = 0.47 F ⋅ (3.3 V − 1.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 14. PCB layout guidelines The tuning fork crystal’s drive level is extremely low (< 1 μW) and the input of the amplifier used in the oscillator (pin OSCI) has a very high impedance. This makes the circuit susceptible to signals generated by other circuits on the board, or further away.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 (1) In practice the input capacitor CT will in most cases be a fixed capacitor Fig 14. PCB layout proposal for PCF8563 using leaded components Alternatively to the last point listed above and in order to achieve highest noise immunity, a guard ring can be placed around the crystal which must be tied to ground to isolate the crystal from unwanted noise pickup.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 guard ring layer 1 oscillator capacitor VDD OSCI SMD CRYSTAL OSCO ground via bypass capacitor PCF8563TS CLK INT SCL VSS SDA GND area 001aai849 Fig 15. PCB layout proposal for PCF8563 using SMD components and guard ring Remark: Take precautions when cleaning PCBs containing tuning fork crystals using ultrasound. The resonance vibration may damage the crystal. Consult the supplier of the crystal in case of doubt.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Fig 16. Protection diodes . 16. Hints to keep power consumption low For some applications low power consumption is a key requirement. Power consumption can be minimized by applying several measures: • Select PCF8563 (I2C) or PCF2123 (SPI-bus). The PCF2123 has the lowest power consumption which is further decreased when a crystal is selected that has a load capacitance of 7 pF instead of the more standard 12.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 • Access the RTC as little as possible in order to reduce the dynamic current consumption by the I2C-bus or SPI; • Disable the CLKOUT in battery backup mode. If CLKOUT needs to be enabled select the pull-up resistor as large as possible.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 R P (max) = tr 0.8473 ⋅ C b 002aac883 20 (1) Rp(max) (kΩ) 16 12 8 (2) 4 (3) 0 0 200 400 600 Cb (pF) (1) Standard-mode (2) Fast-mode (3) Fast-mode Plus Fig 17. Rp(max) as a function of bus capacitance Below Rp(max) is calculated for both Standard-mode and Fast-mode I2C bus. The result has been rounded down to E6 standard values. 400 kHz I2C bus: R P − 400 kHz = tr 300 ⋅ 10 −9 = = 22 kΩ 0.8473 ⋅ C b 0.8473 ⋅ 14.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 VDD SDA MASTER TRANSMITTER/ RECEIVER SCL 1F 100 nF VDD SCL CLOCK CALENDAR OSCI PCF8563 OSCO VSS SDA VDD R R R: pull-up resistor tr R= SDA SCL (I2C-bus) Cb mgm665 Fig 18. Application diagram 1, I2C-bus interface The following example is with PCA2125 and SPI interface.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 17. First period inaccuracy when using the timer This chapter describes why the programmed delay is not always exactly as expected and what to do in order to be as accurate as possible. The enable instruction for the timer is generated by the I2C or SPI interface clock. This clock is asynchronous to the timer source clock. The timer source clock is derived from the 32.768 kHz crystal frequency.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 The timer counts down from a software-loaded 8-bit binary value, n. Loading the counter with 0 effectively stops the timer. Values from 1 to 255 are valid. When the counter reaches 1, the countdown Timer Flag (TF) will be set and the counter automatically reloads and starts the next timer period. The timer has two operating modes, TI and TP. If the timer interrupt is enabled, the bit TI/TP determines the operating mode.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 As an example, the desired timer period is 5 seconds. If the timer source clock frequency is set to 1 Hz and n = 5, the minimum possible timer period will be (5-1) + 15.625 ms = 4.015625 s. The maximum possible timer period will be 5 + 15.625 ms = 5.015625 s. The resulting timer period will have a duration somewhere within these limits.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 I2C interface This signal stops the time counters from counting. It is generated when an I2C READ or WRITE is initiated. BLOCK Time counters SDA 64Hz SCL Pre-scaler 1Hz clocks clock reset Watchdog I2C watchdog (active low) This signal resets the I2C interface if BLOCK remains active for too long. Fig 21. Block diagram I2C interface and Time counters When there is no I2C activity the RTC is counting normally.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 Fig 22. Sequence of events (example READ) From this follows: • A I2C read must be terminated within one second of initiation; • The RTC will automatically terminate the read if it remains active for longer than one second; • Each time auto termination occurs, the RTC looses one second; • The signal BLOCK is also active during a write.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 chapter could occur. First, the data could change while a single register is being read. Second, the data could change during the time between reading two registers. Therefore in order to avoid this from happening it is necessary to read all time registers in one single read operation, using the auto-increment function. The same goes for writing all registers in one single write operation when time and date is set. 19.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 19.3 No communication via I2C-bus When no communication with the RTC is possible, it is also not possible to set and read time. Normally the I2C-bus will not get stuck, but especially during the development phase problems may occur that hang up the bus. One reason may be that spikes on the bus lines are interpreted as additional pulses which then would convey data not in line with the I2C-protocol.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 19.4 Wrong time and date, wrong clock speed When writing into the RTC registers care has to be taken that only valid values are written. For example, seconds only should go to 59, but it is possible to write for example 61 into the seconds register. Care needs to be taken that the software routines convert correctly to the BCD values used in the RTC.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 21. Legal information 21.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. 21.
UM10301 NXP Semiconductors User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 22. Contents 1. 2. 3. 3.1 4. 5. 6. 6.1 6.2 7. 7.1 7.2 8. 9. 10. 10.1 11. 11.1 11.2 11.3 12. 12.1 12.2 12.3 13. 13.1 13.2 13.3 13.3.1 13.3.2 13.4 14. 15. 16. 17. 18. 19. 19.1 19.2 19.3 19.4 20. Introduction .........................................................3 Features ...............................................................4 Comparison .........................................................6 Event counter mode ...