DMA flag is not working correct when bulk out a particular length of data.

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

cross mob
Anonymous
Not applicable

Hi,

   

I'm working on a project using FX3 device (CYUSB3014), which is mostly based on official slave fifo example. Now, almost every thing works fine. But there is a problem that I can't figure out why. Currently, the firmware has an U2P DMA channel used for bulking out. The DMA channel has 4 DMA buffers and each of them has length of 16384 bytes. The burst length is set to 16. The DMA channel uses U-port input socket 1 as producer socket and P-port socket 0 as consumer socket. FLAGA is bound to that DMA channel. FX3 is connected to an FPGA.

   

On the PC sides, I use API function XferData(buf, len) to send data to FX3. The problem is when "len" is an integral number of 1024, FLAGA is always 0 (I use SignalTap II to check FLAGA), but function XferData(buf, len) returns true, and the actual transformed length is equal to what I passed to it. However, when "len" is not an integral number of 1024, FLAGA works as expected. How could I solve this problem?

   

Thanks.

0 Likes
2 Replies
Anonymous
Not applicable

Hi, As the host is sending one complete packet (i.e.1024 for SS), the device does not know that the transfer from the host has ended. If the host send data less than packet size, then the device automatically knows that the transfer has ended, (as it is less than one packet).  This is how USB works. 

   

So, to meet your requirements, you can try one of the following:

   

a) Send a ZLP from the host after the 1024 transfer. 

   

b) make the DMA buffer size to be 1024 (i.e. equal to the DMA buffer size).

0 Likes
Anonymous
Not applicable

Sending a ZLP after 1024 bytes works for me.

   

Thank you, Aditya.

0 Likes