Skip to main content
PMath.4
Senior III
July 19, 2019
Solved

USB CDC Power request

  • July 19, 2019
  • 2 replies
  • 1343 views

Does the STM USB CDC driver support power negotiation? If so please could someone point me to where I configure a request for more than the default 100mA.

I'm using STM32F407 and CDC is working nicely but the computer only shows that 100mA is requested. I need more than this to power peripherals which will be attached to the uP.

Any help appreciated

This topic has been closed for replies.
Best answer by waclawek.jan

USB devices request current through the bMaxPower field in the standard Configuration descriptor, so simply change it there.

0690X000009YuRCQA0.png

JW

2 replies

waclawek.jan
waclawek.janBest answer
Super User
July 19, 2019

USB devices request current through the bMaxPower field in the standard Configuration descriptor, so simply change it there.

0690X000009YuRCQA0.png

JW

Peter Mather
Associate III
July 19, 2019

Thanks - took a bit of time to find as the field name misses the "b"

from usbd_cdc.c

__ALIGN_BEGIN uint8_t USBD_CDC_OtherSpeedCfgDesc[USB_CDC_CONFIG_DESC_SIZ] __ALIGN_END =
{
 0x09, /* bLength: Configuation Descriptor size */
 USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION,
 USB_CDC_CONFIG_DESC_SIZ,
 0x00,
 0x02, /* bNumInterfaces: 2 interfaces */
 0x01, /* bConfigurationValue: */
 0x04, /* iConfiguration: */
 0xC0, /* bmAttributes: */
 250, /* MaxPower 500 mA */