cancel
Showing results for 
Search instead for 
Did you mean: 

USB-C Power Delivery Disconnects at Power State Change

captat
Associate II

I am using the NUCLEO-G474RE along with the X-NUCLEO-SRC1M1 board to create a USB-C power delivery source. I am also using the "SRC1M1_Source" example project in the x-cube-tcpp software download.

I am attempting to provide a 20V, 5000mA source to a USB-C power delivery sink. After I connect the nucleo board to the STM32CubeMonitor-UCPD, I am able to add the 20V, 5000mA PDO and send it to the target. 

I plug the sink device into my SRC1M1 board (trace data attached)

I see the sink requests the 20V, 5000mA profile, however the trace data shows USBPD_CAD_STATE_DETACH_SRC soon after the profile is accepted by my source. The connection and negotiation then start again and continue in an infinite loop. 

I am supplying the SRC1M1 board with an external power supply set to 5V. I had assumed that the source would not indicate SRC_READY until I manually adjusted the supply voltage to 20V, however it just disconnects. 

What is the proper way to use the SRC1M1 source board to establish a 20V contract with a sink device?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Nicolas P.
ST Employee

Hi @captat 

Thanks for sharing your case.

PSready should be sent only once 20V is ready.

About the unexpected detach (1017107), it may be due to SINK event (like a Vbus protection). Could you check Vbus voltage ? (You could use trace system to display VBUS level like explained here.)

Have a look at the G0 demonstration on the G0 Evaluation board in github. Are you using functions similar to  USBPD_PWR_IF_SetProfile and BSP_USBPD_PWR_VBUSSetVoltage_Fixed ?

I put here a trace of the G0 evaluation messages (Port 1 = SRC, On the G0 Evaluation board we have a DCDC that need to be controlled with a PWM) :

We have a request of PDO3 (15V), and we can observe between  PE_SRC_TRANSITION_SUPPLY and PE_SRC_TRANSITION_SUPPLY_EXIT some delay to adjust VBUS, and then we can send the PS RDY.

(You can also notice the SOP1 VDM discovery discussions for the cable 5A support check)
CAD	361617	1	USBPD_CAD_STATE_EMC	0	
CAD	361625	1	USBPD_CAD_STATE_SWITCH_TO_SNK	1	
CAD	361627	1	USBPD_CAD_STATE_DETACHED	2	
CAD	361701	1	USBPD_CAD_STATE_ATTACHED_WAIT	3	
CAD	361791	1	USBPD_CAD_STATE_ATTEMC	5	
NOTIF	361791	1	USBSTACK_START	6	
DEBUG	361791	1	USBIF host start	7	
EVENT	361791	1	EVENT_ATTEMC	8	
DEBUG	361791	1	EN_VBUS	9	
DEBUG	361791	1	CC:2 VCONN:1	10	
DEBUG	361791	1	VCONN ON	11	
DEBUG	361791	1	VBUS ON	12	
DEBUG	361792	1	duty_c=176:cal=:0	13	
DEBUG	361810	1	ca5V:433	14	
PE	361810	1	PE_SRC_STARTUP	15	
NOTIF	361810	1	POWER_STATE_CHANGE	16	
PE	361810	1	PE_CABLE_VDM_DISCOVERY_REQUEST	17	
OUT	361812	1	SOP1	s:006	 PD3	    H:0x108F    	(id:0, DR:UFP, PR:SNK) 	VENDOR_DEFINED	
	VDM:SVDM_DISCOVER_IDENTITY	INIT	 DATA:01A800FF
	18	
OUT	361813	1	SOP1	s:006	 PD3	    H:0x108F    	(id:0, DR:UFP, PR:SNK) 	VENDOR_DEFINED	
	VDM:SVDM_DISCOVER_IDENTITY	INIT	 DATA:01A800FF
	19	
OUT	361815	1	SOP1	s:006	 PD3	    H:0x108F    	(id:0, DR:UFP, PR:SNK) 	VENDOR_DEFINED	
	VDM:SVDM_DISCOVER_IDENTITY	INIT	 DATA:01A800FF
	20	
PE	361817	1	PE_SRC_SEND_CAPABILITIES	21	
OUT	361825	1	SOP	 PD3	s:022	    H:0x51A1    	(id:0, DR:DFP, PR:SRC) 	SRC_CAPABILITIES	DATA: 2C9101232CD102002CB104003C32DCC03C3240C1	
Option: 	UNCHUNK	DRD	DRP	
 [1] Fixed : 5V - 3A
 [2] Fixed : 9V - 3A
 [3] Fixed : 15V - 3A
 [4] Programmable : [5V - 11V] - 3A
 [5] Programmable : [5V - 16V] - 3A
	30	
