You are here

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

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

Summary: 2 Replies, Latest post by kp77_1928921 on 09 Nov 2016 06:12 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
kp77_1928921's picture
User
2 posts

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.

nisa's picture
Cypress Employee
85 posts

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).

kp77_1928921's picture
User
2 posts

Sending a ZLP after 1024 bytes works for me.

Thank you, Aditya.

Log in to post new comments.