EmbeddedRelated.com
Forums
Memfault Beyond the Launch

LPC1343 USB hot plugging

Started by "faro.salvatore" August 15, 2010
Hi, I've got a board running a LPC1343 with the ROM USBHID and have a strange behaviur with the way it connect to the pc. Basically to get the USB enumerated I have to first plug in the usb connector and after power the cpu with an external 5V supply and all works good but if I unplug the usb connector and replug it in again (without cycling power or reseting the cpu) a new enumeration does not happen... I have also noticed that if I power the board with the usb 5V I have the same problem, the point is I have to give power after I plug in the usb connector.

By what I have been able to see the USB_CONNECT pin is behaving correctly because if I remove the usb connector the signal goes high and when I plug it in again the signal goes low and also my PNP transistor with the 1K5 resistor on D+ is working.

P.S. I have also tested the CDC USB driver and I have the exact same problem...

Any ideas, maybe I'm forgetting to do something in software??

Thanks.

An Engineer's Guide to the LPC2100 Series

Hi,

Are you using the BootROM Driver or your own application code?

Have a look at the HID and MSCD code bundle examples here:

http://ics.nxp.com/support/documents/microcontrollers/zip/an10905.zip
http://ics.nxp.com/support/documents/microcontrollers/zip/an10904.zip

Good luck,
Ken
--- In l..., "faro.salvatore" wrote:
>
> Hi, I've got a board running a LPC1343 with the ROM USBHID and have a strange behaviur with the way it connect to the pc. Basically to get the USB enumerated I have to first plug in the usb connector and after power the cpu with an external 5V supply and all works good but if I unplug the usb connector and replug it in again (without cycling power or reseting the cpu) a new enumeration does not happen... I have also noticed that if I power the board with the usb 5V I have the same problem, the point is I have to give power after I plug in the usb connector.
>
> By what I have been able to see the USB_CONNECT pin is behaving correctly because if I remove the usb connector the signal goes high and when I plug it in again the signal goes low and also my PNP transistor with the 1K5 resistor on D+ is working.
>
> P.S. I have also tested the CDC USB driver and I have the exact same problem...
>
> Any ideas, maybe I'm forgetting to do something in software??
>
> Thanks.
>

Hi,

I'm looking through the AN10904 code which is very similar to mine for HID, so far they look the same...

I'm wondering if maybe I have to set the USB port pins, pullup's, ect.. By what I have read in the datasheets the init_clk_pins() function should do it all... but for now I'm just puzzled :(

This is the usb init. code I'm using:

volatile int n;

// HID Device Info
HidDevInfo.idVendor = USB_VENDOR_ID;
HidDevInfo.idProduct = USB_PROD_ID;
HidDevInfo.bcdDevice = USB_DEVICE;
HidDevInfo.StrDescPtr = (uint32_t)&USB_HIDStringDescriptor[0];
HidDevInfo.InReportCount = 1;
HidDevInfo.OutReportCount = 1;
HidDevInfo.SampleInterval = 0x20;
HidDevInfo.InReport = usbHIDGetInReport;
HidDevInfo.OutReport = usbHIDSetOutReport;

DeviceInfo.DevType = USB_DEVICE_CLASS_HUMAN_INTERFACE;
DeviceInfo.DevDetailPtr = (uint32_t)&HidDevInfo;

/* Enable Timer32_1, IOCON, and USB blocks (for USB ROM driver) */
SCB_SYSAHBCLKCTRL |= (SCB_SYSAHBCLKCTRL_CT32B1 | SCB_SYSAHBCLKCTRL_IOCON | SCB_SYSAHBCLKCTRL_USB_REG);

/* Use pll and pin init function in rom */
(*rom)->pUSBD->init_clk_pins();

/* insert a delay between clk init and usb init */
for (n = 0; n < 75; n++) {__asm("nop");}

(*rom)->pUSBD->init(&DeviceInfo); /* USB Initialization */
(*rom)->pUSBD->connect(TRUE); /* USB Connect */
}
--- In l..., "Kenneth" wrote:
>
> Hi,
>
> Are you using the BootROM Driver or your own application code?
>
> Have a look at the HID and MSCD code bundle examples here:
>
> http://ics.nxp.com/support/documents/microcontrollers/zip/an10905.zip
> http://ics.nxp.com/support/documents/microcontrollers/zip/an10904.zip
>
> Good luck,
> Ken
> --- In l..., "faro.salvatore" wrote:
> >
> > Hi, I've got a board running a LPC1343 with the ROM USBHID and have a strange behaviur with the way it connect to the pc. Basically to get the USB enumerated I have to first plug in the usb connector and after power the cpu with an external 5V supply and all works good but if I unplug the usb connector and replug it in again (without cycling power or reseting the cpu) a new enumeration does not happen... I have also noticed that if I power the board with the usb 5V I have the same problem, the point is I have to give power after I plug in the usb connector.
> >
> > By what I have been able to see the USB_CONNECT pin is behaving correctly because if I remove the usb connector the signal goes high and when I plug it in again the signal goes low and also my PNP transistor with the 1K5 resistor on D+ is working.
> >
> > P.S. I have also tested the CDC USB driver and I have the exact same problem...
> >
> > Any ideas, maybe I'm forgetting to do something in software??
> >
> > Thanks.
>

