Closed yn386 closed 1 year ago
Hi @yn386,
Thank you for you contribution. The issue you pointed out is confirmed. Indeed, the HSI value should be 16MHz rather than 8MHz. The proposed fix is thus approved it will be implemented and made available in the frame of a future release.
With regards,
ST Internal Reference: 134336
Hello @yn386 ,
The fix has been implemented and is now available in the frame of the latest STM32CubeL1 package V1.10.4 release. This issue can be closed now. Thank you again for your contribution.
With Regards,
Describe the set-up
Describe the bug SystemCoreClockUpdate() does not work correctly when SYSCLK source is HSI.
If SYSCLK source is HSI and HSI_VALUE is not defined, SystemCoreClockUpdate() cannot update SystemCoreClock correctly.
According to the STM32L1 microcontorollers specification, the HSI value is 16MHz. Also, the comment of SystemCoreClockUpdate() describes that the default HSI_VALUE is 16MHz. https://github.com/STMicroelectronics/STM32CubeL1/blob/5641cb07a1d78d7e9649d056136e513bb273fcca/Drivers/CMSIS/Device/ST/STM32L1xx/Source/Templates/system_stm32l1xx.c#L196-L198 However, default HSI_VALUE is defined as 8MHz at https://github.com/STMicroelectronics/STM32CubeL1/blob/5641cb07a1d78d7e9649d056136e513bb273fcca/Drivers/CMSIS/Device/ST/STM32L1xx/Source/Templates/system_stm32l1xx.c#L69-L72
HSI_VALUE can be adapted by the user appliication, but I think default HSI_VALUE should be 16MHz.
How To Reproduce HSI_VALUE is not defined. To get 32MHz HCLK, I set
After setting these parameters, call SystemCoreClockUpdate(). Global variable 'SystemCoreClock' expected 32MHz, but I got 16MHz.
Additional context I changed default HSI_VALUE as follows.