AnsweredAssumed Answered

Powering USB Memory device On/Off reliably

Question asked by Hess.Marco on May 31, 2016
Latest reply on Jun 6, 2016 by Clive One
In a product using an STM32F407 we use the USB interface to connect to a USB memory stick. The base of the project was generated with CubeMX.

To conserve battery power, we need to switch off the USB memory device as we only write or read from it intermittently.

However, we have a small problem when we power up the USB again after a while in that the USBH interface detects that a device is connected but then fails to continue enumerating the device and I never get the  HOST_USER_CLASS_ACTIVE event.

So far I used a timeout of 10 seconds for this to come in and then power cycle the USB port again. Then often it wakes up correctly and I get the HOST_USER_CLASS_ACTIVE within some 500ms or so.

After I power up the USB I call MX_USB_HOST_Init() to what I think is to kick the USBH library and init and enumerate the device.

So how I am supposed to power up the USB on demand and get it to enumerate and be ready in a reliable way without having to power cycle multiple times?