During development we noticed that current measurements coming from npm1300 appear to be much higher than expected despite the results not matching what we were seeing on the nrf power profiler. For example: while powering our board with the nrf ppk2, we logged a peak current of ~250mA on the profiler but were getting current measurements >300mA from npm1300.
Following this issue down to the npm1300 Zephyr drivers, I am struggling to understand where the numbers for full scale conversion are being derived from. The passage from the npm1300 datasheet on current full scale states:
"A value of 01 means the battery is discharging. During a discharge, the full scale current is the weighted sum of registers BCHGISETDISCHARGEMSB and BCHGISETDISCHARGELSB multiplied by 0.836. A value of 11 means the battery is charging. When charging, the full scale current is the weighted sum of registers BCHGISETMSB and BCHGISETLSB multiplied by 1.25."
When comparing this to the calculation of full scale in the zephyr drivers, however, I do not understand the derivation particularly for the 'discharge' case. In the 'charge' case the number accurately tracks to 1/1.25 = 0.8, which when accounting for unit conversion correctly divides by 800. In the 'discharge' case, I am unable to figure out how a division by 893 is derived. I would expect this to be 1/0.836 = 1.196 (which when converting to mA, would mean dividing 1196)
I wanted to verify whether this is the correct value, and if so, how is this value derived?
The function in question, `calc_current` looks as follows:
```
static void calc_current(const struct npm1300_charger_config *const config, struct npm1300_charger_data *const data, struct sensor_value *valp){ int32_t full_scale_ma; int32_t current; switch (data->ibat_stat) { case IBAT_STAT_DISCHARGE: full_scale_ma = config->dischg_limit_microamp / 893; break; case IBAT_STAT_CHARGE_TRICKLE: /* Fallthrough */ case IBAT_STAT_CHARGE_COOL: /* Fallthrough */ case IBAT_STAT_CHARGE_NORMAL: full_scale_ma = -config->current_microamp / 800; break; default: full_scale_ma = 0; break; } current = (data->current * full_scale_ma) / 1024; valp->val1 = current / 1000; valp->val2 = (current % 1000) * 1000;}