AnsweredAssumed Answered

BUG in STM32CubeMX generated code (SystemClock_Config for STM32F105/107)

Question asked by lol.loller on Apr 5, 2017
Latest reply on Apr 5, 2017 by Imen D

STM32CubeMX generated code for STM32F105xC/STM32F107xC inside SystemClock_Config() function never calls SystemCoreClockUpdate().



Part#1: 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#2: SystemCoreClockUpdate() finction in system_stm32f1xx.c uses uint32_t for pllmull multiplier value, but when multiplier coefficient of 6.5 - is used, this pllmull 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.