Question
STM32CubeMX 4.25 STM32L433RCTx SystemClock_Config Bug PLLM
Posted on April 11, 2018 at 11:48
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:
#system_clock #cubemx-v4.25.0 #systemclock_config #stm32l433rctx