Dear sir/madam,
We are using 2AFE mc33771c driver code in that we are getting garbage values for current measurement.Below is the code used for measuring.Please support the issue to solve the problem.
/*store I_SENSEN measurent voltage raw value*/
BatPack.i32RawCurrent[cid] = BCC_GET_ISENSE_RAW_SIGN(BCC_GET_ISENSE_RAW(measurements[BCC_MSR_ISENSE1], measurements[BCC_MSR_ISENSE2]));
/* Mask the other registers (starting at 5th register). */
for (i = 5U; i < BCC_MEAS_CNT; i++)
{
BatPack.u16RawCell[cid][i-5] =(measurements[i] & BCC_R_MEAS_MASK);
}
isense1 = BatPack.i32RawCurrent[1];
//isense1 = isense1/140;
return error;
}
void BCC_DecodeRawMeasurements(bcc_cid_t cid)
{
uint8_t idx = 0;
BatPack.i32Current[cid] = BCC_GET_ISENSE_VOLT(BatPack.i32RawCurrent[cid]&BIT(18));
Thanks & Regards
venkatesh thaili
Dear Venkatesh Thaili,
please note, that from initialization, the current measurement chain is disabled. The MCU controller must enable the measurement chain by setting the SYS_CFG1[I_MEAS_EN] bit to logic 1, to initiate continuous current conversions. Current measurement conversions for coulomb counting are performed continuously in normal and diagnostic modes, while in sleep mode they occur periodically and the period is given by SYS_CFG1[CYCLIC_TIMER].
The conversion command ADC_CFG[SOC] must be sent at least 27 μs after SYS_CFG1[I_MEAS_EN] is enabled.
Please confirm, that you have enabled the current measurement.
With Best Regards,
Jozef