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.

BQ34Z100: Changing the configuration of the battery monitor

Part Number: BQ34Z100
Other Parts Discussed in Thread: BQSTUDIO

Hi all, 

We are working on a design, in which BQ34Z100-G1 battery monitor is connected to Arduino micro-controller.
We are trying to change the configuration of the battery monitor by changing some registers of the data flash. We are able to read the data flash registers correctly, but the write back is not working properly. 
We are getting a checksum value - 0x00, after writing the calculated checksum.Because of this checksum issue, written data into flash is not reflecting when we read back after a reset.
Please find the attached log (battery_monitor.txt) for details.
We tried to read the firmware version register (Sub Class ID 56 , Offset 4). This returns value - 0x00. 
Is there any issues with the default firmware present inside the battery monitor as suggested in this e2e link ?
Please point us to possible causes for this issue. 
Looking forward to valuable suggestions. 
Regards,
Avinash
  • Here is the transaction log to update the Firmware Version to 0001. The new checksum will be FE. I read SubClass 38H. Changed the Firmware Version parameter and the read SubClass 38H to verify that it has changed.


  • Hi Thomas,

    Thanks for the response.

    We tried to change the firmware version by writing 0x0001 to Subclass ID 56 (0x38) , offset register 4.
    But this change is also not getting reflected when we read back.

    We have attached arduino code & corresponding logs.
    Can you please look into this & suggest us on how to proceed further ?

    Looking forward to your valuable insights.

    We have put the source code and log files below.

    Code
    **********************************************************************************************************************

    #include <Wire.h>


    void setup()
    {
    Wire.begin();

    Serial.begin(9600);
    while (!Serial);
    }


    void loop()
    {

    int reading= 0;
    int flash[32];


    // Read start

    // i2c wr 0x55 0x61 0x00
    Serial.println("Read Start");
    Wire.beginTransmission(85);
    Wire.write(byte(0x61));
    Wire.write(byte(0x00));
    Wire.endTransmission();

    // i2c wr 0x55 0x3E 0x38
    Wire.beginTransmission(85);
    Wire.write(byte(0x3E));
    Wire.write(byte(0x38));
    Wire.endTransmission();

    // i2c wr 0x55 0x3F 0x00
    Wire.beginTransmission(85);
    Wire.write(byte(0x3F));
    Wire.write(byte(0x00));
    Wire.endTransmission();

    delay(1000);


    //i2c rd 0x55 0x40 (32 Bytes)
    Wire.beginTransmission(85);
    Serial.println("starting 32 bytes read\n");
    Wire.write(byte(0x40));
    Wire.endTransmission();
    Wire.requestFrom(85,32);

    if (32 <= Wire.available())
    {
    for (int j=0;j<32;j++)
    {
    flash[j] = Wire.read();
    Serial.println(flash[j],HEX);
    }
    }
    Serial.println("Read Complete");

    //i2c rd 0x55 0x60 (1 Byte)
    Wire.beginTransmission(85);
    Serial.println("Reading checksum\n");
    Wire.write(byte(0x60));
    Wire.endTransmission();
    Wire.requestFrom(85,1);
    if (1 <= Wire.available())
    {
    reading = Wire.read();
    Serial.println(reading,HEX);
    Serial.println("\n");
    }

    //Change the firmware version to 0x0001
    flash[5]=0x1;


    //i2c wr 0x55 0x61 0x00
    Wire.beginTransmission(85);
    Wire.write(byte(0x61));
    Wire.write(byte(0x00));
    Wire.endTransmission();

    // i2c wr 0x55 0x3E 0x38
    Wire.beginTransmission(85);
    Wire.write(byte(0x3E));
    Wire.write(byte(0x30));
    Wire.endTransmission();

    // i2c wr 0x55 0x3F 0x00
    Wire.beginTransmission(85);
    Wire.write(byte(0x3F));
    Wire.write(byte(0x00));
    Wire.endTransmission();

    delay(2000);

    // i2c wr 0x55 0x40 0x00 0x00 0x00 0x00 0x00 0x01
    Serial.println("Starting write\n");
    Wire.beginTransmission(85);
    Wire.write(byte(0x40));
    for (int j=0;j<6;j++)
    {
    Wire.write(byte(flash[j]));
    Serial.println(flash[j],HEX);
    }
    Wire.endTransmission();
    Serial.println("Write completed\n");

    delay(2000);

    // i2c wr 0x55 0x60 0xFE
    Serial.println("Writing checksum\n");
    Wire.beginTransmission(85);
    Wire.write(byte(0x60));
    Wire.write(byte(0xFE));
    Wire.endTransmission();
    Serial.println("Checksum written\n");

    delay(2000);


    Serial.println("Read back after write");
    // i2c wr 0x55 0x61 0x00
    Wire.beginTransmission(85);
    Wire.write(byte(0x61));
    Wire.write(byte(0x00));
    Wire.endTransmission();

    // i2c wr 0x55 0x3E 0x38
    Wire.beginTransmission(85);
    Wire.write(byte(0x3E));
    Wire.write(byte(0x38));
    Wire.endTransmission();

    // i2c wr 0x55 0x3F 0x00
    Wire.beginTransmission(85);
    Wire.write(byte(0x3F));
    Wire.write(byte(0x00));
    Wire.endTransmission();

    delay(1000);

    //i2c rd 0x55 0x40 (32 Bytes)
    Wire.beginTransmission(85);
    Serial.println("starting 32 bytes read\n");
    Wire.write(byte(0x40));
    Wire.endTransmission();
    Wire.requestFrom(85,32);

    if (32 <= Wire.available())
    {
    for (int j=0;j<32;j++)
    {
    flash[j] = Wire.read();
    Serial.println(flash[j],HEX);
    }
    }

    //i2c rd 0x55 0x60 (1 Byte)
    Wire.beginTransmission(85);
    Serial.println("Reading checksum\n");
    Wire.write(byte(0x60));
    Wire.endTransmission();
    Wire.requestFrom(85,1);
    if (1 <= Wire.available())
    {
    reading = Wire.read();
    Serial.println(reading,HEX);
    Serial.println("\n");
    }
    Serial.println("Read Complete");

    while(1);

    }
    ***********************************************************

    Log file
    ********************************************************************
    Read Start
    starting 32 bytes read

    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    Read Complete
    Reading checksum

    FF


    Starting write

    0
    0
    0
    0
    0
    1
    Write completed

    Writing checksum

    Checksum written

    Read back after write
    starting 32 bytes read

    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    Reading checksum

    FF


    Read Complete

    *******************************************************************************************

    Regards,
    Avinash
  • Your code looks correct. You could check the I2C transmission with an oscilloscope to make sure that the device is ACK'ing the bytes. Maybe the address should be AA instead of 55.
  • The program is written for 7-bit I2C Slave address thus address is 0x55 rather than 0xAA.
    Also, we are able to read the data flash registers & corresponding checksum properly.
    This confirms that the I2C communication is proper.
  • Hi Avinash,

    Thanks for the clarification. As Tom said please make sure the address on the scope capture from the micro matches the address on the scope capture from bqStudio. Do you have an I2C sniffer? That would also be very useful for debugging your I2C transactions.

  • Log.docx

    Thanks Damien, log file with response above.

    * Texas Instruments Data Flash File
    * File created Sat Jan 14 19:46:08 2017
    *
    * Device Number 100
    * Firmware Version 0.16
    * Build Number not available
    * Order Number not available
    *
    * bqz Device Number 100
    * bqz Firmware Version 0.16
    * bqz Build Number 17
    *
    * Field Order: Class name  Subclass name  Parameter name  Parameter Value  Display Units
    Configuration Safety OT Chg 55 1degC
    Configuration Safety OT Chg Time 2 Seconds
    Configuration Safety OT Chg Recovery 50 1degC
    Configuration Safety OT Dsg 60 1degC
    Configuration Safety OT Dsg Time 2 Seconds
    Configuration Safety OT Dsg Recovery 55 1degC
    Configuration Charge Inhibit Cfg Chg Inhibit Temp Low 0 1degC
    Configuration Charge Inhibit Cfg Chg Inhibit Temp High 45 1degC
    Configuration Charge Inhibit Cfg Temp Hys 5 1degC
    Configuration Charge Suspend Low Temp -5 1degC
    Configuration Charge Suspend High Temp 55 1degC
    Configuration Charge Pb EFF Efficiency 100 %
    Configuration Charge Pb Temp Comp 24.96 %
    Configuration Charge Pb Drop Off Percent 96 %
    Configuration Charge Pb Reduction Rate 10 %
    Configuration Charge Termination Taper Current 100 mAmp
    Configuration Charge Termination Min Taper Capacity 25 mAmpHr
    Configuration Charge Termination Cell Taper Voltage 100 mVolt
    Configuration Charge Termination Current Taper Window 40 Seconds
    Configuration Charge Termination TCA Set % 99 Percent
    Configuration Charge Termination TCA Clear % 95 Percent
    Configuration Charge Termination FC Set % 100 Percent
    Configuration Charge Termination FC Clear % 98 Percent
    Configuration Charge Termination DODatEOC Delta T 10 1degC
    Configuration Charge Termination NiMH Delta Temp 3 1degC
    Configuration Charge Termination NiMH Delta Temp Time 180 Seconds
    Configuration Charge Termination NiMH Hold Off  Time 100 Seconds
    Configuration Charge Termination NiMH Hold Off Current 240 mAmp
    Configuration Charge Termination NiMH Hold Off  Temp 25 1degC
    Configuration Charge Termination NiMH Cell Negative Delta Volt 17 mVolt
    Configuration Charge Termination NiMH Cell Negative Delta Time 16 Seconds
    Configuration Charge Termination NiMH Cell Neg Delta Qual Volt 4200 mVolt
    Configuration Data Manufacture Date 1/1/1980 Day + Mo*32 + (Yr -1980)*256
    Configuration Data Serial Number 1 hex
    Configuration Data Cycle Count 0 Count
    Configuration Data CC Threshold 900 mAmpHr
    Configuration Data Max Error Limit 100 %
    Configuration Data Design Capacity 1000 MilliAmpHour
    Configuration Data Design Energy 5400 MilliWattHour
    Configuration Data SOH Load I -400 MilliAmp
    Configuration Data Cell Charge Voltage T1-T2 4200 mV
    Configuration Data Cell Charge Voltage T2-T3 4200 mV
    Configuration Data Cell Charge Voltage T3-T4 4100 mV
    Configuration Data Charge Current T1-T2 10 Percent
    Configuration Data Charge Current  T2-T3 50 Percent
    Configuration Data Charge Current  T3-T4 30 Percent
    Configuration Data JEITA T1 0 degC
    Configuration Data JEITA T2 10 degC
    Configuration Data JEITA T3 45 degC
    Configuration Data JEITA T4 55 degC
    Configuration Data Design Energy Scale 1 Number
    Configuration Data Device Name bq34z100-G1 -
    Configuration Data Manufacturer Name Texas Inst. -
    Configuration Data Device Chemistry LION -
    Configuration Discharge SOC1 Set Threshold 150 mAh
    Configuration Discharge SOC1 Clear Threshold 175 mAh
    Configuration Discharge SOCF Set Threshold 75 mAh
    Configuration Discharge SOCF Clear Threshold 100 mAh
    Configuration Discharge Cell BL Set Volt Threshold 2800 mVolt
    Configuration Discharge Cell BL Set Volt Time 2 Seconds
    Configuration Discharge Cell BL Clear Volt Threshold 2900 mVolt
    Configuration Discharge Cell BH Set Volt Threshold 4300 mVolt
    Configuration Discharge Cell BH Volt Time 2 Seconds
    Configuration Discharge Cell BH  Clear Volt Threshold 4200 mVolt
    Configuration Discharge Cycle Delta 0.05 %
    Configuration Manufacturer Data Pack Lot Code 0 hex
    Configuration Manufacturer Data PCB Lot Code 0 hex
    Configuration Manufacturer Data Firmware Version 0 hex
    Configuration Manufacturer Data Hardware Revision 0 hex
    Configuration Manufacturer Data Cell Revision 0 hex
    Configuration Manufacturer Data DF Config Version 0 hex
    Configuration Lifetime Data Lifetime Max Temp 30 1degC
    Configuration Lifetime Data Lifetime Min Temp 20 1degC
    Configuration Lifetime Data Lifetime Max Chg Current 0 mAmp
    Configuration Lifetime Data Lifetime Max Dsg Current 0 mA
    Configuration Lifetime Data Lifetime Max Pack Voltage 160 20mV
    Configuration Lifetime Data Lifetime Min Pack Voltage 175 20mV
    Configuration Lifetime Temp Samples LT Flash Cnt 0 Count
    Configuration Registers Pack Configuration 41d9 flags
    Configuration Registers Pack Configuration B af flags
    Configuration Registers Pack Configuration C 37 flags
    Configuration Registers LED_Comm Configuration 0 flags
    Configuration Registers Alert Configuration 0 flags
    Configuration Registers Number of series cell 1 num
    Configuration Lifetime Resolution LT Temp Res 1 1degC
    Configuration Lifetime Resolution LT Cur Res 100 mA
    Configuration Lifetime Resolution LT V Res 1 20mV
    Configuration Lifetime Resolution LT Update Time 60 Seconds
    Configuration LED Display LED Hold Time 4 Num
    Configuration Power Flash Update OK Cell Volt 2800 mVolt
    Configuration Power Sleep Current 10 mAmp
    Configuration Power FS Wait 0 Seconds
    System Data Manufacturer Info Block A 0 0 hex
    System Data Manufacturer Info Block A 1 0 hex
    System Data Manufacturer Info Block A 2 0 hex
    System Data Manufacturer Info Block A 3 0 hex
    System Data Manufacturer Info Block A 4 0 hex
    System Data Manufacturer Info Block A 5 0 hex
    System Data Manufacturer Info Block A 6 0 hex
    System Data Manufacturer Info Block A 7 0 hex
    System Data Manufacturer Info Block A 8 0 hex
    System Data Manufacturer Info Block A 9 0 hex
    System Data Manufacturer Info Block A 10 0 hex
    System Data Manufacturer Info Block A 11 0 hex
    System Data Manufacturer Info Block A 12 0 hex
    System Data Manufacturer Info Block A 13 0 hex
    System Data Manufacturer Info Block A 14 0 hex
    System Data Manufacturer Info Block A 15 0 hex
    System Data Manufacturer Info Block A 16 0 hex
    System Data Manufacturer Info Block A 17 0 hex
    System Data Manufacturer Info Block A 18 0 hex
    System Data Manufacturer Info Block A 19 0 hex
    System Data Manufacturer Info Block A 20 0 hex
    System Data Manufacturer Info Block A 21 0 hex
    System Data Manufacturer Info Block A 22 0 hex
    System Data Manufacturer Info Block A 23 0 hex
    System Data Manufacturer Info Block A 24 0 hex
    System Data Manufacturer Info Block A 25 0 hex
    System Data Manufacturer Info Block A 26 0 hex
    System Data Manufacturer Info Block A 27 0 hex
    System Data Manufacturer Info Block A 28 0 hex
    System Data Manufacturer Info Block A 29 0 hex
    System Data Manufacturer Info Block A 30 0 hex
    System Data Manufacturer Info Block A 31 0 hex
    Gas Gauging IT Cfg Load Select 1 Number
    Gas Gauging IT Cfg Load Mode 0 Number
    Gas Gauging IT Cfg Res Current 10 mAmp
    Gas Gauging IT Cfg Max Res Factor 50 num
    Gas Gauging IT Cfg Min Res Factor 1 num
    Gas Gauging IT Cfg Ra Filter 500 num
    Gas Gauging IT Cfg Min PassedChg NiMH-LA 1st Qmax 50 %
    Gas Gauging IT Cfg Maximum Qmax Change 100 %
    Gas Gauging IT Cfg Cell Terminate Voltage 3000 mVolt
    Gas Gauging IT Cfg Cell Term V Delta 200 mVolt
    Gas Gauging IT Cfg ResRelax Time 500 Seconds
    Gas Gauging IT Cfg User Rate-mA 0 MilliAmp
    Gas Gauging IT Cfg User Rate-Pwr 0 mW/cW
    Gas Gauging IT Cfg Reserve Cap-mAh 0 MilliAmpHour
    Gas Gauging IT Cfg Reserve Energy 0 mWh/cWh
    Gas Gauging IT Cfg Max Scale Back Grid 4 num
    Gas Gauging IT Cfg Cell Min DeltaV 0 mVolt
    Gas Gauging IT Cfg Ra Max Delta 15 %
    Gas Gauging IT Cfg Design Resistance 42 mOhms
    Gas Gauging IT Cfg Reference Grid 4 -
    Gas Gauging IT Cfg Qmax Max Delta % 10 mAmpHour
    Gas Gauging IT Cfg Max Res Scale 32000 Num
    Gas Gauging IT Cfg Min Res Scale 1 Num
    Gas Gauging IT Cfg Fast Scale Start SOC 10 %
    Gas Gauging IT Cfg Charge Hys V Shift 40 mVolt
    Gas Gauging IT Cfg Smooth Relax Time 1000 s
    Gas Gauging Current Thresholds Dsg Current Threshold 60 mAmp
    Gas Gauging Current Thresholds Chg Current Threshold 75 mAmp
    Gas Gauging Current Thresholds Quit Current 40 mAmp
    Gas Gauging Current Thresholds Dsg Relax Time 60 Seconds
    Gas Gauging Current Thresholds Chg Relax Time 60 Seconds
    Gas Gauging Current Thresholds Cell Max IR Correct 400 mV
    Gas Gauging State Qmax Cell 0 1000 mAmpHr
    Gas Gauging State Cycle Count 0 num
    Gas Gauging State Update Status 0 num
    Gas Gauging State Cell V at Chg Term 4200 mVolt
    Gas Gauging State Avg I Last Run -299 mAmp
    Gas Gauging State Avg P Last Run -1131 MilliWattHour
    Gas Gauging State Cell Delta Voltage 2 mVolt
    Gas Gauging State T Rise 20 Num
    Gas Gauging State T Time Constant 1000 Num
    Ra Tables Ra0 Table Ra Flag ff55 Hex
    Ra Tables Ra0 Table Ra 0 105 Num
    Ra Tables Ra0 Table Ra 1 100 Num
    Ra Tables Ra0 Table Ra 2 113 Num
    Ra Tables Ra0 Table Ra 3 143 Num
    Ra Tables Ra0 Table Ra 4 98 Num
    Ra Tables Ra0 Table Ra 5 97 Num
    Ra Tables Ra0 Table Ra 6 108 Num
    Ra Tables Ra0 Table Ra 7 89 Num
    Ra Tables Ra0 Table Ra 8 86 Num
    Ra Tables Ra0 Table Ra 9 85 Num
    Ra Tables Ra0 Table Ra 10 87 Num
    Ra Tables Ra0 Table Ra 11 90 Num
    Ra Tables Ra0 Table Ra 12 110 Num
    Ra Tables Ra0 Table Ra 13 647 Num
    Ra Tables Ra0 Table Ra 14 1500 Num
    Ra Tables Ra0x Table Ra Flag ffff Hex
    Ra Tables Ra0x Table Ra 0 105 Num
    Ra Tables Ra0x Table Ra 1 100 Num
    Ra Tables Ra0x Table Ra 2 113 Num
    Ra Tables Ra0x Table Ra 3 143 Num
    Ra Tables Ra0x Table Ra 4 98 Num
    Ra Tables Ra0x Table Ra 5 97 Num
    Ra Tables Ra0x Table Ra 6 108 Num
    Ra Tables Ra0x Table Ra 7 89 Num
    Ra Tables Ra0x Table Ra 8 86 Num
    Ra Tables Ra0x Table Ra 9 85 Num
    Ra Tables Ra0x Table Ra 10 87 Num
    Ra Tables Ra0x Table Ra 11 90 Num
    Ra Tables Ra0x Table Ra 12 110 Num
    Ra Tables Ra0x Table Ra 13 647 Num
    Ra Tables Ra0x Table Ra 14 1500 Num
    Calibration Data CC Gain 10.123 mohm
    Calibration Data CC Delta 10.147 mohm
    Calibration Data CC Offset -1200 num
    Calibration Data Board Offset 0 num
    Calibration Data Int Temp Offset 0 degC
    Calibration Data Ext Temp Offset 0 degC
    Calibration Data Voltage Divider 5000 mVolt
    Calibration Current Deadband 5 mAmp
    Security Codes Sealed to Unsealed 36720414 hex
    Security Codes Unsealed to Full ffffffff hex
    Security Codes Authen Key3 1234567 hex
    Security Codes Authen Key2 89abcdef hex
    Security Codes Authen Key1 fedcba98 hex
    Security Codes Authen Key0 76543210 hex

    I am sorry i am not able to attach files and that is the reason i am pasting the complete file here.

    Regards,
    Avinash