We had an issue with the code generated for RCC on STM32F413RHT6 when the RTC module came into play. RCC was configured to use the LL library but the generated code has some problems.
if(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_2)
/* Wait till HSI is ready */
while(LL_RCC_HSI_IsReady() != 1)
/* Wait till LSE is ready */
while(LL_RCC_LSE_IsReady() != 1)
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, LL_RCC_PLLM_DIV_16, 112, LL_RCC_PLLP_DIV_2);
/* Wait till PLL is ready */
while(LL_RCC_PLL_IsReady() != 1)
/* Wait till System clock is ready */
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
/* SysTick_IRQn interrupt configuration */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),15, 0));
- SystemClock_Config() modifies the PWR::CR::DBP bit but the PWR clock is not activated at this point. As a consequence, the backup domain is not unlocked and then the configuration of the RTC module fails…Our workaround was to call LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); before SystemClock_Config().
- SystemClock_Config() calls LL_RCC_ForceBackupDomainReset() hence resetting all the settings of the RTC. In particular any previously set date or time…
Our workaround was to use HAL instead of LL to generate the code for RCC.