cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

JuCh_3556216
New Contributor

Hi,

I've successfully configured and tested a SPI DMA producer to pass data from the SPI producer to a USB socket for consumption. That DMA is currently configured like this:

//Configure DMA for real time streaming channel

CyU3PDmaChannelConfig_t dmaConfig;

dmaConfig.size = 1024;

dmaConfig.count = 64;

dmaConfig.prodSckId = CY_U3P_LPP_SOCKET_SPI_PROD;

dmaConfig.consSckId = CY_U3P_UIB_SOCKET_CONS_1;

dmaConfig.dmaMode = CY_U3P_DMA_MODE_BYTE;

//Disable DMA callbacks

dmaConfig.prodHeader     = 0;

dmaConfig.prodFooter     = 0;

dmaConfig.consHeader     = 0;

dmaConfig.notification   = 0;

dmaConfig.cb             = NULL;

dmaConfig.prodAvailCount = 0;

status = CyU3PDmaChannelCreate(&StreamingChannel, CY_U3P_DMA_TYPE_AUTO, &dmaConfig)

With its current configuration, the DMA doesn't transmit anything (except 0x0000) when streaming. Is there a way to set up another DMA that transmits data stored in memory on the CPU while simultaneously transmitting the data acquired during the transaction over USB?

My code can be found in the BurstMode branch of this repository.

Thanks for your help!

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator

Hello Juan,

- Create a MANUAL DMA channel between FX3 CPU Producer and SPI Consumer to transfer data from the CPU to the SPI interface.

- For the transfer of data from SPI interface to USB, create an AUTO DMA channel between SPI Producer and USB Consumer.

Best regards,

Srinath S

View solution in original post

0 Likes
6 Replies
SrinathS_16
Moderator
Moderator

Hello,

- The DMA channel that you have mentioned is for transferring data from the SPI to the USB socket.

- In order to transfer data from the FX3 CPU to the USB socket, you need to define additional DMA Channel with the DMA type as MANUAL. Alternatively, you can use the existing SPI-USB channel to pause temporarily and send data from the FX3 CPU. Please refer to How to send debug data out an existing dma channel for more details.

Best regards,

Srinath S

0 Likes
JuCh_3556216
New Contributor

Hi,

I'm not trying to transmit data from the FX3 CPU to the USB socket. I'm trying to "Transact" data like is typically done in SPI. I need to send a specific data packet (21 words) over SPI via DMA (FX3 CPU to SPI) while simultaneously sending what I'm receiving during the same SPI transaction to the PC (SPI to USB). I have not been able to find an example where this is done.

-Juan

0 Likes
SrinathS_16
Moderator
Moderator

Hello Juan,

- Create a MANUAL DMA channel between FX3 CPU Producer and SPI Consumer to transfer data from the CPU to the SPI interface.

- For the transfer of data from SPI interface to USB, create an AUTO DMA channel between SPI Producer and USB Consumer.

Best regards,

Srinath S

View solution in original post

0 Likes
JuCh_3556216
New Contributor

Hi,

That's pretty much what I've already implemented, but for some reason I don't see any data get transmitted in either direction. I also don't see any errors when debugging for some reason. Would you be able to take a look at this repository to check whether my implementation is correct?

Link

0 Likes
abhinavg_21
Moderator
Moderator

Hi Juan,

Can you please try both the transactions one by one to make debugging easier. First create only one DMA Auto channel from SPI block to USB and then try to receive data in the control center, move to next step once it is done.

Thanks & Regards
Abhinav Garg

0 Likes
JuCh_3556216
New Contributor

Hi Srinath,

I was able to successfully implement the SPI transfers using the method you described. For anyone looking for an example of the implementation, the code is available here. Of particular interest are the AdiBurstStreamStart() and AdiDataStream_Entry() functions.

0 Likes