- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I would like to get CC pin voltage in order to check the cable type. Any API to get the CC pin voltage?
BRs
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
CCGx power SDK is not offering the voltage value retrieve back. But, below API returns the current status on the CC line (rp_cc_status_t or rd_cc_status_t), you refer this API.
static uint8_t pd_typec_get_rp_rd_status(uint8_t port, uint8_t channel, bool rd_idx)
{
dpm_status_t* dpm_stat = dpm_get_status(port);
PPDSS_REGS_T pd = gl_pdss[port];
uint32_t rval = 0;
uint32_t temp;
uint8_t out;
uint32_t status;
bool change = false;
/* Set default output. */
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
out = RP_OPEN;
}
else
{
out = RD_RA + rd_idx;
}
/* Connect both the Up/Dn comparators to the active CC line. */
if (channel == CC_CHANNEL_2)
{
rval = (PDSS_CC_CTRL_0_CMP_DN_CC1V2 | PDSS_CC_CTRL_0_CMP_UP_CC1V2);
}
temp = pd->cc_ctrl_0 & (PDSS_CC_CTRL_0_CMP_DN_CC1V2 | PDSS_CC_CTRL_0_CMP_UP_CC1V2);
if ( temp != rval)
{
pd->cc_ctrl_0 &= ~(PDSS_CC_CTRL_0_CMP_DN_CC1V2 | PDSS_CC_CTRL_0_CMP_UP_CC1V2);
pd->cc_ctrl_0 |= rval;
change = true;
}
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
/*
* Set the threshold of the Dn comparator to Ra level and the Up
* comparator to Rp open level.
*/
rval = ((thresholds[dpm_stat->src_cur_level_live][0]) << PDSS_CC_CTRL_0_CMP_DN_VSEL_POS) |
((thresholds[dpm_stat->src_cur_level_live][1]) << PDSS_CC_CTRL_0_CMP_UP_VSEL_POS);
}
else
{
/* Set the Dn comparator to vRdUSB and the Up comparator to vRd1.5A. */
rval = ((thresholds[RD_ROW_NO][rd_idx]) << PDSS_CC_CTRL_0_CMP_DN_VSEL_POS) |
((thresholds[RD_ROW_NO][rd_idx + 1]) << PDSS_CC_CTRL_0_CMP_UP_VSEL_POS);
}
temp = pd->cc_ctrl_0 & (PDSS_CC_CTRL_0_CMP_DN_VSEL_MASK | PDSS_CC_CTRL_0_CMP_UP_VSEL_MASK);
if (temp != rval)
{
pd->cc_ctrl_0 &= ~(PDSS_CC_CTRL_0_CMP_DN_VSEL_MASK | PDSS_CC_CTRL_0_CMP_UP_VSEL_MASK);
pd->cc_ctrl_0 |= rval;
change = true;
}
if (change == true)
{
/* Delay to allow references to settle. */
CyDelayUs (50);
}
status = pd->intr1_status;
if (((status & PDSS_INTR1_STATUS_VCMP_DN_STATUS) != 0) && ((status & PDSS_INTR1_STATUS_VCMP_UP_STATUS) == 0))
{
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
out = RP_RD;
}
else
{
out = RD_USB + rd_idx;
}
}
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
if (((status & PDSS_INTR1_STATUS_VCMP_DN_STATUS) == 0) && ((status & PDSS_INTR1_STATUS_VCMP_UP_STATUS) == 0))
{
out = RP_RA;
}
}
if (dpm_stat->cur_port_role == PRT_ROLE_SINK)
{
if (((status & PDSS_INTR1_STATUS_VCMP_DN_STATUS) != 0) && ((status & PDSS_INTR1_STATUS_VCMP_UP_STATUS) != 0))
{
out = RD_1_5A + rd_idx;
}
}
return out;
}
Best Regards,
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
CCGx power SDK is not offering the voltage value retrieve back. But, below API returns the current status on the CC line (rp_cc_status_t or rd_cc_status_t), you refer this API.
static uint8_t pd_typec_get_rp_rd_status(uint8_t port, uint8_t channel, bool rd_idx)
{
dpm_status_t* dpm_stat = dpm_get_status(port);
PPDSS_REGS_T pd = gl_pdss[port];
uint32_t rval = 0;
uint32_t temp;
uint8_t out;
uint32_t status;
bool change = false;
/* Set default output. */
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
out = RP_OPEN;
}
else
{
out = RD_RA + rd_idx;
}
/* Connect both the Up/Dn comparators to the active CC line. */
if (channel == CC_CHANNEL_2)
{
rval = (PDSS_CC_CTRL_0_CMP_DN_CC1V2 | PDSS_CC_CTRL_0_CMP_UP_CC1V2);
}
temp = pd->cc_ctrl_0 & (PDSS_CC_CTRL_0_CMP_DN_CC1V2 | PDSS_CC_CTRL_0_CMP_UP_CC1V2);
if ( temp != rval)
{
pd->cc_ctrl_0 &= ~(PDSS_CC_CTRL_0_CMP_DN_CC1V2 | PDSS_CC_CTRL_0_CMP_UP_CC1V2);
pd->cc_ctrl_0 |= rval;
change = true;
}
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
/*
* Set the threshold of the Dn comparator to Ra level and the Up
* comparator to Rp open level.
*/
rval = ((thresholds[dpm_stat->src_cur_level_live][0]) << PDSS_CC_CTRL_0_CMP_DN_VSEL_POS) |
((thresholds[dpm_stat->src_cur_level_live][1]) << PDSS_CC_CTRL_0_CMP_UP_VSEL_POS);
}
else
{
/* Set the Dn comparator to vRdUSB and the Up comparator to vRd1.5A. */
rval = ((thresholds[RD_ROW_NO][rd_idx]) << PDSS_CC_CTRL_0_CMP_DN_VSEL_POS) |
((thresholds[RD_ROW_NO][rd_idx + 1]) << PDSS_CC_CTRL_0_CMP_UP_VSEL_POS);
}
temp = pd->cc_ctrl_0 & (PDSS_CC_CTRL_0_CMP_DN_VSEL_MASK | PDSS_CC_CTRL_0_CMP_UP_VSEL_MASK);
if (temp != rval)
{
pd->cc_ctrl_0 &= ~(PDSS_CC_CTRL_0_CMP_DN_VSEL_MASK | PDSS_CC_CTRL_0_CMP_UP_VSEL_MASK);
pd->cc_ctrl_0 |= rval;
change = true;
}
if (change == true)
{
/* Delay to allow references to settle. */
CyDelayUs (50);
}
status = pd->intr1_status;
if (((status & PDSS_INTR1_STATUS_VCMP_DN_STATUS) != 0) && ((status & PDSS_INTR1_STATUS_VCMP_UP_STATUS) == 0))
{
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
out = RP_RD;
}
else
{
out = RD_USB + rd_idx;
}
}
if (dpm_stat->cur_port_role == PRT_ROLE_SOURCE)
{
if (((status & PDSS_INTR1_STATUS_VCMP_DN_STATUS) == 0) && ((status & PDSS_INTR1_STATUS_VCMP_UP_STATUS) == 0))
{
out = RP_RA;
}
}
if (dpm_stat->cur_port_role == PRT_ROLE_SINK)
{
if (((status & PDSS_INTR1_STATUS_VCMP_DN_STATUS) != 0) && ((status & PDSS_INTR1_STATUS_VCMP_UP_STATUS) != 0))
{
out = RD_1_5A + rd_idx;
}
}
return out;
}
Best Regards,
Lisa