USB PD Sink Configuration for a wide input range charger?
We are designing a USB PD LiPo charger that can receive power from a variety of USB PD sources. It is based around a charger IC designed to handle a wide range of input voltages with internal control of the current draw. For example, our design can draw 3A at 20V if the USB PD Source can handle it. However, our design can also just pull 1.5A at 12V if that's all the USB PD Source can supply. We are using the STM32G071RB with integrated USB PD peripheral and the USB PD stack provided by ST. How should we configure the PORT0_PDO_ListSNK[] array so the stack will always ask for the highest voltage and current available from the source (we can easily handle 20V 5A, but our device will accept 5V 1A if that's all the source can provide)? Also, where is the best location to configure this array. We are currently hard coding the values in the USBPD_PWR_IF_Init() function.
Here is a snippet of code we have been testing with:
USBPD_StatusTypeDef USBPD_PWR_IF_Init(void)
{
/* USER CODE BEGIN USBPD_PWR_IF_Init */
USBPD_StatusTypeDef _status = USBPD_OK;
/* Set links to PDO values and number for Port 0 (defined in PDO arrays in H file).
*/
PWR_Port_PDO_Storage[USBPD_PORT_0].SinkPDO.ListOfPDO = (uint32_t *)PORT0_PDO_ListSNK;
PWR_Port_PDO_Storage[USBPD_PORT_0].SinkPDO.NumberOfPDO = &USBPD_NbPDO[0];
//Hard coded config values
PORT0_PDO_ListSNK[0] = _PWR_SNKFixedPDO(1.5,5,1,0,0,0,0);
PORT0_PDO_ListSNK[1] = _PWR_SNKVariablePDO(20,5,1.25);
PORT0_PDO_ListSNK[2] = _PWR_SNKVariablePDO(20,5,1.5);
PORT0_PDO_ListSNK[3] = _PWR_SNKVariablePDO(20,5,2);
PORT0_PDO_ListSNK[4] = _PWR_SNKVariablePDO(20,5,2.25);
PORT0_PDO_ListSNK[5] = _PWR_SNKVariablePDO(20,5,2.5);
PORT0_PDO_ListSNK[6] = _PWR_SNKVariablePDO(20,5,3);
USBPD_NbPDO[0]=7;This works fine (successfully establishes a contract with the highest power available from the source) if we plug our device into a 100W or 60W USB PD charger, but it doesn't work if we plug into a USB PD charger that is only 18W (12V @ 1.5A).
Below is the request that gets made to the 18W charger, but the request gets rejected.


Thank you in advance for any help you can provide.
