cancel
Showing results for 
Search instead for 
Did you mean: 

stm32L496 error clock offset

CamiloRJ9
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
CamiloRJ9
Associate II

@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

 

View solution in original post

4 REPLIES 4

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?

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
AScha.3
Chief III

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

If you feel a post has answered your question, please click "Accept as Solution".
CamiloRJ9
Associate II

@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

 

Why are you worrying about this "offset"?

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

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.