How to switch an Output on when device is registered?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
tauruz
Posts: 1
Joined: Fri Oct 03, 2008 10:40 pm
Contact:

How to switch an Output on when device is registered?

Post by tauruz » Fri Oct 03, 2008 10:46 pm

Hi there,

is it possible to switch an Output to High- State only when the avr-usb is succesfully registered at the Host- System?

I just want to use AvrUsb as USB to Rs232- Converter but the whole Circuit should be powered by USB-BUS at its consumption will be around 400mA, so i want to switch on/off the rest of the circuit with succesfull bus registration.

i wand to do that because i have read that the power consumption of bus slaves should be only 100mA when not registered (max 100mA) and only if succesfull registered it can go up to 500mA.

Sorry for my bad english, im from germany... :-)

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

Post by christian » Thu Oct 09, 2008 4:45 pm

Look at the global variable usbConfiguration. It contains the value of the configuration choosen by the host. However, it is not reset when the device is disconnected.

To find out whether your device is disconnected, connect INT0 to D- instead of D+, define USB_COUNT_SOF to 1 and check whether usbSofCount increments. That's the same algorithm as used for suspend mode. See http://avrusb.wikidot.com/examples (end of page) for details.

Post Reply