Skip to main content
Visitor II
January 15, 2025
Question

STM32 internal oscillator drift over time

  • January 15, 2025
  • 3 replies
  • 1522 views

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 .  

    This topic has been closed for replies.

    3 replies

    Super User
    January 15, 2025

    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

    npreiserAuthor
    Visitor II
    January 15, 2025

    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 . 

     

    Super User
    January 15, 2025

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

     

    see:

    https://semiengineering.com/what-causes-semiconductor-aging/

     

    Super User
    January 16, 2025

    Some STM32 UARTs have baudrate detection feature. That allows even with imprecise clock to tune to the master baudrate (using some protocol of course, and repeating the detection as needed). 

     

    npreiserAuthor
    Visitor II
    January 16, 2025

    Thank you all for you input. 

    At that time I designed the circuit,  I did not know about not using internal oscillators when using rs232.. now I do :).   

    The board itself is in a garage which sees some temperature swings , but I live in the NW, so not too bad.  I will double check  the supply and see, however all other ic's on the board are fine.   

    Everything is pointing to drift, an maybe I just got lucky and that it has been borderline the entire time,, 

     

    thanks again for all the good info,  working on re-design now with external oscillator..