Two questions regarding the virtual serial device (nxpusblib, lpc1788)

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

Two questions regarding the virtual serial device (nxpusblib, lpc1788)

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Mon Jul 09 05:58:26 MST 2012
Hello!

I am new to NXP uCs (and ARM processors in general) and to USB, so I was trying to use the VirtualSerialDevice example from the current version of nxpusblib.
Compiling and programming went well and (after installing the driver) I do have a virtual serial port available in HTerm.

However when I sent any byte of data I got a not ending stream of reply data. I fixed that with the small patch from Vu Nguyen (http://lpcware.com/content/forum/nxpusblib-dualvirtualserial-example#comment-1419). Now I can send single bytes just fine and get the correct response. But when sending multiple bytes I get wrong data back (e.g. sending "123", receiving "11").
How would I fix that?


Also I have a general question about the baud rate. It didn't seem to matter which baud rate setting I chose in HTerm. Everything worked like above. From 300 baud to 15 Mbaud (which is faster than Full-Speed USB). Also I can't seem to find a setting for that in the nxpusblib.
The documentation (or at least the parts that I read) didn't say anything about that either.
Can someone explain how I can set the actual speed of that port? And what is the maximum possible?


Best regards,
Tim
Labels (1)
0 Kudos
Reply
5 Replies

1,066 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Fri Jul 13 02:12:55 MST 2012
Hello tuong!

I wrote myself a simple C# program that just pushes out data over the virtual COM-port as fast as possible and receives the data back from the controller. With that I could get up to the speed of ~128 kByte/sec. However, that's both directions combined, one direction is only about 64 kByte/sec.

Is there a way to speed that up? I would really like to get closer to 12 MBit/s ;-)


Regards,
Tim
0 Kudos
Reply

1,066 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Thu Jul 12 00:44:21 MST 2012
Dear TKoe,

Setting the baudrate is needed for the physical link with a RS232 chip, and you have to make sure that both sides of this link have the same baudrate to encode/decode the data.

In our case, we are virtual link via USB bus, setting the baudrate is not needed. What you need to know are:
   - Your bus speed is high, full or low
   - What is your endpoint max packet size and the size of a file that your PC host's terminal software intend to write to CDC device. These numbers calculate the number of packets transfered on USB bus.

With best regards,
0 Kudos
Reply

1,066 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Mon Jul 09 06:39:14 MST 2012
Nevermind, I guess I figured it out... the EchoCharacter function will always just send back a single character. Changing the example to a more usable version changed that.

Luckily, that leaves only the question with the speed of the connection. Can anyone answer that?
0 Kudos
Reply

1,066 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Mon Jul 09 06:18:28 MST 2012
I didn't change a thing from the nxpusblib example (except for that patch).
But if it helps you, here's the example C file.


But now I noticed that in the example there's a commented line (95):
//CDC_Device_USBTask(&VirtualSerial_CDC_Interface);

It flushes the send-buffer, so I guess it's okay that it's commented out.
0 Kudos
Reply

1,066 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjarnjak on Mon Jul 09 06:05:49 MST 2012
Can you post relevant sections of your code which you use for setup & sending?
0 Kudos
Reply