PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

RTC (Real Time Clock)
HAL API Reference » Implementation Specific

Internally the RTC only stores the year as a two digit BCD value (0-99); no century information is stored.

On RTC initialization the HAL must, as a result, assume a default century. If mtb_hal_rtc_write has been called with a different century than the default, its value must be stored and that value must persist through deep sleep, hibernate, software resets, etc. hardware provides a number of BREG registers which exist in the BACKUP domain and will persist over these power modes and resets. The HAL uses the highest indexed BACKUP->BREG register to store the century for the RTC.

Therefore do not use the highest indexed BACKUP->BREG register as it is reserved for internal HAL usage.

Note
  A century rollover (eg: 1999 to 2000) will only be detected if the backup domain is reset. This happens automatically on a hardware reset, or can be done manually by calling Cy_SysLib_ResetBackupDomain(). Calling the reset function will clear any existing RTC/WCO/WDT configuration, so they must be setup after the reset.