2 Replies Latest reply on Aug 2, 2018 1:21 AM by peter_birdy_3557726

    SlaveFiFoSync with only one endpoint and SlaveFifoSync with 2 Sockets

    peter_birdy_3557726

      I want to maximize data througput with SlaveFifoSync implementation. For this I want to use only endpoint 0x82, so to have only one direction: From GPIF to USB.

      However deleting the other endpoint 0x01 doesn't seem to be so easy:

       

      I deleted from SlaveFifoSync:

       

          /* Producer endpoint configuration */
          apiRetStatus = CyU3PSetEpConfig(CY_FX_EP_PRODUCER, &epCfg);
          if (apiRetStatus != CY_U3P_SUCCESS)
          {
              CyU3PDebugPrint (4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus);
              CyFxAppErrorHandler (apiRetStatus);
          }
      

       

      and:

       

          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);
          }
      

       

      and:

       

          /* Flush the Endpoint memory */
          CyU3PUsbFlushEp(CY_FX_EP_PRODUCER);
      
      
      
          /* Set DMA channel transfer size. */
          apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleSlFifoUtoP, CY_FX_SLFIFO_DMA_TX_SIZE);
          if (apiRetStatus != CY_U3P_SUCCESS)
          {
              CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus);
              CyFxAppErrorHandler(apiRetStatus);
          }
      

       

      and in the USB enumeration descriptors i changed in interface descriptor endpoint number from 2 to 1. And I commented the following out in SS HS and FS descriptor:

       

          /* Endpoint descriptor for producer EP */
          0x07,                           /* Descriptor size */
          CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
          CY_FX_EP_PRODUCER,              /* Endpoint address and description */
          CY_U3P_USB_EP_BULK,             /* Bulk endpoint type */
          0x00,0x04,                      /* Max packet size = 1024 bytes */
          0x00,                           /* Servicing interval for data transfers : 0 for bulk */
      
          /* Super speed endpoint companion descriptor for producer EP */
          0x06,                           /* Descriptor size */
          CY_U3P_SS_EP_COMPN_DESCR,       /* SS endpoint companion descriptor type */
          BURST_LEN-1, /* Max no. of packets in a burst : 0: burst 1 packet at a time */
          0x00,                           /* Max streams for bulk EP = 0 (No streams) */
          0x00,0x00,                      /* Service interval for the EP : 0 for bulk */
      

       

       

      However, project doesnt seem to work. When uploading firmware to FX3 it doesn't enumerate and Control Center freezes. Can you help me solving this issue?

       

      Is it possible to use let 2 Sockets work on the gpif site? I aksed in another thread if this can bring throughput benefits.

      I want to give this a try for SlaveFifoSync, so I changed stated the following in SlaveFifoSync:

       

          /* Create a DMA AUTO channel for P2U transfer. */
          dmaMultiConfig.size = DMA_BUF_SIZE*size;
          dmaMultiConfig.count = CY_FX_SLFIFO_DMA_BUF_COUNT_P_2_U;
          dmaMultiConfig.validSckCount = 2;
          dmaMultiConfig.prodSckId[0] = CY_U3P_PIB_SOCKET_0;
          dmaMultiConfig.prodSckId[1] = CY_U3P_PIB_SOCKET_1;
          dmaMultiConfig.consSckId[0] = CY_FX_CONSUMER_USB_SOCKET;
          dmaMultiConfig.notification = 0;
          dmaMultiConfig.cb = NULL;
          dmaMultiConfig.prodHeader = 0;
          dmaMultiConfig.prodFooter = 0;
          dmaMultiConfig.consHeader = 0;
          dmaMultiConfig.prodAvailCount = 0;
      

       

      and created MultiChannel:

       

          apiRetStatus = CyU3PDmaMultiChannelCreate (&glChHandleUVCStream, CY_U3P_DMA_TYPE_AUTO_MANY_TO_ONE,
                  &dmaMultiConfig);
          if (apiRetStatus != CY_U3P_SUCCESS)
          {
              /* Error handling */
              CyU3PDebugPrint (4, "DMA Channel Creation Failed, Error Code = %d\n", apiRetStatus);
              CyFxAppErrorHandler (apiRetStatus);
          }
      

       

      However even this doesn't enumerate. Can you help me ? I attached both in the attachments.

        • 1. Re: SlaveFiFoSync with only one endpoint and SlaveFifoSync with 2 Sockets
          hman

          Hi,

           

          I have gone through your files. Please find the below changes you have to make:

           

          1. Regarding the first issue: Change related to One Endpoint:

          a. Make sure that the number of endpoints you report in the descriptors is one

          b. Update the length of the configuration descriptor since you have removed one endpoint (Reduction of 13 bytes)

           

          2. Regarding multi channel creation:

          a. By default the DMA buffer available is 224KB (if you are using CYUSB3014).

          So, when you create a DMA multichannel with dmaMultiConfig.count as 8 and with 16KB of DMA buffer, then the meaning is you are allocating 16KB*8 buffer in each channel. When the count is 8 it would mean 8 buffers in each of the two channels. So, for your multi channel the buffer allocation is 16KB*8*2 =  256KB

           

          So, make sure total DMA buffer allocated (including all channels) does not exceed 220KB (4KB is internally used by SDK)

           

          b. In your firmware even for multi channel you have used DmaChannelSetXfer instead use MultiChannelDmaSetXfer API.

           

          Regards,

          Hemanth

          • 2. Re: SlaveFiFoSync with only one endpoint and SlaveFifoSync with 2 Sockets
            peter_birdy_3557726

            Dear Hemanth,

            regarding my project with only 1 endpoint: I changed the suggested things you remarked. Thank you for the hints but it seems there are still problems left: The project enumerates now but transferring data still doesn't work. In the FPGA flag_b will not set to 1 and transfer will not start accordingly. Do I have to change something in the GPIF state machine, there is still the original slavefifosync GPIF state machine inside the project.