IN	361827	1	SOP	s:002	    H:0x0041     (id:0, DR:UFP, PR:SNK) 	GOODCRC	33	
NOTIF	361827	1	SRCCAP_SENT	34	
PE	361827	1	PE_SRC_WAIT_REQUEST	35	
IN	361829	1	SOP	 PD3	REQUEST	s:006	    H:0x1082    	(id:0, DR:UFP, PR:SNK)  DATA: 96588231
ObjectPosition:3
GiveBack:0
CapabilityMismatch:0
USBCommunicationCapable:0
NoUSBSuspend:1
UnchunkedExtendedMessagesSupported:1
MaximumOperatingCurrent:1500mA
OperatingCurrent:1500mA	39	
OUT	361829	1	SOP	s:002	    H:0x0161     (id:0, DR:DFP, PR:SRC) 	GOODCRC	40	
PE	361830	1	PE_SRC_NEGOTIATE_CAPABILITY	43	
OUT	361832	1	SOP	 PD3	ACCEPT	s:002	    H:0x03A3     (id:1, DR:DFP, PR:SRC) 	44	
IN	361833	1	SOP	s:002	    H:0x0241     (id:1, DR:UFP, PR:SNK) 	GOODCRC	47	
PE	361833	1	PE_SRC_TRANSITION_SUPPLY	48	
NOTIF	361863	1	POWER_STATE_CHANGE	52	
DEBUG	361863	1	duty_c=432:cal=:0	53	
DEBUG	361927	1	ca15V:2746	56	
DEBUG	361932	1	V:15043(count=1)	57	
PE	361932	1	PE_SRC_TRANSITION_SUPPLY_EXIT	58	
OUT	361934	1	SOP	 PD3	PS_RDY	s:002	    H:0x05A6     (id:2, DR:DFP, PR:SRC) 	59	
IN	361935	1	SOP	s:002	    H:0x0441     (id:2, DR:UFP, PR:SNK) 	GOODCRC	62	
NOTIF	361935	1	POWER_STATE_CHANGE	63	
NOTIF	361935	1	POWER_EXPLICIT_CONTRACT	64	

You can also have a look at STEVAL-2STPD01 with associated software.

It’s a USB Type-C Power Delivery dual port adapter based on the STPD01 programmable buck converter with a STM32G071RE on NUCLEO + 2x TCPP02-M18 + 2x STPD01.

Input DC voltage of the buck is 24V and each USB-C port can deliver 20V – 3A independently. Ant the voltage control is done thanks to an I2C bus.

View solution in original post

2 REPLIES 2
Nicolas P.
ST Employee

Hi @captat 

Thanks for sharing your case.

PSready should be sent only once 20V is ready.

About the unexpected detach (1017107), it may be due to SINK event (like a Vbus protection). Could you check Vbus voltage ? (You could use trace system to display VBUS level like explained here.)

Have a look at the G0 demonstration on the G0 Evaluation board in github. Are you using functions similar to  USBPD_PWR_IF_SetProfile and BSP_USBPD_PWR_VBUSSetVoltage_Fixed ?

I put here a trace of the G0 evaluation messages (Port 1 = SRC, On the G0 Evaluation board we have a DCDC that need to be controlled with a PWM) :

We have a request of PDO3 (15V), and we can observe between  PE_SRC_TRANSITION_SUPPLY and PE_SRC_TRANSITION_SUPPLY_EXIT some delay to adjust VBUS, and then we can send the PS RDY.

(You can also notice the SOP1 VDM discovery discussions for the cable 5A support check)
CAD	361617	1	USBPD_CAD_STATE_EMC	0	
CAD	361625	1	USBPD_CAD_STATE_SWITCH_TO_SNK	1	
CAD	361627	1	USBPD_CAD_STATE_DETACHED	2	
CAD	361701	1	USBPD_CAD_STATE_ATTACHED_WAIT	3	
CAD	361791	1	USBPD_CAD_STATE_ATTEMC	5	
NOTIF	361791	1	USBSTACK_START	6	
DEBUG	361791	1	USBIF host start	7	
EVENT	361791	1	EVENT_ATTEMC	8	
DEBUG	361791	1	EN_VBUS	9	
DEBUG	361791	1	CC:2 VCONN:1	10	
DEBUG	361791	1	VCONN ON	11	
DEBUG	361791	1	VBUS ON	12	
DEBUG	361792	1	duty_c=176:cal=:0	13	
DEBUG	361810	1	ca5V:433	14	
PE	361810	1	PE_SRC_STARTUP	15	
NOTIF	361810	1	POWER_STATE_CHANGE	16	
PE	361810	1	PE_CABLE_VDM_DISCOVERY_REQUEST	17	
OUT	361812	1	SOP1	s:006	 PD3	    H:0x108F    	(id:0, DR:UFP, PR:SNK) 	VENDOR_DEFINED	
	VDM:SVDM_DISCOVER_IDENTITY	INIT	 DATA:01A800FF
	18	
