How to make custom user USBPD PPS sink application on NucleoG0B1RE + SNK1M1
Dear community,
I have deployed a basic USB PD sink application according to AN5418 on NucleoG0B1RE + SNK1M1 hardware. I have also implemented a USBPD_DPM_RequestMessageRequest() function inside usbpd_dmp_user.c (according to this post), so the user can ask for power profiles in CubeMonitor-UCPD
I have also added some custom application code app.c in order to utilize encoder button and segment display. I want the user to choose relevant voltage and current value and make a request for new PPS. Yet the problem is that I am having quite hard time understanding all the different functions and underlying dependencies. Are there some further materials to understand the USBPD lib expect UM2902, and UM2552?
I guess my steps are:
1. Get the SRC PDOs and limit the user voltage range
- Extract the max and min voltages from following struct: DPM_Ports[PortNum].DPM_ListOfRcvSRCPDO[(IndexSrcPDO - 1)];
- limit the user to choose from allowed voltage range
2. Build rdo object from user request details
- build USBPD_SNKRDO_TypeDef rdo.d32 or rdo.ProgRDO in my case? from the USBPD_DPM_SNKPowerRequestDetailsTypeDef
3. Find the SrcPDOIndex matching the user request
- use previously builded rdo in order to find relevant SRC APDO index, probably by using USER_SERV_FindVoltageIndex() (located in usbpd_user_services.c)
4. Request the PPS using USBPD_DPM_RequestMessageRequest() (located in usbpd_dpm_user.c)
- use SrcPDOIndex from point 3 to make new request
github: link
Could you please give me some small guidance or provide me with further resources to better grasp the USB PD library as a whole?
Related question:
What is the point of predefining voltage and current ranges for APDOs like in STM32G0C1E-EV/.../usbpd_pdo_defs.h if we dont know what will be the ranges of actual wall adapter (SRC provider)? Or should we just use predefined ranges according to USB PD Specification on (usb.org) under 10.2.3.2.1 SPR Programmable Power Supply Voltage Ranges?
