cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

Ivan_Lee
Contributor

We modify cyfxisosrcsink example code to disable USB3.0. let it only work on USB2.0

We have two question:

1). if MaxPktSize  = 3, the streamer application can't recognize ISO endpoint.

2). if MaxPktSize  = 2, the streamer application can recognize ISO endpoint, but throughput is only 15900 bytes per second.

How to improve it?

0 Likes
1 Solution
YashwantK_46
Moderator
Moderator

Hello,

The Streamer application is designed to test the maximum throughput capable by squeezing IN or OUT tokens from a Cypress Device (FX2LP/FX3).

When you are using the isochronous data transfers and the streamer application, the throughput can be limited from the host side i.e the host may not be able to stream OUT the data as fast as we are requesting it to, through the streamer application and hence the failures will be reported.

The failures are due to the fact that the streamer application is trying to stream out the data faster than the capacity that the device and the host can handle.

The streamer application will try to transfer a buffer of size = maximum packet size * packets per xfer at once and queue up Xfers per Queue number of buffers.

Failures will be reported if the FinishXferData fails or the data in the packet is invalid.

As mentioned, the maximum throughput achievable is also dependent on the Host controller.

Please make sure that the packet size is set to 1024 and the mult value is set to 3 for both the endpoints in your firmware.

Reduce the Packets per Xfer and the Xfers per Queue in the streamer application to avoid failures and check the maximum throughput achievable without failures.

Also make sure that the streamer application is restarted and then you change the parameters every time before starting the streaming.

Regards,

Yashwant

View solution in original post

0 Likes
9 Replies
Ivan_Lee
Contributor

Hi, Sir,

I modify high speed usb descriptor and use Streamer to test it.

1. ISO-IN maximun transfer rate is 23M bytes per second

2. ISO-OUT  maximun transfer rate is 9M bytes per second, How to improve transfer rate of ISO-OUT?

/*
Standard high speed configuration descriptor */

constuint8_t CyFxUSBHSConfigDscr[] __attribute__((aligned
(32))) =

{

    /*
Configuration descriptor */

  
0x09,                         
/*
Descriptor size */

    CY_U3P_USB_CONFIG_DESCR,       /*
Configuration descriptor type */

  
0x29,0x00,                    
/*
Length of this descriptor and all sub descriptors */

  
0x01,                         
/*
Number of interfaces */

  
0x01,                        
/*
Configuration number */

  
0x00,                         
/*
COnfiguration string index */

  
0x80,                         
/*
Config characteristics - bus powered */

  
0x32,                         
/*
Max power consumption of device (in 2mA unit) : 100mA */

    /*
Interface descriptor: Interface 0, Alt setting 0 - No endpoints */

  
0x09,                         
/*
Descriptor size */

    CY_U3P_USB_INTRFC_DESCR,       /*
Interface Descriptor type */

  
0x00,                         
/*
Interface number */

  
0x00,                         
/*
Alternate setting number */

  
0x01,                         
/*
Number of end points */

  
0xFF,                         
/*
Interface class */

  
0x00,                         
/*
Interface sub class */

  
0x00,                         
/*
Interface protocol code */

  
0x00,                         
/*
Interface descriptor string index */

    /*
Endpoint descriptor for producer EP */

  
0x07,                                                             
/*
Descriptor size */

    CY_U3P_USB_ENDPNT_DESCR,                                           /*
Endpoint descriptor type */

CY_FX_EP_PRODUCER, /* Endpoint
address and description */

    CY_U3P_USB_EP_ISO,                                                 /*
Isochronous endpoint type */

  
(CY_U3P_GET_LSB(CY_FX_ISO_MAXPKT)),                               
/*
LS Byte of maximum packet size. */

  
(CY_U3P_GET_MSB(CY_FX_ISO_MAXPKT)
| ((CY_FX_ISO_PKTS - 1) << 3)), 
/*
MS Byte of max. packet size and MULT. */

  
0x01,                                                             
/*
Servicing interval for data transfers */

    /*
Interface descriptor: Interface 0, Alt setting 1 - Two endpoints */

  
0x09,                         
/*
Descriptor size */

    CY_U3P_USB_INTRFC_DESCR,       /*
Interface Descriptor type */

  
0x00,                         
/*
Interface number */

  
0x01,                         
/*
Alternate setting number */

  
0x01,                         
/*
Number of endpoints */

  
0xFF,                         
/*
Interface class */

  
0x00,                         
/*
Interface sub class */

  
0x00,                         
/*
Interface protocol code */

  
0x00,                          
/*
Interface descriptor string index */

    /*
Endpoint descriptor for consumer EP */

  
0x07,                             
                               
/*
Descriptor size */

    CY_U3P_USB_ENDPNT_DESCR,                                           /*
Endpoint descriptor type */

  
CY_FX_EP_CONSUMER,                                                
/*
Endpoint address and description */

    CY_U3P_USB_EP_ISO,                                                 /*
Isochronous endpoint type */

  
(CY_U3P_GET_LSB(CY_FX_ISO_MAXPKT)),                               
/*
LS Byte of maximum packet size. */

  
(CY_U3P_GET_MSB(CY_FX_ISO_MAXPKT)
| ((CY_FX_ISO_PKTS - 1) << 3)), 
/*
MS Byte of max. packet size and MULT. */

  
0x01                                                              
/*
Servicing interval for data transfers */

};

