cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 usb bus powered limitation

JB91
Associate II

We are currently developing a portable device with a STM32F4 display and so on. It is usually powered with non-rechargeable batteries (4x AA LR6). It consumes at least 140mA and max 450mA.

As everyone has a micro usb cable and power plug, we thought about using a micro usb socket as an alternative power source.  As soon as the usb micro cable is plugged in, the internal electronic switches immediately from the non-rechargeable batteries to the usb source. It won’t be possible to inadvertently charge the non-rechargeable batteries.

1.      Is it allowed to use the usb socket for this power purpose (no charching, no data transmission, only power supply)? Even if the device consumes more power than specified?

2.      In the next step we are also thinking about another additional feature. This would be to also use the usb for data transmission (mass storage device) and power supply. As far as I have understood the specification, the device has to negotiate with the power provider(e.g. pc) , if it gets enough power. The problem is, with the specified 100mA the device won’t even turn on to start negotiating for the power. Is it anyhow allowed to consume more than 100mA for a second until the the device has asked the host to get more power? Or is it even possible to get the STM32 running in a low power mode only to ask for more power afterwards firing up?

Thanks a lot. We would appreciate any help or hint.

1 REPLY 1

As you've said, the device is not supposed to draw more than 100mA before configuration (and the host may refuse to configure a device asking for more current than the host is willing to supply). However, in the USB world, violation of many aspects of the standard is widespread, and hosts (or hubs) actually enforcing the 100mA-before-configuration limit (i.e. having an actual power switch) are exceedingly rare; OTOH, devices violating the current limit are relatively common.

So, for 1., I'd say, use it, but be prepared for various scenarios on VBUS - current limiting resistance, host switching off after detecting overcurrent after certain timeout and then switching on again, resulting in pulsing input, etc. Maybe the easiest solution would be to boost the VBUS slightly above maximum possible VBAT and then merge the two simply through diodes before dropping (or further boosting) it to the common supply voltage. But the design details are up to you.

For 2., if such a sophisticated power supply scheme is employed, you shouldn't count on full 5V/100mA either, as there will be inevitably losses. Nevertheless, the STM32 itself can comfortably run USB at a lowered clock out of a few tens of mA, simply dont use anything else - mainly external circuitry which consumes the 100s of mA - but the STM32, at lower clock, and in it only USB, while enumerating.

JW