MAX32660 User Guide
Maxim Integrated Page 98 of 195
9.2.1 Time-of-Day Alarm
Program the RTC Time-of-Day Alarm register (RTC_RAS) to configure the time-of-day-alarm. The alarm triggers when the
value stored in RTC_RAS matches the lower 20 bits of the RTC_SEC.rts 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_RAS.tod field.
When the alarm occurs, hardware sets the Time-of-Day Alarm Interrupt Flag (RTC_CTRL.alarm_tod_fl) to 1.
Setting the RTC_CTRL.alarm_tod_fl bit to 1 in software results in an interrupt request to the processor if the Alarm
Time-of-Day Interrupt Enable (RTC_CTRL.alarm_tod_en) bit is set to 1, and the system interrupt enable is set.
9.2.2 Sub-Second Alarm
The RTC_RSSA and RTC_CTRL.alarm_ss_en field control the sub-second alarm. Writing RTC_RSSA sets the starting value for
the sub-second alarm counter. Writing the Sub-Second Alarm Enable (RTC_CTRL.alarm_ss_en) bit to 1 enables the
sub-second alarm. Once enabled, the sub-second alarm begins up-counting from the RTC_RSSA value. When the counter
rolls over from 0xFFFF FFFF to 0x0000 0000, hardware sets the RTC_CTRL.alarm_ss_fl bit triggering the alarm. At the same
time, hardware also reloads the counter with the value previously written to RTC_RSSA.rssa. A 256Hz clock drives the
sub-second alarm allowing a maximum interval of 16,777,216 seconds with a resolution of approximately 3.9 msec.
You must disable the sub-second interval alarm, RTC_CTRL.alarm_ss_en, prior to changing the interval alarm value,
RTC_RSSA.
The delay (uncertainty) associated with enabling the sub-second alarm is up to one period of the sub-second clock,
approximately 3.9 msec based on 256Hz RTC clock input to the register. This uncertainty is propagated to the first interval
alarm. Thereafter, if the interval alarm remains enabled, the alarm triggers after each sub-second interval as defined
without the first alarm uncertainty because the sub-second alarm is an auto-reload timer. Enabling the sub-second alarm
with with the sub-second alarm register set to 0 (RTC_RSSA.rssa = 0) results in the maximum sub-second alarm interval.
9.2.3 RTC Wakeup From DEEPSLEEP/BACKUP Power Modes
The RTC alarms are an optional wakeup source for the MAX32660 during DEEPSLEEP/BACKUP mode. Perform the following
steps to use the RTC as a DEEPSLEEP/BACKUP wakeup source:
1. Configure the RTC Time-of-Day Alarm for the required number of seconds.
2. Create a RTC IRQ handler function and register the address of the RTC IRQ handler using the NVIC.
3. Enable the RTC time of day interrupt enable, (RTC_CTRL.alarm_tod_en = 1).
4. Enable the System wakeup for the RTC by setting the GCR_PM.rtcwk_en field to 1.
5. Enter the desired low power mode. Refer to section Operating Modes for details on entering DEEPSLEEP or
BACKUP mode.
9.3 RTC Register Access
Restricted access to specific registers prevents software reading from or writing to the RTC registers while they are updated
by the RTC hardware.