Using Real-Time Clock

The STM32MP1 platform provides the internal real-time clock (RTC).

The internal RTC is enabled by default in the STM32MP1 BSP and does not require any additional configuration during Yocto build or run-time.

The BSP provides the standard Linux hwclock utility for fetching and updating the current time stored by the RTC.

When executed with the -w parameter, hwclock saves the current system time to the RTC:

root@stm32mp15-som:~# hwclock -w root@stm32mp15-som:~#

When executed without parameters or with the -r parameter, hwclock shows the saved current time:

root@stm32mp15-som:~# hwclock Tue Feb 27 02:39:07 UTC 2024

The RTC requires a CR-1220 battery installed in the BT1 connector to keep the current time during system power off state.