Intersil Real Time Clock Family User’s Guide ® Application Note New Devices Integrate Crystal Compensation Circuitry Overall Functionality Intersil Real Time Clock (RTC) products integrate the real time clock function with microprocessor supervisory functions and nonvolatile memory to form a vital system element. Applications such as utility meters, security and surveillance systems, entertainment systems and handheld data loggers are just a few systems that require these functions to operate reliably and accurately. This functionality is provided in 8 or 14-pin surface mount products, which along with a 32.768kHz crystal and a small backup battery provide the entire RTC function. Intersil has now integrated the oscillator compensation circuitry on-chip, to adjust for crystal drift over temperature and enable very high accuracy (<5ppm drift) and eliminating the need for external components. Applications will be discussed here for implementing this compensation, and an evaluation board with software is available from Intersil which demonstrates the functionality. The entire family of devices is summarized in Table 1 below, indicating the features available in each device. Summary of Device Functions Real Time Clock Function The RTC function includes a clock/calendar and two alarms, which use a set of registers for control, status and programming. These registers provide seconds, minutes, May 4, 2005 AN154.0 hours, day of the week, month, and year, with automatic correction for leap years. The X1286 and X1288 have 1/100th second resolution for precision applications. The clock format is selectable for either AM/PM or 24 hour (military) format. On power up, the clock will not function until at least one byte is written to the clock register. Alarm Registers The Alarm function enables the system to generate an alarm once every minute, hour, day, week, month or year. There are two alarm registers and they are set up essentially the same as the clock/calendar registers. Once an alarm register matches the clock/calendar setting, an alarm flag is set in the main status register for software interrupts. Also, some RTC devices in the family have an IRQ- status pin for a hardware flag. Note that an alarm flag is reset once the status register contents are read. CPU Supervisory Functions Some devices have a RESET- pin which is intended to provide a hardware reset to a microcontroller. The RESETpin is asserted low either when the Vcc supply voltage has dropped below a certain threshold, or when the watchdog timer period has expired. The devices are provided with a choice of Vcc trip voltage threshold for 3.3V or 5V systems, or can be user programmable. The watchdog timeout period is programmable via the control registers and can be set to 0.25, 0.75, 1.75 seconds, or disabled. This pin is always an open drain output and requires a pullup resistor of from 5K to 50kΩ. TABLE 1. INTERSIL RTC PRODUCT FAMILY WATCHDOG TIMER (.25, .75, 1.75s) CLOCK FREQUENCY OUTPUT ON-CHIP OSCILLATOR COMPENSATION EEPROM PACKAGES PRODUCT 2 ALARMS POWER-ON RESET (250ms) X1205 Yes - - Yes Yes 0 8-TSSOP, SO X1226 Yes - - Yes Yes 4k 8-TSSOP, SO X1227 Yes Yes Yes - Yes 4k 8-TSSOP, SO X1228 Yes Yes Yes Yes Yes 4k 14-TSSOP, SO X1286 Yes - - Yes Yes 256k 14-TSSOP X1288 Yes Yes Yes Yes Yes 256k 14-TSSOP 1 CAUTION: These devices are sensitive to electrostatic discharge; follow proper IC Handling Procedures. 1-888-INTERSIL or 1-888-468-3774 | Intersil (and design) is a registered trademark of Intersil Americas Inc. Copyright Intersil Americas Inc. 2005. All Rights Reserved All other trademarks mentioned are the property of their respective owners. Application Note 154 Frequency Output Battery Backup Switchover Circuit This is the PHZ output noted on the data sheets and shares pin functionality with the IRQ- function. When the PHZ function is enabled, the IRQ- function is disabled. Two bits in the control registers (FO0 and FO1) select the functionality for this pin as shown in Table 2 below: There are two power supply pins for each RTC device, Vcc and Vback. The Vcc pin is for the main board power supply of 5V or 3.3V. The Vback pin is for a dedicated backup supply only for the RTC chip. The pin can be tied to a battery, a supercap, or tied to ground if not used. The RTC devices contain internal circuitry to automatically switch over to the backup battery when the main Vcc supply fails, and switch back from battery to Vcc when the main supply recovers (See Figure 1). This circuit contains assymetrical hysteresis to address noise and glitch issues in Vcc lines. There is approximately 150mV of hysteresis in the voltage comparator when switching from Vcc to Vback, and 50mV of when switching from Vback to Vcc. TABLE 2. PHZ OUTPUT CONTROL OUTPUT FREQUENCY FO1 FO0 X1226, X1228 X1286, X1288 0 0 IRQ- Output IRQ- Output 0 1 32.768kHz 32.768kHz 1 0 4096Hz 100Hz 1 1 1Hz 1Hz The PHZ function can be used for clocking other devices in the system, or as an accurate counter for miscellaneous timing functions. It is also very useful for calibrating the oscillator frequency as described in the oscillator section. In some devices in the Intersil RTC family, the PHZ/IRQ- output has a CMOS output. This output is driven even in battery backup operation, so it is necessary to note the external hardware connections to this pin to prevent excessive current drain to the battery. Since Lithium batteries are often used for battery backup, knowledge of the backup circuitry is required for UL approval. Figure 3 shows the internal switchover circuitry illustrating the complementary control which disables one input while enabling the other. Leakage from Vcc to Vback is negligible (<100nA). Transistor 1 Internal VCC VCC Serial Data Interface This interface consists of clock and data (SCL and SDA) pins and have functionality similar to those in an I2C interface. Start and stop conditions are used along with acknowledge on address and data transfers. The devices can be used with clock frequencies up to 400kHz, although they go into a low current standby state if the SDA and SCL are disabled (high). The SDA output is open drain and each of the serial bus lines needs a pullup resistor somewhere on the board for proper operation. It is highly recommended that the serial interface pullup resistors are tied to Vcc and that Vcc needs to go to 0V when powered down to avoid excessive battery current drain. Non-Volatile Memory Either 4Kor 256K of EEPROM memory is available for system use on these devices. The memory is useful in utility meter applications for rate-schedule tracking and recording readings as well as for general microcontroller memory. The memory is addressed separately from the RTC control and status registers, so there are separate slave address bytes for each, as listed below. TABLE 3. SLAVE ADDRESSES SERIAL BUS SLAVE ADDRESS BYTE NV Memory = 1 0 1 0 1 1 1 R/W- Clock Control = 1 1 0 1 1 1 1 R/W- 2 VBACK Transistor 2 FIGURE 1. BATTERY-BACKUP SWITCHOVER CIRCUIT If this circuitry is not sufficient to meet the safety requirements for battery leakage in an application, it is suggested that a small schottkey barrier diode (like 1N5811 or ZC2811) be placed in series with Vback which minimizes reverse current into the backup battery. If the battery input (Vback) is not used, it should be tied to ground, not to Vcc. Operational Features Crystal Oscillator The Intersil RTC family uses an oscillator circuit with on-chip crystal compensation network, including adjustable loadcapacitance. The only external component required is the crystal. The compensation network is optimized for operation with certain crystal parameters which are common in many of the surface mount or tuning-fork crystals available today. Table 4 summarizes these parameters. AN154.0 May 4, 2005 Application Note 154 TABLE 4. CRYSTAL PARAMETERS REQUIRED FOR INTERSIL RTC’S PARAMETER MIN Frequency TYP MAX UNITS 32.768 Freq. Tolerance Turnover Temperature 20 Operating Temperature Range -40 kHz ±100 ppm 30 deg C 85 deg C 25 Parallel Load Capacitance NOTES 12.5 Equivalent Series Resistance Down to 20ppm if desired Typically the value used for most crystals pF 50 kΩ For best oscillator performance TABLE 5. CRYSTAL MANUFACTURERS PART NUMBER TEMP RANGE +25 DEG C FREQ TOLER. Citizen CM201, CM202, CM200S -40 to +85 deg C +/-20ppm Epson MC-405, MC-406 -40 to +85 deg C +/-20ppm Raltron RSM-200S-A or B -40 to +85 deg C +/-20ppm SaRonix 32S12A or B -40 to +85 deg C +/-20ppm Ecliptek ECPSM29T-32.768K -10 to +60 deg C +/-20ppm ECS ECX-306/ECX-306I -10 to +60 deg C +/-20ppm Fox FSM-327 -40 to +85 deg C +/-20ppm Table 5 contains some crystal manufacturers and part numbers that meet the requirements for the Intersil RTC products. The turnover temperature in Table 4 describes the temperature where the apex of the of the drift vs. temperature curve occurs. This curve is parabolic with the drift increasing as (T-T0)2(see figure 2). For an Epson MC-405 device, for example, the turnover temperature is typically 25 deg C, and a peak drift of >110ppm occurs at the temperature extremes of -40 and +85 deg C. It is possible to address this variable drift by adjusting the load capacitance of the crystal, which will result in predictable change to the crystal frequency. The Intersilintersil RTC family allows this adjustment over temperature since the devices include on-chip load capacitor trimming. This control is handled by the Analog Trimming Register, or ATR, which has 6 bits of control . The load capacitance range covered by the ATR circuit is approximately 3.25pF to 18.75pF, in 0.25pf increments. Note that actual capacitance would also include about 2pF of package related capacitance. In-circuit tests with commercially available crystals demonstrate that this range of capacitance allows frequency control from +116ppm to 37ppm, using a 12.5pF load crystal. In addition to the analog compensation afforded by the adjustable load capacitance, a digital compensation feature is available for the Intersil RTC family. There are three bits known as the Digital Trimming Register or DTR, and they operate by adding or skipping pulses in the clock signal. The range provided is ±30ppm in increments of 10ppm. The default setting is 0ppm. The DTR control can be used for coarse adjustments of frequency drift over temperature or for crystal initial accuracy correction. 3 A final application for the ATR control is in-circuit calibration for high accuracy applications, along with a temperature sensor chip. Once the RTC circuit is powered up with battery backup, the PHZ output is set at 32.768kHz and frequency drift is measured. The ATR control is then adjusted to a setting which minimizes drift. Once adjusted at a particular temperature, it is possible to adjust at other discrete temperatures for minimal overall drift, and store the resulting settings in the EEPROM. Extremely low overall temperature drift is possible with this method. The Intersil evaluation board contains the circuitry necessary to implement this control. 0 -20 Delta Frequency (PPM) MANUFACTURER -40 -60 -80 -100 -120 -140 -160 -180 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 Temperature (°C) FIGURE 2. CRYSTAL FREQUENCY DEVIATION vs TEMPERATURE AN154.0 May 4, 2005 Application Note 154 Layout Considerations The crystal input at X1 has a very high impedance and will pick up high frequency signals from other circuits on the board. Since the X2 pin is tied to the other side of the crystal, it is also a sensitive node. These signals can couple into the oscillator circuit and produce double clocking or misclocking, seriously affecting the accuracy of the RTC. Care needs to be taken in layout of the RTC circuit to avoid noise pickup. Below in Figure 3 is a suggested layout for the X1226 or X1227 devices. FIGURE 3. SUGGESTED LAYOUT FOR INTERSIL RTC IN SO-8 The X1 and X2 connections to the crystal are to be kept as short as possible. A thick ground trace around the crystal is advised to minimize noise intrusion, but ground near the X1 and X2 pins should be avoided as it will add to the load capacitance at those pins. Keep in mind these guidelines for other PCB layers in the vicinity of the RTC device. A small decoupling capacitor at the Vcc pin of the chip is mandatory, with a solid connection to ground. The X1226 product has a special consideration. The PHZ/IRQ- pin on the 8-lead SOIC package is located next to the X2 pin. When this pin is used as a frequency output (PHZ) and is set to 32.768kHz output frequency, noise can couple to the X1 or X2 pins and cause double-clocking. The layout in figure 1 can help minimize this by running the PHZ output away from the X1 and X2 pins. Also, minimizing the switching current at this pin by careful selection of the pullup resistor value will reduce noise. Intersil suggests a minimum value of 5.1K for 32.768kHz, and higher values for lower frequency PHZ outputs. For other RTC products, the same rules stated above should be observed, but adjusted slightly since the packages and pinouts are slightly different. Assembly inserted in final assembly, then there are no issues with operation of the RTC. If the battery is soldered to the board directly, then the RTC device Vback pin will see some transient upset from either soldering tools or intermittent battery connections which can stop the circuit from oscillating. Once the battery is soldered to the board, the only way to assure the circuit will start up is to momentarily (very short period of time!) short the Vback pin to ground and the circuit will begin to oscillate. Oscillator Measurements When a proper crystal is selected and the layout guidelines above are observed, the oscillator should start up in most circuits in less than one second. Some circuits may take slightly longer, but startup should definitely occur in less than 5 seconds. When testing RTC circuits, the most common impulse is to apply a scope probe to the circuit at the X2 pin (oscillator output) and observe the waveform. DO NOT DO THIS! Although in some cases you may see a useable waveform, due to the parasitics (usually 10pF to ground) applied with the scope probe, there will be no useful information in that waveform other than the fact that the circuit is oscillating. The X2 output is sensitive to capacitive impedance so the voltage levels and the frequency will be affected by the parasitic elements in the scope probe. Applying a scope probe can possibly cause a faulty oscillator to start up, hiding other issues (although in the Intersil RTC’s, the internal circuitry assures startup when using the proper crystal and layout). The best way to analyze the RTC circuit is to power it up and read the real time clock as time advances, or if the chip has the PHZ output, look at the output of that pin on an oscilloscope (after enabling it with the control register, and using a pullup resistor for an open-drain output). Alternaltively, the X1226/1286 devices have an IRQ- output which can be checked by setting an alarm for each minute. Using the pulse interrupt mode setting, the once-per-minute interrupt functions as an indication of proper oscillation. Backup Battery Operation Many types of batteries can be used with the Intersil RTC products. 3.0V or 3.6V Lithium batteries are appropriate, and sizes are available that can power a Intersil RTC device for up to 10 years. Another option is to use a supercapacitor for applications where Vcc may disappear intermittently for short periods of time. Depending on the value of supercapacitor used, backup time can last from a few days to two weeks (with >1F). A simple silicon or Schottky barrier diode can be used in series with Vcc to charge the supercapacitor, which is connected to the Vback pin. Do not use the diode to charge a battery (especially lithium batteries!). Most electronic circuits do not have to deal with assembly issues, but with the RTC devices assembly includes insertion or soldering of a live battery into an unpowered circuit. If a socket is soldered to the board, and a battery is 4 AN154.0 May 4, 2005 Application Note 154 2.7-5.5V VCC timekeeping circuitry. The fact that the chip can be powered from Vback is not necessarily an issue since standby current for the RTC devices is <2µA for this mode (called “main timekeeping current” in the data sheet). Only when the serial interface is active is there an increase in supply current, and with Vcc powered down, the serial interface will most likely be inactive. Vback Supercapacitor VSS One way to prevent operation in battery backup mode above the Vtrip level is to add a diode drop (silicon diode preferred) to the battery to insure it is below Vtrip. This will also provide reverse leakage protection which may be needed to get safety agency approval. FIGURE 4. SUPERCAPACITOR CHARGING CIRCUIT Since the battery switchover occurs at Vcc = Vback-0.1V (See figure 1), the battery voltage must always be lower than the Vcc voltage during normal operation or the battery will be drained. A second consideration is the trip point setting for the system RESET- function, known as Vtrip. Vtrip is set at the factory at levels for systems with either Vcc = 5V or 3.3V operation, with the following standard options (except for the X1226 which has no RESET- function): One mode that should always be avoided is the operation of the RTC device with Vback greater than both Vcc and Vtrip (Condition 2d in Table 5). This will cause the battery to drain quickly as serial bus communication and non-volatile writes will require higher supplier current. VTRIP = 4.63V ± 3% VTRIP = 4.38V ± 3% VTRIP = 2.85V ± 3% VTRIP = 2.65V ± 3% Summary The Intersil RTC product family integrates the clock/calendar function, alarms, battery backup circuit, precision crystal compensation, CPU supervisor and EEPROM into a single device. The device also draws very low battery current insuring long life in remote applications. This functional integration is crucial to applications where clock accuracy, nonvolatile storage and long field life are needed, such as utility meters, security surveillance systems and network equipment. The small packages offered along with the low parts count also make the devices ideal for handheld applications. The summary of conditions for backup battery operation is given in Table 6. Referring to example 1 in Table 6, Vtrip applies to the “Internal Vcc” node which powers the entire device. This means that if Vcc is powered down and the battery voltage at Vback is higher than the Vtrip voltage, then the entire chip will be running from the battery. If Vback falls to lower than Vtrip, then the chip shuts down and all outputs are disabled except for the oscillator and TABLE 6. BATTERY BACKUP OPERATION 1. EXAMPLE APPLICATION, VCC=5V, VBACK=3.0V CONDITION VCC VBACK VTRIP IBACK RESET NOTES a. Normal Operation 5.00 3.00 4.38 <<1µA H b. Vcc on with no battery 5.00 0 4.38 0 H c. Backup Mode 0-1.8 1.8-3.0 4.38 <2µA L VCC VBACK VTRIP IBACK RESET a. Normal Operation 3.30 3.00 2.65 <<1µA H b. Vcc on with no battery 3.30 0 2.65 0 H c. Backup Mode 0-1.8 1.8-3.0* 2.65 <2µA* L Timekeeping only 2.65 - 3.30 > Vcc 2.65 up to 3mA H Internal Vcc=Vback Timekeeping only 2. EXAMPLE APPLICATION, VCC=3.3V,VBACK=3.0V CONDITION d. UNWANTED - Vcc ON, Vback powering * since Vback>2.65V is higher than Vtrip, the battery is powering the entire device Intersil Corporation reserves the right to make changes in circuit design, software and/or specifications at any time without notice. Accordingly, the reader is cautioned to verify that the Application Note or Technical Brief is current before proceeding. For information regarding Intersil Corporation and its products, see www.intersil.com 5 AN154.0 May 4, 2005