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.

BQ20Z60-R1_BQEVSW-SW: Conversion values from Hex to what BQ Studio displays for calibration values

Part Number: BQ20Z60-R1
Other Parts Discussed in Thread: BQ40Z50

Tool/software:

We've created a program to assist in automating calibration of a battery that uses the BQ20Z60 chip.  That part works great.  The part I'm having trouble with is getting and saving the calibration values afterwards.  I can read the raw values from flash but I want to display them in the same format that BQ Evaluation Software shows them.  For the Temperature offsets this was easy (divide by 10).  For the Ref Voltage this was also easy.  However, I have no idea how it's displaying

CC Gain
CC Delta
CC Offset
Board Offset

I made a similar program for another one of our batteries that uses the BQ40Z50 chip, and I was able to find an app note that told me exactly what values I had to multiple and/or divide by to convert from the hex values in flash to what the BQ Studio showed but can't find anything similar for the 20Z60.  Anyone have any idea the formula's used to convert from what's stored in flash to what BQ Eval SW displays?

Additionally, does anyone know the format of the floating point numbers?  The BQ40Z50 datasheet specifically called them out as IEE754 Single Precision, but when I convert them using that format I get values very far outside what the datasheet says the min and max values should be by a couple orders of magnitude.

Thanks!

  • Please try the info from this app note: www.ti.com/.../slva148a.pdf

  • Thanks for the super fast reply.  I'm in the process of going through this and running tests, but I'm not sure this is exactly right for the 20z60.  It names things slightly differently than the 20z60 and their closest counter-parts do not line up with the values given here.  For instance, this part says "AFE Ref" units are in .1mV.  The closest names in the bq20z60 are "Ref Voltage" and "AFE Pack Gain", neither of which work correctly with .1mV.

    Additionally, this datasheet says that CC Offset is a Signed Integer, but the 20z60 stores it as a floating point and neither of the current constants in here make values come out to what I expect.  However, I am pretty sure that it is a Xemics floating point number in the 20z60, which I have never heard of and didn't see on any of the various online conversion utilities that I found, so I was able to convert the VB code in here into C# and that seems to give me numbers more in the range of what I expect based upon the datasheet.  Progress!

    Any other app notes you can recommend that might have constant info?  Any TI software engineers that can load up the EVSW source code and look at the constants it uses? Slight smile

  • Wait... maybe the Xemics float format doesn't make sense.  Datasheet says that min/max values for CC Gain is .1 to 4, and my CC gain is 2.316 using the xemics float.  That checks out.  However, the CC Delta has a min/max of 29,826 to 280,932.6 and mine works out to 14.932...

  • CC Delta = CC Gain * (((double) 0x10000L * (double) 0x10000L) * 0.25/3600.0). This is always a fixed scaling factor.

    The gauge itself doesn't apply a min/max for CC Gain. CC Gain is the scaling factor that the gauge uses to convert the integer result from the coulomb counter delta-sigma ADC (the passed charge over the integration period) to a current in mA. Any min/max is applied by the EV software (and the d/s lists limits for various reasons) but not by the gauge.

    You can calculate the scaling factor that the UI uses by converting a 4 byte Xemics floating point result that the software wrote to the gauge to a human readable floating point number and the number that the UI displays.

    The coulomb counter offset is stored in units of coulomb counter LSBs * number of offset samples. It is divided by the number of offset samples and added to the coulomb count results over a sample period.

  • Oww actual formulas!  Do these exist in some app note somewhere I just haven't been able to find?

    Would you be able to tell me the exact formula's for the following items?  I am reading the raw values from flash and need to convert them to the same format that BQ Eval Software displays
    CC Gain
    CC Offset
    Board Offset

    Unsure about CC Offset and Board Offset, but CC Gain is definitely not a simple multiplication or division. 
    For instance, if I convert the CC Gain field from the dataflash using Xemics floats, I get the following values:

    Raw hex value             Float                       BQ Eval Software
    81 45 15 BA                 2.30958843              6.117
    81 45 A4 5C                 2.31199765              6.1
    (Forgot to record)         1.88379991              10


    The CC Offset might be a simple division of 6812.03f.  I have 2 datapoints that works for and one it doesn't.

    All three of my systems have the exact same Board Offset so I don't know if multiplying by 1.469769f is the correct conversion or if it works for just that single data point.

    Thanks!

  • No, this info doesn't exist in any app note because it's not supposed to be changed by the user other than with the UI.

    I don't have the source code for the UI. The gauge uses the 32-bit xemics floating point value as stored in the data memory (configuration) without additional scaling. If you convert the 32-bit data correctly then you should be able to infer the conversion scheme from the UI.

    If I type your hex values into my Xemics converter, I get:

    81 45 15 BA = 1.53972554206848
    81 45 A4 5C = 1.54407835006713

  • Hmm ok, seems to be something wrong with my conversion routine, though I did copy it directly from one of the app notes and simply converted it to C#.  Probably a byte order thing.  

    So even with using those numbers I still don't know how to convert from what the chip reports to what BQ Eval Software reports.

    1.53972554206848   will show up in BQ as:   6.117
    1.54407835006713   will show up in BQ as:    6.1

    I don't know how to infer this conversion scheme.  I guess I can try arbitrarily subtraction and multiplication values, but that seems excessively painful.


    I might just have to store the values as directly read from flash memory without conversion and accept that we can't compare them to values in BQ as we don't know how to convert them.

  • Just in case someone else runs across this post in the future and is also looking for constants, here are the values I've developed that work reasonably well for the datapoints I was able to gather from our batteries.

    What BQ displays         Raw values from flash
    CC Gain BQ                  = (float)((-21.917 * Math.Pow(CCGain, 2)) + (63.64 * CCGain) - 39.911)
    RefVoltageBQ               = (float)(RefVoltage * 50) / (float)1000
    AFEPackGainBQ          = (float)Math.Round(AFEPackGain / 32.768f, 2)
    CCOffsetBQ                  = (float)Math.Round(CCOffset / 6812.03f, 3)
    BoardOffsetBQ              = (float)Math.Round(BoardOffset * 1.471f, 3) / 10