Weird phenomenon in RT1052 while transmit massive data through usb

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Weird phenomenon in RT1052 while transmit massive data through usb

991 Views
eric_yp_chen
Contributor I

Hi all

I'm facing a weird problem when using usb_vcom_bm on rt1052.

Example as below (modify from official usb_vcom_bm sdk example)

It should transmit over 30000 bytes at once from rt1052 to pc after receiving a command code.

int main(void)

{

   InitBoard();

   InitUSB();

   while(1)

   {

      AppUsb(); //Receive command

      AppUsbTransmit();  //Transmit massive data after received command flag

   }

}

However , it seems not stable after this usb device enumerated.

We got a terrible throughput at beginning, after few seconds , throughput raised and never decrease.

Only when this device is re-plug into pc (Re-enumerated) happens.

I did use usb protocol analyzer to check the transmission, nothing weird.

Any suggestions ?  

Labels (4)
0 Kudos
6 Replies

826 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Eric, 

What version of the SDK are you using? Just to confirm that I understood correctly the behavior that you are facing. When you flash your application, at the beginning you are getting a low throughput, but after a couple of seconds the throughput goes to what you are expecting and if you re-plug the USB cable then the throughput is the expected since the beginning, is my understanding correct? 

Regards, 

Victor 

0 Kudos

826 Views
eric_yp_chen
Contributor I

Hi Victor 

I'm using SDK 2.7.0

You're correct !

0 Kudos

826 Views
mjbcswitzerland
Specialist V

Hi

Load the attached binary to your i.MX RT 1050-EVK board and do the following tests:

- it enumerates on the USB interface next to the Ethernet connector as USB-MSD and USB-CDC composite device
- connect the USB cable and open a terminal emulator on it
- Hit enter and then move to the USB menu (6)
- Command "usb-tx" to command it to send 10MBytes of a data pattern to the terminal
- At the same time drag and drop the file "SPI_flash.bin" from the "DATADISK1" that will also have appeared to a director on the PC (this file contains the complete image of the 64MByte hyperflash device on the board).
- Afterwards you can also use the command "usb-serial" to create a bridge between the terminal and the LPUART interface (debug VCOM), although this throughput is limited by the LPUARt speed of 115kBaud.

Generally you will see that USB-MSD will copy data at about 6MBytes/s and the CDC output data is slower, and not really affected by the USB-MSD operation. It seems that the PC will give less bandwidth to the CDC or/and the terminal emulator will not necessarily process the data being sent fast enugh to allow the full bandwidth to be reached.

Therefore you may find that any issues you have could be related to the behavior of terminal emulator (or whatever program is receiving the data)  being used. I find TeraTerm will receive CDC data up to about 500kBytes per second whereby the i.MX RT 1050 could send much faster but needs to wait for it to poll additional bulk data (confirmed by the fact that USB-MSD transfers in parallel are much quicker).

If you have difficulties loading the binary see this document for a guide: https://www.utasker.com/docs/iMX/uTaskerLoader_TestDrive.pdf
Since the binary contains a complete secure serial/OTA loader and application solution you can also play around with its many other features too.
The same application runs on any i.MX RT 1010..1064 without any porting effort.

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]

0 Kudos

826 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Eric, 

Thank you for the confirmation! Could you please tell me how are you verifying that at the beginning the throughput is low but after a couple of seconds the throughput goes to what you are expecting? 

Regards, 

Victor 

0 Kudos

826 Views
eric_yp_chen
Contributor I

Hi Victor

I took LeCroy USB protocol analyzer to verify throughput.

Regards,

Eric

0 Kudos

826 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Eric, 

Thanks for the confirmation. I checked this internally as and what Marke mentioned at the end of his reply might be the cause of this behavior.

Most of the time the throughput doesn't depend on the device (in your case the RT) but in the HOST and bandwidth that the HOST gives to the device. Based on the information that you provided, it seems that at the beginning your HOST assigns a low bandwidth to your device and after some time it increases this bandwidth when it realizes that there aren't any more devices. 

One way to see if this is the reason for this behavior would be to test this with a different HOST, a different PC preferably not running the same OS would be a good option.

Regards, 

Victor 

0 Kudos