2016-05-01 01:06 PM
Dear Community,
currently I am experimenting with the STM32‘ demo usb stack (COPYRIGHT 2012 STMicroelectronics) to use it as a mass storage device. This works so far. However I wanted also to use the power delivered by the usb interface to power my custom mass storage device. By default the current is restricted to 250 mA only which is unfortunately not enough. However accordingly to the USB standard there is also a high power mode capable to deliver 500 mA. Did anybody know where to set the power mode ?
2016-05-02 09:42 AM
Hi gerh.jo,
Try to use the ''Configuration descriptors''. You can Refer to the “STM32 USB-FS-Device development kit�http://www.st.com/st-web-ui/static/active/cn/resource/technical/document/user_manual/CD00158241.pdf
. -Hannibal-Dear Community,
currently I am experimenting with the STM32‘ demo usb stack (COPYRIGHT 2012 STMicroelectronics) to use it as a mass storage device. This works so far. However I wanted also to use the power delivered by the usb interface to power my custom mass storage device. By default the current is restricted to 250 mA only which is unfortunately not enough. However accordingly to the USB standard there is also a high power mode capable to deliver 500 mA. Did anybody know where to set the power mode ?
2016-05-07 08:11 AM
Thank you very much for the hint.
In the USB Stack I currently use the relevant section can be found here:
#ifdef USB_OTG_HS_CORE
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
#pragma data_alignment=4
#endif
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
__ALIGN_BEGIN uint8_t USBD_MSC_OtherCfgDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
{
0x09, /* bLength: Configuation Descriptor size */
USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION,
USB_MSC_CONFIG_DESC_SIZ,
0x00,
0x01, /* bNumInterfaces: 1 interface */
0x01, /* bConfigurationValue: */
0x04, /* iConfiguration: */
0xC0, /* bmAttributes: -> self powered and bus powered device*/
0xFA, /* MaxPower 500 mA */
/******************** Mass Storage interface ********************/
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints*/
0x08, /* bInterfaceClass: MSC Class */
0x06, /* bInterfaceSubClass : SCSI transparent command set*/
0x50, /* nInterfaceProtocol */
0x05, /* iInterface: */
/******************** Mass Storage Endpoints ********************/
0x07, /*Endpoint descriptor length = 7*/
0x05, /*Endpoint descriptor type */
MSC_IN_EP, /*Endpoint address (IN, address 1) */
0x02, /*Bulk endpoint type */
0x40,
0x00,
0x00, /*Polling interval in milliseconds */
0x07, /*Endpoint descriptor length = 7 */
0x05, /*Endpoint descriptor type */
MSC_OUT_EP, /*Endpoint address (OUT, address 1) */
0x02, /*Bulk endpoint type */
0x40,
0x00,
0x00 /*Polling interval in milliseconds*/
};
How to calculate the power value is also described here:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff539241%28v=vs.85%aspx