gitmyhub

X-CUBE-USB-PD

C ★ 56 updated 8y ago ⑂ fork

USB-PD Firmware (X-Cube-USB-PD) for STM32F0 Nucleo boards (named P-NUCLEO-USB002 & P-NUCLEO-USB001)

X-Cube-USB-PD Explanation

This project is firmware that turns a simple STM32 microcontroller into a USB Power Delivery controller. In practical terms, it lets you build devices that can negotiate power and data over USB-C cables automatically—figuring out how much power to draw, what voltage to use, and whether to charge fast or slow. Rather than relying on a dedicated chip to handle all of this, the code runs entirely on the microcontroller's software, which keeps costs down.

USB Power Delivery (USB-PD) is the standard that allows USB-C devices to communicate about power needs. Without it, your phone might not know it can charge at full speed, or a laptop might draw the wrong voltage. This firmware implements the full USB-PD protocol, so a device built with it can talk to chargers, docks, and other USB-C equipment and agree on the best power settings for both sides.

The repo includes firmware for two different hardware setups. Both use the same STM32F072 microcontroller as the brain, but they differ in how the power-switching part is built. One version (P-NUCLEO-USB002) uses a dedicated chip called the STUSB1602 to handle the high-voltage switching. The other (P-NUCLEO-USB001) builds that switching part out of discrete components like resistors and transistors. The discrete version is cheaper to manufacture but requires more careful circuit design. Both setups are officially certified by the USB standards organization, so they meet real-world requirements.

This would appeal to hardware designers and engineers building custom USB-C chargers, power banks, or devices that need smart power negotiation. Instead of licensing an expensive proprietary solution, they can use this open-source firmware as a starting point and customize it for their specific needs.