Hello,
Using TIVA TM4C129DNCPDT, running at 120 MHz. Processor enters hard fault ISR early during intialization.
I have read the hard fault app note, and have ruled out the usual suspects. There is plenty of stack space; all devices that are accessed are enabled; no invalid instructions.
During initialization, the processor enables USB, serial I/O, timer tick interrupt. It is at a point during init where it asserts some GPIOs to enable an external device; code then delays 2mS before accessing the external (spi) peripheral. Serial output is fine up to the point of failure, confirming baud rate, serial I/O.
We have multiple cards; happens on some cards with great frequency; not observed on other cards. Changes to the software (moving code around, adding debug logs, etc.) may cause problem to occur with more or less frequency.
Problem seems to occur in the vicinity of reading the sys tick value register fairly often.
Stack trace, from GDB:
#0 FaultISR () at /home/tcooper/higherground/p4_firmware/hwlib/tm4c123gh6pm_startup_ccs_gcc.c:445
#1 <signal handler called>
#2 CPUcpsie () at /home/tcooper/higherground/p4_firmware/driverlib/cpu.c:219
#3 0x00032c36 in IntMasterEnable ()
at /home/tcooper/higherground/p4_firmware/driverlib/interrupt.c:216
#4 0x000293f8 in _timerGetTime (pSubTick=pSubTick@entry=0x20023fac <pui32Stack+16300>)
at /home/tcooper/higherground/p4_firmware/utils/timers.c:285
#5 0x000297be in _timerDelay (t=<optimized out>)
at /home/tcooper/higherground/p4_firmware/utils/timers.c:662
#6 0x000297e8 in timerDelayMs (ms=<optimized out>)
at /home/tcooper/higherground/p4_firmware/utils/timers.c:673
#7 0x00025510 in txTaskInit () at /home/tcooper/higherground/p4_firmware/monitor/txTask.cpp:484
#8 0x0001c714 in main () at /home/tcooper/higherground/p4_firmware/monitor/main.cpp:108
Registers:
(gdb) info reg
r0 0x0 0
r1 0x0 0
r2 0x4005b000 1074114560
r3 0x244fe018 609214488
r4 0x10a 266
r5 0x20023fac 537018284
r6 0x20023fac 537018284
r7 0x5a6d0 370384
r8 0x0 0
r9 0x0 0
r10 0x0 0
r11 0x3e69 15977
r12 0x4c 76
sp 0x20023f60 0x20023f60 <pui32Stack+16224>
lr 0xfffffff9 -7
pc 0x1c22a 0x1c22a <FaultISR+18>
xPSR 0x21000003 553648131
Stack dump, starting 16 bytes above top of stack:
(gdb) x/32xw 0x20023f50
0x20023f50 <pui32Stack+16208>: 0xffffffff 0xffffffff 0xffffffff 0xffffffff
0x20023f60 <pui32Stack+16224>: 0x00000000 0x00000000 0x681dd00e 0x00000000
0x20023f70 <pui32Stack+16240>: 0x0000004c 0x00032c5f 0x00032c74 0x21000000
0x20023f80 <pui32Stack+16256>: 0xffffff38 0x000293ed 0xffffff38 0x0000010a
0x20023f90 <pui32Stack+16272>: 0x20023fac 0x000c4807 0x0005a6d0 0x000297d7
0x20023fa0 <pui32Stack+16288>: 0x00000000 0x00000010 0x20035094 0x000dfe40
0x20023fb0 <pui32Stack+16304>: 0x20028258 0x20024a70 0x20024a78 0x00029801
0x20023fc0 <pui32Stack+16320>: 0x00005254 0x00025529 0x20027e80 0x00000054
Now, I've added code to FaultISR to read the SysTickValue register and store it; here is the resulting disassembly:
(gdb) disassemble FaultISR
Dump of assembler code for function FaultISR:
0x0001c218 <+0>: movw r3, #57368 ; 0xe018
0x0001c21c <+4>: movt r3, #57344 ; 0xe000
0x0001c220 <+8>: ldr r2, [r3, #0]
0x0001c222 <+10>: movw r3, #15944 ; 0x3e48
0x0001c226 <+14>: movt r3, #8195 ; 0x2003
=> 0x0001c22a <+18>: str r2, [r3, #0]
0x0001c22c <+20>: b.n 0x1c22c <FaultISR+20>
End of assembler dump.
Note, however, that when the processor locked up, ctl-c and GDB reported the PC at 0x1c22a. However, notice r3 value from the register dump: 0x224f_e018. R3 should be e000_e018 at this point. R2, the tick counter, should be <= 1,200,000 and it is much higher.
Interrupt enable registers show vectors 5, 42 = UART0, USB MAC.
(gdb) x/4xw 0xe000e100
0xe000e100: 0x00000020 0x00000400 0x00000000 0x00000000
Any thoughts on how to proceed are appreciated.
Thanks!