2018-04-03 03:27 AM
Hi,
I have Nuckeo-L452RE with STM32L452RE uC on board.
This uC max speed is 80MHz.
But after enabling MCO on pin PA8 in STM32CubeMX and generating the code to Atollic, I could see wrong SYSCLK frequencies.
The reason of this behavior is CubeMX generates wrong content of SystemClock_Config function:
/**Initializes the CPU, AHB and APB busses clocks
*/ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = 16; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;RCC_OscInitStruct.PLL.PLLN = 20; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7; RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV4;//...
It works fine after changing it to:
/**Initializes the CPU, AHB and APB busses clocks
*/ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = 64; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; RCC_OscInitStruct.PLL.PLLM = 1; RCC_OscInitStruct.PLL.PLLN = 20; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7; RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV4;Best regards,
Mateusz
#tipsandtricks2018-04-04 06:56 AM
Hello
Kaskow.Mateusz
,We confirmthe missing of
PLLM parameter
in the generation
content ofSystemClock_Config functionfor STM32L4 us
ing
CubeMX
version 4.25
.T
hisCubeMX bug passed internally to CubeMx team for fix in the coming release.Sorry for such inconvenience that it may bring.
Best Regards,
Imen
2018-04-05 12:44 AM
Thanks for confirmation.
I'm moving from SPL library to Cube and learning it, so it took me a while to figure that it is CubeMX issue.
But on the other hand it is nice, that this forum is living and helpful.
Best regards,
Mateusz