Keeping the USB connected – LPC2148

So I just spent about a week debugging a USB problem on a project using a LPC2148.  I was finding that the USB would randomly connect and disconnect when plugged into the PC.  Sometimes it would stay connected for 10 seconds before disconnecting, sometimes it would stay connected for hours with no problem. I spent several days looking for firmware bugs and checking the USB signal quality, but everything looked good. With the disconnect time being random I assumed it had to be a hardware problem. It turned out to be a problem with both hardware and software. Apart from the D+ and D- pins, the LPC2148 has two other IO pins associated with the USB peripheral:  Connect (PO.31) and Vbus (P0.23). Connect is an output that is used to turn on the pullup to start enumeration. Vbus in an input to detect if USB power is present. On my PCB, the Vbus pin was not connected to anything (that was the hardware problem), but was configured as Vbus instead of P0.23 (that was the firmware problem). It looks like the chip is hardwired so that if you have the “Vbus” pin enabled, the logic level on that pin controls the “Connect” pin. So in my case the floating Vbus pin was randomly going high and low causing the USB to connect and disconnect. Configuring the Vbus pin as a GPIO pin instead fixed the problem.

What kind of bugs me about this is that this behavour isn’t really documented in the user manual. Oh well. It is fixed and the solution was simple. I just wish it didn’t take me so long to find.

One thought on “Keeping the USB connected – LPC2148”

  1. i m very much interested in usb protocol, basically how to interface usb to my lpc2148 board. but unable to do that . will u plz guide me or send me the code to interface the usb to my board.??
    waiting for ur reply ………….

Leave a Reply

Your email address will not be published. Required fields are marked *