Skip to main content
Isidre Sole
Associate II
September 20, 2017
Solved

STM32CubeMX 4.22.1 STM32L476JGYx SystemClock_Config Bug

  • September 20, 2017
  • 3 replies
  • 1185 views
Posted on September 20, 2017 at 12:35

Hi guys.

I'm working in a STM32L476JGY based project using the board STEVAL-STLCS02V1.

The code generated by the Cube using the default clock configuration 'forgets' initialize the M value of the PLL struct, see original code:

/** System Clock Configuration

*/

void SystemClock_Config(void)

{

RCC_OscInitTypeDef RCC_OscInitStruct;

RCC_ClkInitTypeDef RCC_ClkInitStruct;

RCC_PeriphCLKInitTypeDef PeriphClkInit;

/**Initializes the CPU, AHB and APB busses clocks

*/

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;

RCC_OscInitStruct.MSIState = RCC_MSI_ON;

RCC_OscInitStruct.MSICalibrationValue = 0;

RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;

RCC_OscInitStruct.PLL.PLLN = 40;

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__);

}

...

it's very strange that the call to HAL_RCC_OscConfig returns with a HAL_OK, but later, when the function tries to configure the PPLSAI1 it fails and the system is blocked on the _Error_Handler loop.

I fixed the problem initializing the M value on the PLL adding the following line:

RCC_OscInitStruct.PLL.PLLM = 1; // STM32CubeMX forgets that line.

#steval-stlcs02v1 #stm32l476jgyx #systemclock_config #stm32cubemx-4.22.1
This topic has been closed for replies.
Best answer by Jeanne Joly
Posted on February 06, 2018 at 14:33

Hi

Ramon.Isidre

,

Sorry for my late reply.

Regarding the issue about 'PLLM is no more generated', it was fixed in the CubeMx version 4.23 asmentioned in the Release note of STM32CubeMX

/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fccc%2Fresource%2Ftechnical%2Fdocument%2Frelease_note%2Fb2%2F02%2F4b%2Fe3%2F81%2F32%2F49%2Fc4%2FDM001076pdf%2Ffiles%2FDM001076pdf%2Fjcr%3Acontent%2Ftranslations%2Fen.DM001076pdf

.

You can upgrade with the latest CubeMX release (version4.24).

Best Regards,

Jeanne

3 replies

ST Technical Moderator
October 3, 2017
Posted on October 03, 2017 at 17:49

Hello

isidresole

,

This issue is already

raised internally to CubeMx team

and itwill be fixed in our next release.

Thank you for your contribution.

Best Regards,

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Jeanne Joly
Jeanne JolyBest answer
Associate
February 6, 2018
Posted on February 06, 2018 at 14:33

Hi

Ramon.Isidre

,

Sorry for my late reply.

Regarding the issue about 'PLLM is no more generated', it was fixed in the CubeMx version 4.23 asmentioned in the Release note of STM32CubeMX

/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fccc%2Fresource%2Ftechnical%2Fdocument%2Frelease_note%2Fb2%2F02%2F4b%2Fe3%2F81%2F32%2F49%2Fc4%2FDM001076pdf%2Ffiles%2FDM001076pdf%2Fjcr%3Acontent%2Ftranslations%2Fen.DM001076pdf

.

You can upgrade with the latest CubeMX release (version4.24).

Best Regards,

Jeanne

Isidre Sole
Associate II
February 6, 2018
Posted on February 06, 2018 at 19:05

Great News Jeanne

THanks.