- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
soft environment:
ubuntu 16.04 + cyusb3014
Problem Description:
My goal is to get the data uploaded by cyusb3014,but whenever the program runs for 4-5 hours, the reception timeout will suddenly appear.
With the help of monusb under linux,I caught it at that moment, urb status = -2,and no matter what I call cyusb_reset_device() or cyusb_clear_halt(),it can't afford any effect。
so, What causes this phenomenon? How can I perform the operation to let the reception continue?
I am looking forward to your reply. This problem has been bothering me for a week.
--------------------------------------------------------------------------------------------------------------
Attach my code about bulk transfer:
bool USBHandler::USBIn(unsigned char * buffer, size_t bufferSize){
HANDLENotNULL;
int r;
libusb_context *ctx = NULL;
struct libusb_transfer *transfers = libusb_alloc_transfer (0);
int transferred = 0;
int pkg_size=1228800;
if (transfers == NULL)
{
printf ("Failed to allocate buffers and transfer structures\n");
free_transfer_buffers (transfers);
return false;
}
libusb_fill_bulk_transfer (transfers, getRealHandler(h1), 0x83,buffer, 1228800, xfer_callback, NULL, 100);
r = libusb_submit_transfer (transfers);
cout<<"submit status:"<<r<<endl;
if(r<0)
{
// libusb_cancel_transfer(transfers);
free_transfer_buffers(transfers);
return false;
}
SetTransmitPicure(1);
do
{
libusb_handle_events (NULL);
} while ((!get_one_frame)&&(!error_happen)&&(!time_out_happen));
if(error_happen)
{
Reset();
}
if(time_out_happen)
{
//Reset();
}
cout<<"error_count:"<<error_count<<endl;
cout<<"transfer timeout_count:"<<time_out_count<<endl;
if((error_happen)||(time_out_happen))
{
error_happen = 0;
time_out_happen = 0;
return false;
}
get_one_frame = 0 ;
return true;
}
void USBHandler::xfer_callback (
struct libusb_transfer *transfer)
{
int r = 0;
switch (transfer->status)
{
case LIBUSB_TRANSFER_COMPLETED:
cout<<"transfer complete!"<<endl;
get_one_frame = 1;
free_transfer_buffers(transfer);
break;
case LIBUSB_TRANSFER_ERROR:
error_happen = 1;
error_count++;
cout<<"transfer uncomplete!"<<endl;
libusb_cancel_transfer(transfer);
free_transfer_buffers(transfer);
break;
case LIBUSB_TRANSFER_TIMED_OUT:
time_out_happen = 1;
time_out_count++;
libusb_cancel_transfer(transfer);
free_transfer_buffers(transfer);
break;
default:
error_happen = 1;
error_count++;
cout<<"other error happen!"<<endl;
libusb_cancel_transfer(transfer);
free_transfer_buffers(transfer);
break;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Supplement:
Before I did the development based on windows+cyusb3014, I have been using it for a year or so, and there is no problem. This time, based on the development under the ubuntu environment, there is a problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
- Is FX3 running in 2.0 mode Or 3.0?
- Verify through DebugPrints if FX3 is reporting CYU3P_USBEP_SS_RESET_EVT event.
Please also refer to the below thread:
ASMedia FX3 EP hangs on USB 3.0 eXtensible Host Controller
- Check if there are any error prints from the device when the issue occurs (From your post, the frequency of issue occurrence is once in few hours. Am I right?)
Regards,
Hemanth