AnsweredAssumed Answered

Problems with custom board at FLASH->ACR access

Question asked by nunes.ricardo on May 10, 2017
Latest reply on May 11, 2017 by Clive One

Hi all,

we are working on our second custom board for our product, using STM32F446RET6 MCU, 8MHz HSE and 32.746Hz LSE external crystals. From the first board to this one the only difference it's that all needed chips are integrated in one PCB, instead of having 3 PCBs connected with wires in the first version.


Debugging the first board is fast and works. On the second one it takes 20-30 seconds to stop in the main breakpoint or just fails silently. When it runs, it triggers a hard fault on this instruction (line 2):


// stm32f4xx_hal_rcc.c:HAL_RCC_ClockConfig
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */

/* Check that the new number of wait states is taken into account to access the Flash
memory by reading the FLASH_ACR register */

return HAL_ERROR;


Looking at the hard fault handler  I see a UNDEFINSTR error, with the PC register loaded with the instruction on line 2 (above).

Do you have any idea on what can be happening?




Here's the diff of the OpenOCD output when using the newest board (on the left) and the oldest one (on the right). Shouldn't the line 51 (below) be the same for the same .elf file? If it should, what can be causing this? 

xPSR: 0x01000000 pc: 0x1fff503a msp: 0x20002af8

AvaTar - Power source stays constant at 3.4V

Clive One - if the FPU or clock speed were the problem shouldn't it be happening in both boards? Both crystals work at the expected frequency.