General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
-
ph1l
Post
by ph1l » Thu Oct 02, 2008 6:17 pm
Hi,
I'm currently working on a USB-self-powered device. Now I'm worried about the "USB_CFG_MAX_BUS_POWER" define in the usbconfig.h.
According to the USB Specs the maximum current should be 500mA. To demand this, I did the following:
#define USB_CFG_MAX_BUS_POWER 250
Set this variable to the maximum USB bus power consumption of your device.
* The value is in milliamperes. [It will be divided by two since USB
* communicates power requirements in units of 2 mA.]
Should be alright, as 500 divided by two = 250. Am I right?
But what if I exced the 500mA? Will the device be disconnected by the host?
thx phil
-
christian
- Objective Development
- Posts: 1443
- Joined: Thu Nov 09, 2006 11:46 am
Post
by christian » Thu Oct 09, 2008 4:40 pm
The value you define is in mA, so define it to 500. The USB Spec demands half that value and AVR-USB divides it automatically.
Note that you must wait until your device is configured before you draw the full power. Until then you are limited to 100 mA.
If you exceed the value, it depends on the host/hub what happens. Some hosts are willing to deliver much more. Others disconnect you even before you reach 500 mA (if the polyfuse is worn out).