5
\$\begingroup\$

Why do we use an external oscillator for STM32??? Why not just use the microchip oscillator?

I am using STM32F2xx it clocks at 120Mhz

But, an external oscillator of 12Mhz is latch into the microchip, why use the external clock?

\$\endgroup\$
  • 3
    \$\begingroup\$ An external crystal oscillator is by far more accurate than the internal (RC I assume) oscillator. If your project doesn't need accurate timing you can use the internal oscillator. \$\endgroup\$ – Mike Oct 17 '14 at 4:34
  • \$\begingroup\$ There are several type of resonators and oscillators. each have special feature. as @Mike said an external crystal oscillator has more accurate than the internal RC oscillator. \$\endgroup\$ – Roh Oct 17 '14 at 5:33
11
\$\begingroup\$

They are more accurate over a wider temperature range, they have far less jitter (cycle by cycle timing precision) and in general are more accurate to within very good tolerances of the required frequency. If you then are multiplying this reference by many times to get the final clock speed in your processor, any error or inaccuracy of the clock source would be multiplied too, possible giving huge offsets in real vs intended frequencies and larger than acceptable clock jitter during time sensitive things such as high speed synchronous communications or asychronous with timeouts.

External crystals (usually Quartz) or resonators (usually ceramic, have less awesome tolerances but are still better than internal RC oscillators) are quite cheap and can have very small footprints like the Murata Ceralock series ceramic resonators that I often use for my Atmel AVRs and even my Atmel Cortex M3 (to get 64 Mhz from 16 is annoying by the way, when you have to also get 48Mhz for USB!).

As a side note, I found that 12Mhz is a much nicer crystal/resonator frequency for USB (just x4) and for most clock speeds (like, 120Mhz is just x10), and I see it often on ARM based boards reference designs these days.

\$\endgroup\$
  • 2
    \$\begingroup\$ Nicely summed up. Just to add, some manufacturers are selling microcontrollers with on-board oscillators with enough accuracy (or with tricks to auto-calibrate to sufficient accuracy) to support USB. For example, the STM32F0x2 line supports crystalless USB. I haven't looked into cost savings, but it takes three components of most BOMs! \$\endgroup\$ – Scott Seidman Oct 20 '14 at 13:03
  • \$\begingroup\$ Indeed @ScottSeidman do they support crazy high speed mode though? For virtual serial port and 115200 Baud i'm sure they could easily do that onboard \$\endgroup\$ – KyranF Oct 20 '14 at 13:06
  • 1
    \$\begingroup\$ I'm not sure. To the best of my recollection, It uses something about USB comms to tweak out the clock, so I'm fairly sure it will work with any USB protocol, as they claim full functionality for USB2.0 \$\endgroup\$ – Scott Seidman Oct 20 '14 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.