- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to connect CY4531(DFP) and CY4531(UFP) and comunicate VDM custom command.
DFP side send following code. I refered to CCGx_FW_UserGuide.pdf
dpm_pd_command(port, DPM_CMD_SEND_VDM, &cmd_buf, pd_command_cb)
please tell me How to get VDM custom command at UFP?
Do I 'm able to use "dpm_get_info" command?
Please let me know if there is any reference document.
Solved! Go to Solution.
- Labels:
-
ispn:39569:1:0
-
l1:314:1:0
-
USBEZ-PDType-C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
As per A, please try adding your required UVDM handling code in eval_vdm() function. This will be called by the stack on receiving a VDM command as per the app_callback_ptr. The existing code handles the VDM commands and calls the vdm_resp_handler() so you could modify the response as per your requirement. For example:
if ((vdm->dat[VDM_HEADER_IDX].ustd_vdm_hdr.vdm_type == VDM_TYPE_UNSTRUCTURED) &&(vdm->dat[VDM_HEADER_IDX].ustd_vdm_hdr.cmd_type == CMD_TYPE_INITIATOR))
{
app_stat->vdm_resp.resp_buf[VDM_HEADER_IDX].val = vdm->dat[VDM_HEADER_IDX].val;
{
if (vdm->len == 1)
{
switch(vdm->dat[VDM_HEADER_IDX].ustd_vdm_hdr.cmd)
{
case START_UVDM_COMMAND: //custom command
{
app_stat->vdm_resp.resp_buf[0].val = 0xFF000000; //custom data
app_stat- >vdm_resp.resp_buf[VDM_HEADER_IDX].ustd_vdm_hdr.cmd_type = CMD_TYPE_RESP_ACK;
}
break;
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
On the UFP side, the VDM command can be handled using the app callback from the stack on eval_vdm() function. Please refer to the vdm.c file in the CCG3 project and you can add your own handling of the commands, I'm assuming that you'll be sending UVDMs. You could also refer to the CCGx Host SDK API Guide for more details.
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Sananya.
Thank you for your reply.
I checked eval_vdm() at vdm.c. and CCGx_FW_API_Guide.pdf
But I don't fully understand your advice.
Which change should I make?
A,Should I add my operation code to the eval_vdm () code?
or
B,Should eval_vmd() be called at main.c with that replaced vdm_resp_handler with my operation code?
Are there sample code with eval_vmd() be used.
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
As per A, please try adding your required UVDM handling code in eval_vdm() function. This will be called by the stack on receiving a VDM command as per the app_callback_ptr. The existing code handles the VDM commands and calls the vdm_resp_handler() so you could modify the response as per your requirement. For example:
if ((vdm->dat[VDM_HEADER_IDX].ustd_vdm_hdr.vdm_type == VDM_TYPE_UNSTRUCTURED) &&(vdm->dat[VDM_HEADER_IDX].ustd_vdm_hdr.cmd_type == CMD_TYPE_INITIATOR))
{
app_stat->vdm_resp.resp_buf[VDM_HEADER_IDX].val = vdm->dat[VDM_HEADER_IDX].val;
{
if (vdm->len == 1)
{
switch(vdm->dat[VDM_HEADER_IDX].ustd_vdm_hdr.cmd)
{
case START_UVDM_COMMAND: //custom command
{
app_stat->vdm_resp.resp_buf[0].val = 0xFF000000; //custom data
app_stat- >vdm_resp.resp_buf[VDM_HEADER_IDX].ustd_vdm_hdr.cmd_type = CMD_TYPE_RESP_ACK;
}
break;
Best Regards,
Sananya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, sananya.
Thank you for reply.
The question has been solved.