System: Tiva C Launchpad
I have written a software that works as follows:
- Timer triggers the ADC0SS0 sequencer, last step in Sequencer triggerst the ADC0SS0 ISR routing
- in the ISR, the new samples are written to the USB tx_ringbuffer, a counter variable is updated
- In the main application loop, it is checked whether the counter variable is greater than (or eq) 32 (meaning that there are 64 bytes to be transmitted), if the system is in transmitting state and if there is enough tx buffer space (USBBufferSpaceAvailable >= 64) available
The starting of the transmission is controlled by a state machine that switches into active state upon receiving a control command from the host- The USBRingBufDataWritten method is then called
- The counter is then reduced by the number of written samples
I can achieve high sample rates and good USB throughput using this method. This works by my host (via libusbx) receiving packets of max size 1024.
However, very shortly after the last endpoint.read(1024) on the host, a Fault occurs -- in line 2862 of usblib/device/usbdenum.c:
ui32DMAIntStatus = USBLibDMAIntStatus(g_psDCDInst[0].psDMAInstance);
see the backtrace:
#0 FaultISR () at usb_startup_gcc.c:327
#1 <signal handler called>
#2 0x00040000 in ?? ()
#3 0x00001cee in USBDeviceIntHandlerInternal (
ui32Index=<optimized out>, ui32Status=0)
at ./device/usbdenum.c:2862
#4 0xffffffe8 in ?? ()
#5 0xffffffe8 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
I'm out of my wits.
USBLibDMAIntStatus is in fact only a define that calls g_psDCDInst[0].psDMAInstance->pfnIntStatus, which strangely has the suspicious address 0x40000.
But how this happens only after the host stopped requesting packets, I don't know. To me, this looks like a grave bug in USBlib, but I'm sure there are at least workarounds that you could help me find.
Greetings,
Marcus Müller