Cypress CYUSB3KIT-003 USB3 device crash

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

Maybe one of you has encountered similar problems or can give some advice on this topic. Please see the problem description below:

Preliminary System Setup:

We use the Cypress CYUSB3KIT-003 USB3 device to stream a bigger amount of data from an FPGA capture card to a PC via USB3. The data streamed is composed within the FPGA to a BGR video pixel stream in HD resolution. On the PC side we have a Windows application which uses the Cypress API to access the USB device.

The PC application uses the CCyUSBEndPoint and the CCyUSBDevice API classes to ‘open’ a USB end point.

Our Problem:

During a session it possible that the USB device does not retrieve any new data from the FPGA capturer going to a time out. This could happen several times in a short time period. This causes either the application waiting for a transfer to be done or the USB driver crashes. After such a crash the device has to be reseted by pulling the USB connector to the PC.

The following approach for the communication with the USB device via the driver is used:

1. USB initialize:

   1.1 Open usb device and checks it, if it does not satisfy the conditions, then disconnects it and try to connect again. If a video stream disconnect signal appears, stop trying to connect.

   1.2 Create an array of empty buffers and a pointer to the OVERLAPPED structure and reset them, start the transfer.

2. Data transfer cycle:

   2.1 Wait for the end of the transfer of the i-th element.

   2.2 Finish the transfer of the element and save its status.

   2.3 Status handling:

      2.3.1 If an error is received at the end of the transfer or the overflow counter is greater than 8:

         2.3.1.1 Clear all information and delete the buffer pointers.

         2.3.1.2 USB initialize[1]

      2.3.2 Process the received data, save it and restart the transfer[2].

      2.3.3 Increment the transfer counter, to go to the next pointer in the OVERLAPPED structur

0 Likes
1 Solution

Hi,

--> During a session it possible that the USB device does not retrieve any new data from the FPGA capturer going to a time out. This could happen several times in a short time period. This causes either the application waiting for a transfer to be done or the USB driver crashes.

If you go through the implementation of "Streamer" Application source code that is available with the FX3 SDK, you will find that whether there is any data streaming from the device or not it will never crash, timeout will happen but not crash.

I suggest you to implement your application in the such a way that it will not crash even with no data.

I am attaching the code snippet of the Streamer application for your reference:

for (;bStreaming;)                                                                                 

            {

                long rLen = len; // Reset this each time through because

                // FinishDataXfer may modify it

                if (!EndPt->WaitForXfer(&inOvLap, TimeOut))    

                {

                    EndPt->Abort();

                    if (EndPt->LastError == ERROR_IO_PENDING)

                        WaitForSingleObject(inOvLap.hEvent,2000);

                }

For complete code you may refer to Streamer.h file on "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\cpp\streamer"

Thanks & Regards

Abhinav

View solution in original post

0 Likes
5 Replies