cancel
Showing results for 
Search instead for 
Did you mean: 

How accurate are the STM32 internal clocks

Scott Dev
Senior
Posted on February 02, 2017 at 18:09

Hi

   I cant seem to find anywhere where it explains how accurate the internal clocks are. I would like to know this before using them for the base clock for the uart, timer etc. Anyone let me know where I can find this information?

Many thanks

Scott

3 REPLIES 3
Imen.D
ST Employee
Posted on February 02, 2017 at 19:16

Hello

devlin.scott

,

You canrefer to thereference manual related to your device. It maybe helpful.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on February 02, 2017 at 19:30

how accurate the internal clocks are

You mean, LSI, MSI, HSI?

You can refer to the reference manual related to your device. It maybe helpful.

Actually, I would refer to the Datasheet, rather than to the Reference Manual, for actual numbers. Note, that these oscillators are influenced not only by manufacturing process variation (compensated at some models by factory-set calibration), but also by temperature and supply voltage. Data on these are also to be found in the Datasheet to given product.

The Reference Manual is good in explaining, whether and how any of these clocks can be user-calibrated.

Count on a few % of frequency error with these oscillators, even with calibration to a good known clock source whenever voltage/temperature changes significantly. Compare this with the tens of ppm achievable with crystal oscillators and similar or better with external oscillators. Your applicaton determines which of these is applicable.

JW

Posted on February 02, 2017 at 20:41

The internal RC clocks in the STM32 are generally pretty poor, and vary erratically. At least the ones I've tested, and I'm not using L0 parts.

Calibrating probably won't help as they depend on process, voltage, temperature, etc. (simple clock insertion/removal to tune the clock best I can tell)

They are quite adequate for USART operation. For CAN and USB I'd be looking to use crystals.

They quote 1% for the HSI RC, but I'm pretty sure that isn't arrived at via multi-order compensation, or extensive over temperature testing and it's not a off by .5% all the time type of clock, but one with a lot of instantaneous variation. If timing is a critical issue for you I'd suggest routing internal clocks via the MCO and evaluating.

Internally TIM21 can be used to benchmark clock sources.

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