This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ76925: calculation of cellvoltage VCOUT

Part Number: BQ76925

Dear Battery Team,

I have some questions to the reading out of the correction factors.

According to the datasheet the factors are stored as 5 or 6 bit values in 2’s complement.

 

As given in table 2 and table 3 in the datasheet the MSBs and LSBs are simply shifted and arranged.

 

The sample code in sluc581 shows the following:

 

  // Get the 2 msb for offset and 1 msb for gain correction of VREF

    if (i2c_read(VREF_CAL_EXT, &i2c_read_struct)) error_trap();

    // Shift in msb and sign extend

    offset_corr[0] |= (((i2c_read_struct.data & 0x06) << 3) ^ 0x20) - 0x20;

    gain_corr[0]   |= (((i2c_read_struct.data & 0x01) << 4) ^ 0x10) - 0x10;

 

The shift seems correct but the data is also XORed with the MSB and the MSB is subtracted at the end.

To me it seems, that this has no effect.

 

Example:

Data: 00001

XOR with 10000 gives 10001

Subtraction by 10000 gives 00001 (the same as the input data).

 

Maybe this is the code of a former chip.

I would keep to the datasheet which results in a reduced code for the reading of the correction factors.

 

To be sure – could you clarify that?

Best wishes,

Olrik

  • Hi Olrik,

    I'm not a programmer, so my explanation may be simplistic.

    The value is made up of some MSBs packed with other cell's MSBs in a common register, so one part of the commands is to extract the correct MSB bit(s).  For example in the command:

     gain_corr[0]   |= (((i2c_read_struct.data & 0x01) << 4) ^ 0x10) - 0x10;

    gain_corr[0] was previously loaded with the lower nibble.  The newly processed upper nibble will be applied to it.

    (i2c_read_struct.data & 0x01) selects the bit of interest from the value read.  in the register bit S is the sign bit for gain_corr[0]:  read: xxxx xxxS 

    processed: 0000 000S

    Shifting left 4: << 4 puts the sign bit in the proper bit position to be applied to the lower nibble:  000S 0000

    Exclusive ORing with 0x10, ^ 0x10,  will invert the sign bit.  Now there are 2 possibilities for the same computation:

    If the sign bit is 0, the number is positive.  0x00 ^ 0x10 = 0x10.  Subtract 0x10 gives 0x00.  For a positive number, as you describe, it has done nothing since nothing needed done.

    If the sign bit is 1, the number is negative.  0x10 ^ 0x10 = 0x00.  Subtract 0x10 gives 0xF0.  For the negative number the sign is extended to the full upper nibble.

    This result, whether positive or negative, is OR'd with the value already in the register to make the full number (byte), gain_corr[0]   |= .  The computation works the same way for either positive or negative rather than requiring a decision and different operations based on the sign bit which is more of how many of us  commonly think and how the author described it in the data sheet.

    Each correction value has its own equation because different bits must be picked out of the packed MSB registers.

  • a few further questions around the correction and the calculation of VREF and VCOUT of the BQ76925.

     

    1. VREF

    In the datasheet of the BQ76925 an initial tolerance of VREF is given with +/- 120mV for VREF = 3.0V.

    After calibration the tolerance should be in the range of +/-  0.1%.

     

    How exactly is the calibration done? Is it just a theoretical correction as given in slua619 (equation 2) with:

     

    VREF_INIT = (1+GC_VREF) x VREF_NOM + OC_VREF with VREF_NOM = 3.0

     

    This corrected VREF value is afterwards used in the calculation of VCOUT.

    Do I have any possibility to read out the corrected value of VREF_INIT via the HOST ADC?

     

    2. VCOUT

    In slua619 (equation 4) the calculation of the corrected VCOUT is given  by:

    VCOUT_CORR = (VCOUT + OC_VCOUT) x (1 + GC_VCOUT)

     

    As opposed to the calculation of the corrected VREF value, to VCOUT is at first the offset added. Subsequent is the gain multiplied.

    Is this correct? I do not know how the corrected data is determined and how it is stored in the memory.

     

  • Hi Olrik,

    1. The behavior of the reference differs from calibrated reference standards.  The amount of difference is measured at manufacture and stored in the registers described.  The user can use those values to calculate to a calibrated value.

    Only the levels indicated in the data sheet can be selected to be read out of the device.

    2. The calculation of VCOUT_CORR noted above appears to be equation 7 in the application note appears to be the same as equation 1 in the data sheet.  It is also carried forward into equation 8 and the example in 9 and 10.  It seems consistent with the design put in place by the part developers.