4 years ago.

RTC accuracy with the NUCLEO-F042K6, external xtal


I am making a Numitron clock using a STM32F042 microcontroller. I use the time library ( https://developer.mbed.org/handbook/Time ) and the clock works like it should. Apart from one issue, the accuracy is crap, the clock is 5 minutes off per day, unusable in my opinion.

The reason for this is simple, the intertal RC oscillator has an accuracy of about 1%, so, as I made my own PCB for it I added an external 8Mhz clock. My question is, how do I make sure that the microcontroller uses the external oscillator instead of the internal one? And does the time library use the RTC inside of the STM or does it keep track of time in a different way?

Best regards,


1 Answer

4 years ago.

It uses the RTC. But it won't use the 8MHz crystal. If you want a more accurate time you will need to add a 32kHz crystal at the correct pins.