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

1 REPLY 1
FBL
ST Employee

Hi @NAtta.1 

Thank you for sharing this project and for the clear explanation of your approach.

It is great to see a baremetal USB PD sink implementation for STM32 UCPD, especially with such a lightweight structure and a focus on portability. Your work may be useful for developers looking for a simple sink-only solution without an RTOS or middleware dependency.

As a reminder, the main focus of this community is to provide support for ST official products and software stacks. That said, community contributions like yours are always welcome when they help other members explore new approaches and exchange practical feedback.

Thanks again for contributing to the ST Community, and best of luck with your testing campaign. If you share updates or test results from other STM32 families, I’m sure they will be valuable for the community.

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.




Best regards,
FBL