rtc-clock
Set the SoC RTC, then read it back. The minimal demo for <alp/rtc.h>.
Source: examples/rtc-clock/.
board.yaml
schema_version: 2
som:
sku: E1M-AEN701
carrier:
name: E1M-EVK
cores:
m55_hp:
os: zephyr
app: ./src
peripherals: [rtc]
diagnostics:
log_level: info
Source (abbreviated)
#include <alp/rtc.h>
int main(void) {
alp_rtc_t *rtc = alp_rtc_open(&(alp_rtc_config_t){});
if (rtc == NULL) return -1;
alp_rtc_datetime_t dt = {
.year = 2026, .month = 5, .day = 14,
.hour = 12, .minute = 0, .second = 0,
};
alp_rtc_set(rtc, &dt);
for (int i = 0; i < 5; i++) {
alp_rtc_datetime_t now;
alp_rtc_get(rtc, &now);
printk("[rtc] %04u-%02u-%02u %02u:%02u:%02u\n",
now.year, now.month, now.day, now.hour, now.minute, now.second);
k_msleep(1000);
}
alp_rtc_close(rtc);
return 0;
}
On-module RTC (V2N)
V2N modules carry a battery-backed Micro Crystal RV-3028-C7 alongside the SoC RTC. For backup-domain persistence use <alp/chips/rv3028c7.h> directly. See v2n-rtc-multi-alarm.
See also
Questions about this page? Discuss in Community Forum