1
\$\begingroup\$

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).

\$\endgroup\$
2
  • \$\begingroup\$ Can you elaborate why you want to update the RTC on the fly? I think you can use tamper event to record a timestamp but be sure to clear the timestamp flag and overflow flag carefully. \$\endgroup\$
    – charansai
    Commented Dec 29, 2017 at 9:42
  • \$\begingroup\$ The remote unit ( stm32 ) acts as data collector, it sends data to the pc and hence timestamp of the event recorded should be as close as possible to the pc one.the pc sends his own timestamp in a ping request to the remote unit , if I detect a significant drift, I'd like to update the rtc. \$\endgroup\$ Commented Dec 29, 2017 at 17:57

1 Answer 1

3
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ I actually did but I will take a look again, thanks for the reference though. The thing is that I have rtc alarms set (alarm a ) , and setting the rtc cause them to reset \$\endgroup\$ Commented Dec 29, 2017 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.