
Document Number: 001-52040 Rev. *C Page 15 of 24
Real Time Clock
The clock registers maintain time up to 9,999 years in
one-second increments. The user can set the time to any
calendar time and the clock automatically keeps track of days of
the week and month, leap years, and century transitions. There
are eight registers dedicated to the clock functions which are
used to set time with a write cycle and to read time during a read
cycle. These registers contain the Time of Day in BCD format.
Bits defined as ‘0’ are currently not used and are reserved for
future use by Cypress.
Reading the Clock
Halt internal updates to the real time clock registers before
reading clock data to prevent reading of data in transition.
Stopping the internal register updates does not affect clock
accuracy.
Write a ‘1’ to the read bit “R” (in the Flags register at 0x7FF0) to
capture the current time in holding registers. Clock updates do
not restart until a ‘0’ is written to the read bit. The RTC registers
can now be read while the internal clock continues to run.
Within 20 ms after a ‘0’ is written to the read bit, all real time clock
registers are simultaneously updated.
Setting the Clock
Set the write bit “W” (in the Flags register at 0x7FF0) to ‘1’ to
enable the time to be set. The correct day, date, and time can
then be written into the real time clock registers in 24-hour BCD
format. The time written is referred to as the “Base Time.” This
value is stored in nonvolatile registers and used in calculation of
the current time. Reset the write bit to ‘0’ to transfer the time to
the actual clock counters, The clock starts counting at the new
base time.
Backup Power
The RTC is intended to keep time even when system power is
lost. When primary power, V
CC
, drops below V
SWITCH
, the real
time clock switches to the backup power supply connected to
either the V
RTCcap
or V
RTCbat
pin.
The clock oscillator uses a maximum of 300 nanoamps at 2V to
maximize the backup time available from the backup source.
The user can power the real time clock with either a capacitor or
a battery. Factors to be considered when choosing a backup
power source include the expected duration of power outages
and the cost and reliability trade-off of using a battery versus a
capacitor.
When selecting a capacitor power source, connect the capacitor
to the V
RTCcap
pin and leave the V
RTCbat
pin unconnected.
Capacitor backup time values based on maximum current speci-
fications are shown below. Nominal times are approximately
three times longer.
A capacitor has the obvious advantage of being more reliable
and not containing hazardous materials. The capacitor is
recharged every time the power is turned on so that the real time
clock continues to have the same backup time over years of
operation
When selecting a battery power source, connect the battery to
the V
RTCbat
pin and leave the V
RTCcap
pin unconnected. A 3V
lithium is recommended for this application. The battery capacity
should be chosen for the total anticipated cumulative down-time
required over the life of the system.
The real time clock is designed with a diode internally connected
to the V
RTCbat
pin. This prevents the battery from ever being
charged by the circuit.
Stopping and Starting the RTC Oscillator
The OSCEN bit in the Calibration register at 0x7FF8 enables
RTC oscillator operation. This bit is nonvolatile and shipped to
customers in the “enabled” state (set to ‘0’). OSCEN should be
set to ‘1’ to preserve battery life while the system is in storage.
This turns off the oscillator circuit extending the battery life. If the
OSCEN bit goes from disabled to enabled, it typically takes 5
seconds (10 seconds maximum) for the oscillator to start.
The STK17T88 has the ability to detect oscillator failure due to
loss of backup power. The failure is recorded by the OSCF
(Oscillator Failed bit) of the Flags register (at address 0x7FF0).
When the device is powered on (V
CC
goes above V
SWITCH
) the
OSCEN bit is checked for “enabled” status. If the OSCEN bit is
enabled and the oscillator is not active within 5 ms, the OSCF bit
is set. Check for this condition and then write a ‘0’ to clear the
flag. When the OSCF flag bit, the real time clock registers are
reset to the “Base Time” (see the section Setting the Clock on
page 15, the value last written to the real time clock registers.
The value of OSCF should be reset to ‘0’ when the real time clock
registers are written for the first time. This initializes the state of
this bit because it may have become set when the system was
first powered on.
To reset OSCF, set the write bit “W” (in the Flags register at
0x7FF0) to ‘1’ to enable writes to the Flags register. Write ‘0’ to
the OSCF bit and then reset the write bit to ‘0’ to disable writes.
Calibrating The Clock
The RTC is driven by a quartz controlled oscillator with a nominal
frequency of 32.768 kHz. Clock accuracy depends on the quality
of the crystal specified (usually 35 ppm at 25
°C). This error can
equate to 1.53 minutes gain or loss per month. The STK17T88
employs a calibration circuit that can improve the accuracy to
+1/-2 ppm at 25
°C. The calibration circuit adds or subtracts
counts from the oscillator divider circuit.
The number of time pulses added or subtracted depends upon
the value loaded into the five calibration bits found in Calibration
register (at 0x7FF8). Adding counts speeds the clock up;
subtracting counts slows the clock down. The calibration bits
occupy the five lower order bits of the register. These bits can be
set to represent any value between 0 and 31 in binary form. Bit
D5 is a Sign bit, where a ‘1’ indicates positive calibration and a
‘0’ indicates negative calibration. Calibration occurs during a 64
minute period. The first 62 minutes in the cycle may, once per
minute, have one second either shortened by 128 or lengthened
by 256 oscillator cycles.
Capacitor Value Backup Time
0.1 F 72 hours
0.47 F 14 days
1.0 F 30 days
Not Recommended for New Designs
[+] Feedback
Comentários a estes Manuais