•Program the control register every time the LPD is powered on. The value returned by reading the control register matches with the actual control settings that are stored in the battery powered domain.
•The value that is programmed through the SET_TIME_WRITE register is represented by the seconds counter when the next second is signaled by the RTC. To make the load time of this value deterministic, before writing the current time to the SET_TIME_WRITE register, the value for the calibration should be written to the CALIB_WRITE register. This clears the tick counter and forces the next second to be signaled exactly in one second. In that case, the value that is written to the SET_TIME_WRITE register must be the current time in seconds plus one.
•The value that is programmed through the SET_TIME_WRITE register is loaded in the seconds counter in one cycle (see previous programming bullet). If, for any reason, an application reads the time prior to that elapsed one second, an incorrect value could be read. In that case, after SET_TIME_WRITE register was written, a value of FFFFh should be written to the RTC_INT_STATUS register to clear the status of the all RTC interrupts. During a read_time function, the code should read the RTC_INT_STATUS register and if bit 0 is still 0, it means that one second has not yet elapsed from when the RTC was set and the current time should be read from the SET_TIME_READ register; otherwise, the CURRENT_TIME register is read to report the time.
•The alarm value programmed in the RTC controller represents a specific second within the 136-year range that the RTC is operating. To set an alarm that goes off regularly at a specific time in a day, or any other regular period, the alarm interrupt service routine is expected to set the next time that the alarm is expected to go off in the alarm register.
•The calibration and set_time values are each written and read through different addresses. When a value is written to either of these registers and read back, a sync instruction must be inserted between the write and read operations to ensure that the value read is the one that was written. Furthermore, the program should read the current time from the CURRENT_TIME register twice through back-to-back reads with a sync instruction between them. If the times match, use that value to ensure a stable value is read by the program.