MAX32665-MAX32668 User Guide
Maxim Integrated Page 371 of 457
Software can use two methods to ensure valid results when reading RTC_SEC and RTC_SSEC:
• Poll RTC_CTRL.ready until it reads 1 before reading the registers.
• Set the RTC_CTRL.ready_int_en field to 1 to generate an RTC interrupt when the next update cycle is complete and
hardware sets RTC_CTRL.ready to 1 again. This avoids the software overhead associated with polling to observe
the state of RTC_CTRL.ready.
Software can clear RTC_CTRL.ready following the read of the registers to acknowledge the read.
18.3.2 RTC Write Access Control
The read-only status field RTC_CTRL.busy is set to 1 by hardware following a software instruction that writes to specific
registers. The bit remains 1 while the software updates are being synchronized into the RTC. Software should not write to
any of the registers until hardware indicates the synchronization is complete by clearing RTC_CTRL.busy to 0.
Figure 18-2. RTC Busy/Ready Signal Timing
18.4 RTC Alarm Functions
The RTC provides time-of–day and sub-second interval alarm functions. The time-of-day alarm is implemented by matching
the count values in the counter register with the value stored in the alarm register. The sub-second interval alarm provides
an auto-reload timer that is driven by the trimmed RTC clock source.
18.4.1 Time-of-Day Alarm
Program the RTC Time-of-Day Alarm register (RTC_TODA) to configure the time-of-day-alarm. The alarm triggers when the
value stored in HTIMER_RAS matches the lower 20 bits of the RTC_SEC seconds count register. This allows programming the
time-of-day-alarm to any future value between 1 second and 12 days relative to the current time with a resolution of 1
second. You must disable the time-of-day alarm before changing the RTC_TODA .tod field.
When the alarm occurs, a single event sets the Time-of-Day Alarm Interrupt Flag (RTC_CTRL.tod_alarm_fl) to 1.
Setting the RTC_CTRL.tod_alarm_fl bit to 1 in software results in an interrupt request to the processor if the Alarm
Time-of-Day Interrupt Enable (RTC_CTRL.tod_alarm_en) bit is set to 1, and the RTC’s system interrupt enable is set.