Skip to main content
Saredo
Associate III
December 9, 2019
Solved

How to configure the STM32F412VET6 clock at 100MHz?

  • December 9, 2019
  • 5 replies
  • 1758 views

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.

This topic has been closed for replies.
Best answer by waclawek.jan

> 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

5 replies

Tesla DeLorean
Guru
December 9, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
waclawek.jan
Super User
December 9, 2019

> 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
SaredoAuthor
Associate III
December 9, 2019

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

waclawek.jan
waclawek.janBest answer
Super User
December 9, 2019

> 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
SaredoAuthor
Associate III
December 10, 2019

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.