cancel
Showing results for 
Search instead for 
Did you mean: 

USBPD Driver DRP Behavior

Carl_G
Associate III

I am using the USB PD driver package on an STM32G071. I have 4 ports. Two are SNK and the other two should operate as SNK unless I have a power source.

First issue is DRP will not work unless you also enable CAD role toggle in the configuration. If you don't enable that then it does not detect the cable from what I can see. Does anyone know why this is or a way to change it?

Second question, is there a way to manually control the behavior of the DRP port? I'd like it to be a SNK until my power source is connected. Then and only then I'd like it to be DRP.

3 REPLIES 3
FBL
ST Employee

Hi @Carl_G 

First, STM32G071 have 2 ports. Second, cable Attach/Detach role toggle for Dual Role Power functionality to detect the cable is detailed in USB Power Delivery (USB PD) and USB Type-C specifications manage role detection and state transitions. Third, about your last question, you can change roles on the fly using Power Role Swap. This could be managed by your DPM in your application.

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.

Carl_G
Associate III

@FBL , yes sorry, 2 ports. 4 lines. In any event. When configured as DRP it does not work. The DRP port seems to be setup as a SRC as it was instructed to be by the configuration tool. I check with the oscilloscope and CC1 and CC2 are both high. But when I connect the SNK device with a cable, the CC voltage drops but the SNK is not detected. However, simply changing the port mode to SRC which only changes 1 line in a define file, makes it not detect the SNK when connected. OR setting the port to toggle also works. But by default it doesn't seem to work.

I have read the spec and I have used other chips and I have implemented DRP from scratch on other hardware so I am familiar with how it should work.  

Power Role Swap is a request to the port partner to change roles correct? Its not a command you send to the local hardware. Or are you suggesting I send a PRS every 50ms or so to toggle the port mode?

I can't test the example code because it relies on having the nucleo DRP board which I don't have. I only have the nucleo SNK board. I do however have my own PCB but it doesn't contain the TCPP chip so again I can't test the DRP example code as is.

Anyway as I said, it works if I enable port toggling, but without that, it correctly sets the port into Default SRC mode but it does not detect the connection when I plug the cable in with a SNK device on the other end. I watch the voltage on the CC drop but its not detected.

Carl_G
Associate III

Here is what I consider a problem.

With no connections the function CAD_StateMachine_SNK is called several times after reset. However, with no connections and not toggling the port the function CAD_StateMachine_DRP is NOT called. Thus, a DRP does not detect any connections. Seems like an issue. If port toggling is required for DRP then it should be force enabled in the configuration.

The inspiration for this behavior appears to be in the USBPD Library file.