cancel
Showing results for 
Search instead for 
Did you mean: 

USBPD possible bug in DPM_USER_Settings initialization from cubeMX

DDeba.1
Associate III

Hi, 

I'm using the code generated by CubeMX ver 16.14.0 following the following link to develop a USBPD sink. 

https://wiki.stmicroelectronics.cn/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Dual_Role

I added an APDO to the PDO list but it is not working. I traced the issue to be coming from the USBPD_DPM_RequestMessageRequest function when it calculates the allowable power. It uses the DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits found in the DPM_USER_Settings structure. The issue is that this value is not initialized. If I use the cubeMonitor-UCPD app, I can see that APDO is defined in the SINK capabilities tab, so the data is there somewhere. Additionally, if I press "SEND TO TARGET", the DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits found in the DPM_USER_Settings is now correct. 

Is this an issue related to missing initialization in the code generated by the cubeMX which is leaving the DPM_USER_Settings to be not correctly initialized?

PS. Attached the IOC

Thanks

 

Edit: I confirmed that initialization is the issue as if I manually call the UpdateSNKPowerPort0 function during firmware initialization, everything works from the start. Is this the correct planned way? Should there be other code generated by the cubeMX?

0 REPLIES 0