cancel
Showing results for 
Search instead for 
Did you mean: 

[BUG] CubeMX v4.20 RCC Initialization Fail with HSE selected

fronders
Senior
Posted on March 10, 2017 at 15:57

Hello! Recent update of CubeMX v4.20 introduced a bug in SystemClock_Config() function which cause HAL_RCC_OscConfig() fail. I am using STM32F103C8T6 chip with SW4STM32 v1.14 under Windows 10.

In previous releases of CubeMX (v4.19 and older), when HSE turned on for Crystal\Ceramic Resonator the following code was generated as part of SystemClock_Config(): 

RCC_OscInitTypeDef RCC_OscInitStruct;

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

*/

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

RCC_OscInitStruct.HSEState = RCC_HSE_ON;

RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;

RCC_OscInitStruct.HSIState = RCC_HSI_ON;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {

    Error_Handler();

}

In v4.20 the same part of code (generated by same .ioc file) looks like this:

RCC_OscInitTypeDef RCC_OscInitStruct;

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

*/

RCC_OscInitStruct.OscillatorType = 

RCC_OSCILLATORTYPE_HSI |

RCC_OSCILLATORTYPE_HSE;

RCC_OscInitStruct.HSEState = RCC_HSE_ON;

RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;

// no HSIState field setting

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {

   

Error_Handler();

}

Notice that

OscillatorType now has both HSI and HSE (which I think is wrong in the first place) a

nd since the field HSIState is never set to RCC_HSI_ON, the 

HAL_RCC_OscConfig() returns HAL_ERROR, the chip then falls into Error_Handler().

Please fix this ASAP, as it is really painful to manually fix SystemClock_Config() every time the project is regenerated.

Thanks!

#bug-stm32cubemx #bug #stm32cube-bug
8 REPLIES 8
Khouloud GARSI
Lead II
Posted on March 10, 2017 at 18:20

Hi

fronders

,

This issue is already

https://community.st.com/0D50X00009XkYY4SAN

and confirmed from our side.

This will be fixed in the next version of CubeMX.

Thanks a lot for your feedback and sorry forany inconvenience this may have caused.

Khouloud.

Dmitrij Rajkov
Associate II
Posted on March 10, 2017 at 22:30

Not only HSE, but LSE

https://community.st.com/0D50X00009XkYI5SAN

.

john doe
Lead
Posted on March 11, 2017 at 04:20

you may wish to push this bug fix into a release before the normal release schedule. this bug is what a person might call a 'show stopper.'

Posted on March 11, 2017 at 15:55

Can you meanwhile post a download link to CubeMX v4.19? The website hosts a v4.20 link.

Thanks!

Posted on March 14, 2017 at 11:09

Hi all,

Sorry for the inconvenience, but our teams are working on it. We 

will keep you posted on the status as soon as possible.

Khouloud.

Khouloud GARSI
Lead II
Posted on April 05, 2017 at 16:49

Hi all,

I would inform you that a new patch

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

is now available on ST website. The issue is fixed.

Thanks a lot for your patience and sorry for any inconvenience this may have caused.

Khouloud.

Posted on April 06, 2017 at 12:21

Thank you Khouloud!! 

I have one more question - why don't you let it download via CubeMX Check Update Manager?

I beleive this is true for all minor updates, including libraries too.. It would be much easier to do so!

Posted on April 06, 2017 at 15:28

Hi Alexander,

This is a synchronization issue between the CubeMX tool and the update of the new version on the web.

The new release takes some additional time to be visible on the CubeMX.

Khouloud.