lpcware

USB VBus Detection

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by CarlMle on Wed Feb 06 10:09:37 MST 2013
I am implementing a USB CDC using the USB CDC Rom example from Lpcware.com

http://lpcware.com/content/nxpfile/sample-code-bundle-lpc11uxx-peripherals-using-lpcxpresso

Question 1 :

First issue is reliable USB_VBUS detection. I want to know if USB is plugged in either a PC or charger, So I want to read the state of the USB_VBUS pin P03. (Its a battery powered device)

Using LPC11U24/401 - LPCXpresso 5.0.14_1109

USB CDC is working and I can send + Recv Data over the CDC

No USB cable connected : P0B3=0 P0W3=0xffffffff P0PORT=0x5506bb ( BIT3 is set )
USB Connected : P0B3=0 P0W3=0xffffffff P0PORT=0x5506bb ( BIT3 is set )

So first issue is a disagreement over the pin state, as far as I can see these should all agree? As P0B3 & P0W3 are convenience registers showing the state of BIT3 of Port0. Unless with USB enabled you cant use this as a GPIO?

I've tried both modes on the pin :

PIO0_3 = 0x8 // Pulldown enabled, PIO_3 mode
PIO0_3 = 0x9 // Pulldown enabled, USB_VBUS mode

The result is the same.

Question 2

LPC11Ux User Manual states that the top 64 bits of an LPC11U24/401 Eeprom are reserved for NXP use. Which way is up? is it 0-63 or the last 64 bytes? I can't see a memory map that shows this.


Thanks,
Carl.

Outcomes