AnsweredAssumed Answered

USB device detect host attach/detach

Question asked by lpcware Employee on Jun 15, 2016
Latest reply on Oct 7, 2016 by Dezheng Tang
Content originally posted in LPCWare by fancypants on Thu Jun 11 15:51:38 MST 2015
Hi all - I'm developing a high-speed usb 2.0 device (not host or on-the-go) on an LPC4350. It is self-powered. I'm trying to reliably detect when the host attaches and/or detaches (i.e. cable plugged in or unplugged). Attaching is pretty straightforward - it receives a usb suspend and/or reset event (SLI and/or URI). However, detecting detach isn't as straightforward. VBUS is attached to USB0_VBUS (protected so it doesn't power while the mcu isn't powered).

So, I've got a some questions:
1) Is it possible to monitor VBUS status via the OTGSC register? So far my experiments with this doesn't appear fruitful: the "A" status bits don't seem to reflect proper state, and the "B" status bits sort-of do, but I've also been able to get false positives from them. In any case, they don't seem to be reliable.
2) Is it possible to depend on getting a suspend or reset event (SLI and/or URI)? So far my experiments show that it is possible that pulling the usb cable fast enough sometimes doesn't register any SLI or URI interrupts - BUT the CCS bit in PORTSC1 is clear (but the user manual says " It does not state the device being disconnected or suspended").

I guess, ultimately my question is: via the usb registers, is there a way to detect disconnect from host? How?

Outcomes