Electronic – STM32 RTC – how to update

rtcstm32stm32cubemx

I have a remote unit that runs a STM32L0 MCU. It is not connected to the internet but communicates with a remote PC over radio.

I would like to update the RTC on the remote unit with a timestamp that I am receiving from the PC.

Is it possible to configure STM32 RTC on the fly? Or this is a one-time operation during initialization?

Any alarms (A or B) that I have set stop working as soon as I update the RTC (set date/time).

Best Answer

You did not even bother to look at the reference manual (let me guess that the chip is STM32L011). Section 22.4.7. There is a magic sequence that has to be followed to update RTC registers. Everything can be changed at run-time.