Skip to main content
Graduate II
August 6, 2024
Question

SMT32F767 HSI Clock Calibration

  • August 6, 2024
  • 3 replies
  • 2317 views

Hi,

I am having uart baudrate problems while HSI clock as uart source clock. No problem with PCLK as source with the same uart.

 

In Cube IDE (V1.16.0) and F7 software package (V.17.2), I get different values for HSI_CALIBRATION:

Ide gets as 0x10 while register (RCC_CR) has 0x68 as HSI_CALIBRATION. The register also has 0x10 for HSI Trim value, which made me confused:

 

TKana1_0-1722926090116.png

Any pointers which value to use for calibration?

Thanks,

Tim

 

 

    This topic has been closed for replies.

    3 replies

    Super User
    August 6, 2024

    Hi,

    why you want use HSI , if you anyway have HSE -> PLL ... ?

    HSI is not suitable for anything that needs a constant clock like CAN, UART, USB... .

    So better use clock HSE /PLL to avoid timing problems.

     

     

    TKana.1Author
    Graduate II
    August 6, 2024

    Need low bps (1200) for uart and high clock rate (100MHz) for others. cant go down to 1200 bps with 100MHz

    Tim

    Super User
    August 6, 2024

    But you could choose other source, here at 48M (anyway for USB needed) or LSE for 1200 baud:

    AScha3_0-1722931201085.png

     

    Super User
    August 6, 2024

    HSITRIM = 0x10 is the default value, and is as expected. No issues there.

    HSICAL gets initialized at startup using calibration values loaded during production.

     

    If you want to trim the HSI, HSITRIM is the register to change. HSICAL is read-only.

     

    TDK_0-1722945515806.png

     

    TKana.1Author
    Graduate II
    August 6, 2024

    So HSI_CAL has 32 config ( five bytes  - HSITRIM) table then. Thanks

    Tim

     

    Technical Moderator
    August 6, 2024

    Hi @TKana.1 

    You can measure the output frequency using an oscilloscope or logic analyze with MCO. Then, you can compare this frequency with the expected HSI frequency to determine if any trimming is needed.

    After any reset, trim value is set to 16. Increasing this value by 0x01, increase the period of the oscillator by approximately 0.3% on STM32. AN5067 should explain the calibration principles.