AnsweredAssumed Answered

Hard fault with no obvious reason why

Question asked by kikugawa.sho on Aug 3, 2011
Latest reply on Aug 4, 2011 by kikugawa.sho
I'm running into a hard fault situation and I'm not sure why this is happening.

From what I'm seeing in the fault status registers I'm getting...

Usage fault status: INVSTATE is set
Hard fault status : FORCED is set
Debug fault status: EXTERNAL and VCATCH are set

At the time of the fault, the only register that looks odd is my link register (0xFFFFFFF9).

This happens in my code when after I'm sending off some bytes over a USART, if that helps anything.

If it helps too, my memory consumption is 22.7KB/23.0KB FLASH and 2.5/10KB for SRAM. Target is STM32F103R6H6. If you're wondering about the FLASH size, I'm using a custom memory map.

EDIT:
This is a snippet of the disassembly that right after executing the last line, the MCU goes to a hard fault state:

    F1070708    add.w r7, r7, #8
    46BD        mov sp, r7
    BD80        pop {r7, pc}

r7 before the first line of code is executed is 0x20000754

Outcomes