Cypress CY14B108M, CY14B108K manual Real Time Clock Operation

Page 7

PRELIMINARY

CY14B108K, CY14B108M

 

Real Time Clock Operation

nvTime Operation

The CY14B108K/CY14B108M offers internal registers that contain clock, alarm, watchdog, interrupt, and control functions. RTC registers use the last 16 address locations of the SRAM. Internal double buffering of the clock and timer information registers prevents accessing transitional internal clock data during a read or write operation. Double buffering also circumvents disrupting normal timing counts or the clock accuracy of the internal clock when accessing clock data. Clock and alarm registers store data in BCD format.

RTC functionality is described with respect to CY14B108K in the following sections. The same description applies to CY14B108M, except for the RTC register addresses. The RTC register addresses for CY14B108K range from 0xFFFF0 to 0xFFFFF, while those for CY14B108M range from 0x7FFF0 to 0x7FFFF. Refer to Table 4 on page 11 and Table 5 on page 12 for a detailed Register Map description.

Clock Operations

The clock registers maintain time up to 9,999 years in one second increments. The time can be set 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 double buffered RTC register structure reduces the chance of reading incorrect data from the clock. The user must stop internal updates to the CY14B108K time keeping registers before reading clock data, to prevent reading of data in transition. Stopping the register updates does not affect clock accuracy.

The updating process is stopped by writing a ‘1’ to the read bit ‘R’ (in the flags register at 0xFFFF0), and does not restart until a ‘0’ is written to the read bit. The RTC registers are then read while the internal clock continues to run. After a ‘0’ is written to the read bit (‘R’), all RTC registers are simultaneously updated within 20 ms

Setting the Clock

Setting the write bit ‘W’ (in the flags register at 0xFFFF0) to a ‘1’ stops updates to the time keeping registers and enables the time to be set. The correct day, date, and time is then written into the registers and must be 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 the calculation of the current time. Resetting the write bit to ‘0’ transfers the values of timekeeping registers to the actual clock counters, after which the clock resumes normal operation.

If the time written to the timekeeping registers is not in the correct BCD format, each invalid nibble of the RTC registers continue counting to 0xF before rolling over to 0x0 after which RTC resumes normal operation.

Note The values entered in the timekeeping, alarm, calibration, and interrupt registers need a STORE operation to be saved in

nonvolatile memory. Therefore, while working in AutoStore disabled mode, the user must perform a STORE operation after writing into the RTC registers for the RTC to work correctly.

Backup Power

The RTC in the CY14B108K is intended for permanently powered operation. The VRTCcap or VRTCbat pin is connected depending on whether a capacitor or battery is chosen for the application. When the primary power, VCC, fails and drops below VSWITCH the device switches to the backup power supply.

The clock oscillator uses very little current, which maximizes the backup time available from the backup source. Regardless of the clock operation with the primary source removed, the data stored in the nvSRAM is secure, having been stored in the nonvolatile elements when power was lost.

During backup operation, the CY14B108K consumes a maximum of 300 nanoamps at room temperature. User must choose capacitor or battery values according to the application.

Backup time values based on maximum current specifications are shown in the following table. Nominal backup times are approximately two times longer.

Table 3. RTC Backup Time

Capacitor Value

Backup Time

0.1F

72 hours

 

 

0.47F

14 days

 

 

1.0F

30 days

 

 

Using a capacitor has the obvious advantage of recharging the backup source each time the system is powered up. If a battery is used, a 3V lithium is recommended and the CY14B108K sources current only from the battery when the primary power is removed. However, the battery is not recharged at any time by the CY14B108K. The battery capacity must be chosen for total anticipated cumulative down time required over the life of the system.

Stopping and Starting the Oscillator

The OSCEN bit in the calibration register at 0xFFFF8 controls the enable and disable of the oscillator. This bit is nonvolatile and is shipped to customers in the “enabled” (set to 0) state. To preserve the battery life when the system is in storage, OSCEN must be set to ‘1’. This turns off the oscillator circuit, extending the battery life. If the OSCEN bit goes from disabled to enabled, it takes approximately one second (two seconds maximum) for the oscillator to start.

While system power is off, If the voltage on the backup supply (VRTCcap or VRTCbat) falls below their respective minimum level, the oscillator may fail.The CY14B108K has the ability to detect oscillator failure when system power is restored. This is recorded in the OSCF (Oscillator Failed bit) of the flags register at the address 0xFFFF0. 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 to “1”. The system must check for this condition and then write ‘0’ to clear the flag. Note that in addition to setting the OSCF flag bit, the time registers are reset to the “Base Time” (see Setting the Clock on page 7), which is the value last written to the timekeeping registers. The control or

Document #: 001-47378 Rev. **

Page 7 of 29

[+] Feedback

Image 7
Contents Cypress Semiconductor Corporation FeaturesLogic Block Diagram1, 2 Functional DescriptionPinouts AutoStore Operation Device OperationSram Read Sram WriteSoftware Store Hardware Recall Power UpHardware Store HSB Operation Software RecallStore Mode SelectionA15 A05 Mode Power Preventing AutoStoreNoise Considerations Data Protection Best PracticesReal Time Clock Operation Watchdog Timer AlarmCalibrating the Clock Flags Register Power MonitorInterrupt Register InterruptsAF Alarm Flag WDF Watchdog Timer FlagPF Power Fail Flag PFE Power Fail EnableWDS OscenWDF Oscf For the register is 0 to 0xFFFF9 0x7FFF9 Time Keeping Seconds0xFFFF6 0x7FFF6 Interrupt Status/Control 0xFFFF5 0x7FFF5 Alarm DayTime-base Write only. Reading it always returns aThis condition and write 0 to clear this flag 0xFFFF2 0x7FFF2 Alarm SecondsCenturies 0xFFFF0 0x7FFF0 Flags WatchdogOperating Range DC Electrical CharacteristicsRange Ambient Temperature Maximum RatingsAC Test Conditions Data Retention and EnduranceCapacitance Thermal ResistanceRTC Capacitor Pin Voltage TOCS RTC Oscillator Time to Start RTC Backup CurrentHot Temperature 85 oC RTC Battery Pin VoltageSram Write Cycle AC Switching CharacteristicsSwitching Waveforms Parameters Sram Read CycleData Input Input Data Valid Data Output High Impedance Output Data ValidStandby Active Address Address ValidData Input Input Data Valid High Impedance Data Output Data Input Data OutputInput Data Valid High Impedance Not applicable for RTC register writesParameters Description 20 ns 25 ns 45 ns Unit Min Max AutoStore/Power Up RecallSoftware Controlled Store and Recall Cycle Hardware Store Pulse Width To Output Active Time when write latch not setHardware Store Cycle Description 20 ns 25 ns 45 ns Unit MinTruth Table For Sram Operations For x8 ConfigurationFor x16 Configuration Inputs and Outputs Mode PowerZS Tsop Part Numbering Nomenclature CY14 B 108 K ZS P 20 X C TNvsram Ordering Information Pin Tsop II Package Diagrams51-85160 Document History Sales, Solutions, and Legal InformationWorldwide Sales and Design Support Products PSoC Solutions New Data Sheet