nxpUSBlib DualVirtualSerial example

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

nxpUSBlib DualVirtualSerial example

1,052 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kpa on Fri Mar 02 08:22:37 MST 2012
Hello all,

I have ported the DualVirtualSerial example to my LPCxpresso LPC11U14.
When I connect my board to a computer (RunningLinux) I could see that two new tty are detected and /dev/ttyACM0 and /dev/ttyACM1 are automatically added.

When I try top open them using a terminal (like picocom) I am not able to communicate with the board.
On the second port the board should echo every received data. And port one I have replaced the original CheckJoystickMovement()by a function that send a constant string.

Both are not working. Do you have any idea why ?

Thanks in advance for your help

kpa

Labels (1)
0 Kudos
13 Replies

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kpa on Wed May 09 06:21:48 MST 2012
I am facing the same problem on LPC11U24xx. Any patch or clean solution is available ?

kpa
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by smoorby on Thu Apr 19 23:25:08 MST 2012
Hi, this will work but I'm wondering about the use of globals for usb_data_buffer_index and usb_data_buffer_count.
In a full usb serial application the data can only be consumed at the UART line rate.  Isn't it possible that another USB transfer may complete and overwrite these globals before the first buffer is finished with?  Why not do away with the globals and access the data through the currently selected (and retired) DMA descriptor.

Regards
Steve
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vu on Thu Apr 19 20:10:40 MST 2012
You can try these steps :

1. In Endpoint_LPC17xx.h you can see function Endpoint_BytesInEndpoint(), replace " return (dmaDescriptor[ endpointhandle[endpointselected] ].PresentCount)"   with   " return usb_data_buffer_size ".

2. And in Endpoint_LPC17xx.c with function DMAEndTransferISR(), you add " usb_data_buffer_size = dmaDescriptor[PhyEP].PresentCount "   for OUT Endpoint.

With best regards,
Vu Nguyen
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by smoorby on Wed Apr 18 05:36:42 MST 2012
Have looked at the code and think I can see the problem. 
In the function CDC_Device_ReceiveByte(), whether a byte is read is determined by Endpoint_BytesInEndpoint() which accesses the PresentCount field of the DMA descriptor.  The function Endpoint_Read_8() consumes the byte by

usb_data_buffer_index++;
usb_data_buffer_size--;

However, this has no effect on what is returned by Endpoint_BytesInEndpoint() as PresentCount in the DMA descriptor is not modified.

I see usb_data_buffer_size is new to v0.94.  Doesn't seem to be used consistently.
This is related to the "Endpoint_Read_Stream_LE()" topic in this forum.
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by smoorby on Wed Apr 18 04:59:30 MST 2012
Hi all,

I have a similar problem with "Example_VirtualSerialDevice". 
I'm trying to get this as a working example before I try with MIDI device class.
It builds without problems configured for LPC17XX / LPCXpressoRevB.  It connects and enumerates as a serial device /dev/ttyACM0.
I can open this device ok with minicom and then send a single character 'a'.  What I get echoed back appears to be an infinite supply of 'a's.
Using the LPCXpresso debugger I see CDC_Device_BytesReceived() always returns something > 0 after the first 'a' is received.

Using nxpUSBlib-v0.94

Thanks
Steve
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kpa on Wed Apr 04 00:46:41 MST 2012
Ok thanks for your help.
There is no check or warning about this. It could be a nice addition.
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Tue Apr 03 03:04:35 MST 2012
Dear Kpa,

The LPC11U14 only has 4 logical endpoints, exclude control endpoint, but the DualVirtualSerial demo uses 6 endpoints...

With best regards,
Tuong Nguyen
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kpa on Tue Apr 03 02:02:16 MST 2012
Ok I have tried the DualVirtualSerialDevice demo on myLPCExpresso LPC11U14 with the nxpUSBlib 0.93
The edited sources are attached.

The first VirtualCom work nicely, the second one is visible on my system (ubuntu 11.04), I can open it but it doesn't work when writing or reading from it...

Does any one have any idea why ?

Thanks kpa
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kpa on Tue Apr 03 01:13:48 MST 2012
Good idea, that was the problem. I have set the CPU only for the Example...

I will now make a try with the DualVirtualSerial example

Thanks kpa
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Mon Apr 02 23:51:51 MST 2012
Dear Kpa,

I think you need to select the correct LPC11U14/201 MCU for all projects: BSP, CDL, nxpUSBlib, your demo (ex: VirtualSerial).

With best regards,
Tuong Nguyen
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kpa on Mon Apr 02 08:14:53 MST 2012
Just forget to say that I use LPCXpresso v4.2.0
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kpa on Mon Apr 02 06:55:02 MST 2012
Hello,

I have tested the Example_VirtualSerial on my LPCExpresso LPC11U14 and it doesn't work.
When I start the program it jump to the HardFault_Handler. I have executed in step-by-step and it's seems that the issue come from the line "USB_IsInitialized = true;" in the USB_Init() function (line 38 from USBController_LPC.h).

Any idea ?

Thanks in advance

Patrick
0 Kudos

979 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Mon Mar 26 18:56:51 MST 2012
Dear kpa,

Please try your application with the new release 0.93! There is VirtualSerial demo ported for LPC11Uxx.

With best regards,
Tuong Nguyen

0 Kudos