Author Topic: Which frequency crystal/oscillator for a STM32F microcontroller  (Read 10955 times)

0 Members and 1 Guest are viewing this topic.

Online KjeltTopic starter

  • Super Contributor
  • ***
  • Posts: 6626
  • Country: nl
Hi I was just wondering since in the evaluation boards of ST I see a lot of different frequency oscillators, like on the F10x devices typ. 8MHz,
on the F2xx devices typ. 16 or even 25MHz.
Now looking in the ref manuals the F1xx HSE osc. input can have any frequency between 4-16MHz and the F2xx any frequency between 4-26MHz.

Since with the pll and clockdevider registers you can almost choose any clock frequency from either oscillators, is there any particular other reason you choose a certain frequency for the oscillator?
« Last Edit: August 26, 2014, 08:41:31 am by Kjelt »
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: Which frequency crystal/oscillator for a STM32F microcontroller
« Reply #1 on: August 26, 2014, 07:40:16 am »
Whenever I make my own boards, I just use a standard 8MHz crystal oscillator as these are easy to get a hold of and work with 18pF capacitors (for my PCB's anyway). The STM32F0 discovery board doesn't even have an on board crystal (for the actual microcontroller that you program) as this processor can either use the HSI clock or use the external clock derived from the STLink microcontroller.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Which frequency crystal/oscillator for a STM32F microcontroller
« Reply #2 on: August 26, 2014, 10:30:46 am »
Not specific to STM32F chips but generally the datasheet specififies the valid frequency range - your crystal would have to fit into that range.

From there, I usually pick the lowest frequency that with the PLL can hit the highest operating frequency. Say your chip can run at 72Mhz max. With a PLL multiplier from 2x - 16x. I would pick 8Mhz crystal (8Mhz x 9 = 72Mhz). This approach allows the widest range of possible  frequencies.

After that, you may need to refine it, for example if you are running a uart; or if you require a particular master clock out frequency, etc. Or due to sourcing: 4/8/16/24Mhz crystals are the most common ones. Or if you are running USB.
================================
https://dannyelectronics.wordpress.com/
 

Online KjeltTopic starter

  • Super Contributor
  • ***
  • Posts: 6626
  • Country: nl
Re: Which frequency crystal/oscillator for a STM32F microcontroller
« Reply #3 on: August 26, 2014, 12:26:38 pm »
So there are no EMC or other consequences why you should pick the lowest or highest frequency for the crystal/oscillator?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Which frequency crystal/oscillator for a STM32F microcontroller
« Reply #4 on: August 26, 2014, 12:53:39 pm »
It can be part of the "refine" process. But it has rarely made it to my priority list - I have used clocks in the 200-400Mhz range without problems.

================================
https://dannyelectronics.wordpress.com/
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Which frequency crystal/oscillator for a STM32F microcontroller
« Reply #5 on: August 27, 2014, 12:18:32 am »
So there are no EMC or other consequences why you should pick the lowest or highest frequency for the crystal/oscillator?
8MHz is fine for most things. 16MHz crystals are often smaller in size, if that's interesting. When you're going to use USB, make sure you can generate a 48MHz clock via the PLL. They're pretty flexible, so it won't be a problem with any frequency that's a multiple of 8 (or 12) MHz. Also, make sure your crystal's load capacitance is consistent with what the mcu can handle.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17929
  • Country: us
  • DavidH
Re: Which frequency crystal/oscillator for a STM32F microcontroller
« Reply #6 on: August 27, 2014, 04:26:37 pm »
In some applications you may not want to use the internal PLL because of startup time, power draw, or excessive phase noise.  Another reason to select a specific external crystal is if the external clock frequency will be used to drive other circuits.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf