cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 internal oscillator drift over time

npreiser
Visitor

I designed a board using a STM32L031F6P6 about 4 years ago,  (April 2021).   The design has been using the internal oscillator running at 16Mhz perfectly for years.   Then this past summer all of a sudden the RS232 Uart stopped receiving data until I cycle the power on the unit.    The problem has now become more frequent, and the Tx on the uart is also bad, so it appears like the baud rate is bad, which means the internal oscillator is drifting.   My spi bus remains 100% fine btw.   

Has anyone ever seen this with the internal oscillators?,   can they drift over time like this .    I would expect the accuracy of the oscillator to be stable  .

Thanks .  

4 REPLIES 4

Well, it's a very common recommendation not to rely on RC oscillators when UARTs are used.

Did you measure the actual oscillator frequency initially?

Strangely, the datasheet does give drift figures for LSI and MSI - but not HSI.

What's on the other end of the UART link? Maybe that's (also) drifted ...

 


@npreiser wrote:

My spi bus remains 100% fine btw.   


That's to be expected with a synchronous link

npreiser
Visitor

thanks for the reply

I have never did measure oscillator frequency.  (sad).     For the past 4 years, the system has been stable, and the uart has been rock solid.   The behavior I am seeing now  is that on boot it will  be totally fine , but after some random period (days ,  or weeks) it will eventually drift out.   

I am re-doing the design now with an external oscillator(learned my lesson).  

However,  I am still a bit confused on how the internal one can be fine for years and then suddenly start drifting randomly,   is that "normal" for these internal oscillators.    Can they "age"? 

 

Thanks . 

Nick . 

 

> Can they "age"? 

Well, i am not in chip design ....but yes,   they  will "age" !

The point in ds is, how much time+temperature will affect the drift - acceptable or not for certain use cases.

So for sync data links, like SPI, no problem. But any async , like RS232 or USB etc. , will get problems by aging .

Some sooner, some later...

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

Well it's going to be dependent on voltage and temperature. Something else in your circuit or power supply might have changed. Is it unusually hot, cold, humid, dry etc?

Not sure I've seen them drift/age, but they tend to be woefully unstable.

Watch also code settings, and if you're filling structures properly, or starting from clear structures, and if those or the HAL are setting the default tuning/correct factors properly.

RCC_OscInitStruct.MSICalibrationValue=??

RCC_OscInitStruct.HSICalibrationValue=??

Perhaps route/measure internal clocks via PA8/MCO pin?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..