- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
Solved! Go to Solution.
- Labels:
-
ispn:39570:1:0
-
l1:314:1:0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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