Skip to main content
Visitor II
December 10, 2020
Question

How can I find out which PDO has been negotiated

  • December 10, 2020
  • 4 replies
  • 2138 views

From the point of view of firmware in microcontroller, which is communicating with STUSB4500 by I2C, how can it find out what PDO (voltage and current) has been negotiated with the power source.

I am particularly interested in maximum current so the microcontroller can ensure it doesn't exceed this.

    This topic has been closed for replies.

    4 replies

    Visitor II
    December 10, 2020

    Hi,

    With STUSB4500, To get the PDOs available on the Source side, you can use the GetSrcCap() function.

    Get Source Capabilities :

    https://github.com/usb-c/STUSB4500/blob/master/Firmware/Project/Src/USB_PD_core.c#L1124

    The PDO that has been negociated between the USB-C Sink and Source is called RDO = Request Data Object

    To get the RDO, you can use the Print_RDO() function:

    https://github.com/usb-c/STUSB4500/blob/master/Firmware/Project/Src/USB_PD_core.c#L541

    Regards

    s_Author
    Visitor II
    December 11, 2020

    Thanks for your reply Gregory.

    The value in RDO is sometimes correct, but sometimes it reports 22.5V when I have requested 20V (and VBUS is at 20V):

     STUSB regs:
     00: 0x12 0x00 
     08:0x11 0x20 0x00 0x01 0xF9 0x00 0x41 0x00 
     10:0x0A 0x13 0x00 0x40 0x00 0x02 0x00 0x2C 
     18:0x00 0x00 0x26 0x21 0x01 0x80 0x00 0x00 
     20:0x10 0xC8 0x5F 0x00 0x00 0x9C 0x00 0x02 
     28:0x02 0x18 0x00 0xE1 0x05 0x00 0x00 0x21 
     30:0x00 0x66 0x07 0x7D 0x4B 0x1A 0xEC 0xC0 
     38:0xA1 0x05 0x00 0xC2 0x41 0x06 0x00 0x25 
     40:0xBE 0xA1 0x80 0x00 0x00 0x00 0x00 0x00 
     48:0x00 0x00 0x00 0x00 0x00 0x18 0xE3 0x00 
     50:0x00 0x0D 0x00 0x00 0x4B 0x2C 0x21 0x43 
     58:0x00 0x48 0xFB 0x00 0x00 0x00 0x00 0x00 
     60:0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
     68:0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
     70:0x43 0xC8 0x90 0x01 0x08 0x64 0xD0 0x02 
     78:0x00 0x2C 0xB1 0x04 0x00 0xF4 0xB1 0x04 
     80:0x00 0x5E 0xFD 0x01 0x00 0x96 0x90 0x01 
     88:0x10 0xC8 0xB0 0x04 0x00 0xC2 0x41 0x06 
     90:0x00 0xC2 0x09 0x07 0x30 
     DPM_SNK_PDO1(Pdo 10019096 fix mV=5000 mA=1500) 
     DPM_SNK_PDO2(Pdo 0004B0C8 fix mV=15000 mA=2000) 
     DPM_SNK_PDO3(Pdo 000641C2 fix mV=20000 mA=4500) 
     DPM_REQ_RDO (Pdo 300709C2 fix mV=22500 mA=4500) 

    Visitor II
    January 6, 2021

    Be careful that the Source Capabilities PDOs are available in STUSB4500 registers only for a short time (few ms) , until the next USB PD message from the Source overwrites the buffer with new data.

    So if you read an incorrect value like 22.5V, it means you have missed the right USB-PD message. Thus you should try again.

    s_Author
    Visitor II
    January 6, 2021

    Thanks Gregory.

    Yes, I found that reading the message header and data (from address 0x31 ...) needs to be done quickly (before the next message overwrites it).

    But I am seeing strange values at DPM_REQ_RDO (address 0x91 ...0x94) (see register dump above).

    Is there any reason why the data address would not be valid ?