2021-07-12 12:09 AM
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.
2021-07-14 08:53 PM
I would guess it is a stack overflow or an out of bounds array access.
> 0x080015bc: 4877 wH LDR r0,[pc,#476] ; [0x800179c] = 0x20000130
I don't see anything wrong with this. Perhaps I'm missing it.
2021-07-16 08:28 PM
Please note that the actual address of the variable is 0x20000130, but the controller tries to access 0x28000130 as pointed by the BFAR register causing hard fault as 0x28000130 is out of the valid range of RAM addresses. It appears that an extra bit is getting set. Also this fault does not occur every single time. In one board, the fault occurs within 15 mins after power on. While in another board, the fault occurs after more than 1 hour.
2021-07-18 06:18 PM
Double check for valid clock settings, voltage and wait states.