2017-03-10 06:57 AM
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, theHAL_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-bug2017-03-10 09:20 AM
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.
2017-03-10 01:30 PM
Not only HSE, but LSE
.2017-03-10 07:20 PM
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.'
2017-03-11 07:55 AM
Can you meanwhile post a download link to CubeMX v4.19? The website hosts a v4.20 link.
Thanks!
2017-03-14 04:09 AM
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.
2017-04-05 07:49 AM
Hi all,
I would inform you that a new patch
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.
2017-04-06 05:21 AM
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!
2017-04-06 08:28 AM
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.