Read TYPE-C cable E-marker IC VDM data on CY4541

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
WiCh_3149431
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

We are work on read TYPE-C cable E-marker IC VDM data on CY4541, the read out put on UART of CYPD4225 pin1,

uart1.jpg

CYPD4225.jpg

The source code is :

   SW_Tx_UART_1_PutString("start");

but we get garbled on terminal, the baud rate is set on 115200,N,8,1, we also try 9600,N,8,1, it is also.

ACCESSPORT.jpg

Could Cypress help us fix this problem or please give us hint to fix this problem?

0 Likes
1 Solution

Hi William,

1. For send discover Id, I was shared to you in the CCG2 project.

a. You can Disable or Enable RP CC line.

   

    /* Enable Rp+Rd on both CC1 & CC2 */

    pd_typec_en_rp(port, CC_CHANNEL_1, RP_TERM_RP_CUR_DEF);

    pd_typec_en_rp(port, CC_CHANNEL_2, RP_TERM_RP_CUR_DEF);

b. You need to detect which line have been assert Ra on CC line.

.  static uint8_t pd_typec_get_rp_rd_status(uint8_t port, uint8_t channel, bool rd_idx)

The return value is looking for:

/**

* @typedef rp_cc_status_t

* @brief Enum of the Rp status when Rp is asserted.

*/

typedef enum

{

    RP_RA  = 0,                         /**< CCG has applied Rp. External Ra present.  */

    RP_RD,                              /**< CCG has applied Rp. External Rd present.  */

    RP_OPEN,                            /**< CCG has applied Rp. No external pulldown. */

} rp_cc_status_t;

c. Assert RD on other CC line.

pd_typec_en_rd(port, CC_CHANNEL_1);

pd_typec_en_rd(port, CC_CHANNEL_2);

If you simulate a RD on CC line, the SOP' discovery ID will sent out by PD Stack.

2. And then, for cable information, I was shared to you in the threads CY4521 Read TYPE-C cable E-marker IC VDM data  latest response.

a.You can use

        case APP_EVT_EMCA_DETECTED: under function void app_event_handler(uint8_t port, app_evt_t evt, const void* dat) at file app.c to get the cable information.

b.

vdm_msg_info_t is struct holds received/sent VDM info.

vdm_msg_info_t *msg_p  = get_msg (port);

Best Regards,

Lisa

View solution in original post

0 Likes
15 Replies
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi,

Have you comments out all of FW_LED code in CYPD4225 firmware?

@file config.h

#define APP_FW_LED_ENABLE                          (0u)  >> Set to 0

/*

* Select CCG4 GPIO to be used as Activity Indication. This should be set to a

* valid value if APP_FW_LED_ENABLE is non-zero.

*/

// #define FW_LED_GPIO_PORT_PIN                        (GPIO_PORT_1_PIN_1) >> Comment out directly.

Best Regards,

Lisa

0 Likes

Hi, Lisa:

We also try SW_Tx_UART_1 on pin 6, it is also.

SW_Tx_UART_1 on pin6.jpg

0 Likes

We connect a I2C OLED display on I2C bus to display VDM data, but OLED all show 00000000 even we plug with E-marker or not with E-marker. Source code list at below, please help how correct read E-marker VDM data on CY4541.

OLED.jpg

void get_cable_vdo (uint8_t port)

{   

    char temp[64];

    unsigned int  *ptr;

    const dpm_status_t *dpm_stat;

   

    SW_Tx_UART_1_PutChar('M');

   

    //if (dpm_stat->emca_present != false)

    if (app_is_cbl_disc_done(0))

    {

        dpm_stat = dpm_get_info (port);

        cbl_vdo_get.std_cbl_vdo.cbl_fw_ver = dpm_stat->cbl_vdo.std_cbl_vdo.cbl_fw_ver;

        cbl_vdo_get.std_cbl_vdo.vbus_cur = dpm_stat->cbl_vdo.std_cbl_vdo.vbus_cur;

       

        ptr = (unsigned int*)&dpm_stat->cbl_vdo.std_vdm_hdr;

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_vdm_hdr = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_Fill(0x00);

        OLED_ShowStr(0, 0, temp, 2);

       

        ptr = (unsigned int*)&dpm_stat->cbl_vdo.ustd_vdm_hdr;

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nustd_vdm_hdr = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 2, temp, 2);

        ptr = (unsigned int*)&dpm_stat->cbl_vdo.std_id_hdr;

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_id_hdr = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 4, temp, 2);

       

        ptr = (unsigned int*)&dpm_stat->cbl_vdo.std_cert_vdo;

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_cert_vdo = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 6, temp, 2);

       

        ptr = (unsigned int*)&dpm_stat->cbl_vdo.std_prod_vdo;

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_prod_vdo = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 16, temp, 2);

       

        is_emca_present = 1;

    }

}

0 Likes

We modify get_cable_vdo() in the main.c

void get_cable_vdo (uint8_t port)

