cancel
Showing results for 
Search instead for 
Did you mean: 

On what factors the operating frequency of microcontroller (Crystal oscillator) is decided in any application? Generally development board suggest the frequency of 8 MHz or 16 MHz. Please help.

ketan v
Associate

What are the frequency that stm32 microcontroller peripherals work on ?

2 REPLIES 2
Danish1
Lead II

stm32 microcontrollers are complicated devices. Some subsections can only operate within certain frequency ranges, and others (e.g. USB) only at specific clock frequencies. All this is documented within the data-sheet and reference manual for your chosen part.

Higher frequency means higher instantaneous power consumption but calculations can be performed more quickly.

For best accuracy the clock can be derived from an external crystal resonator. Physical limitations mean that crystals are only cheap/reliable within certain frequency ranges (1 MHz to 16 MHz, also 32768 Hz for very low-power operation).

For lowest-cost applications where this accuracy is unnecessary, ST have also put in an internal oscillator, typically 8 or 16 MHz.

I tend to use an external crystal that has the same frequency as the internal oscillator (be it 8 or 16 MHz).

But generally we want to run the processor much faster than this, so inside the microcontroller is an oscillator with a phase-locked-loop, which essentially means that it can run with the stability of your crystal resonator but at a higher frequency e.g. 72 MHz or even 400 MHz depending on the part.

Hope this helps,

Danish

S.Ma
Principal

Brute force being the highest possible frequency, usually this would be the default for most provided examples. The source of the clock will determine its tolerances. These tolerances have impact such as high baudrate on USARTs, USB device and higher precision for USB Host. The absolute value of the frequency will determine the response speed and latency of interrupts. Some interrupts must fire within a max delay, hence a minimum frequency will be needed. Last, some peripherals have limited clock prescaling, look especially with SPI. Master max frequency could be core clock div 2. Max SPI Slave frequency could be clock div 4. SPI prescaler has div 1, div 2, div 4, div 8: This should be checked before finalizing SYSCLK for example. If you want 20MHz SPI slave and USB, you will need at least 80 MHz and 48 MHz for USB.

Last, if battery and low power is important, then you'll want to find the lowest working clock frequency. For this particular case, in some STM32 the peripherals clock can be independent of the core frequency, it is possible to create a speed "gear box" where the core frequency can change by a power of 2 by SW. It brings more degrees of freedom to tackles timing and power constrains, etc..