Cypress STK17TA8 manual RTC Operations

Page 14

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

Image 14
Contents Description FeaturesLogic Block Diagram Cypress Semiconductor Corporation 198 Champion CourtPinouts Pin DescriptionsSymbol Parameter Commercial Industrial Units Min DC Electrical CharacteristicsRF SSOP-48 Package Thermal Characteristics Absolute Maximum RatingsAC Test Conditions Symbol Parameter Commercial Industrial Units Min MaxSymbol Parameter Max Units Conditions CapacitanceRTC DC Characteristics Symbols Parameter STK17TA8-25 STK17TA8-45 Units Alt Min Max Sram Read Cycles #1 and #2Sram Write Cycles #1 and #2 Units Standard Alternate Min Max AutoStore/Power Up RecallSymbols Parameter Software-Controlled STORE/RECALL Cycle Hardware Store Cycle Soft Sequence CommandsHardware Store to Sram Disabled Hardware Store Pulse WidthMode Selection A16-A0 Mode PowerHardware Store HSB Operation Hardware Recall POWER-UPNvSRAM Operation AutoStore OperationData Protection Low Average Active PowerSoftware Recall Noise ConsiderationsRTC Operations Power Monitor Watchdog TimerAlarm Calibrating The ClockInterrupt Register InterruptsFlags Register RTC Register Register BCD Format Data Function / RangeRegister Map Detail 0x1FFF7 0x1FFF5 Alarm Day0x1FFF4 Alarm Hours 0x1FFF6 Interrupt0x1FFF0 Flags 0x1FFF2 Alarm Seconds0x1FFF1 Real Time Clock Centuries 10s Centuries WDF Oscf CALOrdering Information Ordering CodesPackage Diagrams 51-85061 *C Document # 001-52039 RevDocument History Sales, Solutions, and Legal InformationWorldwide Sales and Design Support Products PSoC Solutions