MQX4.0 USB data transmission

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

MQX4.0 USB data transmission

1,005 Views
qianmingzhu
Contributor II

Hi, Martin.

First of all , thanks a million for your help all the time.

     These days I'm gonna use twrk60n512 as a USB device to communicate with the PC. I'd like to make the twrk60n512 a co-processor and transmit a nearly 100k configuration file or some real-time data between the PC and twrk60n512. I have tried the MQX4.0 USB CDC virtual com example and found that the MAX size of a transmission packet is 64 bytes at full-speed.If I sent a 68 bytes string, the Uart printf could only print out the last four bytes. But it seems that the twrk60n512 has recieved all the bytes. Is it correct?

     According to the introduction of the official manuals, K60 seems only support the low-speed and full-speed of USB 2.0. So the MAX size of a buffer packet is 64 bytes at the bulk endpoint in or out. Only high-speed model can support 512 bytes? Ultimately, should I use the CDC example to satisfy my requirement above?

     PS:  In the MSD example or others, the maximun speed of one-way transmission is? how many in bytes per second?

Thanks a million!!!!!

                                                                                                                                            Ming

Labels (1)
Tags (3)
0 Kudos
4 Replies

499 Views
timias
Contributor IV

You MAX payload is not limited to 64 bytes, that is just the size of the transmission packet.

USB_Class_CDC_Send_Data( can accept buffers larger than 64, it will just internally break it into multiple 64 byte packets. This is not something you typically need to worry about with a few exceptions.

If you call USB_Class_CDC_Send_Data once per byte - say you are forwarding a serial stream and everytime you receive a single byte you pass it along - this will perform very poorly. I Know I tried it. You are best off caching the byte until you reach 64 or a small amount of time passes and then calling the USB_Class_CDC_Send_Data function.

The other problem might be very larger buffers- though I can't confirm this. I send about a 300 byte buffer with USB_Class_CDC_Send_Data all the time.

499 Views
qianmingzhu
Contributor II

That is it!  I didn't try to send data more than 64 bytes once. I will have a try.

And I have created a demo to measure the USB transmission rate, the stable rate is only 200KB/sec.

Do you have any idea to promote this?:smileygrin:

0 Kudos

499 Views
Martin_
NXP Employee
NXP Employee

Hi Ming,

check this:

https://community.freescale.com/message/330833#330833

you need to keep the usb controller busy, thus, prepare data for next transmission while the actual transmission is on-going.

0 Kudos

499 Views
qianmingzhu
Contributor II

:smileysad::smileysad::smileysad::smileysad:Anybody could give me one small hand?

0 Kudos