cancel
Showing results for 
Search instead for 
Did you mean: 

F401RET6 - unstable at 84MHz, works fine with 48MHz

MSchy
Associate

Hi,

I am trying to setup clock from HSE on a F401RET6, when I setup 48MHz it works fine, but when I try 84Mhz after few steps when clock is set the CPU makes werid things (the PC counter stops increment or goes to a strange value).

I am using libopencm3 default presets for 84MHz https://github.com/libopencm3/libopencm3/blob/master/lib/stm32/f4/rcc.c

but I already tried changing flash delay, power mode and pll options with no luck.

Any idea what I am doing wrong? Can this be a hardware problem? I am using a custom PCB but I don't think it is since it works perfectly fine with 48MHz

3 REPLIES 3
Kraal
Senior III

Hi,

First question is: what is the value of the HSE crystal you are using ?

Second question is: did you reflect the actual HSE value to the one in the library ? I'm not used to libopencm3, but in the ST lib there is a define for the HSE_VALUE. Usually it is 8 or 25 MHz. Because if this define is not correct maybe your code is trying to clock the system at a value higher than 84 MHz. Last question: Have you measured the actual system clock (through the MCO pin) ?

MSchy
Associate

I use 8MHz crystal and yes I use the settings for 8MHz in libopencm3.

I checked it the frequency is right by toggling a port in systick and at 48MHz settings it is bang on (systick counter with should give me 100ms perid gives it in real life).

And I have verified libopencm3 settings with CubeMX clock configuration and they same to be fine.

I will try later testing the actual system clock with MCO

Flash latency is set properly?

> Can this be a hardware problem?

Yes - insufficient power supply, incorrect VCAPs, incorrect decoupling, incorrect grounding, not all VSS(A)/VDD(A) pins connected, bad solder joints, all this can result in "unstability" worsening with increasing operational frequency.

Try your settings on a known-good board such as a Nucleo.

JW