![Maxim Integrated MAX32660 User Manual Download Page 98](http://html1.mh-extra.com/html/maxim-integrated/max32660/max32660_user-manual_1744484098.webp)
MAX32660 User Guide
Maxim Integrated
Page 98 of 195
9.2.1
Time-of-Day Alarm
Program the RTC Time-of-Day Alarm register (
) to configure the time-of-day-alarm. The alarm triggers when the
value stored in
matches the lower 20 bits of the
.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
.tod
field.
When the alarm occurs, hardware sets the Time-of-Day Alarm Interrupt Flag (
alarm
_
tod
_
fl
) to 1.
.alarm_tod_fl
bit to 1 in software results in an interrupt request to the processor if the Alarm
Time-of-Day Interrupt Enable (
alarm
_
tod
_
en
) bit is set to 1, and the
’s
system interrupt enable is set.
9.2.2
Sub-Second Alarm
and
.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 (
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
.alarm_ss_fl
bit triggering the alarm. At the same
time, hardware also reloads the counter with the value previously written to
.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,
.alarm_ss_en,
prior to changing the interval alarm value,
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 (
.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, (
alarm
_
tod
_
en
= 1).
4.
Enable the System wakeup for the RTC by setting the
rtcwk_en
field to 1.
5.
Enter the desired low power mode. Refer to section
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.