cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault_Handler

cyril2399
Associate II
Posted on June 21, 2011 at 09:26

hello,

I have dowload the example of HOST USB for stm32f105 (same for stm32F107) and when I compile my project (I have copy/paste all files in my project) i go into the inifinite loop of HardFault_Handler().

this happend when I  use:

static void BSP_Delay(uint32_t nTime, uint8_t unit)

{

 

  BSP_delay = nTime;

  BSP_SetTime(unit); 

  while(BSP_delay != 0);

  TIM_Cmd(TIM2,DISABLE);

}

at the set time step, exactly here:

  /* TIM2 enable counter */

  TIM_Cmd(TIM2, ENABLE); 

}

Just after if I do step over I go into herfault_handler()...

It is the last step of the function.

How must I do for solving this?

Thanks to all
1 REPLY 1
Posted on June 21, 2011 at 15:22

Use the assembler/disassembly view, step to the point where it faults. Note the instruction, and the register content.

Chances are you are reading/writing memory outside the normal scope of the part, or trying the execute ARM code, the STM32 only supports Thumb.

A more long term solution, that I've generally recommended, would be to use a Hard Fault handler along the lines of the one presented by Joseph Yiu. It's on the forum in a couple of places, and probably a google away.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..