Question
STM32CubeMX does not preserve conditional RTC initialization (it reinitialize when backup register is set)
Hi ST Support Team,
I am using MXCube for STM32U5A5VJ. I have enabled the RTC, and cube generates the following Init Function. In this way, everytime I restart the controller, the RTC date is gonna be overwritten. In practice, I would like to have the bracket at line 9 down in line 21. Thank you for your support.
Best Regards,
Gianmarco Cerutti
void MX_RTC_Init(void)
{
...
/** Initialize RTC and set the Time and Date
*/
if(LL_RTC_BKP_GetRegister(RTC,LL_RTC_BKP_DR0) != 0x32F2){
LL_RTC_BKP_SetRegister(RTC,LL_RTC_BKP_DR0,0x32F2);
}
RTC_TimeStruct.Hours = 0x0;
RTC_TimeStruct.Minutes = 0x0;
RTC_TimeStruct.Seconds = 0x0;
LL_RTC_TIME_Init(RTC, LL_RTC_FORMAT_BCD, &RTC_TimeStruct);
RTC_DateStruct.WeekDay = LL_RTC_WEEKDAY_MONDAY;
RTC_DateStruct.Month = LL_RTC_MONTH_FEBRUARY;
RTC_DateStruct.Day = 0x11;
RTC_DateStruct.Year = 0x25;
LL_RTC_DATE_Init(RTC, LL_RTC_FORMAT_BCD, &RTC_DateStruct);
...
}
