EmbeddedRelated.com
Forums

new member - philips VCOM driver question

Started by "hsu...@sbcglobal.net" July 18, 2009
> I see at least two more possibilities here in the lpc2000 group; one in
> the files section and one in links.
>
> * USBVCOM.c
> >
> clXuQC6JL51uOY4FxoY8nEHWWBX_q2F-Qfqap7R5nU16QhF-tp18K6RvRPyqL0C-opxSyLYg\
> AlaN0/USBVCOM.c> by Mike Anton
> * LPCUSB by Bertrik
> Sikken
> Can anyone comment on either of these as a starting point? For now, I
> will be unlikely to want anything other than a virtual COM port.

I can't comment on the first, but Bertrik's code is good, easy
to read, and well factored.

> (I hate to admit it but for the project I'm working on,
> FTDI is beginning to look pretty good. Even though it
> would rankle to have those USB ports on the 4148 sitting
> idle.)

The other reason to use an FTDI device is to reduce the CPU load
and to reduce interrupt overhead. Unless you use DMA (strongly
recommended), the interrupt overhead can be much more than you
expect. Using DMA adds its own wrinkles, but makes later
expansion to a Mass Storage Class device (FlashDrive) much
easier.

Stephen
--
Stephen Pelc, s...@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads

An Engineer's Guide to the LPC2100 Series

> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of h...@sbcglobal.net
> Sent: Monday, July 20, 2009 5:20 PM
> To: l...
> Subject: [lpc2000] Re: new member - philips VCOM driver question
> Thank you for the guidance, Tsuneo, Stephen, and Ralph. Seems
> pointless
> to waste time trying to figure out exactly where I went wrong building
> the Philips app.
>
> I see at least two more possibilities here in the lpc2000
> group; one in
> the files section and one in links.
>
> * USBVCOM.c
> > 38CkN6IcsO\
> clXuQC6JL51uOY4FxoY8nEHWWBX_q2F-Qfqap7R5nU16QhF-tp18K6RvRPyqL0
> C-opxSyLYg\
> AlaN0/USBVCOM.c> by Mike Anton
> * LPCUSB
> by Bertrik
> Sikken
> Can anyone comment on either of these as a starting point? For now, I
> will be unlikely to want anything other than a virtual COM port.
>

I submitted the USBVCOM.c file to the group. It is based on the
VCOM files from LPCUSB. I modified it to improve performance, and
so that it behaves more like a standard USART. You will need to use
it along with the other LPCUSB files to make it work.

LPCUSB is a general purpose USB stack, and as such can be used as
the driver for many USB devices. VCOM is just one of the device
types that it supports. I've used it for MSC as well, and it works
very well for both devices.

Mike Anton

This explanation was really useful. I used the WM_DEVICECHANGE mechanism
for other usb devices, but I didn't know that it was possible to use
it with CDC this way.

Thank you Tsuneo!,
Really! :)
2009/7/21 t_chinzei :
>> Have you managed to fix the problems of: ?
>> 1) You connect to the device VCOM
>> 2) Disconnect device
>> 3) Connect it again...
>> 4) Even if you close the VCOM you're unable to connect again...
>
> On your PC application, detect connection / disconnection of the CDC
> device.
> - When a device is connected, open the port and start communication over
> the port
> - When a device is disconnected, close the port and stop communication
> over the port
>
> To detect connection / disconnection, there are two options,
> a) Register device notification and get device message (WM_DEVICECHANGE)
> b) Using SetupDi-API, poll the device connection periodically
>
> a) Using WM_DEVICECHANGE notification
> To register USB device for device notification, the interface GUID of
> the device driver is required. Unfortunately, usbser.sys doesn't expose
> any device interface (including GUID_DEVINTERFACE_COMPORT). Using
> serenum.sys as the upper filter of usbser.sys,
> GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR is available to specify
> usbser.sys for notification.
> You'll see many example INF files on the web, to attach serenum.sys upon
> usbser.sys.
> For example,
> Make Controller USB CDC ACM Setup File
> http://www.makingthings.com/files/temp/make_controller_kit.inf
>
> GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR
> http://msdn.microsoft.com/en-us/library/bb663066.aspx
>
> Once the interface GUID is available, register it, and handle
> WM_DEVICECHANGE message (DBT_DEVICEARRIVAL / DBT_DEVICEREMOVECOMPLETE)
> as usual USB devices.
>
> Jan Axelson shows a good example of WM_DEVICECHANGE handling for HID.
> The outline for COM port is almost same as the code flow of this
> example.
> http://www.lvr.com/files/usbhidio_V2.3.cs.zip
> - DeviceManagement.cs,
> - DeviceManagementDeclarations.cs,
> - frmMain.cs - OnDeviceChange()
>
> b) Using SetupDi-API polling
> In this post to Microchip forum, I posted an example to detect CDC
> devices currently attached to the PC.
> CDC_COM_port_lister.cpp
> http://www.microchip.com/forums/tm.aspx?m64903
> Run this procedure periodically, to detect attach / detach of CDC
> devices.
>
> In the source code of Mike Obrien's HID library, you'll find the idea -
> how to run it periodically.
> http://labs.mike-obrien.net/Document.aspx?id=hidlibrary
>
> https://hidlibrary.svn.codeplex.com/svn/Library/HIDLibrary/HidDeviceEven\
> tMonitor.vb
> https://hidlibrary.svn.codeplex.com/svn/Library/HIDLibrary/HidDevices.vb
>
> If you unplug a USB device and re-plug it quickly, Windows sometimes
> fail to detect the re-connection. At least 2-3 seconds interval is
> recommended before re-plug.
>
> Tsuneo
>
> --- In l..., Miguel Angel wrote:
>>
>> Have you managed to fix the problems of: ?
>>
>> 1) You connect to the device VCOM
>> 2) Disconnect device
>> 3) Connect it again...
>> 4) Even if you close the VCOM you're unable to connect again...
>> I think it's an usbser.sys bug or limit because of it's architecture.
>>
>> 2009/7/20 Ralph Hempel rhempel@...:
>> >
>> >
>> > Stephen Pelc wrote:
>> >
>> >>
>> >>
>> >> Tsuneo said:
>> >>
>> >> > I recommend you to use Windows in-box device driver for
>> >> > VCOM, usbser.sys, instead. Surely, usbser.sys has some
>> >> > problems, but it's better than PLP2KUS.
>> >>
>> >> Tsuneo knows of what he speaks! If you use usb.sersys and match
>> >> the requirements of the USB CDC class, you can make your product
>> >> work without any host drivers on Windows, Linux and OSX.
>> >
>> > I'll second that. I use the default CDC driver in my LEGO MINDSTORMS
>> > NXT pbLua firmware and it works great on all those platforms.
>> >
>> > Ralph
>> >
>>
>> --
>> Miguel Angel Ajo Pelayo
>> http://www.nbee.es
>> +34 91 120 1798
>> +34 636 52 25 69
>> skype: ajoajoajo
>>

--
Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 91 120 1798
+34 636 52 25 69
skype: ajoajoajo