How to suspend a GPIF DMA to USB from a thread

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I'm face to priority when I want to use in parallel 2 EPIN:  One is transferring high speed data from GPIF to USB, the other low speed data from UART to USB. Both of them are connected to DMA AUTO but the UART has and AUTO SIGNAL allowing to set a flag (_pktsPendingUart) when a transfer is completed. Within a thread, I read the flag every 40ms and if not set I use the CyU3PDmaChannelSetWrapUp() in order to tell to USB they might be some bytes in the DMA buffer so the host can get it with XferData().

   

The thing is while the GPIF to USB is sending some data to the host, the DMA UART wrapup or the associated EPIN is stuck since I don't see anymore UART Data Packet on the USB and any XferData() call returns LastError/NtStatus/UsbdStatus = 997/995/0xC001000 on the 1st call and then 997/23/0xC0000011 on the next calls

   

So I wonder how to suspend the GPIF DMA, force the UART DMA and resume the GPIF in the thread body, something like the code below, BUT IT DOESN'T WORK. Any other method or do I use these functions correctly ?

   

while(true){

   

if (_pktsPendingUart == 0){

   

CyU3PDmaChannelSetSuspend(&_glChHandleSlFifoGPIFtoUSB, CY_U3P_DMA_SCK_SUSP_NONE, CY_U3P_DMA_SCK_SUSP_EOP);

   

CyU3PDmaChannelSetWrapUp (&_glChHandleUarttoUsb);

   

CyU3PDmaChannelSetSuspend(&_glChHandleSlFifoGPIFtoUSB, CY_U3P_DMA_SCK_SUSP_NONE, CY_U3P_DMA_SCK_SUSP_NONE);

   

CyU3PDmaChannelResume(&_glChHandleSlFifoGPIFtoUSB, CyTrue, CyTrue);

   

}//end if

   

_pktsPendingUart = 0;

   

CyU3PThreadSleep (40);

   

}//end while

   

 

   

PS : I've also tried CY_U3P_DMA_SCK_SUSP_CUR_BUF and CY_U3P_DMA_SCK_SUSP_CONS_PARTIAL_BUF rather than CY_U3P_DMA_SCK_SUSP_EOP but nothing is working.

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

   

You can continue data transfer on the other socket even without suspending. (Provided the data on the UART is small). You just have to do the required handling in the host application.

   

Regards,

   

- Madhu Sudhan

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

You can continue data transfer on the other socket even without suspending. (Provided the data on the UART is small). You just have to do the required handling in the host application.

   

Regards,

   

- Madhu Sudhan

0 Likes