hard fault exception

I am generating optimsed code using simulink coder for LMS filter using stm32f4VG407 discovery board,KEIL MDK-ARM, but upon single conversion of signal through ADC , it is stopping at hardfault handler. fault report:
MM_FAULT_STAT:0x00
BUS_FAULT_STAT:0x04 i.e. IMPRECISERR IS HIGH
USG_FAULT_STAT:0x000
HARD_FAULT_STAT:0x4000000 i.e.FORCED IS HIGH
DBG_FAULT_STAT:0x00000001 i.e. HALTED IS HIGH

I am using Matlab 2013b & MDK_ARM 4.74
please help me how to get rid of this.

Parents
  • Debugging? If you get into a hard fault, you have to assume that you have too small stack, or the code for some reason do an out-of-bounds access or makes use of an invalid data pointer or maybe sees an invalid instruction because of an invalid code pointer.

    Debugging of available state in the trap handler can give you some ideas where it fails. Verifying stack size can also help. Standard, traditional code review can also be a good way to catch what possible error situations that might hit you.

Reply
  • Debugging? If you get into a hard fault, you have to assume that you have too small stack, or the code for some reason do an out-of-bounds access or makes use of an invalid data pointer or maybe sees an invalid instruction because of an invalid code pointer.

    Debugging of available state in the trap handler can give you some ideas where it fails. Verifying stack size can also help. Standard, traditional code review can also be a good way to catch what possible error situations that might hit you.

Children
More questions in this forum