Electronic – When should one use an external crystal for this MCU given that the internal oscillator is much faster

crystalmicrocontrollerstm32stm32f0

I am looking at this MCU and was wondering if it makes sense to use an external crystal.

Extracted from the datasheet pg1,

*Clock management
4 to 32 MHz crystal oscillator
– 32 kHz oscillator for RTC with calibration
– Internal 8 MHz RC with x6 PLL option
– Internal 40 kHz RC oscillator

Internal 48 MHz oscillator with automatic trimming based on ext. synchronization*

The internal oscillator can be up to 48Mhz. The external crystal is between 4 – 32 Mhz. Why would one use an external crystal when the internal one is faster than 48Mhz given that external crystal costs money and occupies space? When should one use an external crystal?

Best Answer

The internal oscillator is much less stable than an external crystal oscillator.

If I'm reading the datasheet correctly, the internal 48 MHz oscillator is only factory calibrated to within 2.9% of the specified frequency - not even good enough for RS-232. There are ways to synchronize it to an external clock, I think it's designed to be used in a USB device situation where you can lock the PLL to the USB bitstream.

An external crystal is typically accurate to around 20 ppm, parts-per-million. That's 0.002% from the specified frequency. If you need even better, there are even temperature compensated, ovenized crystal oscillators.

Additionally, you may want an exact clock speed at a different frequency, typically for communication with a device or master over an asynchronous communications channel. For this you might need an oscillator at for example 29491200 Hz (115200*256).