Erroneous HSI default trim value in datasheet/CubeMX
I found this by mistake.
I posted a problem waking up from Stop Mode 2 via LPUART
https://community.st.com/0D50X00009XkfHjSAJ
.The problem started when I used CubeMX generated code to use 80Mhz system clock instead of the HSI, while HSI stayed the LPUART clock.
The CubeMX generated the following line:
LL_RCC_HSI_SetCalibTrimming(16);
This is consistent with the datasheet that states:
Bits 30:24 HSITRIM[6:0]: HSI16 clock trimming (only HSITRIM[4:0] on STM32L475xx/476xx/486xx
devices)These bits provide an additional user-programmable trimming value that is added to theHSICAL[7:0] bits. It can be programmed to adjust to variations in voltage and temperaturethat influence the frequency of the HSI16.The default value is 16, which, when added to the HSICAL value, should trim the HSI16 to16 MHz ± 1 %.Once I masked this line the code functioned properly (when this line wasn't masked I got frame errors in the LPUART), and looking at HSITRIM I see the actual default value is 0x40.
#stm32l4 #trim #lpuart #hsi