My custom board has a TM4C1294KCPDT processor operating in OTG mode. Because the attached device's cable has ID grounded, the TIVA chip is used in host mode with an external device. The processor generates a Hard Fault; Bus Fault; Imprecise when the device is reconnected following a disconnect.
Environment is CCS 6.1.0.00104. TI-RTOS version 2.14.00.10. TIVAWARE version TivaWare_C_Series-2.1.1.71b. Device is proprietary "handpad" that is similar to a gamepad; it has VBUS-Powered and has a Microchip PIC18F8J50 processor with the MICROCHIP USB device stack. Emulator is Blackhawk XDS100v2 ARM.
Sequence:
1. Power up TIVAWARE with the handpad attached. Device and TIVA chip talk fine.
2. Physically disconnect the device's cable from the TIVAWARE board. Wait several seconds until TIVA device goes back into unconnected state.
3. Reconnect the device's cable.
4. The TIVA device recognizes the reconnect and sets itself up as a host.
5. Less than a second later, the TIVA chip throws a Hard Fault:Forced exception. The Bus Fault: Imprecise is also asserted. The fault is occurring in the usbhostenum.c file, but the exact location seems to move around.
I went into my main.c module and added code to change the ARM ACTRL register (address = 0xe000,e008) from 0x0 to 0x7. (This disables IT folding, write buffering, and multicycle instruction interrupts. Now, what is reported is Hard Fault: Forced Exception; Bus Fault Precise that always occurs at the same place.
The line of source code where the fault occurs is the inner statement of the if located at source code line 4417 of usbhostenum.c:
if(g_sUSBHCD.psUSBOUTPipes[ui32Idx].psDevice)
{
g_sUSBHCD.psUSBINPipes[ui32Idx].psDevice->ui32Flags |= <- Fault occurs here
USBHDEV_FLAG_NOTIFYINT;
}
For reference, ui32Idx is equal to 1 when the fault occurs.
Disassembling this instruction,
ldr
ldr
movs
muls
ldr
ldr
orr
str r0, [r1, #0x30] <- fault occurs on this instruction.
Prior to fault, r0 is 0x0001,C1D5, r1 is 0, r2 is 1, sp is 0x2001,02b0 which is within my defined .data area of memory
At entry to the ti_sysbios_family_arm_m3_Hwi_excHandlerAsm__I, r0-r2 are the same, sp is 0x2001,0290
Suggestions on how to diagnose this?
Tom