You are here

FX3 | CyU3P Dma Channel Create failed, Error code = 64 | Cypress Semiconductor

FX3 | CyU3P Dma Channel Create failed, Error code = 64

Summary: 3 Replies, Latest post by KCNGP on 06 Sep 2016 06:55 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
user_354537326's picture
User
71 posts

Hi,

We were using modified 'Slave FIFO' application note design. With this design, we will be performing the DMA channel destroy and create in-between our operation. During these operation, some times we are seeing the below error (but we are seeing it to work for some times as well).

This error states that, some parameters are bad. But, we are calling the same function all the times and working sometimes and not sometimes. So, please let us know what other parameters will cause this issue and probably how to solve this.

 

//Error

CyU3PDmaChannelCreate failed, Error code = 64

 

//Code Snippet

    /* Create a DMA AUTO channel for U2P transfer.
        * DMA size is set based on the USB speed. */

      dmaCfg.size  = DMA_BUF_SIZE* size ;
      dmaCfg.count = CY_FX_SLFIFO_DMA_BUF_COUNT_U_2_P;
      dmaCfg.prodSckId = CY_FX_PRODUCER_USB_SOCKET;
       dmaCfg.consSckId = CY_FX_CONSUMER_PPORT_SOCKET;
       dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
       /* Enabling the callback for produce event. */
       dmaCfg.notification = 0;
       dmaCfg.cb = NULL;
       dmaCfg.prodHeader = 0;
       dmaCfg.prodFooter = 0;
       dmaCfg.consHeader = 0;
       dmaCfg.prodAvailCount = 0;

        tempDmaChannel = CyU3PDmaChannelGetHandle(CY_FX_PRODUCER_USB_SOCKET);
        if(tempDmaChannel != NULL)
        {
              CyU3PDebugPrint (4, "CY_FX_PRODUCER_USB_SOCKET : %d socket occupied", CY_FX_PRODUCER_USB_SOCKET);

        }

        tempDmaChannel = CyU3PDmaChannelGetHandle(CY_FX_CONSUMER_PPORT_SOCKET);
        if(tempDmaChannel != NULL)
        {
              CyU3PDebugPrint (4, "CY_FX_CONSUMER_PPORT_SOCKET : %d socket occupied", CY_FX_CONSUMER_PPORT_SOCKET);
        }

       apiRetStatus = CyU3PDmaChannelGetStatus(&glChHandleSlFifoUtoP, &dmaState, &prodXferCount, &consXferCount);
       CyU3PDebugPrint (4, "CyU3PDmaChannelStatus = %d\n", dmaState);
 

       if(dmaState != CY_U3P_DMA_NOT_CONFIGURED)
       {
             CyU3PDebugPrint (4, "Dma U2P channel already configured\n");
       }

       apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSlFifoUtoP,
               CY_U3P_DMA_TYPE_AUTO, &dmaCfg);
       if (apiRetStatus != CY_U3P_SUCCESS)
       {
               CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);
               CyFxAppErrorHandler(apiRetStatus);
       }

 

Thanks,

KCNGP

mady's picture
Cypress Employee
1053 posts

Hi Gokul,

Can you please use CyU3PDmaSocketIsValidConsumer and CyU3PDmaSocketIsValidProducer APIs to see if the sockets are in the usable state?

The other parameters that return the error 64 (bad argument) are trival things like size, count, mode etc., Your snippet does not seem to err on this. You can refer to the source code of CyU3PDmaChannelCreate API to see where all it returns this error. The source code is in C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\fx3_sdk_1_3_3_src.zip

Regards,

- Madhu Sudhan

user_354537326's picture
User
71 posts

Hi Madhu Sudhan,

I am not able to find the mentioned function "CyU3PDmaSocketIsValidConsumer" and "CyU3PDmaSocketIsValidProducer". Also, I am not able to find the zip file that you have referred. Please share the same.

FYI: I have created a support case #00285662

Thanks,

Gokul

user_354537326's picture
User
71 posts

Hi Madhu,

 

Just to add some more info:

I have observed 'Mutex Failure' error during DMA destroy. I presumed that this error is due to calling 'DMA Destroy' in 
USBEvent Call Back function. So, I have created an another thread and handled the 'DMA Destroy' with a separate event. Even with this approach, I am observing the 'Mutex Failure'.

 

Please let me know, how to resolve this issue and when this issue will happen.

 

Thanks,

Gokul

Log in to post new comments.