USB device detect host attach/detach

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USB device detect host attach/detach

1,582件の閲覧回数
lpcware
NXP Employee
NXP Employee
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?
ラベル(1)
0 件の賞賛
返信
1 返信

1,000件の閲覧回数
Dezheng_Tang
NXP Employee
NXP Employee

For USB0 as device, OTGSC bit 11 BSV (B-session valid) should do it. For USB1 as device, OTGSC won't help, you may have to route VBUS to a pin interrupt.

0 件の賞賛
返信