2017-05-10 06:29 AM
Hi all,
we are working on our second custom boardfor our product, using STM32F446RET6 MCU, 8MHz HSE and 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�?�?
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 */
__HAL_FLASH_SET_LATENCY(FLatency);
/* 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)
{
return HAL_ERROR;
}
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
Looking at the
https://paste.ofcode.org/336un8t6JR3cwVmvsdeKUux
I see aUNDEFINSTR error, with the PC register loaded with the instruction on line 2 (above).
Do you have any idea on what can be happening?
EDIT
https://www.diffchecker.com/QVY6Ocfg
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
-Power source stays constant at 3.4V - if the FPU or clock speed werethe problem shouldn't it be happening in both boards? Both crystals work at the expected frequency.2017-05-10 06:36 AM
Your description of the system and problem aren't very enlightening.
2017-05-10 08:42 AM
I posted it first on error, it was incomplete while I was editing it
2017-05-10 08:50 AM
I agree with Clive, not much information to chew on.
Perhaps a power supply issue (PCB or components related) ?
2017-05-10 08:56 AM
An undefined instruction might suggest you are not enabling the FPU properly before using an instruction that stacks state from it.
Check obvious things like the clock speed being set, and the voltage present on VCAP pin(s)
Look at a *disassembly* view, at the instruction specifically that faults, and the CPU registers that instruction is utilizing.
2017-05-11 04:25 AM
The PC of 0x1FFFxxxx suggests you don't have BOOT0 pulled low on the board.