2023-09-24 11:41 AM - edited 2023-09-24 11:47 AM
Hello,
I am developing a USB PD sink application on custom board with STM32G0B1VET
I am using periphery UCPD2. I followed AN5418 to set up eveyrthing in CubeMX and add the specified pieces of code.
Hovewer, ithe USBPD stack doesn't seem to send or recieve anything on the CC1 or CC2 lines. I have confirmed with oscilloscope, data is flowing to the MCU CC2 pin, but nothing seem to happen inside the USB stack.
This is as far as it gets:
With a sniffer device, I can see the power supply sending source capabilities, but these packets are nowhere to be seen when logging the application.
This leads me to believe, the USB PD stack isn't getting the data.
Any ideas where to look for the problem? I have followed the instrucions and I can't see how this could be a electricall issue.
Firmware package is STM32Cube FW_G0 V1.6.1
Thank you for any help
Solved! Go to Solution.
2023-10-02 09:58 AM - edited 2023-10-02 10:00 AM
Solved it.
Turns out, precise timing is very important. Even though all ST manuals suggest using internal 16MHz RC oscilator, it might not be precise enough. After switching to external crystal oscilator, it started working as expected.
Hope this helps anyone in this situation.
@LLECH.1 please update your manuals to reflect this finding. At least as a debug step. It had cost me 15h of my life to figure out.
Also external pull down resistors don't actually hurt anything and can stay.
2023-09-24 09:47 PM
Hello @Tadeas_Pilar ,
First let me welcome you to the Community :)
I recommend you follow the tips and FAQ described in ST Wiki page. This will help you to start and debug your application.
Imen
2023-09-25 02:09 AM - edited 2023-09-25 03:41 AM
I went through that. None of the tips seem applicable to my problems.
I need something more low-level. Some way to check the UPDC perihrey is even alive and reading the data.
2023-09-25 04:58 AM
Hello @Tadeas_Pilar,
It seems that VBUS is not detected by your sink device. Could you check if 5V is detected on VBUS with USBPD_DPM_IsPowerReady() function please ? What is your hardware setup ? Do you use a TCPP01 shield ? In that case the shield musn't be plugged on the nucleo board since you use UCPD2 instance.
To help you more efficiently, it would be nice to get your project. Would you provide us your code please?
Best regards,
LECHEVESTRIER Lucas
2023-09-26 06:29 AM
I am using custom development board. The CC lines are connected to ground with 4k7 resistors. No other connection to other parts. No protection, no filtering.
USBPD_DPM_IsPowerReady returns USBPD_ENABLE. I am monitoring the Vbus voltage using BSP_USBPD_PWR_VBUSGetVoltage and it returns stable voltage around 4.9V. I believe this part of my project is correct.
It would be great if you could take a look at my project.
Thank you
2023-09-27 02:52 AM
Hello @Tadeas_Pilar,
I took a look on your project and it seems you forget to add some pieces of code. For example, USBPD_DPM_SNK_EvaluateCapabilities() function should be completed as indicated in AN5418.
Also you don't need to add additional 4k7 resistors on your custom board since they are included in UCPD IP, you just need to configure those resistors.
Best regards,
LECHEVESTRIER Lucas
2023-09-27 07:23 AM
I had USBPD_DPM_SNK_EvaluateCapabilities() implemented before. Probably got lost in some of the numerous CubeMX code generations.
But it never gets called. You can see in the log in my original post, it never writes "ADVICE: update USBPD_DPM_SNK_EvaluateCapabilities"
2023-09-28 05:56 AM
What about resistors ? Do you have additional resistors on your board ? It should not be the case.
Best regards,
LECHEVESTRIER Lucas
2023-09-28 06:03 AM
Did you follow this wiki : Make a Power Delivery Sink
It is a useful page to help you to build your own Sink device.
Best regards,
LECHEVESTRIER Lucas
2023-09-28 09:44 AM
The CC1 and CC2 lines are connected like this