Set USB Max Power in Arduino Micro

Hi!

I'm using the Arduino Micro as a joystick in one of my projects. With it, the joystick configuration is being rejected when I connect it through a USB hub I'm using.

It looks like the Arduino Micro is requesting 500mA and the hub says it cannot supply the power, so the configuration gets rejected as seen in dmesg: "rejected 1 configuration due to insufficient available bus power"

This also happens when I power the Micro with an external power supply. It seems that the USB configuration isn't updated and always requests 500mA.

Can anyone point me in the right direction on where I could configure the Arduino Micro USB power? I see DynamicHID in the library, but I'm not sure where to set the bMaxPower descriptor. The USB protocol seems very complex and runs deep :slight_smile:

Attribute bmAttributes .


your library don't handle this attribute

Which library exactly are you referring to?

if i knew an arduino library that can handle this attribute i would say

These are messages I found useful.

Awesome, thanks for pointing me in the right direction.

I will compile, test this shortly and let ya'll know if it worked.

So to configure the USB power you need to update this line in USBCore.h, which is hard-coded and doesn't change even when you have external power coming into your arduino board:

#define D_CONFIG(_totalLength,_interfaces) \
	{ 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(500) }

USBCore.h is found in your Arduino packages install directory. In my case, it's here:
~/Downloads/arduino-1.8.15/hardware/arduino/avr

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.