7
\$\begingroup\$

I am a beginner with respect to microcontrollers, so I just want to ask is there two option for choosing the frequency of the microcontroller: to be internal or external?

If there is internal frequency available in the controller, then we don't need to use external crystal oscillator?

\$\endgroup\$
1

3 Answers 3

13
\$\begingroup\$

It depends on what you want to use the processor for, the manufacturer, etc. RC internal oscillators are "only" good for 1-2% accuracy, there are some processors that have tuning adjustment registers that allow you to shift the frequency, so with the right software/calibration, etc. you can get better results.

For (asynchronous) serial port type communications, the RC inaccuracy can become critical at high baud speeds (generally 230kbps and above, depending on processor and baud rate clock flexibility)

With RC oscillators you typically get 1 or 2 frequencies unless the MCU offers PLL capabilities in which case there can be a wide range. This can be used to advantage to dynamically scale the clock speed for battery powered situations where you can't go to 'sleep' due to complicated monitoring situations, but don't have to be running flat-out.

A crystal can get you any frequency you would want within the MCU operating limits, however you need to verify that the loading is correct so that the oscillator starts up correctly and is accurate and stable over time and temperature.

The RC internal oscillator is generally guaranteed to work by the manufacturer with no hardware design issues.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Good answer, but I'm not sure about "RC inaccuracy can become critical at high baud speeds". Why would that be the case? Because of more limited divisor selection for baudrate, or am I missing something? \$\endgroup\$
    – domen
    Commented Oct 17, 2018 at 7:40
  • 1
    \$\begingroup\$ @domen Because what you think is a nominal 230kbps bit-stream might actually be a 235kbps stream (due to inaccuracy in the RC oscillator) and possibly outside the tolerances of the serial line. \$\endgroup\$
    – TripeHound
    Commented Oct 17, 2018 at 9:57
8
\$\begingroup\$

Main difference is that the internal oscillator is usually a RC type oscillator which is not very accurate. External oscillators can be of type quartz crystal which are far more accurate.

\$\endgroup\$
5
\$\begingroup\$

Most practical differences I have encountered:

  1. Frequency stability (especially across different temperatures). It depends on your application if you need a very stable clock or not. I had issues once using an ATmega8 running from the internal oscillator with an UART that lost sync below zero. For VGA a crystal is a must.

  2. Power consumption - internal oscillators usually will be more power efficient than external crystals

  3. Available frequencies. For example to get ideal 115200 baud UART timing on an ATmega8 you will need a clock with an "oddball" frequency of 7.3728 MHz, while the closest frequency the internal clock can only deliver 8 Mhz (so some bauds will not be available).

Depending on the exact MCU you can also get great clock stability if you use it as an USB device. The internal oscillator can lock on to the clock signal from the USB host (that is crystal-stabilized).

\$\endgroup\$
2
  • \$\begingroup\$ i could also imagine that you want to do something synchronized between different micro controllers on one board which may be easier if you use an external clock \$\endgroup\$
    – Sascha
    Commented Oct 17, 2018 at 19:28
  • 1
    \$\begingroup\$ It depends. You can make one of them a master (eg. SPI) and the clock speed will not matter. If two MCUs have identical but separate clocks then they will NEVER be synchronized. Some MCUs can output their clocks on pins, so the internal clock of MCU A could be connected to a pin and then fed as external clock to MCU B - then both can be synchronized, even if the clock source is not perfectly stable. \$\endgroup\$
    – filo
    Commented Oct 17, 2018 at 19:48

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