This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to exit UsageFaultHandler()

Hi,

I'm using cortex-m7,

  • set Configuration Control Register (0xE000ED14) bit[4]  DIV_0_TRP = 1
  • also set System Handler Control and State Register (0xE000ED24) bit [18] USGFAULTENA = 1

Then with following assembly code

__asm(
"push {r0, r1} \t\n"
"mov r0, #0x0 \t\n"
"mov r1, #0x10 \t\n"
"udiv r1, r1, r0 \t\n"
"pop {r0, r1}"
);

It can enter UsageFaultHandler successfully. 

In UsageFaultHandler(), I tried to read and clear the fault status register(0xE000ED28)

    int reg_val;

    reg_val = *REG_FSR;
    printf("REG_FSR = %0x\n", reg_val);

    *REG_FSR = reg_val;

    reg_val = *REG_FSR;
    printf("read REG_FSR again = %0x\n", *REG_FSR);

Looks that can't clear the fault status. It keep execute the UsageFaultHandler() again and again. Could you help to check?