AnsweredAssumed Answered

Hard Fault test error?

Question asked by zanon.luciano on Jan 9, 2014
Latest reply on Jan 9, 2014 by sung.chen_chung
In order to test the Hard Fault interrupt, I modified the Systick example on "STM32F0xx_Discovery_FW_V1.0.0" as follows..

on main.c I added two lines:
int main(void)
uint8_t* BytePtr = (uint8_t)0x20002000;
    *BytePtr = 0x5a;        //generate hardfault IRQ
  /*!< ...........comment
  /* Initialize Leds mounted on STM32F0-discovery */

on stm32f0xx_it.c I modified the error handler:
void HardFault_Handler(void)
  TimingDelay_Decrement();    //really do nothing...

So, when the line
      *BytePtr = 0x5a;
is executed and the processor access the wrong location 0x20002000
a HardFault_Handler is called and executed.

At return I expect the processor to execute the line

but instead it returns still at line "*BytePtr = 0x5a;  and newly execute it, entering in loop!!!

I am a novice on STM32  so it must be a stupid error but if I repeat
the same test on the "STM32F10x_vldiscovery_package" it works as expected...

Can someone help me??