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.

BQ78350-R1: Current calibration sequence and calculations

Part Number: BQ78350-R1
Other Parts Discussed in Thread: BQSTUDIO

Hello, we are using BQ78350-R1 device with R2-firmware. Please find my questions below regarding CC calibration section 12.2.5 in TRM

  1. R2-FW changes: Are there changes in calibration related functions in R2 firmware? I noticed Capacity gain has the same value as CC gain when I perform calibration using BQ studio, but TRM has relation: Capacity Gain = CC Gain * 298261.6178, can you confirm which is correct value to write in for Capacity gain calibration for R2-FW
  2. Coulomb Counter Offset Samples: What does this parameter do? Does it change during the calibration process or is it fixed value and can be read anytime? There is no explanation in TRM regarding this parameter.
  3. After enabling raw ADC data 2 using 0xF082, if data flash parameter  Coulomb Counter Offset Samples is read will it stop raw ADC output? Or I can read this before enabling raw ADC? This is related to my previous question
  4. Is there a timeout for CALIBRATION mode to disable calibration? or it's only changed based on command 0x002D?
  5. Is it possible to calibrate CC Gain/ Capacity gain with a calibrated shunt emulator? If yes then, can we skip step 5 of section 12.2.5.2 in TRM to enable FETs? 
  6. Section 12.2.5.2 step 10: Can you confirm ADCcc is FCALcc from step 7. Also, the Coulomb Counter Offset Samples is same and does not have to be read again if this is known from CC offset calibration. 

  • Hi Prasanna,

    1. There are no changes to the calibration functions in the R2 firmware. In BQStudio, both CC Gain and Capacity Gain are expressed in terms of the sense resistor value (in mohms), so it is a little confusing. So these are not the actual values in the calibration registers. For example CC Gain displays 8.4381 divided by the register value. These registers are also in Xemics floating point format. I am posting an example Python script below that does the floating point conversions.

    2. It is best to leave Coulomb Counter Offset Samples at the default value (of 64). It is the number of samples used for the board offset calibration.

    3. You don't need to read Coulomb Counter Offset Samples. It is a data flash parameter and is set to 64 by default.

    4. I'm not sure if it will ever timeout. 

    5. It is possible, but one benefit of the calibration is it can improve accuracy with shunt value variation from board to board.

    6. That is correct. Here is a quick example that might be helpful:

    Icc = -5000   (in mA)

    GGgg from 0xF082 = 0xFED9     -> This is a signed integer, so 0xFED9 = -296

    CC Offset = 0  (from 0x4018)

    Columb counter samples  = 0x4000  (from 0x4018, little endian format)

     So the calculation for CC Gain is [-5000 / (-296 – 0)] = 16.89

    The value displayed in BQStudio is 8.4381 / x, so 8.4381/16.89 = 0.500

     Icc is the current in mA. ADCcc is the code representing the voltage across the sense resistor (-296 * 8.4381uV = 2.5mV).

    '''

    /* Xemics floating point script
    '''
    import sys
    import time
    from time import sleep
    import sets
    import math

    #####################################################


    def Dec2Flash(value):
    '''

    '''
    if value == 0:
    value += 0.0000001 #avoid log of zero
    if value < 0:
    bNegative = 1
    value *= -1
    else:
    bNegative = 0

    exponent = int( (math.log(value)/math.log(2)) + 1)
    MSB = exponent + 128 #exponent bits
    mantissa = value / (2**exponent)
    mantissa = mantissa / (2**-24)

    if (bNegative == 0):
    mantissa = int(mantissa) & 0x7fffff #remove sign bit if number is positive

    result = mantissa + MSB * 256**3
    print hex(result)

    def Flash2Dec(value):
    '''

    '''
    exponent = value / (256**3) #exponent is most significant byte
    mantissa = value % (256**3)
    if (0x800000 & mantissa == 0): #check if number is positive
    isPositive = 1
    mantissa = 0x800000 + mantissa
    else:
    isPositive = 0
    result = mantissa * 2**(exponent-128-24)
    if not(isPositive):
    result *= -1
    print result




    ##########################################
    # Start of Main Script
    ##########################################

    decDefault = 8.4381
    flashDefault = 0x84070275

    print "Flash2Dec(0x84070275) = "
    Flash2Dec(flashDefault)
    print "Dec2Flash(8.4381) = "
    Dec2Flash(decDefault)
    print "Dec2Flash(16.8762) = "
    Dec2Flash(16.8762)