Page 1 of 1

How to switch an Output on when device is registered?

Posted: Fri Oct 03, 2008 10:46 pm
by tauruz
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... :-)

Posted: Thu Oct 09, 2008 4:45 pm
by christian
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.