Skip to main content
Clonimus74
Senior II
Feb 11, 2018 12:59 PM UTC
Question

Erroneous HSI default trim value in datasheet/CubeMX

Posted on February 11, 2018 at 13:59

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 the

HSICAL[7:0] bits. It can be programmed to adjust to variations in voltage and temperature

that influence the frequency of the HSI16.

The default value is 16, which, when added to the HSICAL value, should trim the HSI16 to

16 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.

0690X00000609UfQAI.png

#stm32l4 #trim #lpuart #hsi
This topic has been closed for replies.

5 replies

ST Technical Moderator
Feb 13, 2018 5:50 PM UTC
Posted on February 13, 2018 at 18:50

Hello

Ofri.Igal

,

I checked that RCC_HSICALIBRATION_DEFAULT value is correct in the STM32CubeL4 with the default value 0x

I already raised this issue internally to correct

the reference manual with the number of bits containing HSITRIM[6:0] for the

default value set to 0x

Best Regards

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Clonimus74
Senior II
Feb 14, 2018 10:02 AM UTC
Posted on February 14, 2018 at 10:02

I started a new project using CubeMX Version 4.24.0

The project was for STM32L476QE, the default value is still 16.

0690X00000609jYQAQ.png
ST Technical Moderator
Feb 14, 2018 10:15 AM UTC
Posted on February 14, 2018 at 10:15

Hello

Ofri.Igal

,

You are right, I checked that

the default value is not correct

with

CubeMX Version 4.0 and

I raised this internally to CubeMx team for fix.

Thank you for highlighting this issue, and Sorry for the inconvenience it may bring.

Best Regards,

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks