Skip to main content
Associate
August 15, 2024
Solved

USBPD CC orientation STM32G071RB

  • August 15, 2024
  • 6 replies
  • 2381 views

Hi, I am troubleshooting a custom board using USBPD as sink.

 

It only negotiates a PDO on one orientation of the USBC connector.

Checked with an oscilloscope and I see waveform going to CC1 on the orientation that works , naturally, and changing orientation I see a waveform going to CC2 but it does not negotiate on this side.

 


I know the signal goes to CC2's pin. The pin is configured in STM32CubeIDE as UCPD_CC2 and set to analog mode.

 

The cable detection feature also does not work to detect dettach events.

Any advice appreciated. Using 4.1.0 TCPP library version. 

 

 

Best answer by josemdq

Hi, ok, I think the problem is solved.

Thanks for that pointer to the ADC. During my debugging session I saw the library constantly executing the function you pointed to after connecting the USBC port.

After adding the voltage divider and configuring the ADC properly both orientations work without resetting the MCU.

Before I was also not getting cable detach traces. Now I do see them.

I would say that without the ADC it would never realize the cable was detached and kept CC1/CC2 configuration from the first negotiation.

Regards, Jose

6 replies

BarryWhit
Lead
August 15, 2024

Can you show the schematic? 

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."
josemdqAuthor
Associate
August 16, 2024

josemdq_1-1723771453805.png

 

josemdq_0-1723771261177.png

We are transitioning from FUSB302 PD controller. Right now we have the same DNP config as schematic for jumper selection of STM32 UCPD controller.

 

BarryWhit
Lead
August 16, 2024

Do you have Capacitors on CC1c/CC2c as per datasheet section 6.6.4 "CC line capacitance (C1, C2)"? (probably not the issue)

 

Where did you probe with the scope - on the connector pin side or on the MCU pin side? Did you probe on the MCU pin itself or near it?

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."
josemdqAuthor
Associate
August 16, 2024

I don't have caps on the CC1c/CC2c.

 

I have probed on the MCU pin itself. The waveform looks the same as the signal on CC1 when I change connector orientation. Seems like the DFP keeps sending packets but MCU does not respond.

 

 

BarryWhit
Lead
August 18, 2024

You can try and follow

https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Sink#-5BOPTIONAL--Configure_Tracer_for_debug

Which describes how to set up PD for tracing/debugging with UCPD monitor, so you can see if the STM32 is seeing the messages from the DFP.

(note other related wiki articles on different PD roles appear in the TOC on the left)

 

Please post an update if you make progress figuring it out.

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."
josemdqAuthor
Associate
August 18, 2024

Hi Barry, thanks. I found something interesting.

 

If a do an MCU reset in between orientation flips it always works.

After a successful negotiation it will only work on that orientation until I restart the MCU, which makes me think maybe my code is missing something? Does the ST library expect a command after an unplug event to prepare for the next negotiation?

BarryWhit
Lead
August 18, 2024

ah, progress indeed.

 

I'm not sure what it expects. A quick look found this in one of the example projects where the detach event code isn't auto-generated. I have no idea what (if anything) depends on this, but you could try to chase it up the call chain and see

 

Did you base your app on one of the existing example projects in the Cube Package? 

You could also try and see if the same behavior occurs with the official ST eval board and debug from there.

 

 

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."
josemdqAuthor
Associate
August 18, 2024

OK, I don't have a VBUS voltage divider on my hardware and start to think it is related to that. 

josemdqAuthorBest answer
Associate
August 19, 2024

Hi, ok, I think the problem is solved.

Thanks for that pointer to the ADC. During my debugging session I saw the library constantly executing the function you pointed to after connecting the USBC port.

After adding the voltage divider and configuring the ADC properly both orientations work without resetting the MCU.

Before I was also not getting cable detach traces. Now I do see them.

I would say that without the ADC it would never realize the cable was detached and kept CC1/CC2 configuration from the first negotiation.

Regards, Jose

BarryWhit
Lead
August 19, 2024

Good job. You should accept your own solution.

 

For future visitors, Section 5.1.5 "ADC configuration for VBUS reading" of AN5418 provides the details and states that monitoring VBUS with the ADC is required for correct operation of the USB state machines.

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."