0 Likes
YashwantK_46
Moderator
Moderator

Hello,


Can you please share your project so that I can reproduce it on my end?

I have tried and found that the ISOC IN throughput is 15900 Bytes as you pointed out in the first response but didn't get the 23MBps throughput that you shared in the second response.

Please share your project so that I can review and reproduce it on my end.


Regards,
Yashwant

0 Likes
Ivan_Lee
Contributor

Hi, Yashwant,

   Attached is my test code, please connect FX3 EVK to USB2.0 port.

   and how to solve "bad packet" issue while running Steamer application?  

BR

Ivan

0 Likes
Ivan_Lee
Contributor

Hi Yashwant

Do you have any update ?

BR

Ivan

0 Likes
YashwantK_46
Moderator
Moderator

Hello Ivan,

Thank you for sharing the project.

The device is connected to a USB 3.0 port on my PC but the CyU3PConnectState() API, i have disabled the ssEnable parameter which makes the device enumerate as a USB 2.1 device as seen below in the control center (BcdUSB).

I have noticed a similar throughput for the ISOC IN endpoint at 23.9MBps.

But the throughput for ISOC OUT endpoint is as shown:

pastedImage_0.png

Also, in the first interaction, I can see that you are only requesting Packets per Xfer = 8 and Xfers to Queue = 16.
This is a performance limitation since the host will only request the bandwidth equivalent to (8*16KBps).


In order for the device to perform better, you can tweak the above two parameters such that the host requests for the maximum data from the device to utilize the maximum bandwidth.

Regards,
Yashwant

0 Likes
Ivan_Lee
Contributor

ISO_OUT.pngHi, Yashwant

Could you please provide me your test code?

i test ISO-OUT, the transfer rate = 17.5Mbyes and it has more bad pakts.

BR

Ivan

0 Likes
YashwantK_46
Moderator
Moderator

Hello Ivan,

I have only changed the CyU3PConnectState() API to make the device enumerate as a USB 2.0 on my PC.

And no other changes are made to the firmware you shared.

Also, can you try setting Packets per Xfer to 128 and Xfers per Queue to 16 and see if you are facing any issues?

To understand more about the Bad Pkts, you can go through the cop source of streamer application present in the path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\cpp\streamer

In streamer.h file of the project, the function XferLoop() {line: 805} is responsible for the data transfers.
The failure count (Failures ++) is incremented when the FinishDataXfer() API fails as shown in the picture below.

pastedImage_9.png

Regards,

Yashwant

0 Likes
Ivan_Lee
Contributor

Hi, Yashwant,

I changed the CyU3PConnectState() API to make the fx3 enumerate as a USB 2.0

and set Packets per Xfer to 128 and Xfers per Queue to 16 to test it.

Test result :

ISO-IN  = 23.8Mbytes without any bad pakts.

ISO-OUT = 19Mbytes with 10% bad pakts ( Good pkts = 317536 , Bad pakts = 30624 )

BR

Ivan

0 Likes
YashwantK_46
Moderator
Moderator

Hello,

The Streamer application is designed to test the maximum throughput capable by squeezing IN or OUT tokens from a Cypress Device (FX2LP/FX3).

When you are using the isochronous data transfers and the streamer application, the throughput can be limited from the host side i.e the host may not be able to stream OUT the data as fast as we are requesting it to, through the streamer application and hence the failures will be reported.

The failures are due to the fact that the streamer application is trying to stream out the data faster than the capacity that the device and the host can handle.

The streamer application will try to transfer a buffer of size = maximum packet size * packets per xfer at once and queue up Xfers per Queue number of buffers.

Failures will be reported if the FinishXferData fails or the data in the packet is invalid.

As mentioned, the maximum throughput achievable is also dependent on the Host controller.

Please make sure that the packet size is set to 1024 and the mult value is set to 3 for both the endpoints in your firmware.

Reduce the Packets per Xfer and the Xfers per Queue in the streamer application to avoid failures and check the maximum throughput achievable without failures.

Also make sure that the streamer application is restarted and then you change the parameters every time before starting the streaming.

Regards,

Yashwant

View solution in original post

0 Likes