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?
Hello Scott Dev,
You can refer to the reference manual related to your device. It maybe helpful.
how accurate the internal clocks are
You mean, LSI, MSI, HSI?
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.
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.
Retrieving data ...