3 Replies Latest reply on Dec 26, 2014 1:12 AM by arasc_296896

    sendEP0Data() returns CY_U3P_ERROR_DMA_FAILURE



      I have a device which sends data over 2 SuperSpeed bulk pipes. Each pipe is fed via its own DMA thread.


      I am running into a problem USB Setup callback: sometimes sendEP0Data() returns CY_U3P_ERROR_DMA_FAILURE and I have no clear understanding for both the cause and how to recover. This problem occurs quite often when talking to some host controllers (uPD720200) and very seldom (never) with others.


      I tried suspending DMA channels while doing sendEP0Data() similar to how it is done in cyfxgpiftousb.c example even though the example does it only for USB-2.0 without much success. One problem is that I do not know how long to wait for my DMA channel callback to be called after CyU3PDmaChannelSetSuspend(). In my case DMA might not happen for quite long time and I cannot afford to have one of the pipes suspended while waiting for the callback on another pipe.


      In any case, is it really necessary to do CyU3PDmaChannelSetSuspend()? What are other probable causes for CY_U3P_ERROR_DMA_FAILURE? How can one recover from this condition? In my case when it happens once all subsequent CyU3PUsbSendEP0Data() fail.







        • 1. Re: sendEP0Data() returns CY_U3P_ERROR_DMA_FAILURE

           My suggestions to solve your issue,


          Try printing the setupcb requests and decode the request before the failure. It may help you to see if the corresponding type where your failure occurs. 


          Also you might not use the  CyU3PDmaChannelSetSuspend() if you are not playing with 2.0. 

          • 2. Re: sendEP0Data() returns CY_U3P_ERROR_DMA_FAILURE

             Thank you for the reply. Of course I do decode the request before sending reply with CyU3PUsbSendEP0Data() :-)


            These are CY_U3P_USB_VENDOR_RQT. The problem happens with various requests, the only common thing is using CyU3PUsbSendEP0Data() while DMA is active on another thread (different DMA channel).


            I did not see any mention about CyU3PDmaChannelSetSuspend() being limited to USB-2.0 pipes anywhere in docs/sources. Is it "official"?

            • 3. Re: sendEP0Data() returns CY_U3P_ERROR_DMA_FAILURE

              It is specified in one of the cypress examples as "When operating at USB 2.0 speeds, there is a possibility that the bulk transfers create errors during control transfers. Ensure that the bulk channel is suspended for the duration of the control request to avoid this possibility."


              I would suggest you using USB bus analyzers or protocol analyzer to have a clue.