Showing results for 
Search instead for 
Did you mean: 

STM32F4 USB host/device with USB-C connector


Hi, I want to use a USB with USB-C connector and STM32F427 mostly as a HOST for USB mass storage, but it has to be able to switch to device, works as serial port. A 5V can be applied to the USB by a power switch for a HOST mode, and can be detected with a resistor divider and STM's VBUS pin in both modes. What I am wondering is a power delivery. I do not want to use an additional PD controller. Is it possible to use simple pullups/pulldowns resistors on CC pins? Do I have to switch them eg. by a transistors, to connect PU in host mode and PD in device mode? Maybe someone did it already and can suggest simple solution.


ST Employee

Hello @mkuczma 

You can use a MOSFET to switch the power delivery. Check the shield for dual role as an example. Schematic diagrams - (



To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.