Solved
RTC not rolling over at midnight
- 3 replies
- 2817 views
Using the RTC on a NUCLEO-G071RB (HAL) I have a program the prints out the time, date and temperature in degrees Centigrade. I left it running overnight and discovered in the morning that the hours had not reset to 00:00 at midnight and neither had the date rolled forward by a day.
I'm not experienced in embedded systems, in fact this is my first attempt at programming any MCU, but I thought this rollover was implemented in the HAL library.
I'm using functions HAL_RTC_SetTime & HAL_RTC_SetDate to initialise the clock to 10 seconds before midnight) and then HAL_RTC_GetTime and HAL_RTC_GetDate before printing to the serial monitor.
I'm not asking to fix my code (attached) but would appreciate help in knowing where to look. Thanks
