Questions about dpm_pd_command API

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
lagr_4818041
Level 1
Level 1
First comment on KBA 5 sign-ins First reply posted

我在完成power negotiation后设置了一个标志位,在while循环里面判断到标志位后直接调用dpm_pd_command API 发送discover identity会提示失败(返回的错误为CCG_STAT_BUSY),但是使用一个10ms period的timer,在定时器回调上调用dpm_pd_command API 发送discover identity,却是正常的,请问原因是什么?另外使用dpm_pd_command发送PD命令的正确做法应该是怎么样的?

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

1. 根据 dpm_pd_command的头文件定义如下:

/**
* @brief This function provides an interface for the application module to
* send PD commands.
* @param port Port index.
* @param cmd Command name.
* @param buf_ptr Pointer to the command buffer.
* @param cmd_cbk Pointer to the callback function.
* @return Returns
* - CCG_STAT_SUCCESS if the command is registered
* - CCG_STAT_CMD_FAILURE if the PD port is not ready for a command
* - CCG_STAT_BUSY if there is another pending command.
* @warning Data received via the callback should be copied out by the
* application, because the buffer will be reused by the stack to store data on
* new message reception.
*/
ccg_status_t dpm_pd_command(uint8_t port, dpm_pd_cmd_t cmd, dpm_pd_cmd_buf_t* buf_ptr,
dpm_pd_cmd_cbk_t cmd_cbk);

2. CCG5的固件中,aap.c文件里面有一个case是表征power negotiate completed,

case APP_EVT_PD_CONTRACT_NEGOTIATION_COMPLETE:

这个case里面是去做了相关的VDM的操作。相关的函数是:enable_vdm_task_mngr(port);

如果同时进行处理,或者跟随,可能是存在冲突的

 

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

1. 根据 dpm_pd_command的头文件定义如下:

/**
* @brief This function provides an interface for the application module to
* send PD commands.
* @param port Port index.
* @param cmd Command name.
* @param buf_ptr Pointer to the command buffer.
* @param cmd_cbk Pointer to the callback function.
* @return Returns
* - CCG_STAT_SUCCESS if the command is registered
* - CCG_STAT_CMD_FAILURE if the PD port is not ready for a command
* - CCG_STAT_BUSY if there is another pending command.
* @warning Data received via the callback should be copied out by the
* application, because the buffer will be reused by the stack to store data on
* new message reception.
*/
ccg_status_t dpm_pd_command(uint8_t port, dpm_pd_cmd_t cmd, dpm_pd_cmd_buf_t* buf_ptr,
dpm_pd_cmd_cbk_t cmd_cbk);

2. CCG5的固件中,aap.c文件里面有一个case是表征power negotiate completed,

case APP_EVT_PD_CONTRACT_NEGOTIATION_COMPLETE:

这个case里面是去做了相关的VDM的操作。相关的函数是:enable_vdm_task_mngr(port);

如果同时进行处理,或者跟随,可能是存在冲突的

 

Best Regards,

Lisa

0 Likes