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):
if(FLatency < (FLASH->ACR & FLASH_ACR_LATENCY)) // HARD FAULT HERE!!!
/* 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 */
if((FLASH->ACR & FLASH_ACR_LATENCY) != FLatency)
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?
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.