LED to Indicate address assigned

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
TomH
Posts: 1
Joined: Tue May 27, 2008 2:48 am

LED to Indicate address assigned

Post by TomH » Tue May 27, 2008 4:39 am

Greetings.

I want to have a LED that indicates USB connected, now the address assigned hook USB_SET_ADDRESS_HOOK() is perfect for turning it on, but what would be a good event for turning it OFF, say if the USB cable is unplugged?

I suspect that this would involve sensing no USB activity, similar to Suspend mode. I suppose that I could just use the 5V from the USB cable, no cable = no LED!

TomH

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Wed May 28, 2008 5:31 pm

Yes, you can sense the USB power. If you check for USB activity, the LED would go off when the hosts goes into suspend mode and not go back on when it awakes because there's no new enumeration.

You should also turn it off when USB Reset is detected.

Post Reply