AnsweredAssumed Answered

STM32CubeMX 4.25 STM32L433RCTx SystemClock_Config Bug PLLM

Question asked by H. K. on Apr 11, 2018
Latest reply on May 3, 2018 by Nawres GHARBI

Hi guys.

I'm working in a STM32L433RCTP based project.

The code generated by the Stm32CubeMX for clock configuration has no value set for the PLL-M prescaler in the  PLL struct, see original code:

----------------------------------

 /**Initializes the CPU, AHB and APB busses clocks 
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLN = 10;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
----------------------------------

I fixed it, by adding the folowing line:
RCC_OscInitStruct.PLL.PLLM = 1;
Even with PLLM prescalers set with different values than 1, CubeMX will forget to add the line.

If I don't add the line, the program freezes at the function call of  HAL_RCC_OscConfig(..).

The bug seems to be occured in a different configuration in the past, too, see:

CubeMx 4.22.1 bug? 

 STM32CubeMX 4.22.1 STM32L476JGYx SystemClock_Config Bug 

Outcomes