Any way for USB Host to request device to reattach?

58 views
Skip to first unread message

inizen

unread,
Dec 20, 2012, 2:02:54 PM12/20/12
to lufa-s...@googlegroups.com
Hi there:

My AT90USB647 prototype USB host board continually supplies VBUS (from its own +5V rail) to any attached device. It doesn't use UVCON to switch VBUS on and off. This has worked fine with some devices but with one device, when I switch the power to the host board off and on, the device does not reattach. I have to physically unplug the device and plug it back in. Then the device reattaches fine.

What's the difference between switching the host board off/on and unplugging/replugging a device, from the perspective of the USB stack? Has anyone seen anything like this or have any idea how to debug it?

Regards,

Martin

inizen

unread,
Dec 20, 2012, 3:39:45 PM12/20/12
to lufa-s...@googlegroups.com
Bit more detail. I put a scope on the D++ line and in normal running (either with my well behaved USB devices or my badly behaved USB device once it has been manually unplugged/replugged) I see periodic squirts of data (looks like coming down from a default +3.3V to 0) every 110us or so. When I power off my USB host board and repower it, with the 'bad' USB device plugged in ... I get a flatline 0V on D++. So I guess that's why the USB host cannot detect it. But again, if I then disconnect and reconnect my 'bad' USB device it all starts working.

Why is the 'bad' USB device not providing a pullup? It is an Android phone in debug mode. Any ideas welcome.

Opendous

unread,
Dec 21, 2012, 5:48:47 PM12/21/12
to LUFA Library Support List
Since USB is Host-centric, a device has to wait on the Host
(AT90USBxx7) for communication instructions. If your AT90USBxx7 does
not send a Host disconnected signal, your Device (Android Phone) has
no way of distinguishing whether the Host has disconnected or is
simply taking a long time to communicate so it keeps the communication
channel open.

One solution to pursue is playing around with the
HOST_DEVICE_SETTLE_DELAY_MS timing since your problem is the inverse
of a similar problem:
http://groups.google.com/group/lufa-support/msg/e91967ee5446c215
http://code.google.com/p/lufa-lib/source/browse/trunk/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h#80
http://code.google.com/p/lufa-lib/source/browse/trunk/Demos/Host/ClassDriver/AndroidAccessoryHost/Config/LUFAConfig.h#84

You could also try sending a USB RESET (AT90USB1287 Datasheet
Pg#298, UHCON definition):
http://code.google.com/p/lufa-lib/source/browse/trunk/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h#168
http://code.google.com/p/lufa-lib/source/browse/trunk/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c#251

It should be getting called when your AT90USB powers up though:
http://code.google.com/p/lufa-lib/source/browse/trunk/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c#111

What brand/version of Android Phone are you testing with?
Reply all
Reply to author
Forward
0 new messages