2020-11-02 11:25 AM
Hi,
I'm developing an USB-C sink, using dead battery feature.
I have respective CCx pins connected to DBCCx pins and the source can successfully power the sink.
However, when the UCPD code starts running, the source disconects the 5V, effectively resulting in an endless power cycle.
I have powered the board externally and connected trough the STM32G0 Discovery in spy mode to have some trace capability. Attached you'll find the trace dump.
I'm using lastest version of the libraries, followed the AN5418 to the letter... I can confirm the vbus sensing is correctly working.
I have tried as a source both a pc and an usb-c wall charger. Same behaviour...
The same occours also if i disconnect the DBCCx pins and use an external power supply for the 3.3v...
Anybody has some ideas why this is happening?
Any help will be immensely appreciated!
Solved! Go to Solution.
2020-11-18 12:52 PM
Dear Yohann,
We are getting somewhere! By adding that line to the USBPD_DPM_TraceWakeUp function i can get a proper trace of what's going on.
Attached the lastest trace, i have two issues:
One thing i noticed, i have to put back that magic line in USBPD_DPM_TraceWakeUp function everytime i regenerate code with cubemx, any workaround to this?
Thank you very much for your help!!
Stefano
2020-11-18 11:50 PM
Dear Stefano,
Happy to see that you are progressing in your setup.
I remind here the expected sink power negotiation (described in UM2552 as well):
I attached the NO_RTOS application based on G4.
DPM_Ports is defined in usbpd_dpm_user.c.
Regards,
Yohann
2020-11-20 08:50 AM
Hello Yohann,
IT WORKS!
Thank you very much for your help, it was invaluable.
The main improvement was getting the trace work, after that was easy to understand there was some of my code holding up the execution of the USBC code for too long for it to correctly reply to the SRC.
Thank you again
PS: Please consider adding DPM_Sleep_time[USBPD_PORT_COUNT + OFFSET_CAD] = 0; to CubeMX generated code because this is the only annoying thing to add it again each time i rebuild the code from CubeMX.