2017-04-05 06:38 AM
STM32CubeMX generated code for STM32F105xC/STM32F107xC inside SystemClock_Config() function never calls
SystemCoreClockUpdate().
Part&sharp1: This bug appears when external crystal resonator in use and HSE_VALUE not equal to 8 MHz, so the system producing code that does not contain SystemCoreClockUpdate(), so this function must be called just after HAL_RCC_ClockConfig() in main.c
Part&sharp2:
SystemCoreClockUpdate() finction in
system_stm32f1xx.c uses uint32_t for pllmull multiplier value, but when multiplier coefficient of 6.5 - is used, thispllmull can't keep fractional number of 13/2, so additional variable is needed or changing pllmul to float. Solution to use fractional number as two intergers - is in attachment.
By using this changes, SysTick does it's job exactly as expected.
#stm32f107xc #stm32f105xc #systick #systemclock_config #bug2017-04-05 07:07 AM
Also inside SystemClock_Config() there is structure initialisation that looks like:
RCC_OscInitStruct.OscillatorType =
RCC_OSCILLATORTYPE_HSI |
RCC_OSCILLATORTYPE_HSE;Which is not ok and HAL_RCC_OscConfig() never returns HAL_OK.
That variable must set just one value, but not both.
Systems been used:
STM32CubeMX version 4.20.0
and STM32CubeF1 Firmware Package V1.4.0
2017-04-05 08:33 AM
Hello,
1- The issue on the RCC config is fixed in the new patch releases CubeMx 4.20.1.
So, please download and update the new version 4.20.1 to resolve this issue.
PS: if you are using an old .ioc project, you should first EDIT the .ioc file and REMOVE this line (remove the RCC.OscillatorType that you don't need)
RCC.OscillatorTypeHSI=RCC_OSCILLATORTYPE_HSI
Then re-generate the project, this will resolve your problem.
Please keep me informed about your updates.
2- About PLLMUL
multiplier,
the issue is on the aPLLMULFactorTable, inside STM32CubeF1 V1.4.0 (stm32f1xx_hal_rcc.c and stm32f1xx_hal_rcc_ex.c) which should be :
const uint8_t aPLLMULFactorTable[14] = {0, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0,
0, 0,
13};instead
const uint8_t aPLLMULFactorTable[12] = {0, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0, 13};
This issue is already reported internally and will be fixed in the coming version.
Thanks
Imen
2017-04-05 08:51 AM
Hi,
Just installed
STM32CubeMX version 4.20.1 and generated project again.
Good news:
Yes, now
RCC_OscInitStruct.OscillatorType - is setted correctly
Bad news: unfortuinaly the main topic's bugs - are still presented:
SystemCoreClockUpdate() is not called after configured clocks and it's
pllmull variable is still uint32_t that is not able to keep fractional number of 6.5x multiplier.