1
\$\begingroup\$

Everybody talking about that HSE (External crystall) is much better than internal RC-oscillator in a STM32 microcontroller. But how much better is it and how?

  • Is the ADC more accurate?
  • Are the timers more accurate?
  • Does the controller stand against more noise?
  • Will the ADC be more correct?

According to STM32F373CC, the accuracy of the internal RC-oscillator is -1% to 1% at 25C.

I don't know if that is good. If I measured at 100C and got 1% error. I think that is good.

enter image description here

\$\endgroup\$
2
  • 6
    \$\begingroup\$ Would you be happy if your watch gained or lost 800 or 900 seconds a day? That’s +/-1%. \$\endgroup\$ Feb 24 '21 at 23:37
  • \$\begingroup\$ @SpehroPefhany I would not care because I'm not using a RTC. \$\endgroup\$
    – MrYui
    Feb 25 '21 at 17:22
4
\$\begingroup\$

If the accuracy of the internal oscillator is adequate for your application, then by all means use it. It saves a bit of cost and no board space is used by the parts needed for an external oscillator.

But if you need accurate timing, then a crystal is the way to go.

It's entirely up to you, as the designer, to determine what your application needs. For some applications +/- 1% is way better than needed. But for some, like timekeeping for example, it's way too inaccurate.

Is the ADC more accurate?

No, the ADC uses the clock to drive its conversion but its accuracy is not affected.

Is the timers more accurate?

Yes, and this is the biggest improvement. The internal timers can be no more accurate than the time standard that drives them. So if you need accurate timing, you will need to use a crystal oscillator.

Does the controller stand against more noise?

No.

Will the ADC be more correct?

I'm not sure how this question differs from the first one.

\$\endgroup\$
1
  • \$\begingroup\$ What I'm going to do is measure with an encoder and measure with capture input. \$\endgroup\$
    – MrYui
    Feb 25 '21 at 17:26
3
\$\begingroup\$

Precise timing is especially important when using asynchronous communication modules. USART, CAN Bus and USB are the main examples. USART may work with HSI when using low baud rates, but CAN Bus and USB are more sensitive to clock deviations. You can't establish a reliable full-speed USB connection without HSE, unless your STM32 model supports automatic clock tuning based on start-of-frame tokens (some models support it, others don't). And HSE is a must when using high-speed USB.

Timing is less critical when using synchronous communications, like SPI or I2C. HSI should be sufficient for them.

ADC accuracy is not affected by clock speed, but conversion time is affected. HSI probably won't cause any problems for most applications. But there may be some applications where the exact timing of the sampling is important.

For time keeping applications, you definitely need a crystal or some other precise clock source. You can't have a RTC running on HSI or LSI and expect good results. Some applications which are connected to power mains can measure the well known frequency of the mains line and self calibrate their LSI.

Hardware timer accuracy is of course affected by the clock source. The importance of this depends on the application where you use timers. You probably don't need highly accurate PWM frequency to drive a motor for example.

\$\endgroup\$
1
  • \$\begingroup\$ What I'm going to do is measure with an encoder and measure with capture input. \$\endgroup\$
    – MrYui
    Feb 25 '21 at 17:26

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.