Hi there,
I am trying to transfer large files(larger than 1MB) with fx2lp. Actually, I just followed AN61345(Implementing an FX2LP™-FPGA Interface). It worked well on EZ-USB console, 512 bytes send to ep2, 512 bytes back to ep6.
Then I made a app with VC6. Divide the large file to 512 bytes packets, and transfer them via Xferdata() fuction. The code is
for(i=0;i<pcount;i++)
{
for(j=0;j<buf_size;j++){usb_i[j]=sig_i[buf_size*i+j];}
if(USBDevice->BulkOutEndPt)
i_finish=USBDevice->BulkOutEndPt->XferData(usb_i,buf_size);
if(USBDevice->BulkInEndPt)
o_finish=USBDevice->BulkInEndPt->XferData(usb_o,buf_size);
for(j=0;j<buf_size;j++) {sig_o[buf_size*i+j]=usb_o[j];}
}
When the files are small(<20kB), it works well. Every step ep6 become empty when the data is read by host.
If the file is larger, as the process continus, ep6 will not be empty sometime and all the followed data is error code(always CD).
I am using cy3684_kit_15, hope someone help me to find the reason or give some advice.
Thanks!
|