This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to solve a Precise Bus Fault in Cortex -M3?

Hello! I am currently working on Cortex - M3 using Keil uvision. I have been getting an INVPC hard fault repeatedly. So I increased the stack size from 0x400 to 0x800 and set the stack alignment bit in CCR register at power on. 

This removed the INVPC hard fault but instead I got Precise Bus Fault with following stack frame :

R0 = 28000134 R1 = 1 R2 = 40000000 R3 = 1 R12 = ae60cd5 LR = 80015b9 PC = 80015be PSR = 2100002c- FSR/FAR: CFSR = 8200 HFSR = 40000000 DFSR = 0 AFSR = 0 BFAR = 28000130

By disassembling the code, I found that the faulty instruction given below which was inside the Timer 2 ISR :

   0x080015bc:  4877    wH   LDR   r0,[pc,#476] ; [0x800179c] = 0x20000130

This is done in attempt to increment a global counter uint16_t uiTimeCounter = 0;

It appears that the memory address got corrupted. Any insights on how should I proceed to solve this would really be helpful. Thank you.