I'm using a code legacy of the streamer example from the SDK1.3
The BeginDataXfer/WaitForXfer/FinishDataXfer is working fine at high throughput (my PC read and process data at 2Gb/s). Now when I have a low throughput of data (<1Gb/s) due to a different FPGA operating mode, the functions WaitForXfer(hEvent, 500) returns 0. And I've tried several options : adding or removing the following functions EndP abort(), Pinvoke.WaitForSingleObject(), FinishDataXfer()... but I'm still stucked and the documentation of CyUSB.NET is not very clear. Help would be precious.
Config : My CYUSB3012 is connected to my FPGA with a 32-bits GPIF interface and dedicated partial flags for FPGA write to the CYUSB. HW Signals are OK (CYUSB & FPGA communicate together without any problem, oscilloscope checked). Library = cyUSB.dll v220.127.116.11.
NB : When I use the control center, I use BULKIN 0X81 Xfer Data-IN to get my data with low or high throughput without any problem.
With a breakpoint in the code I see WaitForXfer() function exiting with timeout since data arrive from FPGA at low speed.
The question is what do I have to do to reinitiate properly the Xfer : EndPoint abort ? PInvoke.WaitForSingleObject ? FinishDataXfer () ? Recall the WaitForXfer()? a mix of them ?
Cypress Doc is not clear at all when using the asynchronous IO methods...
If the FPGA is sending the data at a lower rate, I think you should wait for a long time. Please increase the timeout value of the WaitforXfer function and test.
Thanks Madhu but it will ot solve my problem since I may not know the rate of the data pushed by the FPGA which are application dependent (random events with high rate equ. to ~2Gb/s down to very low rate at 1Mb/s). My idea was to use the XferData() function (which work at full throughput) and to reinitiate transfer(s) if a timeout occurs until the user stop the application or a certain total number of bytes have been transferred.
So is there a way to reinitiate properly a XferData() after a timeout without losing data ?
For information, once timeout has occurred, I've tried to call again the XferData() with/without the Abort() function (despite it is explicitly written in the CyUSb prog. reference doc that the XferData() call Abort() in case of timeout) but no way, the XferData() will always return false after that!
I think i have an issue similar to yours. My CYUSB3014 is connected to my FPGA with a 16-bits GPIF interface and a PCLK signal. Any data rate above 32Mb/s will cause XferData()/FinishDataXfer() return false and get stuck, even if Abort() is called. Increasing timeout value doesn't help either. I don't know whether it's firmware's problem or not. Have you made any progress? Thanks.