- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I'm wrting a very simple program to send file to USB as follows:
... LONG count;
while(!feof(fp)){
count=fread(buffer,1,BUFSIZE,fp);
USBDevice->BulkOutEndPt->XferData(buffer, count,NULL);
} ...
#define BUFSIZE 0x100000
and I also use asynchonous method :
...
LONG count;
while(!feof(fp)){
count=fread(buffer,1,BUFSIZE,fp);
UCHAR *outContext = USBDevice->BulkOutEndPt->BeginDataXfer(buffer, count, &outOvLap);
USBDevice->BulkOutEndPt->WaitForXfer(&outOvLap,100);
USBDevice->BulkOutEndPt->FinishDataXfer(buffer, count, &outOvLap,outContext);
}
...
The two methods both run OK By USB2.0, but By USB3.0, They can only send a little data and then fail.
Please help me!
Thanks & Best Regards,
Shakaqrj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Shakaqrj,
Your code snippet looks fine. This can be an issue in your firmware or in your board too
In order to isolate . Please do the following
1) Program the device with Bulk loop example project and test with our Control Center and Streamer applications. Ensure device has enumerated as USB3.0 .If this work there is no issue in your board .
2) Program the device with your project . Ensure device is in USB3.0. Try sending the data using Control Center and see if you are seeing any issue . If there is no issue then it is not your FX3 firmware issue.
3) Program the device with Bulk Loop project and try using your host application and see if it work.
Try to figure which among the above 3 cases cause failure . A USB traces would help you in resolving this issue faster.
-sobi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Sobi,
If I use Control Center to send data less then 16KB, it runs OK, But If I send data with large size, it fails both in USB2.0 and USB3,0.
If I use my tool to send data, there is no problem both in USB2.0 and USB3.0 unless data size. But In USB 3.0, I can't send data even more than 8KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Now I program USBBulkLoopManualInOut.img to RAM, and write code like this,
#define BUFSIZE 0x1000
void CTestUSBDlg::OnBnClickedButtonSend()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(TRUE);
if(dlg.DoModal()==IDOK){
FILE* fp=_tfopen(dlg.GetPathName(),_T("rb"));
FILE* fw=_tfopen(_T("READBUFFER"),_T("wb"));
fseek(fp,0,SEEK_SET);
unsigned char* buffer=new unsigned char[BUFSIZE];
LONG count;
while(!feof(fp)){
count=fread(buffer,1,BUFSIZE,fp);
USBDevice->BulkOutEndPt->XferData(buffer, count,NULL);
memset(buffer,0,BUFSIZE);
USBDevice->BulkInEndPt->XferData(buffer,count,NULL);
fwrite(buffer,1,count,fw);
}
fclose(fw);
fclose(fp);
delete[] buffer;
}