CYPD3171-PB application VBUS divider confusion

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
AnGa_4482271
Level 1
Level 1

Hello,

There's this function in power_bank.c, in the CYPD3171_pb example code:

static uint16_t pb_get_battery_voltage(void)

{

    /* Measure voltage on VBATT_MON GPIO. */

    uint8_t level;

    uint16_t vbatt;

    hsiom_set_config (VBATT_MON_GPIO, HSIOM_MODE_AMUXA);

    /* Take ADC sample. */

    level = pd_adc_sample (0, PD_ADC_ID_1, PD_ADC_INPUT_AMUX_A);

    /* Convert level to VBUS using 1/11 divider. */

    vbatt = pd_adc_level_to_volt (0, PD_ADC_ID_1, level);

    hsiom_set_config (VBATT_MON_GPIO, HSIOM_MODE_GPIO);

    /* TODO: Value on kits board is not 1/11 but around 1/12. */

    return (vbatt * 12);

}

What does that line mean "Value on kits board is not 1/11 but around 1/12"?

I checked the schematics for CY4532 EVK board, and ratio is 49.9k*(499k+49.9k) = 1/11. I see no obvious reason to multiply the obtained value with 12.

vbat.PNG

Can you help me figuring out what's going on here?

Thanks.

EDIT: I measured the voltages on EVK: with exact 12V on top of R4, VBAT_VDC_MON is 1.088V, which corresponds to a ratio of 1/11.

0 Likes
1 Solution
RajathB_01
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hello,

Thank you for pointing out this confusion. This looks like a discrepancy in the code. We will further investigate this and make appropriate changes. Meanwhile, I would recommend you to consider the 1/11 divider ratio in the code as well.

Thanks,

Rajath

View solution in original post

0 Likes
1 Reply
RajathB_01
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hello,

Thank you for pointing out this confusion. This looks like a discrepancy in the code. We will further investigate this and make appropriate changes. Meanwhile, I would recommend you to consider the 1/11 divider ratio in the code as well.

Thanks,

Rajath

0 Likes