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.
Table 2.
Table 3.
Table 4.
Summary of deselect and switchover thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
M41T81S register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
M41ST85W register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Doc ID 16253 Rev 2
3/23
List of figures
AN3060
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Layout considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Built-in load capacitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Typical parasitic diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Undershoot protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Typical switchover circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Switchover circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Oscillator fail detect circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Battery monitor function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Clock and non-clock registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
M41T83/M41T82 power-up defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
First power-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Power-up from backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4/23
Doc ID 16253 Rev 2
AN3060
Layout considerations
1
1.1
Layout considerations
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
ADD GUARD RING AROUND
CRYSTAL CONNECTIONS,
CONNECT TO GND PIN
KEEP TRACES SHORT
MOUNT CRYSTAL AS CLOSE
TO RTC AS POSSIBLE
CRYSTAL
XI
RTC
XO
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
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