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?

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.

  • 1
    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? – domen Oct 17 at 7:40
  • 1
    @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. – TripeHound Oct 17 at 9:57

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.

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).

  • 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 – Sascha Oct 17 at 19:28
  • 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. – filo Oct 17 at 19:48

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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