cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431 UCPD continuous power cycling

Stefano.Patassa
Associate II

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!

12 REPLIES 12
Stefano.Patassa
Associate II

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:

  • both PC and wall charger are sending USBPD_CORE_DATATYPE_RCV_REQ_PDO instead of what it is used in the examples...
  • if i try to cut and paste the code from the examples, compiler is upset by not having DPM_Ports defined anywhere, in fact a search in the code does not find anything. Is it possible lastest version has different naming respect to the examples?

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

Dear Stefano,

Happy to see that you are progressing in your setup.

  • Did you apply compare your application with Simple application:

https://github.com/STMicroelectronics/STM32CubeG4/tree/master/Projects/STM32G474E-EVAL/Applications/USB-PD/USB-PD_Consumer_1port

I remind here the expected sink power negotiation (described in UM2552 as well):

0693W000005BuEQQA0.pngI attached the NO_RTOS application based on G4.

DPM_Ports is defined in usbpd_dpm_user.c.

Regards,

Yohann

Stefano.Patassa
Associate II

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.