SPI DMA USB problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaFa_974161
Level 5
Level 5
100 sign-ins 50 replies posted 50 questions asked

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 ?

0 Likes
1 Reply
Anonymous
Not applicable

Hi!,

SPI is operating at 33MHz. So, the max. speed at which we can write to SPI is 33Mbps.

I suppose, the failures you are observing on Streamer is because of Timeout error.

Due to the bandwidth mismatch, you may be observing Failures.

0 Likes