- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi, i have a CY1306A in my board. i am coding in C++(Qt platform) in windows 10. i want to resist my code on re-plugging usb.
this is my code:
void MainWindow::new_Data(){// run every 40 ms with a timer trig
CCyUSBDevice USBDevice;
short int numDevices = USBDevice.DeviceCount();
if(numDevices==1){if(USBDevice.IsOpen()){
LONG length = PACKET_SIZE;is_ok=USBDevice.BulkInEndPt->XferData((PUCHAR)xferBuffer_in[0], length , (CCyIsoPktInfo*)0,false);}
}
}
but sometime it works good and some times it crashes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
- Is the device being used CY7C68013A?
- I understand that new_Data() is being executed every 40mS right?
- Every time this function is run, you need to send data in xferBuffer_in of length PACKET_SIZE over the Bulk endpoint right?
- When you say "it crashes", do you mean the XferData() is returning false OR is the application crashes?
Regards,
Hemanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, the device is CY7C68013A. and every 40 ms new_Data() is executed. i need to read data in xferBuffer_in of length PACKET_SIZE over the Bulk endpoint.
it crashes means application crashes.
is it possible that when the code check true the conditions and waiting for receive data, usb disconnected and it crashes.is there any solution for this?