cancel
Showing results for 
Search instead for 
Did you mean: 

Minimal bare-metal USB-C PD sink for STM32 UCPD, no RTOS, looking for testers

NAtta.1
Associate

Hi everyone,

I have published a small bare-metal USB-C Power Delivery sink example for STM32 MCUs with the built-in UCPD peripheral:

https://github.com/robobtnet/stm32-usb-pd-baremetal-sink

The goal is to keep it minimal and portable:
- no FreeRTOS
- no ST USB-PD middleware
- only two core files: pd_bm.c and pd_bm.h
- configurable sink profiles
- starts from the highest configured voltage profile, then falls back to lower profiles
- reports the selected PD contract through the API

The current tested setup is NUCLEO-G474RE using UCPD1. I also added porting notes for STM32U5/GPDMA based on an STM32U575 test project.

I would appreciate tests and feedback on other STM32 families or boards that include UCPD, especially:
- STM32G0
- STM32G4
- STM32U5
- STM32L5
- boards using UCPD2
- boards using GPDMA instead of classic DMA
- different USB-C PD chargers and PDO combinations

This is not intended to be a full USB-PD stack. It is a lightweight sink-only example for simple cases where the MCU only needs to request a fixed PDO such as 9 V, 15 V, or 20 V.

Known scope/limitations:
- sink only
- fixed PDO selection
- no PPS/APDO support yet
- no VBUS measurement/control inside the core
- RX uses an application-provided DMA callback
- board-specific clocks, pins, DMA, interrupts, and dead-battery handoff stay in the application layer

If anyone can test it on another STM32 UCPD device, I would be happy to receive issues, pull requests, or test results on GitHub.

Thanks,
Naser

0 REPLIES 0