cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-G474 and X-Nucleo-USBPDM1 sink setup for continuous changement of PDOs and APDOs

S.Cross
Associate II

Hey there,

since a few weeks i am setting up a USB-PD sink with the Nuc-USBPDM1 and Nuc-G474.

In this special case i want to:

1. Read out charger PDOs

2. Set up Fixed PDOs (e.g. 15V@3A) and switching during runtime

3. Set up APDOs according to PPS (variable voltage and current) and switching during runtime

My project files are generated by CubeMX with firmware package 1.2.0 for the G4 series (with 1.3.0 i couldn't get this work). I am using non RTOS mode.

For now it is possible for me to select fixed PDOs and switching them during runtime (by USBPD_DPM_RequestMessageRequest). But when i want to set up an APDO (by requesting continuously every 100ms) i can't get this work.

Only the first request is sent by the stack (proved with Cypres USB-PD protocol analyser) and after this i only get a "USBPD_BUSY" or "USBPD_ERROR" by the request function and the stack goes crazy (hard resetting every few seconds). The whole board has to be reset, that USB-PD stack works stable again.

Is there any possibility to get PPS working properly with my setup. Or do i have to make special changes in CubeMX, "usbpd_dpm_user" or "usbpd_dpm_core"?

Best regards

20 REPLIES 20
S.Cross
Associate II

Dear @Guenael Cadier​ ,

i'm happy that my code seems right! I checked your code snippet and this code is executed correctly in my setup.

On my X-NUCLEO-USBPDM1 i checked the jumper settings of JP2 and recognized, that i configured [VCC-3.3V] and [DB-3.3V] because i don't want low power mode. So i disabled USBPDM1_VCC_FEATURE_ENABLED and USBPDM1_DB_OUT_FEATURE_ENABLED in usbpdm1_usbpd_pwr.h.

But the same error is still occurring. Is there any possibility to debug why the stack on my sink sends the HardReset? Or do you have any idea how to detect the fault?

Again i attached my log file; but it's similar to the previous file. Best regards

Guenael Cadier
ST Employee

Dear @S.Cross​ ,

Just a question on your last log : time spent between 2 REQUEST from Sink, in PPS mode, is expected to be around 9 sec (max is 10 sec). You mentioned it is what you observe. But looking at counter, it looks like around 18000 units occurred between 2 requests. I would have expected to see something around 9000.

Do you confirm time between Requests is around 9 seconds ?

Guenael

S.Cross
Associate II

Dear @Guenael Cadier​ ,

the request was sent in the right time delta of 9-10 seconds. I just recognized, that an HAL_IncTick() is already executed by the interrupt handler of TIM20. So i removed my inserted HAL_IncTick() and the timebase is correct now . But error is still the same.

OK, Thanks for clarification.

By the way, is the Hard Reset always occurring after the 3rd Request or is it sometimes after the 4th, 5th, ... ?

Dear @Guenael Cadier​ ,

after doing some tests i still have the same problem with selecting PPS profiles. The reset seems to relate to the charger i connect my sink with. So in some cases i get an HardReset after the 3rd request, and sometimes already after the 2nd request. If i select an APDO and there is a HardReset caused by the sink i get sometimes up to 10 HardResets after this before the regular 5V profile is selected correctly by the sink. This behaviour is shown in the attached file. But every time the sink goes to status "POWER_EXPLICIT_CONTRACT". I also checked the voltage level of VBus, if something changes, which causes the sink to do an HardReset, but everything was stable. So i assume, that the HardReset is caused by the stack, which i can't monitor.

Dear @S.Cross​

In order to try to investigate, could you, if possible :

  • Let me know IDE you are using and name of the Middlewares\ST\STM32_USBPD_Library\Core library you are using in your project ? (i might send you a new library with additional debug info, so ideally, could you also share your current lib for checking ?)
  • Try to set a breakpoint in USBPD_DPM_HardReset(), and when stopped, try to dump RCC registers contents
  • Share your IOC file if you generate your project with cubeMx

Thanks

Guenael

S.Cross
Associate II

.

S.Cross
Associate II

Dear @Guenael Cadier_O (ST Employee)​ ,

my IDE i am using is Keil v5.20.0.0 with "USBPDCORE_PD3_FULL_CM4_Keil.lib".

The IOC file and libraries are within the archive attached.

Thanks

S.Cross
Associate II

Dear @Guenael Cadier​ ,

ich checked the entries in the forum and found this question:

https://community.st.com/s/question/0D53W00000BKW4KSAX/xcubeusbpd-problem-unexpected-hardreset-transmission

which seems to point to the same problem. In my case i have activated the CRC module and use it for validation in my communication. Could this result in that trouble i have with the USB-PD stack?

Thank you and best regards

Dear @S.Cross​ 

Thanks for your attachments.

Libraries provided in USBPD Middleware could be used on several targets. Depending on Cortex M core used inside the STM32xx device, several libs for same IDE/USBPD feature configuration, exist. For STM32G4xx, libs with ***_CM4*** are ok.

Regarding the Hard Reset issue, could you try to use updated lib (as attached to this post, please remove"_update" suffix), rebuild you binary, and check if issue still present ?

Thanks

Guenael