cancel
Showing results for 
Search instead for 
Did you mean: 

USB-C PD Dual Role Power Swap not working

YLV
Associate

Hello,

I have been working for a week now on USB-C Power Delivery Library for STM32G0 but I am facing some problems to communicate with other devices. I want to setup a Dual Role Power (DRP) communication with a power bank also supporting DRP.

I based my code on the USB-PD sink introduction example, changing only the total heap size of FreeRTOS to 10KB to be able to launch the USBC thread.

Then, I added some Source and Sink PDOs to the system: 0x22019096 (5V DRP+DRD), 0x2202d096 (9V DRP+DRD) and 0x2203c096 (12V DRP+DRD) based on the USB-C PD Rev3.0 specs.

My hardware setup looks like this (I adapted the measurement of VBUS for BSP_PWR_VBUSGetVoltage):

0693W000004JGKGQA4.png

I even downloaded the USB-C PD ST Microcontroller Guide and looked at the PR Swap Accepted request message sequence, but this time, but this time I get no notification at all.

Eventually, In my default thread when I launch the power role swap :

USBPD_StatusTypeDef ret = USBPD_DPM_RequestPowerRoleSwap(USBPD_PORT_0);

I can't even connect to STM32CubeMonitor UCPD. The only trace I can get with my COM port is "PRS not accepted by the stack", which doesn't help me either.

The return status USBPD_ERROR and I don't really know why. When debugging, you end up in the USBPD pre-compiled code so no way to find what the problem is.

I never found a Dual Role Power code example on Internet. Can someone help me?

Thanks in advance

1 REPLY 1
Nicolas P.
ST Employee

Hello @Yann Le Vaguerès​ ,

The mentioned application note is not handling power role swap.

There are examples of DRP application on STM32G0 and STM32G4 Evaluation board.

See the USBPD wiki page special chapter on available examples.

Having source and sink PDOs is not enough. How is your stack configured ?

The message "PRS not accepted by the stack" can indicate that the configuration of your stack is not correct.

Can you attach the .cpd file please ?

Nicolas