RTC not changing in Nucleo-F746ZG?
Hi - I have a Nucleo-F746ZG that I am configuring in CubeMX (version 6.2.1). When configuring it I am trying to only set up the RTC and UART3. UART3 is set up to print to the USB virtual COM port (and that works fine).
In CubeMX, once I start a new project, I go to the "Timers" tab, the to the "RTC" node, then select the checkbox for "Activate Clock Source."
The only changes I made to the generated source code were in the main method. I understand from reading the source code for stm32f7xx_hal_rtc.c that it is important to call HAL_RTC_GetTime and then call HAL_RTC_GetDate.
Inside of main, in USER CODE BEGIN 2:
RTC_TimeTypeDef current_time;
RTC_DateTypeDef current_date;
HAL_RTC_GetTime(&hrtc, ¤t_time, RTC_FORMAT_BIN);
HAL_RTC_GetDate(&hrtc, ¤t_date, RTC_FORMAT_BIN);
printf(" H:M:S = %02d:%02d:%02d\r\n", current_time.Hours, current_time.Minutes, current_time.Seconds);
HAL_Delay(2000);
printf(" H:M:S = %02d:%02d:%02d\r\n", current_time.Hours, current_time.Minutes, current_time.Seconds);I was expecting to see "09:05:00" followed by "09:05:02" because of the 2 second delay inserted by HAL_Delay. What I got was "09:05:00" followed by the same thing.
I didn't see a "start" function in the API for the RTC. What else am I missing?
I tried this with two different Nucleo-F746ZG boards.