Does the USB VBUS actually supply power to the board? I.e. is it
connected to one of the power rails?

Mike
> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of faro.salvatore
> Sent: Sunday, August 15, 2010 8:20 AM
> To: l...
> Subject: [lpc2000] LPC1343 USB hot plugging
> Hi, I've got a board running a LPC1343 with the ROM USBHID
> and have a strange behaviur with the way it connect to the
> pc. Basically to get the USB enumerated I have to first plug
> in the usb connector and after power the cpu with an external
> 5V supply and all works good but if I unplug the usb
> connector and replug it in again (without cycling power or
> reseting the cpu) a new enumeration does not happen... I have
> also noticed that if I power the board with the usb 5V I have
> the same problem, the point is I have to give power after I
> plug in the usb connector.
>
> By what I have been able to see the USB_CONNECT pin is
> behaving correctly because if I remove the usb connector the
> signal goes high and when I plug it in again the signal goes
> low and also my PNP transistor with the 1K5 resistor on D+ is working.
>
> P.S. I have also tested the CDC USB driver and I have the
> exact same problem...
>
> Any ideas, maybe I'm forgetting to do something in software??
>
> Thanks.

Hi, the USB 5V supplies a 3,3V regulator that powers the cpu. The problem is that I must power the cpu or reset it after connecting the usb cable to get it correctly working.
--- In l..., "Michael Anton" wrote:
>
> Does the USB VBUS actually supply power to the board? I.e. is it
> connected to one of the power rails?
>
> Mike
> > -----Original Message-----
> > From: l...
> > [mailto:l...]On Behalf
> > Of faro.salvatore
> > Sent: Sunday, August 15, 2010 8:20 AM
> > To: l...
> > Subject: [lpc2000] LPC1343 USB hot plugging
> >
> >
> > Hi, I've got a board running a LPC1343 with the ROM USBHID
> > and have a strange behaviur with the way it connect to the
> > pc. Basically to get the USB enumerated I have to first plug
> > in the usb connector and after power the cpu with an external
> > 5V supply and all works good but if I unplug the usb
> > connector and replug it in again (without cycling power or
> > reseting the cpu) a new enumeration does not happen... I have
> > also noticed that if I power the board with the usb 5V I have
> > the same problem, the point is I have to give power after I
> > plug in the usb connector.
> >
> > By what I have been able to see the USB_CONNECT pin is
> > behaving correctly because if I remove the usb connector the
> > signal goes high and when I plug it in again the signal goes
> > low and also my PNP transistor with the 1K5 resistor on D+ is working.
> >
> > P.S. I have also tested the CDC USB driver and I have the
> > exact same problem...
> >
> > Any ideas, maybe I'm forgetting to do something in software??
> >
> > Thanks.
>

Finally got it working, I made the necessary changes to the AN10904 code to allow compilation with crossworks and it is all good.

I still don't understand why the other code is not working?? My other code was based on the microbuilder.eu reference board software that has a crossworks project already done...

--- In l..., "faro.salvatore" wrote:
>
> Hi, the USB 5V supplies a 3,3V regulator that powers the cpu. The problem is that I must power the cpu or reset it after connecting the usb cable to get it correctly working.
> --- In l..., "Michael Anton" wrote:
> >
> > Does the USB VBUS actually supply power to the board? I.e. is it
> > connected to one of the power rails?
> >
> > Mike
> >
> >
> > > -----Original Message-----
> > > From: l...
> > > [mailto:l...]On Behalf
> > > Of faro.salvatore
> > > Sent: Sunday, August 15, 2010 8:20 AM
> > > To: l...
> > > Subject: [lpc2000] LPC1343 USB hot plugging
> > >
> > >
> > > Hi, I've got a board running a LPC1343 with the ROM USBHID
> > > and have a strange behaviur with the way it connect to the
> > > pc. Basically to get the USB enumerated I have to first plug
> > > in the usb connector and after power the cpu with an external
> > > 5V supply and all works good but if I unplug the usb
> > > connector and replug it in again (without cycling power or
> > > reseting the cpu) a new enumeration does not happen... I have
> > > also noticed that if I power the board with the usb 5V I have
> > > the same problem, the point is I have to give power after I
> > > plug in the usb connector.
> > >
> > > By what I have been able to see the USB_CONNECT pin is
> > > behaving correctly because if I remove the usb connector the
> > > signal goes high and when I plug it in again the signal goes
> > > low and also my PNP transistor with the 1K5 resistor on D+ is working.
> > >
> > > P.S. I have also tested the CDC USB driver and I have the
> > > exact same problem...
> > >
> > > Any ideas, maybe I'm forgetting to do something in software??
> > >
> > > Thanks.
>


Memfault Beyond the Launch