2021-09-18 07:28 AM
I have a STM32F373VBTx serie. I know that the RTC saves the backup registers for every second. But when I restart my STM32, then the RTC sets to default date and time again due to the MX_RTC_INIT() function who is generated by CubeMX.
I have two questions:
2021-09-18 08:23 AM
1 yes
2 in the user code section at the start of MX_RTC_INIT, check to see if it's initialized and if so, return from the function.
2021-09-18 08:27 AM
You men between here?
/* USER CODE BEGIN Check_RTC_BKUP */
/* USER CODE END Check_RTC_BKUP */
Edit:
So what can I do with the backup registers?
Edit:
Or do you mean like this?
static void MX_RTC_Init(void)
{
/* USER CODE BEGIN RTC_Init 0 */
if(hrtc != NULL)
return;
/* USER CODE END RTC_Init 0 */