cancel
Showing results for 
Search instead for 
Did you mean: 

Why does an STM32 ARM Microcontroller have 2 resonators?

Sashvat
Associate II

Hi guys,

I want to build my own Microcontroller development board from scratch, as I was checking the data sheet for the STM32F103C8T6 and STM32405RGT6 processors, there were 2 crystals specified on the data sheet. But when I look at tutorials online on how to design your own Microcontroller development board, he doesn't use a crystal at all (https://www.youtube.com/watch?v=tgUx0Gm7-RM you can skip to 18:27 to see his schematic).

And when I was watching another video on how to make your own (drone) Flight Controller this guys just uses 1 crystal than the two given on the data sheet (https://www.youtube.com/watch?v=Uu2vGFMq4Zo&list=PLoPtpxJIxgnYnPrOeGHs3rdhhPgNGIYN5&index=5 you can jump to 2:22 to see the schematic he is using.)

I am getting very confused wether I should put 2 crystals, 1, or no crystal on my board. Also, I am a 12th grader who has a passion in electronics and don't know much of the stuff as you know, so please try to make it simple for me to understand.

Thank you

30 REPLIES 30
S.Ma
Principal

Ok, also look at STM32L4 family.

First, at boot, the STM32 boots with internal resonator (HSI = high frequency source internal clock) say 16MHz.

It has some tolerances (percentage) so its precision has limitation in some specifics such as RS232 at high speed, USB, Ethernet.

For such precise clocks, you need 24MHz for USB, 25MHz for Ethernet or 16MHz typically otherwise.

The external clock source in Nucleo board by default comes from on board STLink MCU which sends its buffered clock to the target MCU (cost reduce).

These are HSE (precise external high frequency source).

If the HSE clock fails, the HSI will kick in as backup and the MCU can be let aware.

Now for specific applications you need precise time clock and calendar, this goes to RTC (real time clock).

There is an internal one (LSI) which allows some peripherals or the MCU to run at very low frequency aiming at low power.

But if you implement a meter application, you need very precise clock over time, and consume low power.

For this, you need very precise clock which comes from an external 32768Hz external clock source which is LSI.

On the L4 family, it is possible to regenerate a high frequency from LSE at lower power budget than using external dual crystals.

This is MSI.

So it's application dependent. Power concern, precision concern, cost concern, drift over time concern.

And like in the L4, most peripheral can choose their clock source. Now you have choice and enough degrees of freedom to get a solution for your implementation.

MikeDB
Lead

As it's your own PCB, I would put pads for both crystals (and supporting Cs) but don't load them unless you find you need them for things like USB or audio.

Thank you very much for that simple explanation, just a few doubts, when seeing a STM32 blue pill, a 8MHz crystal is being used, but in the data sheet of the STM32, it says upto clock freq-72MHz, why?

Second, do you think its a safe option to have both crystals on board?

I will be using USB to send and receive data, so are you saying only the 8MHz crystal is enough? and what do you mean by "load them"?

There is a PLL inside the STM which multiplies the 8MHz up to 72 MHz (or lots of other freqs if you prefer)

If you are using USB then the main crystal is essential I think.

By "load them" I mean just because there are pads or holes on a PCB doesn't mean you have to put components on the board. But it's far easier to do so when you discover you need them.

MikeDB
Lead

To be honest, why are you designing your own board ? I had to because nobody does a multiple H7 board but there's so many options for F1 and F4 series on AliExpress which are always cheaper than making your own. I use Blue Pills by the bucketload.

just simply for fun, just to build on my circuit building skills and PCB. And not only that, I plan to make a robot, which I want to use this Microcontroller and make it all from scratch once I am satisfied with my prototype.

Can I also put the 32.768 kHz crystal also when using USB just to be safe?