USB0 connection status

cancel
Showing results for 
Search instead for 
Did you mean: 

USB0 connection status

34 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by DT1 on Fri Apr 25 07:44:37 MST 2014
Hi,

I'm using the NXP LPC43xx USB stack. I'm implementing a DEV-MSC. I need to know if I have an active connection or not to restrict/allow specific parts of the application. So far in my research I haven't found a clean way to do it. I was thinking on checking the SUSP bit because the behavior I observed was in line with what I wanted to do, but I'm getting strange results, probably due to setup time. Here is what I'm doing:

UINT32 reg = 0;

USB_Connect(TRUE);
*** delay of 5ms***
reg = LPC_USB0->PORTSC1_D;


reg value doesn't always reflect the register value when I break, which tells me I'm racing against hardware. It also tells me that's not a good way to do things.

How can I know what is the current USB connection status? By the way, I can't check the VBUS cause we could be powered by there without USB data.
Thanks!

DT
Labels (1)
0 Kudos
1 Reply

5 Views
NXP Employee
NXP Employee
Content originally posted in LPCWare by embd02161991 on Tue Apr 29 17:55:59 MST 2014
Hi,
When the device is connected to a host , a USB reset is received. The URI bit is set in the USB status register(USBSTS). If the USB reset enable(URE) bit in USB interrupt register(USBINTR) is one and the USB Reset Received bit in the USBSTS register is a one , the device controller will issue an interrupt. This interrupt is acknowledged by software clearing the USB Reset Received bit.

The USB Reset Received Bit and the interrupt can be used to determine if an active connection is established.


Thanks,

NXP Technical Support
0 Kudos