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.

Calibrating bq27421-G1B on custom board

Other Parts Discussed in Thread: BQSTUDIO, EV2400

I have designed a custom board running Linux with the bq27421G1B gas gauge.   I am able to read parameters correctly from the device, however I have not done any calibration for it.    I do not have the evaluation board, only my custom board.   Can I use the bq studio app somehow with my custom board?   Is there an adapter that I can rig into the I2C bus, and run bq studio from windows?

  • Hi Geoffrey,


    That's great you are able to read from the device with your Linux code, but have you also implemented the ability to configure it with your code?

    You can find source code for bqTool in this code repository which will allow you to configure the gauge a few different ways.

    http://processors.wiki.ti.com/index.php/Linux/Android_Software_Solutions_for_TI_Single-cell_Gas_Gauges

    One method bqTool supports is to be able to write a gg.csv file from your Linux file system into the gauge.  (You must export a gg.csv file from bqStudio with the Export All Columns preference selected from the menu.  Then you can delete all the lines which are default and only leave the ones you want to write in your file.)

    Another method supported by bqTool is to parse a gm.fs file which will also update the gauge configuration.  You can configure a bq27421EVM RAM with bqStudio, then use the Golden Image plugin to read out a *.gm.fs flashtream file.  Then use bqTool on Linux to take the gm.fs file and configure the gauge.

    The ideal development flow is to connect your battery to a bq27421EVM, configure it using bqStudio, then run a learning cycle or two, and then export the configured and learned Data Memory parameters in a gg.csv and/or gm.fs file.  The learning cycle is technically optional since you can allow the gauge to learn in the field, but for maximum out of the box accuracy on the first cycle, some customers like to run a learning cycle during development of their "golden file".

    Now, to answer your original question about connecting EV2400 to your system board.  Yes, it is technically possible to connect the I2C bus in your system to the I2C port on EV2400, but there are two things to consider.  First, the EV2400 has internal pullups on the I2C lines to 3.3V.  You need to ensure that this voltage isn't too high for the I2C pins on your micro in your system.  If it is a problem then you could try EV2300, which has no internal I2C pullups.  Secondly, the EV2400 will not "share" the I2C bus with another I2C master.  It will assume it is the only master on the bus and blast out transactions under control of bqStudio without caring about any other traffic.  If you can ensure your host micro is silent or held in reset then this should not be a problem.

    To summarize, you can use bqStudio and EV2400/EV2300 to configure the gauge in your system, but you still need to have the ability for your system's host micro to be able to configure the gauge.  This is because the bq27421 is a ROM gauge and every time it loses power (indicated by the ITPOR bit = 1) all settings will return to defaults and need to be re-updated by your host.

  • Wow - great answer ! Thanks for all of the details.
  • A couple of follow up issues:

    1. Does the EV2300 support 1.8V signal levels on I2C ? The part on my board operates at 1.8, and I can't change it. I was not able to find the allowable signal levels in the EV2300 datasheet.

    2. Can I create a golden file using bqstudio without connecting it to a chip? I was thinking that if I allow the learning cycles to happen on the board, then all I need is a golden file with the basics. I tried running bgStudio without connecting it to a chip and was not able to see how to make a gg files without a connection to chip.
  • Moved to 

    https://e2e.ti.com/support/power_management/battery_management/f/180/t/507290

  • Co-worker of Geoff here,


    Note that we have since fixed the error:

    bqtool: read_bq_poll_intvl(): Failed to read /sys/module/bq27x00_battery/parameters/poll_interval


    By patching SYSFS_POLL_INTVL in interface-linux-i2c.c to be "/sys/module/bq27xxx_battery/parameters/poll_interval"

    The rest of the errors, and suspicious "Success!" remain.