How can I determine Source PDO capabilities?
I am developing an application using an STUSB4500 and an external MCU STM32G031K8 that should be able to read USB PD Source capabilities and allow the user to dynamically set custom PDOs.
I have based the majority of my code off of the example software package STSW-STUSB003.
According to that software, you determine Source capabilities by first sending a USB PD soft reset command (the USB Power Delivery command, not a STUSB4500 soft reset), int PdMessage_SoftReset() and int PdMessage_SoftReset_WithTimeout() in the firmware package, after which the Source will broadcast is capabilities:
1. The STUSB4500 raises the ALRT line as expected after this PD command is sent
2. I read the PRT_STATUS (0x16) register to verify a message is received
3. I then read the RX_HEADER (0x31) register, unfortunately there are no docs on this register content
4. So using the firmware package's definition (USBPD_MsgHeader_TypeDef), I am decoding the content of RX_HEADER
5. At this point, regardless of what PD source I use (testing with Apple 60W PD charger), the reported number of PDOs in RX_HEADER is always 0
6. The message type of these headers is either 0x3 (USBPD_CTRLMSG_Accept) or 0x6 (USBPD_CTRLMSG_PS_RDY)
I'm not sure if I am decoding the header incorrectly or if something else is wrong.
My full source code can be found here:
https://github.com/ardnew/upd-touch/tree/alert-signal/Core/STUSB4500
My subroutine void stusb4500_alert(stusb4500_device_t *) in stusb4500_api.c corresponds to void ALARM_MANAGEMENT(uint8_t) in the STSW-STUSB003 package.
Any suggestions would be appreciated, thanks!
