cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F072: What is the best PREDiv for 25 MHz HSE?

Diez.R.
Associate II
Posted on March 30, 2016 at 09:22

Hi all:

I have a board with an STM32F072. The HSE runs at 25 MHz, because I need to supply another chip with that frequency over the MCO output.

What are the best PREDiv etc. settings for this input frequency? On the bigger chips (STM32F1xx, STM32F4xx) there are ''/M'' and ''/N'' prescalers that offer much flexilibity.

On the STM32F072, is it possible to obtain a clean 48 MHz frequency from a 25 MHz input clock? I guess I couldn't use USB then.

Many thanks in advance,

  rdiez

5 REPLIES 5
Posted on March 30, 2016 at 09:33

I don't recall the F1 parts being at all flexable, the 105 and 107 as special accomodations to get to 48 from 25 MHz.

The F2 and F4 have a different and faster PLL/VCO arrangement with a 1-2 MHz comparison frequency.

I'll have to review the F072 docs later to see what is viable there, not a part I'm using.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Diez.R.
Associate II
Posted on March 30, 2016 at 09:54

> [...]

> I'll have to review the F072 docs later to

> see what is viable there, not a part I'm using.

Thanks for the quick answer.

I would be grateful if you could find the time to help here. Otherwise, we may have to redesign the board in order to add more crystals. 8-(

By the way, assuming that a clean 48 MHz is not possible, do you know how to calculate the optimal (highest) number? Constraints are apparently:

25 MHz input

PREDiv: 1 to 16

PLLMul: 2 to 16

Target: 48 MHz

I guess there must be a mathematical algorithm for that, maybe even some online calculator, but I can't find the right name to search for. I could calculate all possibilities, but we are using a number of different CPUs and an flexible calculator would be more comfortable.

Many thanks in advance,

  rdiez

Posted on March 30, 2016 at 11:51

In 'F07x, you can use HSI48 with CRS to feed the USB peripheral while having an independent HSE clock (and outputting it onto MCO if that was what you was aiming for). You can even chose which one of them, or even a HSI as third, or the PLL output as fourth, will be your system clock.

Review the clock tree figure, and the HSI48 chapter, in the RM.

JW
Walid FTITI_O
Senior II
Posted on March 30, 2016 at 12:51

Hi diez.r

For that reason , there is the HSI48 clock signal which is generated from an internal 48 MHz RC oscillator and can be used directly as a system clock or divided and be used as PLL input.

The internal 48MHz RC oscillator is mainly dedicated to provide a high precision clock to the USB peripheral by means of a special Clock Recovery System (CRS) circuitry,

which could use the USB SOF signal or the LSE or an external signal to automatically adjust the oscillator frequency on-fly, in a very small steps. This oscillator can also be

used as a system clock source when the system is in run mode; it will be disabled as soon as the system enters in Stop or Standby mode.

-Hannibal-

Hi all:

I have a board with an STM32F072. The HSE runs at 25 MHz, because I need to supply another chip with that frequency over the MCO output.

What are the best PREDiv etc. settings for this input frequency? On the bigger chips (STM32F1xx, STM32F4xx) there are ''/M'' and ''/N'' prescalers that offer much flexilibity.

On the STM32F072, is it possible to obtain a clean 48 MHz frequency from a 25 MHz input clock? I guess I couldn't use USB then.

Many thanks in advance,

  rdiez

Diez.R.
Associate II
Posted on March 30, 2016 at 14:01

Thanks for all the answers.

I have an STM32F072 and a kind of Ethernet chip that needs 25 MHz, so I thought a single crystal could supply both (first the CPU, then the Ethernet chip over the CPU MCO pin). I have read that Ethernet chips are very sensitive to clock inaccuracies, therefore I chose a 25 MHz crystal instead of using the CPU PLL to ramp up a 8 MHz clock. But may the PLL is accurate enough for that purpose.

The trouble is, I didn't realise that the STM32F072 lacks the clock flexibility that for example the STM32F4 family has, so I cannot run the CPU at its maximum 48 MHz if the HSE runs at 25 MHz.

The HSI48 is interesting. I guess I could use it to run the CPU at its maximum 48 MHz. I hope the HSI48's documented 3% inaccuracy falls within the CPU's clock tolerance region.

A 3% inaccuracy is normally rather high. This means, for example, that the systick clock will drift away more quickly than usual.

I could try to use HSI48's Clock Recovery System with the 25 MHz HSE as a reference. I would have to look at the documentation to see if that is possible and easy enough to implement. Unfortunately, my board has no LSE.

I am a little worried about the HSI48 CRS for USB purposes. Say that you set it to synchronise with the USB partner (USB SOF packet reception). If there is no partner, there is no sync. But let's say that the partner uses the same sync method (has no accurate crystal either), then both of them could happily drift away, couldn't they? In any way, I wonder how you would market such a USB device: ''This is a cheap USB implementation that needs a proper USB implementation as partner''. 8-)

The ideal scenario would be one single crystal that could supply an accurate 25 MHz clock for Ethernet purposes and an accurate 48 MHz for USB and CPU purposes, whether there is a connected USB partner or not, but I guess that's just not possible with the STM32F072, is it?