cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

MaLi_3529141
New Contributor

We use CYUSB3KIT-001 to connect to TypeC HUB and encounter FX3 streaming media transmission failure problem.
A few transfers were successfully transferred at first, and then the transfer continued to fail.
Once the transmission fails, the transmission cannot be continued.
The same problem occurs bulk in and bulk out.

But using USB storage for transfer is successful.

We want to ask:
1. The reason for the transmission failure?
2. Is there any way to solve this problem?
3. What is the difference between Streamer and Storage transmission?

FX3+HUB Bulk in Fail.PNGFX3+HUB bulk out Fail.PNGS__28631043.jpg

0 Likes
21 Replies
Rashi_Vatsa
Moderator
Moderator

Hello,

Please let me know which firmware is used for the application.

Is the issue seen when  the kit is directly connected to the host PC?

1. The reason for the transmission failure?

>> Please program bulksrcsink firmware of the FX3 SDK 1.3.4 , try the streaming using streamer and share the UART debug prints.

But using USB storage for transfer is successful.

>> Which kit and firmware was used for this test.

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello,

 

Is the issue seen when  the kit is directly connected to the host PC?

-> The kit is directly connected to the host without this issue.

 

1. The reason for the transmission failure?

>> Please program bulksrcsink firmware of the FX3 SDK 1.3.4 , try the streaming using streamer and share the UART debug prints.

-> 

USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 92

 

But using USB storage for transfer is successful.

>> Which kit and firmware was used for this test.

-> The device I use is a commercially available USB flash drive.

Regards,
Manu

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

As the streaming working without errors when directly connected to host (without hub), the problem might be with way USB connection is done (i.e. the adapter and type c hub) 

From the debug prints it seems that the device is in U2 state (low power mode). Try streaming (using streamer application) with the attached project and share the UART debug prints.  I have modified the default bulksrcsink project to disable the LPM

Please confirm if SDK 1.3.4 is being used.  Please check the build_variable in your project settings.

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

I reinstalled SDK1.3.4, and confirmed the version.

FX3_1.3.4.PNG

 

The problem remains unresolved.

 

Log when USB Cable plug in is added:

USB EVENT: 11 0
USB LOG: 2
USB LOG: 6
USB LOG: 83
USB EVENT: 0 1
USB LOG: 88
USB LOG: 12
USB LOG: 89
USB LOG: 8A
USB LOG: 90
USB LOG: 25
USB LOG: 26
USB EVENT: 8 0
USB EVENT: 5 1
USB LOG: 17
USB LOG: 91
USB LOG: 99
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 92
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 92
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 99
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 92

 

After pressing the start button:

USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 92

 

 

Regards,
Manu

 

Loga segment of the trunk of a tree when stripped of branchesMore (Definitions, Synonyms, Translation)

0 Likes
MaLi_3529141
New Contributor

Hello Rashi,


I reinstalled SDK 1.3.4, and checked the build_variable to confirm that it was SDK 1.3.4, the same situation still occurs.

 

FX3_1.3.4.PNGbulk example.PNG

 

Log:
-------
TypeC Cable plug in:

USB EVENT: 11 0
USB LOG: 2
USB LOG: 6
USB LOG: 83
USB LOG: 83
USB LOG: 83
USB LOG: 83
USB LOG: 83
USB LOG: 83
USB LOG: 83
USB EVENT: 2 0
USB LOG: 80
USB LOG: 10
USB LOG: 4
USB LOG: 5
USB LOG: 40
USB EVENT: 0 0
USB EVENT: 4 0
USB EVENT: 0 1
USB LOG: 41
USB LOG: 51
USB LOG: 88
USB LOG: 12
USB LOG: 42
USB LOG: 89
USB LOG: 8A
USB LOG: 90
USB LOG: 25
USB LOG: 26
USB EVENT: 8 0
USB EVENT: 5 1
USB LOG: 17
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 99
USB LOG: 90
USB LOG: 91
USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 92


---
After pressing the start button:

USB LOG: 98
USB LOG: 90
USB LOG: 91
USB LOG: 92


Where else can I analyze from?

 

Regards,

Manu

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

Please try disabling LPM in the default bulksrcsink firmware using CyU3PUsbLPMDisable API and check for the issue. Call this API after the CyU3PConnectState with 10 us delay.

If the problem is still seen please share the UART debug prints with the above workaround

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

 

I found eight places that have the CyU3PConnectState API

Will these eight places call CyU3PUsbLPMDisable after 10us?

cypress01.PNG

Regards,

Manu

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

Please try calling CyU3PUsbLPMDisable after 10us of calling CyU3PConnectState API at this instance in default bulksrcsink firmware and let me know if this helps.

    CyU3PDebugPrint (4, "About to connect to USB host\r\n");

    /* Connect the USB Pins with super speed operation enabled. */
    if (!no_renum) {

        apiRetStatus = CyU3PConnectState(CyTrue, CyTrue);
        if (apiRetStatus != CY_U3P_SUCCESS)
        {
            CyU3PDebugPrint (4, "USB Connect failed, Error code = %d\n", apiRetStatus);
            CyFxAppErrorHandler(apiRetStatus);
        }

    }
    else
    {
        /* USB connection is already active. Configure the endpoints and DMA channels. */
        CyFxBulkSrcSinkApplnStart ();
    }

  

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

