Files
Holt Sun 2e02d29295 boards: nxp: frdm_mcxe31b: enable rtc device.
1. enable RTC and rtc-counter alias for
frdm_mcxe31b.
2. enable sample driver counter alarm.
3. enable sample driver rtc.
4. enable counter_basic_api test.
5. fix misc mcxe31b dts format error.

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2025-11-13 20:41:39 -05:00
..
2024-11-21 14:49:19 +01:00
2024-11-21 14:49:19 +01:00

.. zephyr:code-sample:: rtc
   :name: Real-Time Clock (RTC)
   :relevant-api: rtc_interface

   Set and read the date/time from a Real-Time Clock.

Overview
********

This sample shows how to use the :ref:`rtc driver API <rtc_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:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/rtc
   :board: stm32f3_disco
   :goals: build flash
   :compact:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/rtc
   :board: mimxrt700_evk/mimxrt798s/cm33_cpu0
   :goals: build flash

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/rtc
   :board: mimxrt700_evk/mimxrt798s/cm33_cpu1
   :goals: build ram

Sample Output
=============

.. code-block:: console

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

   <repeats endlessly>