cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure the STM32F412VET6 clock at 100MHz?

Saredo
Associate III

Hi,

I have created a project with STm32CubeMX for a stm32F412VET6 microcontroller. I have configured the clock at 64MHz, I also have 1 SPI and 10 outputs. The project builds correctly and is running on the target correctly.

Now when just changing the clock frequency to 100 MHz, the projects still builds properly. However, when I launch the code after calling the HAL_GPIO_Init function, it goes in HardFault.

1 ACCEPTED SOLUTION

Accepted Solutions

> in debug it never crashes in the same instruction.

Is this a "known good" board like a Nucleo/Disco, or your own?

If the latter, what is VDD value? Is flash latency adequate to it? Are all VDD/GND pins (including the analog ones) properly connected/soldered? can't this be a power supply/grounding/decoupling problem, or problem with VCAPs?

JW

View solution in original post

5 REPLIES 5

Make sure you have adequate wait states, and that the PLL settings, and HSE_VALUE, reflect the board clock properly.

Get a serial port working, output internal settings as perceived by the device. Map the internal/external clocks to the MCO (PA8) pin and scope them.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

> when I launch the code after calling the HAL_GPIO_Init function, it goes in HardFault.

Single-step in disasm. Does the hardfault occur in one particular instruction? If yes, show. If not, it may be the misconfigured RCC/waitstates as Clive hints above.

JW

PS. Change your username to a normal nick.

Saredo
Associate III

Thanks for your answers.

As advised, I mapped the clock to PA8. On the scope I can see it running at 100 MHz. (I have a flash_latency set to 3)

In debug, it stills get stuck in HAL_GPIO_Init. I had assumed that it was because of my clock configuration as it is the only part of the code have changed.

At 64MHz, everything is running.

I don't understand the source of the problem, as in debug it never crashes in the same instruction.

Ilana

> in debug it never crashes in the same instruction.

Is this a "known good" board like a Nucleo/Disco, or your own?

If the latter, what is VDD value? Is flash latency adequate to it? Are all VDD/GND pins (including the analog ones) properly connected/soldered? can't this be a power supply/grounding/decoupling problem, or problem with VCAPs?

JW

Saredo
Associate III

Hello,

I'm working on my own board.

In fact, I checked my hardware design and it was a problem with VCAPs. By default the microcontroller have Regulator ON. It was missing to capacitors. By adding it it works.

@waclawek.jan Thanks for your help.