Issue with stm32l433 configuring HSI
Hi,
I have a stm32l433 chip and i'm using the internal RC Oszilator HSI.
My issue was that code generated straigth from cubemx turned the chip to run too fast, my HalTick was like 1.2 Khz instead of 1kHz.
Now i tracked the error down to a bad configuration of the HSI trim registers within the HAL libraries. Followed listed what i've found:
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;This one gets the default value from stm32l433xx.h which says;
#if defined(RCC_ICSCR_HSITRIM_6)
#define RCC_HSICALIBRATION_DEFAULT 0x40U /*!< Default HSI calibration trimming value 64 on devices other than STM32L47x/STM32L48x */
#else
#define RCC_HSICALIBRATION_DEFAULT 0x10U /*!< Default HSI calibration trimming value 16 on STM32L47x/STM32L48x devices */
#endif /* RCC_ICSCR_HSITRIM_6 */Now this RCC_ICSCR_HSITRIM_6 is beeing defined so it takes the 0x40U.
So this checks if HSITRIM is 7 bits wide. which is according datasheet correct:
Now i see the reset value should be 0x40xx 00xx. When i check this register after POR it has a value of 0x10xx00xx. Strange..
So if i now set:
RCC_OscInitStruct.HSICalibrationValue = 0x10;then the chip runs exactly at my desired speed.....
So that says either:
- Datasheet RM0394 and HAL is wrong
or:
- CHIP STM32L433CCU6 has a bug..
Did i miss something?
Cheers