{   

    char temp[64];

    unsigned int  *ptr;

    const dpm_status_t *dpm_stat;

   

    SW_Tx_UART_1_PutChar('M');

   

    //if (dpm_stat->emca_present != false)

    if (app_is_cbl_disc_done(0))

    {

        dpm_stat = dpm_get_info (port);

        cbl_vdo_get.std_cbl_vdo.cbl_fw_ver = dpm_stat->cbl_vdo.std_cbl_vdo.cbl_fw_ver;

        cbl_vdo_get.std_cbl_vdo.vbus_cur = dpm_stat->cbl_vdo.std_cbl_vdo.vbus_cur;

       

        ptr = (unsigned int*)&(dpm_stat->cbl_vdo.std_vdm_hdr);

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_vdm_hdr = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_Fill(0x00);

    OLED_ShowStr(0, 0, temp, 2);

       

        ptr = (unsigned int*)&(dpm_stat->cbl_vdo.ustd_vdm_hdr);

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nustd_vdm_hdr = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 2, temp, 2);

        ptr = (unsigned int*)&(dpm_stat->cbl_vdo.std_id_hdr);

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_id_hdr = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 4, temp, 2);

       

        ptr = (unsigned int*)&(dpm_stat->cbl_vdo.std_cert_vdo);

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_cert_vdo = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 6, temp, 2);

       

        ptr = (unsigned int*)&(dpm_stat->cbl_vdo.std_prod_vdo);

        to_hex(*ptr, temp);

        //SW_Tx_UART_1_PutString("\nstd_prod_vdo = ");

        //SW_Tx_UART_1_PutString(temp);

        OLED_ShowStr(0, 16, temp, 2);

       

        is_emca_present = 1;

    }

}

the OLED display show as below, there are not correct E-marker VDM data, please Cypress help us or give us instructions on how to read the other E-marker data on CY4521 correctly.

OLED-20190520.jpg

0 Likes

Hi William Chen​,

1. As per the discussion on the threads CY4521 Read TYPE-C cable E-marker IC VDM data , you have noticed below

CCG2 receives all the VDOs of SOP prime Discover ID from cable. However, the PD stack does not expose all information outside. It just exposes cable VDO & cable id header VDO.

2. If you could like to start this project with CCG4 (CYPD4136, CCG4 on CY4532 board), we could share more example code to you.

Best Regards,

Lisa

0 Likes

Hi, Lisa:

Yes, we also has CY4532, it is CYPD4126-40LQXIT on the board, if it can read all E-marker (include VDM Header, ID Header VDO, Cert Stat VDO, Product VDO and Cable VDO), please support us more example code, we can start this project immediately.

Thanks

William

0 Likes

Hi Lisa:

Is the project on CYPD4126-40LQXI_notebook of EZ-PD CCGx SDK?

0 Likes

Hi ,

Yes. The project on CYPD4126-40LQXI_notebook of EZ-PD CCGx SDK is the correct example code for beginning of development. Since we have been shared a MTK firmware example code to our distributor, you could get it as reference if you could like to.

Best Regards,

Lisa

0 Likes

Hi, Lisa:

Because Arrow - Gary Chien is off this week, I did not get MTK firmware example code so far. Could you direct email to me? My email is roin.william@gmail.com.

0 Likes

Hi William,

You could begin to with YPD4126-40LQXI_notebook of EZ-PD CCGx SDK if you do not get reply from our DFAE, we could support you from here.

Best Regards,

Lisa

0 Likes

Hi, Lisa:

I contact with Arrow contact window - Gary Chien and Kevin Tsai, they did not receive MTK example code, would you direct release to me.

0 Likes

Hi William,

Okay. I see. Since you cannot get any additional example project, you can get start from YPD4126-40LQXI_notebook of EZ-PD CCGx HOST SDK (https://www.cypress.com/documentation/software-and-drivers/ez-pd-host-software-development-kit ), I will support you step by step.

Best Regards,

Lisa

0 Likes

Hi, Lisa:

Would you please guide us how & when to send & receive discover_id on CYPD4126-40LQXI_notebook project?

0 Likes

Hi, Lisa:

Did not got your reply, please guide us step by step.

0 Likes

Hi William,

1. For send discover Id, I was shared to you in the CCG2 project.

a. You can Disable or Enable RP CC line.

   

    /* Enable Rp+Rd on both CC1 & CC2 */

    pd_typec_en_rp(port, CC_CHANNEL_1, RP_TERM_RP_CUR_DEF);

    pd_typec_en_rp(port, CC_CHANNEL_2, RP_TERM_RP_CUR_DEF);

b. You need to detect which line have been assert Ra on CC line.

.  static uint8_t pd_typec_get_rp_rd_status(uint8_t port, uint8_t channel, bool rd_idx)

The return value is looking for:

/**

* @typedef rp_cc_status_t

* @brief Enum of the Rp status when Rp is asserted.

*/

typedef enum

{

    RP_RA  = 0,                         /**< CCG has applied Rp. External Ra present.  */

    RP_RD,                              /**< CCG has applied Rp. External Rd present.  */

    RP_OPEN,                            /**< CCG has applied Rp. No external pulldown. */

} rp_cc_status_t;

c. Assert RD on other CC line.

pd_typec_en_rd(port, CC_CHANNEL_1);

pd_typec_en_rd(port, CC_CHANNEL_2);

If you simulate a RD on CC line, the SOP' discovery ID will sent out by PD Stack.

2. And then, for cable information, I was shared to you in the threads CY4521 Read TYPE-C cable E-marker IC VDM data  latest response.

a.You can use

        case APP_EVT_EMCA_DETECTED: under function void app_event_handler(uint8_t port, app_evt_t evt, const void* dat) at file app.c to get the cable information.

b.

vdm_msg_info_t is struct holds received/sent VDM info.

vdm_msg_info_t *msg_p  = get_msg (port);

Best Regards,

Lisa

0 Likes