DMA doubts

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

cross mob
Anonymous
Not applicable

Hi,

   

I am following the below sequence for sending data from CPU to an USB consumer endpoint. 

   

    step 1: Get an empty buffer using CyU3PDmaChannelGetBuffer

   

    step 2: Copy data to be sent to the buffer acquired in step 1.

   

    step 3: Commit the buffer.

   

 

   

The data to be sent is not constant in my usecase, which means I cant preset the data to be committed as in the function CyFxBulkSrcSinkFillInBuffers used in example code cyfxbulksrcsink.c. (The data in that example is a preset pattern 0xAA).

   

1) The copy operation (Step 2) is handled by CPU or DMA?

   

2) To commit the data towards a consumer endpoint, we need to do a copy (CyU3PMemCopy) to the buffer acquired irrespective of DMA with callback or without callback?

   

3) Can I run an AUTO DMA with signal, from SPI to USB consumer endpoint? Thus, when a host application reads from the USB, it gets the SPI data continuously.

0 Likes
1 Reply
Anonymous
Not applicable

1) CyU3PDmaChannelGetBuffer: this function waits until a buffer is ready on the channel, and then returns  a pointer to the buffer status.

   

2) CPU will copy the data.

   

3) Memcopy does not consume the data. The host has to read it for the CPU has to discard the buffer to free the buffers for further data transfers.

   

4) A auto DMA will not have the option to send and asserts signals required for SPI transfers. You need to call SPI read write API. Just creating DMA channel won't be sufficient for the SPI to work

0 Likes