I am using the 16 Bit slave fifo interface and set the fifo full flag of the writing tread fixed to flag B. The DMA channel is set to auto between slave fifo and usb interface, using 2048 byte buffer size with 8 packets.
I am using the BulkLoop C++ application example to send and receive data. To the slave fifo interface an FPGA is attached, that loops the data back.
Now it happens sometimes that the FX3 reports fifo full on the writing thread (flag B stays low forever), and as a result, the FPGA stops writing data to the slave fifo. If I reset the FX3 it works again flawless, but after a few seconds gets stuck once more with the same behavior. Has anybody encountered similar issues? Thx.
Can you explain your setup a little more?
Once the full flag asserts did you try reading the data from the USB side to get the data and clear the internal buffers?
Yes, I can read out the data but for some reason I have to call XferData() many times until the buffer is empty. As an example, if I write 1 MByte data, each XferData() call to the in port only returns around 27'076 Bytes, sometimes more, sometimes less. During this time, no further data is sent to the out port.
Once the buffer is empty, the loopback test is working fine, but gets stuck again after some seconds.
This seems like a manifestation of the rate of IN packets not being equal to rate of OUT packets. So at some point all the buffers are filled and the full flag is asserted.
The fact that you are able to read packets and get the loop working again means that the firmware is good. It is just that data is not being read fast enough. What is the freqeuncy at which you're operating the slave FIFO interface. What is the timeout you're specifying for Xferdata?
In the C++ BulkLoop example it is set to 2s (timeout check box is disabled):
OutEndpt->TimeOut = 2000
InEndpt->TimeOut = 2000
I set a breakpoint if "inlen != outlen". This breakpoint triggers excatly when the reported problem occurs. In my case I got inlen=5118 and outlen=0. This is already very interesting because how can we receive 5118 bytes if no data could be sent?
After that I manually stepped trough the code and executed the DataXfer() function on the in endpoint until no further data was available. After receiving 484152 bytes and calling DataXfer() many times, no further data was available and the BulkLoop example continued normally.
The slave fifo interface is working at 50 Mhz and 16 Bit.
Just figured out that if I set the FX3 to MANUAL DMA mode the problem does not occur. Obviously the data transfer rate is much lower (one fifth).