cancel
Showing results for 
Search instead for 
Did you mean: 

Set date and time RTC in main()

Emm1592
Associate II

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Clive1 (HNL)
Senior II

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.

View solution in original post

1 REPLY 1
Clive1 (HNL)
Senior II

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.