Hi,
I would like to start/stop my thread(s) handling the USB in my firmware on a FX3.
I stop all my thread with tx_thread_terminate then destroy them with CyU3PThreadDestroy. Clean any allocated buffer and memory.
The operations are successful however I have buffers that remain allocated. Using the JTAG I identified the issue in the following call stack :
CyU3PDmaBufferFree() at cyfxtx.c:1,006 0x40007f38
CyU3PDmaChannelDestroy_TypeManual() at 0x4000cb38
CyU3PDmaChannelDestroy() at 0x4000c928
CyU3PUsbStop() at 0x40016b20
The free function is called however the buffer pointer is incorrect and deallocation is unsuscessful :
CyU3PDmaBufferFree
/* Validity check for the pointer. */
if ((uint32_t)buffer < CY_U3P_BUFFER_HEAP_BASE)
return retVal;
The DMA channel in question is the EP0. I have 2 512-byte buffer remaining every time.
BufAlloc Buffer: 40041080 (21) (536) - Reamining Buffer 2nd start/stop
BufAlloc Buffer: 40040E60 (20) (536) - Reamining Buffer 2nd start/stop
BufAlloc Buffer: 40040C40 (13) (536) - Reamining Buffer 1st start/stop
BufAlloc Buffer: 40040A20 (12) (536) - Reamining Buffer 1st start/stop
BufAlloc Buffer: 400409E0 (11) (40)
BufAlloc Buffer: 400409A0 (10) (40)
BufAlloc Buffer: 40040960 (9) (40)
BufAlloc Buffer: 40040920 (8) (40)
I will test with a manual in/out buffer with 3 buffer to check how many buffer CyU3PDmaChannelDestroy_TypeManual fails on.