STK17TA8

Figure 15. Current versus Cycle Time

RTC Operations

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

The user should halt internal updates to the real time clock registers before reading clock data to prevent the 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 0x1FFF0) captures the current time in holding registers. Clock updates will not restart until a “0” is written to the read bit. The RTC registers can then be read while the internal clock continues to run.

Within 20ms 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 0x1FFF0) to a "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 in intended to keep time even when system power is lost. When primary power, VCC, drops below VSWITCH, the real time clock switches to the backup power supply connected to either the VRTCcap or VRTCbat pin.

The clock oscillator uses a maximum of 300 nanoamps at 2 volts to maximize the backup time available from the backup source.

You 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.

If you select a capacitor power source, connect the capacitor to the VRTCcap pin and leave the VRTCbat pin unconnected. Capacitor backup time values based on maximum current specs are shown below. Nominal times are approximately three times longer.

Capacitor Value

Backup Time

0.1 F

72 hours

 

 

0.47 F

14 days

 

 

1.0 F

30 days

 

 

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 real time clock continues to have the same backup time over years of operation.

If you select a battery power source, connect the battery to the VRTCbat pin and leave the VRTCcap pin unconnected. A 3V lithium battery 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 VRTCbat pin. This prevents the battery from ever being charged by the circuit.

Stopping And Starting The RTC Oscillator

The OSCEN bit in Calibration register at 0x1FFF8 enables RTC oscillator operation. This bit is nonvolatile and shipped to customers in the “enabled” state (set to 0). OSCEN should be set to a 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 max) for the oscillator to start.

The STK17TA8 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 0x1FFF0). When the device is powered on (VCC goes above VSWITCH), the OSCEN bit is checked for "enabled" status. If the OSCEN bit is enabled and the oscillator is not active within the first 5 ms, the OSCF bit is set. The user should check for this condition and then write a 0 to clear the flag. When the OSCF flag bit is set, the real time clock registers are reset to the “Base Time” (see the section "Setting the Clock"), 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 which may have become set when the system was first powered on.

To reset OSCF, set the write bit “W” (in the Flags register at 0x1FFF0) to a "1" to enable writes to the Flag register. Write a “0” to the OSCF bit. and thenreset the write bit to "0" to disable writes.

Document #: 001-52039 Rev. **

Page 14 of 23

[+] Feedback

Page 14
Image 14
Cypress STK17TA8 manual RTC Operations