You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a bug a division by zero possible given RCC->PLLCFGR is 0. This is possible if there is a hardware fault which sets PLL Configuration register to 0.
__weakuint32_tHAL_RCC_GetSysClockFreq(void)
{
uint32_tpllm=0U, pllvco=0U, pllp=0U;
uint32_tsysclockfreq=0U;
/* Get SYSCLK source -------------------------------------------------------*/switch (RCC->CFGR&RCC_CFGR_SWS)
{
caseRCC_CFGR_SWS_PLL: /* PLL used as system clock source */
{
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLLM) * PLLN SYSCLK = PLL_VCO / PLLP */pllm=RCC->PLLCFGR&RCC_PLLCFGR_PLLM;
if(__HAL_RCC_GET_PLL_OSCSOURCE() !=RCC_PLLSOURCE_HSI)
{
/* HSE used as PLL clock source */pllvco= (uint32_t) ((((uint64_t) HSE_VALUE* ((uint64_t) ((RCC->PLLCFGR&RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)))) / (uint64_t)pllm);
}
returnsysclockfreq;
}
Possible Fixes
Handling the value of pllm by checking it against 0 can be one of the possible fixes.
The text was updated successfully, but these errors were encountered:
There seems to be a bug a division by zero possible given RCC->PLLCFGR is 0. This is possible if there is a hardware fault which sets PLL Configuration register to 0.
Possible Fixes
Handling the value of pllm by checking it against 0 can be one of the possible fixes.
The text was updated successfully, but these errors were encountered: