2012-01-31 10:46 AM
Hello,
I have a hard fault when running my code, and the result of the hard fault is :
[Hard Fault Handler]
R0 = 4000000 R1 = 1 R2 = 20003fe0 R3 = 40013c00 R12 = 0 LR = 8014acd PC = 8019474 PSR = 100022c BFAR= 4000010 CFSR= 8200 HFSR= 40000000 DFSR= b AFSR= 0All values are in hexa. The thing I don't understand is that CFSR tells me there is a precise bus error and that BFSR is valid ... but the value in BFSR is obviously not valid.
It always trigger while entering a timer interrupt, which is coded as this :
void TIM2_IRQHandler(void)
{ if (TIM_GetITStatus(TIM2, TIM_IT_Update) == SET) { TIM_ClearITPendingBit(TIM2, TIM_IT_Update); [a few lines of code that modify a variable] }if (TIM_GetITStatus(TIM2, TIM_IT_CC3) == SET)
{ TIM_ClearITPendingBit(TIM2, TIM_IT_CC3); [a few lines of code too, but this is never called, checked with a breakpoint] } }I use other timers with no problems, any clue on what's happening ?
Thomas.
[UPDATE] The variable I'm modifying in the interrupt is set as volatile, it seems that if I don't set this variable as volatile, the hard fault doesn't trigger. I'm using TASKING 4.0.2012-01-31 11:11 AM
Can you list the assembler code in proximity to the faulting PC?
Can you see anything doing a code walk of the interrupt routine, as compiled, wrt the registers at the fault. Where are the stack pointers at, and what part or memory limits are you working with?