All the request functions (like USBPD_DPM_RequestDataRoleSwap) will not trig directly the sent of the message to port partner. Idea is to post a request to the stack and when stack is ready, it will consume this request to send it to the port partner.
Only 1 request is possible. Another request sent whereas the previous one has not been consumed will be not taken in account (USBPD_BUSY status will be returned)
USBPD_BUSY is also returned if there are no connected port partners.
In your case, USBPD_OK from USBPD_DPM_RequestDataRoleSwap means than request has been posted to the stack.
Answer from port partner will be available in the different notifications received in the USBPD_DPM_Notification function and mainly:
- USBPD_NOTIFY_DATAROLESWAP_RECEIVED = 35u,
- USBPD_NOTIFY_DATAROLESWAP_UFP = 36u,
- USBPD_NOTIFY_DATAROLESWAP_DFP = 37u,
- USBPD_NOTIFY_DATAROLESWAP_WAIT = 38u,
- USBPD_NOTIFY_DATAROLESWAP_REJECTED = 39u,
- USBPD_NOTIFY_DATAROLESWAP_NOT_SUPPORTED = 40u,
Please refer to message sequence chart available in UM2552, §4.4.1 Data role swap.