[Open_electroporator] STM32F401CE powerup from USB, onboard switchers, battery power

John Griessen john at cibolo.com
Sat Dec 30 12:24:37 UTC 2017


I've looked up the GPIO details of the STM32F401CE and confirm that a plan to use inexpensive PFETs to switch power from 3 sources 
will work fine.  All IO pins in STM32F401's are tolerant of 5 volts in a way that lets you set an output as pulldown, then let it 
float up to 5V and not damage anything.  There are protection diodes that sink enough current to keep the volts within the range 
the GPIO pin circuitry can handle.

One source of power will be the same microUSB type AB connector used to set up communication with the REPL via the main 
micropython USB port at PA9 PA10 PA11 PA12.  Type AB connectors are trapezoidal looking at the end.

Another source of power will be a microUSB type C connector, (fat oval looking at end), to be used only for power.  Type C 
connectors have two sets of contacts for each voltage, so the take a lot of wear and tear.  An external power adapter (wall wart), 
can be used with this connector.

A third source of power will be a LiFePO4 battery with charging circuit on the pyflex_f401 module.  It will use a USB C connector,
but not be a "live" USB device or host, so it will be violating the USB spec, and is only intended to be used with a wall wart 
power adapter.

Using PFETs switches for multiple power sources, one could short two of them together, which would drive VBUS in the upstream 
direction which would be a big violation of the USB specs.  So, I will make a code section that deals with all of them at one go 
to avoid problems.  To allow for easy starting from zero, there will also be a schottky diode bypassing each of the USB ports and 
connecting to the VUNREG signal on the pyflex_f401 module.  They don't allow any upstream driving of the VBUS pin.  They will 
allow starting the MCU when either USB port is powered and the battery is low.



More information about the open_electroporator mailing list