1 Reply Latest reply on Aug 23, 2017 3:32 AM by raghuramhegde

    SPI DMA USB problem

    user_193279881

      Hello,

         

      I have a problem.

         

      I'm using SPI in FX3.

         

      In "ApplicationStart" I configure EndPoint in this way

         

       

         

      CyU3PEpConfig_t epCfg;

         

      CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));

         

      epCfg.enable = CyTrue;

         

      epCfg.epType = CY_U3P_USB_EP_BULK;

         

      epCfg.burstLen = 16;

         

      epCfg.pcktSize = 1024; // I'm using USB 3

         

      CyU3PSetEpConfig(CY_FX_EP_PRODUCER, &epCfg);

         

       

         

      /* Flush the endpoint memory */

         

      CyU3PUsbFlushEp(CY_FX_EP_PRODUCER);

         

       

         

      ... then, I configure Dma in this way ...

         

       

         

      CyU3PDmaChannelConfig_t dmaCfg;

         

      CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof (dmaCfg));

         

      dmaCfg.size = 1024;

         

      dmaCfg.count = 200;

         

      dmaCfg.prodSckId = CY_U3P_UIB_SOCKET_PROD_1;

         

      dmaCfg.consSckId = CY_U3P_LPP_SOCKET_SPI_CONS;

         

      dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

         

      CyU3PDmaChannelCreate (&glChHandleBulkSink,CY_U3P_DMA_TYPE_AUTO, &dmaCfg);

         

       

         

      /* Set DMA Channel transfer size */

         

      CyU3PDmaChannelSetXfer (&glChHandleBulkSink, 0);

         

       

         

      ... then Spi in this way ...

         

       

         

      CyU3PSpiConfig_t spiConfig;

         

      /* Start the SPI module and configure the master. */

         

      CyU3PSpiInit();

         

       

         

      CyU3PMemSet ((uint8_t *)&spiConfig, 0, sizeof(spiConfig));

         

      spiConfig.isLsbFirst = CyFalse;

         

      spiConfig.cpol = CyTrue;

         

      spiConfig.ssnPol = CyFalse;

         

      spiConfig.cpha = CyTrue;

         

      spiConfig.leadTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;

         

      spiConfig.lagTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;

         

      spiConfig.ssnCtrl = CY_U3P_SPI_SSN_CTRL_HW_EACH_WORD;

         

      spiConfig.clock = 33e6;

         

      spiConfig.wordLen = 8;

         

      CyU3PSpiSetConfig (&spiConfig, NULL);

         

       

         

      CyU3PSpiSetBlockXfer (0xFFFFFFFF, 0 );

         

       

         

      When I open C++ Streamer I notice that there are many Failures and

         

      SPI not work continuously but in a "burst way" ....

         

       

         

      Can someone have an idea ?