2011-06-21 12:26 AM
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 all2011-06-21 06:22 AM
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.