CYPD2122 pd_send_ctl_msg

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
Anonymous
Not applicable

您好,

    在使用CYPD2122芯片做触发器(sink port)项目中,需要在获得source端发送的SINK RDY message包后, 再发送一个cmd message给充电头(source)。

另外, 在PE_READY状态调用 pd_send_ctl_msg(CTRL_xxxx, SOP); 用逻辑分析仪抓包CC1上的数据显示有发送数据包。但芯片就一直在该代码内运行不退出死机了,不知贵司的这个库函数在调用时是否要先设置什么变量等?  调用handle_pd_command 则无数据包发送!

 

   谢谢!

王强

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

Hi 王强,

1. 能否告知您在获得SOURCE发送的PS_RDY之后,想要发送什么CMD呢?

2. 因为tSTATUS pd_send_ctl_msg(tCTRL_MSG_TYPE msg_type, tSOP_TYPE pkt_type) 是CCG2内部的状态机跳变的时候使用的回调函数,如果您需要使用,您需要确保现在CCG2内部没有因为您的调用产生阻塞,这样的话,就会出现您说在这个地方出不来。个人建议您使用

/**

* Command Policy engine to send a particular command

* @param cmd command to be sent

* @param dat pointer to command buffer

* @note Some commands do not require command buffer

*/

bool handle_pd_command(tCMD_TYPE cmd, tCMD_BUF* dat, void (*dpm_callback) (tRES_STATUS status, uint32_t*) );

建议您借用usbpd_hpi.h里面的函数来实现您的想法,因为这些函数是经过验证并且测试。

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 王强,

1. 能否告知您在获得SOURCE发送的PS_RDY之后,想要发送什么CMD呢?

2. 因为tSTATUS pd_send_ctl_msg(tCTRL_MSG_TYPE msg_type, tSOP_TYPE pkt_type) 是CCG2内部的状态机跳变的时候使用的回调函数,如果您需要使用,您需要确保现在CCG2内部没有因为您的调用产生阻塞,这样的话,就会出现您说在这个地方出不来。个人建议您使用

/**

* Command Policy engine to send a particular command

* @param cmd command to be sent

* @param dat pointer to command buffer

* @note Some commands do not require command buffer

*/

bool handle_pd_command(tCMD_TYPE cmd, tCMD_BUF* dat, void (*dpm_callback) (tRES_STATUS status, uint32_t*) );

建议您借用usbpd_hpi.h里面的函数来实现您的想法,因为这些函数是经过验证并且测试。

Best Regards,

Lisa

0 Likes