Skip to main content
Graduate
January 20, 2025
Solved

stm32L496 error clock offset

  • January 20, 2025
  • 3 replies
  • 735 views

Good morning community,

I am using the STM32L496QGI6 for a certain application using the uart to send and receive messages, in this case it always gives me symbols even with the baudrate correctly configured, I have checked the clock configuration and it is correct for 80Mhz but when checking by means of a 70ms pulse on any pin it tends to have a phase shift of almost 10%, the SYS has been configured with the TIM3, what is the cause of this phase shift, how can I correct it? I have tested the same configuration with an STM32L476 and everything works correctly.

 

CamiloRJ9_4-1737385379622.png

CamiloRJ9_0-1737385338471.png

    This topic has been closed for replies.
    Best answer by CamiloRJ9

    @AScha.3 , @Andrew Neil 

    Thank you very much for the answers, they were very useful. I checked the configuration. A new project was initialized from scratch to see what was affecting it. I reconfigured the clock but with HSI and within the RCC configuration the HSI calibration parameter at 64 worked correctly. It was 16 before, but now I have some doubts about this value with respect to what is selected, how does it affect the offset? and how does it work internally?

    CamiloRJ9_0-1737486449154.png

     

    3 replies

    Super User
    January 20, 2025

    You're running from internal RC oscillators - that's never a good thing with UART comms:

    https://community.st.com/t5/stm32-mcus-products/stm32-internal-oscillator-drift-over-time/m-p/762198/highlight/true#M270687

     

    Did you check the actual baud rate on the wire?

     

    Super User
    January 20, 2025

    Hi,

    you cannot use an RC oscillator (HSI) and expect exact timing.

    Use HSE + crystal , then you get correct frequency.

    Or to check: put out the clock on MCO and check with a DSO  - then you know,

    is the hsi clock or your program the "problem".

    CamiloRJ9AuthorAnswer
    Graduate
    January 21, 2025

    @AScha.3 , @Andrew Neil 

    Thank you very much for the answers, they were very useful. I checked the configuration. A new project was initialized from scratch to see what was affecting it. I reconfigured the clock but with HSI and within the RCC configuration the HSI calibration parameter at 64 worked correctly. It was 16 before, but now I have some doubts about this value with respect to what is selected, how does it affect the offset? and how does it work internally?

    CamiloRJ9_0-1737486449154.png

     

    Super User
    January 21, 2025

    Why are you worrying about this "offset"?

    For UART comms, it's just the frequency that matters.