I tried to call CyU3PUsbLPMDisable after calling CyU3PConnectState API 10us, the problem still exists.

FX3_210312.PNG

 

Regards,

Manu

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

Please call CyU3PUsbGetErrorCounts API in a for loop to check and print the number of USB 3.0 PHY and LINK error counts detected by FX3

Please share the complete UART debug prints for us to check the USB logs and the USB 3.0 PHY and LINK error counts with the workaround implemented.

Along with this also capture the USB traces using software analyzer like Wireshark. This will help us know to know the bus activity.

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

Is the USB 3.0 PHY and LINK error count added to CyFxAppErrorHandler() like this, or is it added elsewhere?

cypress_error_message.PNG

Regards,

Manu

 

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

CyU3PUsbGetErrorCounts can be called in the for loop (for(;;)) of BulkSrcSinkAppThread_Entry function.

uint16_t phy_error =0, link_error = 0; //global variable 
// BulkSrcSinkAppThread_Entry//
  for (;;)
    {
    	if(glIsApplnActive){
    		stat = CyU3PUsbGetErrorCounts(&phy_error,&link_error);
    		if(stat == 0)
    	      CyU3PDebugPrint (4, "\n\n PHY Error = %d, Link error = %d \r\n",phy_error,link_error);

    	}
......
}

Please share the complete UART debug prints for us to check the USB logs. Along with this also capture the USB traces using software analyzer like Wireshark. This will help us know to know the bus activity.

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

I added debug code, but phy_error and link_error did not increase when a problem occurred.

Is there any other way?

fx3 debug log.PNG

fx3 debug code.PNG


Regards,

Manu

0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

Here is the wireshark log.

For your reference, thank you.

Regards,

Manu

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

Thank you for the Wireshark traces. I understand that the passing trace was taken when the device is directly connected to the host pc. Is my understanding correct?

From the Failure trace, I could see that USBD_STATUS_STALL_PID is returned for BULK IN transfer.

As the endpoint is stalled, it is expected that host sends a clear feature request 

The clear feature request can be handled in the firmware as done in GPIF to USB example  (SDK path -..\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxgpiftousb) of the SDK. The host application need to be modified such that clear feature request is sent by the host on seeing the stalled endpoint

Error recovery can also be done through these operations  mentioned here How to recover from USB pipe errors - Windows drivers | Microsoft Docs 

1) Reset the USB pipe

2) Reset the USB port to which the device is connected

3) Cycle the USB port to re-enumerate the device stack for the client driver

Please share the firmware for us to check after the modifications are done.

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

1. We want to find the reason why the endpoint is stalled, any suggestions?
2. Can the transmission be resumed without re-enumerating it?

Regards,

Manu

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello,

1. We want to find the reason why the endpoint is stalled, any suggestions?

>> Please refer to subsection IV in section 2.3 of FX3 Trouble shooting Guide

2. Can the transmission be resumed without re-enumerating it?

>> The problem is due to poor USB 3.0 link which includes the adapter that is being used in your setup.

If you are using bulksrcsink firmware of the SDK, it handles the CYU3P_USBEP_SS_RETRY_EVT events. When there is poor signal quality (errors in received data) the host does not receive the
data send by the device. Hence, it asks for same packet with retry bit set. On getting retries, CYU3P_USBEP_SS_RETRY_EVT will be triggered. 

To recover from this the workaround mentioned in  subsection IV in section 2.3 of FX3 Trouble shooting Guide need to be implemented. Default bulksrcsink firmware implements the workaround but the host is expected to send a clear feature request on seeing the endpoint stall (USBD_STATUS_STALL_PID). On receiving the clear feature request from the host, the firmware will reset the DMA channel and clear the endpoints.

Host application should send clear feature request to clear the stall over the endpoint
Snippet to handle this in the host application.
if (!endpoint->FinishDataXfer()) {
 if (endpoint->UsbdStatus == USBD_STATUS_STALL_PID) {
 std::cout << "stall detected, resetting endpoint" << std::endl;
 if (!endpoint->second->Reset()) {
 std::cerr << "Reset() failed" << std::endl;
 }
 }
}

As you are using streamer application from the SDK, you can try implementing the above code snippet and rebuild the application . Please take a backup of the original streamer application.

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,

We will not encounter this problem when we use this TypeC HUB to use storage
Is there any difference between storage and bulk Streamer transfer?

Regards,

Manu

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

Could you please let me know which firmware is used for the storage and which host application is used with it?

Regards,
Rashi
0 Likes
MaLi_3529141
New Contributor

Hello Rashi,


We connected a USB flash drive behind the TypeC Hub. It was accessed from the OS and there was no transmission interruption.


Regards,

Manu

0 Likes
Rashi_Vatsa
Moderator
Moderator

Hello Manu,

Please let me know if the same adapter (USB type B to Type A converter) is used to connect the USB Flash to Type C Hub.

I understand that the USB Flash drive (which generally comes with USB Type A connector) would be directly connected to the USB Hub without the adapter. Please confirm

As the USB link errors cause the problem, we recommend to used USB IF certified cables to connect the device (CYUSB3KIT - 001) to the  USB host via USB hub

Regards,
Rashi
0 Likes