1 Reply Latest reply on Nov 14, 2015 6:42 AM by Madhu Lakshmipathy

    CyU3PDmaChannelCreate() fail with Error code = 64

    myeongcheol.lee

      Hello.

         

      I want to transfer data using bulk stream from GPIF to usb bulk endpoint with DMA auto.

         

       

         

      But, CyU3PDmaChannelCreate() API return error code 64(0x40) at stream value is 1.

         

      Error code 64 means bad parameter. What does wrong in my code??

         

      -----------my code---------------------------------------------------------------------

         

      for (stream = 0; stream < CY_FX_EP_MAX_STREAMS; stream++)
          {
              /* Create a DMA AUTO_SIGNAL channel for P2U transfer */
              CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof (dmaCfg));

         

              dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
              dmaCfg.notification = 0;
              dmaCfg.prodHeader = 0;
              dmaCfg.prodFooter = 0;
              dmaCfg.consHeader = 0;
              dmaCfg.prodAvailCount = 0;

         


              dmaCfg.size  = (1024*CY_FX_EP_BURST_LENGTH);
              dmaCfg.count = 4;

         

              dmaCfg.prodSckId = CY_FX_PRODUCER_PPORT_SOCKET;
              dmaCfg.consSckId = (CyU3PDmaSocketId_t)(CY_FX_CONSUMER_USB_SOCKET + stream);
              dmaCfg.notification = (CY_U3P_DMA_CB_CONS_EVENT);
              dmaCfg.cb = CyFxDmaGPIFCallback;

         

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

         

              /* Map the stream to the socket. */
              if (stream != 0) {
                  /* The actual stream ID is stream + 1. */
                  apiRetStatus = CyU3PUsbMapStream (CY_FX_EP_CONSUMER, CyU3PDmaGetSckNum(dmaCfg.consSckId), (stream + 1));
                  if (apiRetStatus != CY_U3P_SUCCESS) {
                      CyU3PDebugPrint (4, "CyU3PUsbMapStream failed, error code = %d\n", apiRetStatus);
                      CyFxAppErrorHandler(apiRetStatus);
                  }
              }

         

              /* Set DMA Channel transfer size */
              apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleBulkLpPtoU[stream], CY_FX_DMA_TX_SIZE);
              if (apiRetStatus != CY_U3P_SUCCESS) {
                  CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer failed, Error code = %d\n", apiRetStatus);
                  CyFxAppErrorHandler(apiRetStatus);
              }

         

              /* This loop will be run only once for FS and HS configurations. */
              if (!glIsStreams) {
                  break;
              }
          }