USB reading/writing 0 bytes | Cypress Semiconductor
USB reading/writing 0 bytes
I am using FX2 controller on a fpga board with CyUSB driver and trying to get data from the fpga using Visual C++2010.
I did program the fpga with an application that came with that fpga board successfully using verilog HDL. Then using C++ I checked all configurations and endpoints and they looked correct. This is my code in short:
I chose Interface which showed 6 bulk end points.
CCyUSBDevice *USBDevice = new CCyUSBDevice(NULL, GUID_KNJN_FX2);
CCyUSBConfig cfg =USBDevice->GetUSBConfig(0);
CCyUSBInterface *ifc =cfg.Interfaces;
CCyUSBEndPoint *BulkOutPipe0=ifc->EndPoints;//defined other endpoints similarly
unsigned char buf='A';long len=1;
now when I use XferData(&buf,len) with any bulkoutpipe, I get len=0. For read operation the buffer is returned empty with len=0;
1. I tried changing Bulkpipe->Timeout values but I get above immediately without any wait time.
2. I tried modifying the HDL state machine. It will wait for any character and then send values. Above I tried to write and then read but it did not work. Even when I configure fpga to send data continuously, I dont get any value using Xferdata read.
3. I get usbdstatus success and ntstatus 0 during both reading and writing.
Am I missing something here? Do I need to set configuration of some other endpoint before using Xferdata()? If I get no error any idea what can be happening? I don't see anything wrong in the hdl code as well. I am hesitant to try begindataxfer() method.
Please let me know anything that can be done to solve this issue.