7 Replies Latest reply on Oct 3, 2019 5:10 AM by OrCo_3183681

    Partly full buffer FinishDataXfer




      I’m using the FX3 for transferring data from a FPGA to PC, and having a problem emptying the last partly filled buffer after the acquisition has finished.


      On the FPGA side the design is based on the Slave FIFO interface described in AN65974.


      The software on the PC is based on Streamer application modified to store the received data to a file. Like in the streamer I use the API methods for asynchronous IO (BeginDataXfer, WaitForXfer, and FinishDataXfer) and a circular FIFO of buffers (queue).


      During steady state the FIFO mechanism works great with the data transferred as expected.


      The acquisition stops when the FPGA stops sending data and WaitForXfer reaches timeout. At this point there is one partly filled buffer in the memory which I am having difficulties emptying.


      I would like to determine how much data was written to this last buffer. If I understand the API correctly, running the FinishDataXfer method on the buffer, i.e. FinishDataXfer(buf_fpga[i], cur_len,…), should set the actual number of bytes transferred in the cur_len field. But in practice calling FinishDataXfer always sets cur_len to 0.


      What am I missing here?


      What exactly is the right behavior I should expect from FinishDataXfer?


      Is there a way to determine the number of bytes transferred without calling FinishDataXfer?


      Attached below is the relevant section of my code.


      Thanks for the help,