ST AN3060 Application note

AN3060
Application note
Applications guide for serial real-time clocks (RTCs)
By Doug Sams
Introduction
ST’s family of serial real-time clocks (RTCs) has been very popular with users. Over the years, many topics associated with these devices have been addressed by the applications groups supporting them. This document is a compilation of some of the most common issues addessed ranging from layout considerations for crystals to proper software access upon power-up. Readers will find this helpful in understanding some of the subtleties of RTCs and what it takes to keep them running reliably.
July 2012 Doc ID 16253 Rev 2 1/23
www.st.com
Contents AN3060
Contents
1 Layout considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1 What are some basic layout considerations for the RTC crystal? . . . . . . . 5
2 Oscillator circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 Besides the crystal, what other components do I need to add to make my
RTC oscillator work correctly? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Undershoot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1 Can undershoot affect operation of my real-time clock? How? What can be
done to guard against it? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4 Switchover voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.1 Does the switchover voltage depend on the battery level? Or is it always a
fixed value? What is the maximum battery voltage for an RTC? . . . . . . . . 9
5 Oscillator fail detect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.1 What is the OF bit? How does it work? . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6 Battery low detect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.1 How does the battery low bit work? Can it detect a missing battery? . . . 13
7 Halt (HT) bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
7.1 What does the halt bit (HT) do? How do I use it? . . . . . . . . . . . . . . . . . . 15
8 RTC initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8.1 What is the best sequence for accessing the RTC at first power-up? On
subsequent power-ups? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
9 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2/23 Doc ID 16253 Rev 2
AN3060 List of tables
List of tables
Table 1. Summary of deselect and switchover thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 2. M41T81S register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Table 3. M41ST85W register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 4. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Doc ID 16253 Rev 2 3/23
List of figures AN3060
List of figures
Figure 1. Layout considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 2. Built-in load capacitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 3. Typical parasitic diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 4. Undershoot protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 5. Typical switchover circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 6. Switchover circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 7. Oscillator fail detect circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 8. Battery monitor function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 9. Clock and non-clock registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 10. M41T83/M41T82 power-up defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 11. First power-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 12. Power-up from backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4/23 Doc ID 16253 Rev 2
AN3060 Layout considerations

1 Layout considerations

1.1 What are some basic layout considerations for the RTC crystal?

Layout considerations are straightforward for the 32 KHz crystals used with ST's M41 series real-time clocks.

Figure 1. Layout considerations

MOUNT CRYSTAL AS CLOSE TO RTC AS POSSIBLE
CRYSTAL
NO OTHER COMPONENTS REQUIRED IN OSCILLATOR CIRCUIT
IF POSSIBLE, ADD LOCAL GROUND PLANE, ON SEPARATE LAYER, ISOLATED FROM PCB GROUND PLANE, AND CONNECTED TO RTC GND PIN
ADD GUARD RING AROUND CRYSTAL CONNECTIONS, CONNECT TO GND PIN
KEEP TRACES SHORT
XI
RTC
XO
GND
AM04719v1
The primary consideration is lead length. The crystal should be mounted as near as possible to the RTC to keep the traces short. A guard ring around these connections, connected to ground, is very important to avoid picking up unwanted noise, which might affect timekeeping.
Users should avoid running signals directly underneath this area unless a ground plane resides between the signals and the crystal connections.
When possible, users can add an island ground plane under the area of the ring and crystal body. This plane is on a separate layer from the ring, and isolated from the PCB ground plane. It connects to ground at the GND pin of the RTC.
No other components are shown in the layout because the crystal is all that is required for the RTC oscillator to work. No external load capacitors or bias resistors should be added.
Doc ID 16253 Rev 2 5/23
Oscillator circuit AN3060

2 Oscillator circuit

2.1 Besides the crystal, what other components do I need to add to make my RTC oscillator work correctly?

None. Nothing else is required. ST's real-time clocks have built-in load capacitors. External load capacitors are not needed, nor are external resistors. All that is needed is the crystal. It must be a 32,768 Hz watch crystal and be rated for the load capacitance built into the RTC.

Figure 2. Built-in load capacitors

EXTERNAL LOAD CAPACITORS NOT NEEDED
EXTERNAL RESISTOR
NOT NEEDED
No other components are required to make the oscillator run. Adding any external components will only serve to reduce the accuracy and reliability of the oscillator. Extra load capacitors will tend to slow the clock. At low temperatures, such capacitance, or any external resistance, may keep the oscillator from starting.
CRYSTAL
C
X1
R
X
XI XO
INTERNAL RTC CIRCUITRY
C
L1
CHOOSE CRYSTAL TO MATCH RTC’S RATED LOAD CAPACITANCE - eg, 6pF OR 12.5pF
C
L2
THEY ARE BUILT INTO RTC
C
X2
AM04720v1
Matching load capacitance
Each RTC comes with built-in load capacitors. These are usually specified as 12.5 pF, or in the case of the M41T6x family, 6 pF. The crystal selected for use with the RTC should have this same rating. Mismatched crystals will tend to run slightly off frequency. For example, a crystal rated for 12.5 pF expects to see that load. If it is used with an RTC rated for 6 pF, the crystal will only see 6 pF instead of the specified 12.5 pF and will thus run fast.
6/23 Doc ID 16253 Rev 2
AN3060 Oscillator circuit
Effective load capacitance value versus internal capacitance value
Occasionally, the reader will see a reference to the individual load capacitors. There are two used inside the RTC - one on each leg of the crystal. The actual value of each is twice the rated or effective load value - that is, twice the load value specified in the data sheet. This is because the internal load capacitors add in series. In Figure 2, the effective load capacitance is:
CC
L
L
2
LL
1
CwithseriesinCC
1
==
L
2
CC
+
L
L
2
1
Thus, when C the data sheet - is half of C
and CL2 are equal, the effective load capacitance, CL - the value listed in
L1
and CL2. An ST RTC rated for 12.5 pF will have two 25 pF
L1
capacitors built into its oscillator circuit. The reader is encouraged to be aware of this. Furthermore, the reader should keep in mind that the crystal specifications should match the rated value - in this case 12.5 pF - and not the individual values.
Doc ID 16253 Rev 2 7/23
Loading...
+ 16 hidden pages