2019-12-09 06:32 AM
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.
Solved! Go to Solution.
2019-12-09 08:13 AM
> 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
2019-12-09 06:41 AM
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.
2019-12-09 06:51 AM
> 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.
2019-12-09 07:23 AM
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
2019-12-09 08:13 AM
> 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
2019-12-10 03:15 AM
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.