OUT	361813	1	SOP1	s:006	 PD3	    H:0x108F    	(id:0, DR:UFP, PR:SNK) 	VENDOR_DEFINED	
	VDM:SVDM_DISCOVER_IDENTITY	INIT	 DATA:01A800FF
	19	
OUT	361815	1	SOP1	s:006	 PD3	    H:0x108F    	(id:0, DR:UFP, PR:SNK) 	VENDOR_DEFINED	
	VDM:SVDM_DISCOVER_IDENTITY	INIT	 DATA:01A800FF
	20	
PE	361817	1	PE_SRC_SEND_CAPABILITIES	21	
OUT	361825	1	SOP	 PD3	s:022	    H:0x51A1    	(id:0, DR:DFP, PR:SRC) 	SRC_CAPABILITIES	DATA: 2C9101232CD102002CB104003C32DCC03C3240C1	
Option: 	UNCHUNK	DRD	DRP	
 [1] Fixed : 5V - 3A
 [2] Fixed : 9V - 3A
 [3] Fixed : 15V - 3A
 [4] Programmable : [5V - 11V] - 3A
 [5] Programmable : [5V - 16V] - 3A
	30	
IN	361827	1	SOP	s:002	    H:0x0041     (id:0, DR:UFP, PR:SNK) 	GOODCRC	33	
NOTIF	361827	1	SRCCAP_SENT	34	
PE	361827	1	PE_SRC_WAIT_REQUEST	35	
IN	361829	1	SOP	 PD3	REQUEST	s:006	    H:0x1082    	(id:0, DR:UFP, PR:SNK)  DATA: 96588231
ObjectPosition:3
GiveBack:0
CapabilityMismatch:0
USBCommunicationCapable:0
NoUSBSuspend:1
UnchunkedExtendedMessagesSupported:1
MaximumOperatingCurrent:1500mA
OperatingCurrent:1500mA	39	
OUT	361829	1	SOP	s:002	    H:0x0161     (id:0, DR:DFP, PR:SRC) 	GOODCRC	40	
PE	361830	1	PE_SRC_NEGOTIATE_CAPABILITY	43	
OUT	361832	1	SOP	 PD3	ACCEPT	s:002	    H:0x03A3     (id:1, DR:DFP, PR:SRC) 	44	
IN	361833	1	SOP	s:002	    H:0x0241     (id:1, DR:UFP, PR:SNK) 	GOODCRC	47	
PE	361833	1	PE_SRC_TRANSITION_SUPPLY	48	
NOTIF	361863	1	POWER_STATE_CHANGE	52	
DEBUG	361863	1	duty_c=432:cal=:0	53	
DEBUG	361927	1	ca15V:2746	56	
DEBUG	361932	1	V:15043(count=1)	57	
PE	361932	1	PE_SRC_TRANSITION_SUPPLY_EXIT	58	
OUT	361934	1	SOP	 PD3	PS_RDY	s:002	    H:0x05A6     (id:2, DR:DFP, PR:SRC) 	59	
IN	361935	1	SOP	s:002	    H:0x0441     (id:2, DR:UFP, PR:SNK) 	GOODCRC	62	
NOTIF	361935	1	POWER_STATE_CHANGE	63	
NOTIF	361935	1	POWER_EXPLICIT_CONTRACT	64	

You can also have a look at STEVAL-2STPD01 with associated software.

It’s a USB Type-C Power Delivery dual port adapter based on the STPD01 programmable buck converter with a STM32G071RE on NUCLEO + 2x TCPP02-M18 + 2x STPD01.

Input DC voltage of the buck is 24V and each USB-C port can deliver 20V – 3A independently. Ant the voltage control is done thanks to an I2C bus.

Thanks for the pointers. Turns out, the USBPD_PWR_IF_SetProfile function I was using was hard coded to use the first PDO profile, not the 20V profile the sink was requesting. Using the code in the github link you provided as an example, I was able to get my setup working. Additionally, I needed to switch the source voltage much more quickly. Seems like the voltage needed to be switched within several hundred milliseconds or a hard reset would occur.