Real-Time Clock (RTC)

Browse source code on GitHub

Overview

This sample shows how to use the rtc driver API to set and read the date/time from RTC and display on the console and can be built and executed on boards supporting RTC.

Building and Running

Build and flash as follows, replacing stm32f3_disco with your board:

west build -b stm32f3_disco samples/drivers/rtc
west flash
# From the root of the zephyr repository
west build -b mimxrt700_evk/mimxrt798s/cm33_cpu0 samples/drivers/rtc
west flash
# From the root of the zephyr repository
west build -b mimxrt700_evk/mimxrt798s/cm33_cpu1 samples/drivers/rtc
west build -t ram

Sample Output

RTC date and time: 2024-11-17 04:19:00
RTC date and time: 2024-11-17 04:19:01

<repeats endlessly>

See also

RTC Interface