USBDEV\Usb_Cdc: Some comments, updates, hints

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by capiman on Sun Sep 30 01:35:18 MST 2012

i have downloaded


(according to release notes: RELEASE: LPC4300CMSIS_20120531)

and tried


on a MCB4357. First i had some problems, but meanwhile i have it running. Just want to share some comments, updates, hints
to save you some hours of trying and debugging)

1) I used KEIL uVision4 (V4.54, mdk454.exe). It was no real problem to compile the project.
(I can't remember what i have done in detail, but i set used chip to MCB4357, checked that used flash address is 0x1A000000 (Bank A).
And i selected to create a HEX file. Even it says "Internal SRAM" a hex file with address range starting at 0x1A000000 was created...)
Perhaps Abstract.txt is not up-to-date with "Internal SRAM" or it is something i have changed, but where i a not aware of)

2) I downloaded with latest FlashMagic 6.94.2780. Flash Bank: "Bank 0". Item "Activate Flash Bank" must be selected.
(Selecting the correct chip type was a bit a problem, selection window is too big, i can't see "OK" button on my computer, big screen,
selected bigger fonts, perhaps this is the reason for the problem?)

3) Connect USB cable to USB0 and PC.
Abstract.txt mentions: "If use USB Port 1, pls set Main Clock to 60Mhz in CGU_Init function"
(I have not tried USB1, because chosen the easy way first. I am happy to get it running on the new MCB4357 at all).

4) My PC (Vista 64 Bit) reported new device "NXP LPC18xx VCOM ", looks good.

5) Now selected the delivered *.inf file, but was not recognized. Seems to be old topic, inf file not yet ready for 64 bit...
(there was a posting in LPC2000 yaqhoo group, see http://tech.groups.yahoo.com/group/lpc2000/message/54637 )
i have adapted it only for the reported VID / PID:

; This INF works for Windows XP SP2, Windows XP x64,
; Windows Vista x86, Windows Vista x64, and Windows 7 x86 and x64.
; This INF will work with Windows XP, and Windows XP SP1
; after applying specific hotfixes
; (I have no idea what those hotfixes might be... boB)

Signature    = "$Chicago$"
Class        = Ports
ClassGuid    = {4D36E978-E325-11CE-BFC1-08002BE10318}
Provider     = %Provider%
DriverVer    = 05/31/2010,
CatalogFile  = g_serial.cat

%Provider%=GSerialDeviceList, NTamd64, NTia64

%GSERIAL%=GSerialInstall,  USB\VID_1FC9&PID_2002

%GSERIAL%=GSerialInstall,  USB\VID_1FC9&PID_2002

%GSERIAL%=GSerialInstall,  USB\VID_1FC9&PID_2002

CopyFiles=FakeModemCopyFileSection; Replace above with this one

usbser.sys;not sure if needs to be here or not



;DefaultDestDir           = 10;Comment this line out using ;
DefaultDestDir=10, System32\Drivers;ADD this line WAS NOT HERE
FakeModemCopyFileSection =12
;GSerialCopyFiles         = 12
;DefaultDestDir=10,System32\Drivers; WAS NOT HERE


AddService = usbser,0x0002,GSerialService

ServiceType = 1                  ; SERVICE_KERNEL_DRIVER
StartType = 3                    ; SERVICE_DEMAND_START
ErrorControl = 1                 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\System32\Drivers\usbser.sys
LoadOrderGroup = Base

Provider             = "MidNite Solar Inc."
GSERIAL              = "USB CDC serial port emulation"
GSERIAL_DISPLAY_NAME = "MidNite Solar USB CDC serial port emulation"

6) Now the driver was accepted, COM-port was created, but driver was not started due to communication problems with the device.
I narrowed it down to a call to USB_ReqSetConfiguration in usbcore.c
Something strange happened here: There is a call to USB_ReqSetConfiguration, but it never arrived there!?!
I put a debug output just before the call and inside the function, i see it before the call, but not inside the function.
I debugged some time, first thinking it crashes somewhere on the way, but there is nothing between the two calls...
Checked that optimization was not turned off, but this was already set to level 0.
I got almost crazy, but then i looked for an update of uVision.

7) Downloaded uVision4 (V4.60, mdk460.exe), which seems, it was just released.
Recompiled, now my debug output looked good, called function got called and returned. I assume it was a problem with the compiler...

8) Now i can open the COM port. Because i am using USART3 for debugging, not used USART0 and UART1 yet, i had to change the code the handle and send via CDC endpoint.
This can be done in

void VCOM_Serial2Usb(void) { ... }
void VCOM_Usb2Serial(void) { ... }

Best regards,