How to detect a REJECT response from a device after sending a dpm command?

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JoLu_3455101
Level 4
Level 4
5 likes given 5 solutions authored 25 replies posted

Hi,

I am writing code to have CCG3PA send a "dpm_pd_command" request to the end device to do a DR_SWAP (data role swap). Originally I thought that the return status (ccg_status_t) will tell me if the end device accepted or rejected the request, but it seems that the ccg status will only tell me if the request is registered or not.

How to I read the response back from the end device to see if it accepted or rejected my DR_SWAP request?

Thanks,

Jonathan

0 Likes
1 Solution
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi Jonathan,

Two ways:

1. Add a timer (about 1s) after you sent DR_SWAP. And define a callback function after timeout. And use the callback function read status as below example.

    if(resp == RES_RCVD || pkt_ptr->msg == CTRL_MSG_REJECT)

2. Add judge condition in app.c

Function: void app_event_handler(uint8_t port, app_evt_t evt, const void* dat)

        case APP_EVT_DR_SWAP_COMPLETE:

Best Regards,

Lisa

View solution in original post

0 Likes
1 Reply
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi Jonathan,

Two ways:

1. Add a timer (about 1s) after you sent DR_SWAP. And define a callback function after timeout. And use the callback function read status as below example.

    if(resp == RES_RCVD || pkt_ptr->msg == CTRL_MSG_REJECT)

2. Add judge condition in app.c

Function: void app_event_handler(uint8_t port, app_evt_t evt, const void* dat)

        case APP_EVT_DR_SWAP_COMPLETE:

Best Regards,

Lisa

0 Likes