cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 with a 50.0MHz Oscillator

Evelyn Sabbag
Associate II
Posted on March 20, 2018 at 19:00

I am running an STM32F407 with an ECS-2033-500BN Oscillator (50.0MHz) to accommodate the MCU and the ETH off the same oscillator. The circuit uses a fanout buffer to distribute the clock. Nowhere can I find information on how to configure the STM32F4 system clock with this high of a value (I assume there's a divide by 2 enabled in the bowels of the MCU) and the Clock Configuration tool doesn't help. Any suggestions? And yes, I've looked through the forum and the datasheet and I haven't been able to get the circuit to run.

I know the circuit works because previous FW was developed using NuTTx. I am porting the code to IAR and am stuck at the PLL initialization in the generated file system_stm32f4xx.c at the line: 

/* Wait till the main PLL is ready */

while((RCC->CR & RCC_CR_PLLRDY) == 0)

{

}

Any help would be greatly appreciated.

 
17 REPLIES 17
Posted on March 21, 2018 at 16:17

From the block diagram, either /2 or /20 is possible.

Which block diagram are you talking about?

And, once this is setup, can the HSE be treated as 25MHz in order to set the other parameters? I.e. PLL_N, PLL_Q, PLL_M, etc?

No, treat it simply as 50MHz... As far as PLL is concerned, the simplest way is to take the parameters you had for 25MHz and multiply the predivider (PLL_M) by two.

JW

Posted on March 21, 2018 at 15:56

Surely, 6.21 from the Ref Manual (above) covers it?

6.2.1 HSE clock

The high speed external clock signal (HSE) can be generated from two possible clock sources:

? HSE external crystal/ceramic resonator

? HSE external user clock 

Once you have the HSE signal, it is irrelevant whether it was derived from a crystal or an external oscillator .

See Fig 16:0690X0000060ACQQA2.png
Posted on March 21, 2018 at 16:11

That is for crystals that the STM32 oscillates, you should be able to use TCXO, OCXO type sources directly, using BYPASS mode.

My observation of the L0 is that a 32 MHz TCXO would not flag HSE READY when BYPASS mode was selected, but would if 8 MHz via ST-LINK MCO was used.

On the F4 you must use a PLL divider that gets the comparison frequency within 1 to 2 MHz, and the VCO not exceeding something like 432 MHz. The VCO is a rapid pulse generator, ie not 50/50 square wave, and thus you always need to divide this by 2 (or more as a power of 2) to get the 50/50 cycles the core expects.

The F4 has fHSE of 50 MHz, shouldn't be a problem, but would need to review the signal presented at the pin. ie is it clean, rail-to-rail, ringing, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 21, 2018 at 16:19

My observation of the L0 is that a 32 MHz TCXO would not flag HSE READY when BYPASS mode was selected, but would if 8 MHz via ST-LINK MCO was used.

I'd lôve to hear ST's explanation for this.

JW

Posted on March 21, 2018 at 16:19

The clocking works like mechanical gears, it is not unduly complicated, and the relationships and limitations/expectations are in the manuals. A spreadsheet is somewhat overkill for the complexity of the math and ratios.

I don't like ST's approach to setting up the clocks, for the F4 I have a solver that picks the CPU and BUS clocks dynamically, and based on the model it is running on, along with the flash wait states.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 21, 2018 at 16:21

Sounds like an L4 part

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 21, 2018 at 16:29

I've flagged it as an issue before, but not seen a confirmation or response. There is a thread on the Murata LoRa module where I discuss my observation. I moved on, not a battle I'm looking to fight.

As I recall the L1 does weird stuff too. The L152-DISCO would run at 4 MHz* or 8 MHz from the ST-LINK clock depending if BYPASS was used or not. ST doesn't consistently use BYPASS in their code examples either.

* M

ight have been 16 MHz, bit foggy on details, but was critical that BYPASS was used.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Bill Dempsey
Senior
Posted on March 21, 2018 at 17:38

For some reason I don't see anyone mentioning the obvious - STMCube clock manager.  You can set 50MHz and then tweak away at the internal dividers  This is an example.  It can produce the necessary clock setup code only if that's what you want.

0690X0000060ACVQA2.png