Skip to main content
Emm1592
Associate II
Apr 14, 2019 1:49 AM UTC
Solved

Set date and time RTC in main()

Hello,

I want to know if it is possible to set date and time of the RTC in the main() function.

I'm working with the LSI and I know that is very inaccurate. My idea is to -"re-initialize" (set manually the date and time) the RTC every 1 week for example.

I obtained those values, date and time, via serial from another device (with updated time).

I'm using the Nucleo Board STM32L476RG

Thank you very much!

This topic has been closed for replies.
Clive1 (HNL)
Clive1 (HNL)Best answer
Explorer
Apr 14, 2019 2:14 AM UTC

Yes, implement a menu to allow configuration, or parse a GPS stream, or query from a cellular network.

You can write code to do pretty much anything you want.

The HAL has specific functions to get/set the time/date.

1 reply

Clive1 (HNL)
Clive1 (HNL)Best answer
Explorer
Apr 14, 2019 2:14 AM UTC

Yes, implement a menu to allow configuration, or parse a GPS stream, or query from a cellular network.

You can write code to do pretty much anything you want.

The HAL has specific functions to get/set the time/date.