Real-Time Clock (RTC) Alarm Functionality#

RTC Operation as an Alarm#

The RTC alarm provides a way to schedule events at a specific time in the future. When the programmed alarm time matches the current calendar value, the hardware generates an interrupt. Depending on configuration, this interrupt can be used to:

  • Wake up the microcontroller unit (MCU) from Sleep state (handled via the Power Manager APIs).

  • Trigger application code through a registered callback.

  • Operate in one-shot or periodic mode to support both single future events and recurring wakeups.

Because the Calendar block is located in the Ultra-Ultra-Low-Power (UULP) domain, alarms remain active even while the M4 is operating in low-power state, ensuring that timed wake-ups are reliable across sleep cycles.

API References and Example Implementations#

The WiSeConnect Software Development Kit (SDK) provides a set of APIs for configuring and using alarms.

Core APIs#

API

Description

sl_si91x_calendar_set_alarm()

Programs the alarm date and time.

sl_si91x_calendar_get_alarm()

Reads back the currently configured alarm.

sl_si91x_calendar_register_alarm_trigger_callback()

Registers a callback that fires when the alarm expires.

sl_si91x_calendar_clear_alarm_trigger()

Clears the alarm interrupt flag, typically from inside the interrupt service routine (ISR).

One-Shot vs. Periodic Behavior#

  • One-shot alarms:
    Configured once with sl_si91x_calendar_set_alarm(). The alarm fires a single interrupt when the scheduled time matches the calendar value.

  • Periodic alarms:
    Periodic behavior can be implemented in software by reprogramming the alarm inside the callback. For example, after a 10-second alarm expires, the callback sets the next alarm 10 seconds ahead.

  • Second-based trigger:
    For precise and lightweight periodic tasks, the Calendar block also provides second-based triggers. These are independent of the alarm and can generate periodic interrupts without needing to reprogram.

RTC Alarm as a Wake-Up source#

The RTC alarm is one of the most commonly used wake-up sources in low-power applications. Because the Calendar block resides in the UULP domain, alarms continue running in the low power states.

When used with the Power Manager, the alarm integrates into the sleep/wakeup flow:

  • Before Sleep: The application configures an alarm and registers it as a wakeup source with the Power Manager.

  • During Sleep: M4 transitions into sleep or low-power states. Only the UULP domain (containing RTC, SYSRTC, and Watchdog Timer (WDT), etc.) remains active.

  • On alarm expiry:

    • The alarm interrupt triggers a Wake-up event.

    • The M4 wakes up and resumes execution.

    • The alarm callback is executed before application code continues.

Power Manager APIs Commonly Involved#

The Wakeup source is configured via the Universal Configurator (UC) in Simplicity Studio.

SiWG917 RTC Clock architecture diagramSiWG917 RTC Clock architecture diagram

Internally, Power Manager uses the sl_si91x_power_manager_set_wakeup_sources() API to register the RTC alarm (and other peripherals) as valid Wakeup sources.

SDK Reference Example#

The following example demonstrates usage of RTC as a wakeup source (Si917 connects to an AWS server, enters sleep state and publishes data to cloud once every 30 seconds based on the wakeup indication from RTC/calendar):

Practical Use Cases#

  • Sensor sampling: Periodically wake the device to sample sensors, then return to sleep.

  • User notifications: Wearables triggering alarms (like health reminders).

Accuracy Note#

The accuracy of timed Wake-Ups is bounded by the low-frequency (LF) clock source.

  • For applications where wakeup timing must be consistent (for example, wireless protocols), use the 32.768 kHz external crystal.

  • If using the RC clock, consider enabling periodic calibration to minimize drift during long Sleep intervals.