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.

BQ35100: The EOS bit dosen't change

Part Number: BQ35100
Other Parts Discussed in Thread: BQSTUDIO, EV2400,

Hi,

Having conducted several tests with the BQ35100EVM, I encountered an issue wherein the EOS bit doesn't change as expected.

Despite applying the prescribed pulse, the voltage fails to 0V.

Here is the setup I made :

So I use a primary cell and try to activate the EOS flag.

Here is the pulse I made :

To observe the EOS bit change, I have been aging the battery by imposing a load to discharge at 132 mA for 6 hours per day. I also allow the battery to rest for 16 hours to fully relax.

I conduct one test per day, but the EOS doesn't change.

Would it be possible to have some help in triggering the EOS bit ?

Best regards.

  • Hey Lilian,

    Please refer to this document: https://www.ti.com/lit/an/sluaal7/sluaal7.pdf

    For your testing you should be gathering Scaled R and Measured Z values from the gauge. When that is gathered, you will see a resistance trend which then can be used to configure the "EOS Trend Detection % percentage" parameter that is used to trigger the EOS flag. Read section 7 to get a more depth explanation.

    Regards,

    Nick Richards

  • Hi Nick,

    Thanks a lot for your response, that's exactly the information I needed.

    I have read the section 7 of this document, but I don't understand what I have concretely need to change in the EOSdata.

    And I don't understand how to calculate "Short trend average" and "Long trend average".

    Best regards.

    Lilian MARQUET.

  • Hey Lilian,

    You will need to gather a log file to calculate long term average and short term average because you will need the updated impedance value after each learning pulse. However, you can read those values from data memory after the learning pulse so you don't need to calculate those values. There are two values in EOSData that you need to change, that is "New Batt R Scale Delay" and "EOS Trend Detection".

    Regards,

    Nick Richards

  • Hi Nick,

    Thanks again for your support. I understand that the short and strong trend averages are automatically updated.

    Regarding the other two:

    • The "EOS trend detection %" represents the percentage of the battery where the EOS change. So if I want the EOS to be detected at a 10% of the battery, I should set the value to 10?

    • Do I need to calculate the "New Batt R Scale Delay" with the Short and Long trend average" ?

    Best regards

    MARQUET Lilian.

  • Hey Lilian,

    No, EOS Trend detection can not be set to trigger at 10% of the battery. EOS Trend detection is determined from the calculated internal impedance of the battery. You will need to conduct a complete test following the example in the document I linked to you earlier. In section 6 of the document shows the results of the test and the corresponding point during the test when certain EOS trend detection points were passed. Depending on your test that data will change and you will need to analyze the results to see at what DOD point corresponds with what EOS trend detection point

    No, New Batt R scale Delay is not an exact science for calculating. There usually is a small drop in resistance for the first few discharges. Again, when you conduct a test you will see how many discharges into the test to when the resistance doesn't decrease. This is also seen in section 6.

    Regards.

    Nick Richards

  • Hi Nick,

    Sorry but I don't understand what I need to do.

    - I have done the step of the discharge.

    - I have find the "Short trend average", "Long trend average" and "New Batt R Scale Delay" (as you can see up to this message).

    But now, what should I do to have the EOS flag during a discharge ?

    Best regards

    MARQUET Lilian.

  • Hello Lilian,

    The short term and long term average values seem weirdly different. I would recommend getting a brand new battery and follow all the steps in the application note I sent earlier. Make sure to collect data after each learning pulse. Do this until the battery is completely dead. Then send me your test results and I can help you with the next steps.

    Regards,

    Nick Richards

  • Hello Nick,

    As you advise me, I'm preparing some tests.

    I have a problem setting up the test. The G_DONE bit doesn't go high so, scaled r and measured z do not update.

    I have done  the test with the EV2400 and BQstudio and it's working, but with our µC (arduino) it doesn't. And we need it to automatized the test.

    Here is an overview of the steps:

    1) GE pin set to "high"

    2)  Wait for INITCOMP at "high" and ALERT at "low"

    3) Send the command "GAUGE_START" (0x0011)

    4) Wait for GA at "high"

    5) Send the pulse

    6) Send the command "GAUGE_STOP" (0x0012)

    7)  Wait for GA and ALERT at  "low"

    8) Wait for G_DONE at "high"

    9) Read the data : SCALED R (0x16), MEASURED Z (0x22) and VOLTAGE (0x08)

    Do you  know why the G_DONE bit doesn't change ?

    Best regards

    MARQUET Lilian.

  • Hey Lilian,

    Step 4 and Step 7 are not necessary and can be removed. Besides that, you stated the this worked before using the EV2400. This is hinting to me that it possibly could be an issue with communication using the Arduino microcontroller. Have you tried to looking at the communication waveforms using a digital logic analyzer.

    Regards,

    Nick Richards

  • Hi Nick,

    I can confirm that the G_DONE bit doesn't change.

    The only one at "high" is the INITCOMP.

    Best regards.

    MARQUET Lilian.

  • Hey Lilian,

    Are you able to use an I2C logic analyzer?  

    Regards,

    Nick Richards

  • Hey Lilian,

    Can you share with me the code that you are using for the Arduino?

    Regards,

    Nick Richards

  • Hi Nick,

    Here is the code

    #include <Wire.h>
     
    /*
      A4 -> SDA
      A5 -> SCL
    */
    /*J1
      GND     // Ground return. Connected to the SMD and HDQ GND
      SCL     // I2C clock. This line must be pulled up by the target.
      SDA     // I2C data. This line must be pulled up by the target.
      Vin     // Controlled EEPROM power. Supplies 5 VDC to a target EEPROM IC
    */
     
    const uint8_t charge = 2;
    const uint8_t gauge = 4;
    const uint8_t pulse = 7;
    const uint8_t start = 8;
     
    const uint8_t SLAVE_I2C_ADDRESS = 0x55;
    const uint8_t SCALED_R_reg = 0x16;
    const uint8_t MEASURED_Z_reg = 0x22;
    const uint8_t TENSION_reg = 0x08;
    const uint8_t BATTERY_STATUS_reg = 0x0A;
    const uint8_t BATTERY_ALERT_reg = 0x0B;
    const uint8_t CONTROL_reg = 0x00;
    const uint16_t CONTROL_STATUS = 0x0000;
    const uint16_t GAUGE_START = 0x0011;
    const uint16_t GAUGE_STOP = 0x0012;
    const uint16_t SELAED = 0x0020;
     
    uint16_t I2C_read(uint8_t reg, uint8_t size) {
      Wire.beginTransmission(SLAVE_I2C_ADDRESS);
      Wire.write(reg);
      Wire.endTransmission();
      Wire.requestFrom(SLAVE_I2C_ADDRESS, size);
      uint16_t data = 0x00;
      int i = 0;
      while(Wire.available()) {
        data += (Wire.read() << 8*i);
        i++;
      }
      Serial.println("reg: " + String(reg, HEX) + ", data: 0x" + String(data, HEX));
      return data;
    }
     
    int I2C_write(uint8_t reg, uint16_t data) {
      Wire.beginTransmission(SLAVE_I2C_ADDRESS);
      Wire.write(reg);
      Wire.write(data);
      return Wire.endTransmission();
      /*
        0: success.
        1: data too long to fit in transmit buffer.
        2: received NACK on transmit of address.
        3: received NACK on transmit of data.
        4: other error.
        5: timeout
      */
    }
     
    void setup() {
      Serial.begin(9600);
      Wire.begin(SLAVE_I2C_ADDRESS);
      Wire.setClock(100000);
      pinMode(charge, OUTPUT);
      pinMode(gauge, OUTPUT);
      pinMode(pulse, OUTPUT);
      pinMode(start, INPUT_PULLUP);
      digitalWrite(charge, LOW);
      digitalWrite(gauge, HIGH);
      digitalWrite(pulse, LOW);
    }
     
    void loop() {
      if(!digitalRead(start)) {
        Serial.println("START");
        int i = 0;
        while(i<5) {
          digitalWrite(charge, HIGH);
          delay(2000);
          // delay(7200000); // Attendre 2h
          digitalWrite(charge, LOW);
          delay(2000);
          // delay(14400000); // Attendre 4h
          digitalWrite(gauge, LOW);
          while(I2C_write(CONTROL_reg, SELAED));
          delay(100);
          while(!((I2C_read(CONTROL_reg, 2) >> 7) & 0b00000001) && ((I2C_read(BATTERY_STATUS_reg, 2) >> 2) & 0b00000001)) {
            Serial.println("INITCOMP+..., ALERT-...");
            delay(100);
          }
          I2C_write(CONTROL_reg, GAUGE_START);
          Serial.println("Gauge Start");
          delay(100);
          digitalWrite(pulse, HIGH);
          delay(200);
          digitalWrite(pulse, LOW);
          I2C_write(CONTROL_reg, GAUGE_STOP);
          Serial.println("Gauge Stop");
          delay(100);
          I2C_write(CONTROL_reg, CONTROL_STATUS);
          delay(100);
          while(!((I2C_read(CONTROL_reg, 2) >> 6) & 0b00000001)) {
            Serial.println("G_DONE+...");
            delay(100);
          }
          uint16_t scaled_r = I2C_read(SCALED_R_reg, 2);
          uint16_t measured_z = I2C_read(MEASURED_Z_reg, 2);
          uint16_t tension = I2C_read(TENSION_reg, 2);
          uint8_t battery_alert = I2C_read(BATTERY_ALERT_reg, 1);
          Serial.println(String(scaled_r) + "," + String(measured_z) + "," + String(tension) + "," + (((battery_alert >> 3) & 0b00000001)?"True":"False"));
          digitalWrite(gauge, HIGH);
          i++;
        }
        Serial.println("END");
      }
    }

    And there the same but in .txt

    #include <Wire.h>
     
    /*
      A4 -> SDA
      A5 -> SCL
    */
    /*J1
      GND     // Ground return. Connected to the SMD and HDQ GND
      SCL     // I2C clock. This line must be pulled up by the target.
      SDA     // I2C data. This line must be pulled up by the target.
      Vin     // Controlled EEPROM power. Supplies 5 VDC to a target EEPROM IC
    */
     
    const uint8_t charge = 2;
    const uint8_t gauge = 4;
    const uint8_t pulse = 7;
    const uint8_t start = 8;
     
    const uint8_t SLAVE_I2C_ADDRESS = 0x55;
    const uint8_t SCALED_R_reg = 0x16;
    const uint8_t MEASURED_Z_reg = 0x22;
    const uint8_t TENSION_reg = 0x08;
    const uint8_t BATTERY_STATUS_reg = 0x0A;
    const uint8_t BATTERY_ALERT_reg = 0x0B;
    const uint8_t CONTROL_reg = 0x00;
    const uint16_t CONTROL_STATUS = 0x0000;
    const uint16_t GAUGE_START = 0x0011;
    const uint16_t GAUGE_STOP = 0x0012;
    const uint16_t SELAED = 0x0020;
     
    uint16_t I2C_read(uint8_t reg, uint8_t size) {
      Wire.beginTransmission(SLAVE_I2C_ADDRESS);
      Wire.write(reg);
      Wire.endTransmission();
      Wire.requestFrom(SLAVE_I2C_ADDRESS, size);
      uint16_t data = 0x00;
      int i = 0;
      while(Wire.available()) {
        data += (Wire.read() << 8*i);
        i++;
      }
      Serial.println("reg: " + String(reg, HEX) + ", data: 0x" + String(data, HEX));
      return data;
    }
     
    int I2C_write(uint8_t reg, uint16_t data) {
      Wire.beginTransmission(SLAVE_I2C_ADDRESS);
      Wire.write(reg);
      Wire.write(data);
      return Wire.endTransmission();
      /*
        0: success.
        1: data too long to fit in transmit buffer.
        2: received NACK on transmit of address.
        3: received NACK on transmit of data.
        4: other error.
        5: timeout
      */
    }
     
    void setup() {
      Serial.begin(9600);
      Wire.begin(SLAVE_I2C_ADDRESS);
      Wire.setClock(100000);
      pinMode(charge, OUTPUT);
      pinMode(gauge, OUTPUT);
      pinMode(pulse, OUTPUT);
      pinMode(start, INPUT_PULLUP);
      digitalWrite(charge, LOW);
      digitalWrite(gauge, HIGH);
      digitalWrite(pulse, LOW);
    }
     
    void loop() {
      if(!digitalRead(start)) {
        Serial.println("START");
        int i = 0;
        while(i<5) {
          digitalWrite(charge, HIGH);
          delay(2000);
          // delay(7200000); // Attendre 2h
          digitalWrite(charge, LOW);
          delay(2000);
          // delay(14400000); // Attendre 4h
          digitalWrite(gauge, LOW);
          while(I2C_write(CONTROL_reg, SELAED));
          delay(100);
          while(!((I2C_read(CONTROL_reg, 2) >> 7) & 0b00000001) && ((I2C_read(BATTERY_STATUS_reg, 2) >> 2) & 0b00000001)) {
            Serial.println("INITCOMP+..., ALERT-...");
            delay(100);
          }
          I2C_write(CONTROL_reg, GAUGE_START);
          Serial.println("Gauge Start");
          delay(100);
          digitalWrite(pulse, HIGH);
          delay(200);
          digitalWrite(pulse, LOW);
          I2C_write(CONTROL_reg, GAUGE_STOP);
          Serial.println("Gauge Stop");
          delay(100);
          I2C_write(CONTROL_reg, CONTROL_STATUS);
          delay(100);
          while(!((I2C_read(CONTROL_reg, 2) >> 6) & 0b00000001)) {
            Serial.println("G_DONE+...");
            delay(100);
          }
          uint16_t scaled_r = I2C_read(SCALED_R_reg, 2);
          uint16_t measured_z = I2C_read(MEASURED_Z_reg, 2);
          uint16_t tension = I2C_read(TENSION_reg, 2);
          uint8_t battery_alert = I2C_read(BATTERY_ALERT_reg, 1);
          Serial.println(String(scaled_r) + "," + String(measured_z) + "," + String(tension) + "," + (((battery_alert >> 3) & 0b00000001)?"True":"False"));
          digitalWrite(gauge, HIGH);
          i++;
        }
        Serial.println("END");
      }
    }

    I'm coming back to you for the i2c tram.

    Best regards.

    MARQUET Lilian.

  • Hey Lilian,

    Thank you for sharing the code, allow me some time to review this.

    Regards,

    Nick Richards

  • Hey Lilian,

    I believe the issue is how you are sending certain commands to the gauge. The gauge start and stop commands are not communicated correctly. Those commands need to be sent in little endian format as well as sending the command to the correct register. I have code written for the BQ35100 using an Arduino that I will share with you. 

    /*
     * ----------------- bq35100_dataAcquisition ------------------- 
     *                  
     * This file will be used for the final data collection for the
     * smoke detectors using an arduino nano. The main program will 
     * communicate to the bq35100EVM-795 and get data like scaled 
     * resistance and measured resistance. The program will then 
     * write that data to an SD card.
     * 
     * 
     * // UPDATED to include trend data and EOS alert // 
     * 
     * PINOUT: 
     * 
     * D13 -> SCK (SD Card)
     * D12 -> MISO (SD Card)
     * D11 -> MOSI (SD Card)
     * D10 -> CS (SD Card)
     * GND -> GND (SD Card)
     * 5V -> VCC (SD Card)
     * 
     * GND -> J1_1 (bq35100EVM)
     * A5 -> J1_2 (bq35100EVM)
     * A4 -> J1_3 (bq35100EVM)
     * 
     * D5 -> J8_GE (bq35100EVM)
     * 
     * 3V3 -> REGIN (bq35100EVM)
     * 
     * Written By: Nicholas Richards
     * Last Modified: 08/5/2022
     */
    
    #include <Wire.h> 
    #include <SPI.h>
    #include <SD.h>
    
    #define bq35100_addr 0x55
    #define bq35100_voltage_LSB_addr 0x08
    #define bq35100_current_LSB_addr 0x0C
    #define bq35100_scaledR_LSB_addr 0x16
    #define bq35100_measuredZ_LSB_addr 0x22
    #define bq35100_internalTemp_LSB_addr 0x28
    #define bq35100_MAC_addr 0x3E
    #define bq35100_longTrend_LSB_addr 0x64
    #define bq35100_longTrend_MSB_addr 0x42
    #define bq35100_shortTrend_LSB_addr 0x60
    #define bq35100_shortTrend_MSB_addr 0x42
    #define gauge_start_cmd 0x11
    #define gauge_stop_cmd 0x12
    #define cs_pin 10
    #define GE_pin 5
    #define battery_relaxation_time 14400000
    #define learning_pulse_time 15000
    #define one_second 1000
    #define ten_milliseconds 10
    #define currentLowerBound -25
    
    File myFile;
    word voltage;
    word scaledR;
    word internalTemp;
    word measuredZ;
    int current;
    unsigned long shortTrend;
    unsigned long longTrend;
    unsigned long currentTime;
    unsigned long startTime;
    unsigned long lastDischarge;
    bool OCV_Bad;
    bool EOS_Alert;
    
    void setup() {
      Wire.begin();
      Serial.begin(9600);
      delay(100);
      Serial.println("trend");
      if (SD.begin(cs_pin)){
        Serial.println("SD card is present & ready");
      } 
      else{
        Serial.println("SD card missing or failure...");
        while(1);  //wait here forever
      }
      SD.remove("trend.csv");
      myFile = SD.open("trend.csv", FILE_WRITE);
      myFile.println("Data Collection 1");
      myFile.println("Time(ms),Voltage(mV),ScaledR(mΩ),MeasuredZ(mΩ),Internal Temp(0.1°K),OCV_Bad,Short Trend Average, Long Trend Average, EOS Alert");
      pinMode(GE_pin,OUTPUT); // digital pin 5 is an output
      delay(ten_milliseconds);
    }
    
    void loop() { 
      delay(battery_relaxation_time); 
      wakeupGauge();
      startGauge();
      waitForLearningPulse();
      delay(learning_pulse_time); //wait for learning pulse to finish
      stopGauge();
      waitForData();
      bq35100GetData();
      SDwrite();
      sleepGauge();
    }
    /*
    void toggle_gauge(){
    
      sleepGauge();
      delay(2000);
      wakeupGauge();
    }*/
    
    /* -------------- bq35100GetData -----------------
     * 
     * This function communicates to the bq35100EVM-795
     * and request data and then writes that data to 
     * global variables. 
     * 
     * Inputs: None 
     * Outputs: None
     */
    void bq35100GetData(){
      currentTime = millis() - startTime;
      scaledR = dataFromAddress(bq35100_scaledR_LSB_addr);
      measuredZ = dataFromAddress(bq35100_measuredZ_LSB_addr);
      voltage = dataFromAddress(bq35100_voltage_LSB_addr);
      internalTemp = dataFromAddress(bq35100_internalTemp_LSB_addr);
      OCV_Bad = checkOCV_bad();
      shortTrend = fromDataFlash(bq35100_shortTrend_MSB_addr,bq35100_shortTrend_LSB_addr);
      longTrend = fromDataFlash(bq35100_longTrend_MSB_addr,bq35100_longTrend_LSB_addr);
      EOS_Alert = checkEOS();
    }
    
    /* ----------------- SDwrite ----------------
     *  
     *  This function takes the values from the  
     *  global variables and writes that data to 
     *  the SD card. 
     *  
     *  Inputs: None
     *  Outputs: None
     */
    void SDwrite(){
      if(myFile){
        myFile.println(String(currentTime)+","+String(voltage)+","+String(scaledR)+","+String(measuredZ)+","+String(internalTemp)+","+String(OCV_Bad)+ "," + String(shortTrend) + "," + String(longTrend)+ "," + String(EOS_Alert));
        myFile.flush();
      }
    }
    
    /* --------------- byteCombiner ------------------
     *  
     *  This function combines two bytes into a word
     *  
     *  Inputs: MSB and LSB 
     *  Output: Word 
     */
    word byteCombiner(word MSB, word LSB){
      word temp = 0;
      temp |= LSB;
      MSB = MSB << 8;
      temp |= MSB;
      return temp;
    }
    
    /* --------------- startGauge ----------------
     *  
     *  This function sends a command to the gauge 
     *  telling it to enter ACTIVE mode
     *  
     *  Input: None 
     *  Output: None
     */
    void startGauge(){
      Wire.beginTransmission(bq35100_addr);
      Wire.write(bq35100_MAC_addr);
      Wire.write(gauge_start_cmd);
      Wire.write(0x00);
      Wire.endTransmission();
      delay(ten_milliseconds);
    }
    
    /* ------------ stopGauge ----------------
     * 
     * This function sends a command to the gauge 
     * telling it to exit ACTIVE mode and complete
     * all task
     * 
     * Input: None 
     * Output: None
     */
    void stopGauge(){
      Wire.beginTransmission(bq35100_addr);
      Wire.write(bq35100_MAC_addr);
      Wire.write(gauge_stop_cmd);
      Wire.write(0x00);
      Wire.endTransmission();
      delay(ten_milliseconds);
    }
    
    /* ------------ wakeupGauge ----------------
     *  
     *  This function sends a digital high to the  
     *  GE pin to wake up the gauge.
     *  
     *  Input: None 
     *  Output: None
     */
    void wakeupGauge(){
      digitalWrite(GE_pin,HIGH);
      delay(one_second); 
    }
    // this is important, have to wait long enough so you can send commands to the gauge
    /* --------------- sleepGauge --------------
     *  
     * This function sends a digital low to the 
     * GE pin to put the gauge to sleep/low power
     * mode
     * 
     * Input: None
     * Output: None
     */
    void sleepGauge(){
      digitalWrite(GE_pin,LOW);
    }
    
    
    bool checkOCV_bad(){
        byte bit1 = 0;
        byte bit2 = 0;
        Wire.beginTransmission(bq35100_addr);
        Wire.write(0x00);
        Wire.write(0x00);
        Wire.write(0x00);
        Wire.endTransmission();
        delay(ten_milliseconds); // also important, cant send two commands back to back too quick 
        Wire.beginTransmission(bq35100_addr);
        Wire.write(0x00);
        Wire.endTransmission();
        Wire.requestFrom(bq35100_addr,2);
        if(Wire.available() <= 2){
          bit1 = Wire.read();
          bit2 = Wire.read();
        }
       return bitRead(bit1,3);  
    }
    
    /* ------------------ waitForData --------------
     *  
     *  This function waits for the data to process 
     *  from the gauge using a busy-wait synchronization
     *  by polling the G_DONE bit in the CONTROL_STATUS
     *  address
     *  
     *  Input: None 
     *  Output: None
     */
    void waitForData(){
      bool finish = false;
      byte bit1 = 0;
      byte bit2 = 0;
      while(!finish){
        Wire.beginTransmission(bq35100_addr);
        Wire.write(0x00);
        Wire.write(0x00);
        Wire.write(0x00);
        Wire.endTransmission();
        delay(ten_milliseconds); 
        Wire.beginTransmission(bq35100_addr);
        Wire.write(0x00);
        Wire.endTransmission();
        Wire.requestFrom(bq35100_addr,2);
        if(Wire.available() <= 2){
          bit1 = Wire.read();
          bit2 = Wire.read();
        }
       finish = bitRead(bit1,6); 
      }
    }
    
    /* ------------- waitForLearningPulse ------------------
     *  
     *  This function waits for the next learning pulse by 
     *  waiting a set amount of time determined by the user
     *  
     *  Inputs: None
     *  Outputs: None
     */
    void waitForLearningPulse(){
      int this_current = 0;
      while(this_current > -5){
       delay(one_second);
       this_current = getCurrent();
      }
      stopGauge();
      sleepGauge();
      delay(110000);
      wakeupGauge();
      startGauge();
    }
    
    /* -------------- waitForFirstDischarge -----------------
     * 
     *  This function waits for the first discharge that 
     *  happens by polling the gauge for the current. When the 
     *  current goes below a certain threshold then it keeps
     *  track of the start time and the time the discharge 
     *  finishes
     *  
     *  Inputs: None
     *  Outputs: None 
     */
     /*
    void waitForFirstDischarge(){
      int this_current = 0;
      while(this_current > currentLowerBound){
        delay(1000);
        this_current = getCurrent();
      }
      startTime = millis();
      delay(dischargeTime);
      lastDischarge = millis();
    }
    */
    /* ---------------- dataFromAddress -----------------
     * 
     * This function uses the address passed to then
     * request 2 bytes of data from the gauge. The 2 bytes 
     * return is in a little endian format. The data is 
     * transformed into a word and returned.
     * 
     * Input: Address
     * Output: Word
     * 
     */
    word dataFromAddress(byte addr){
      word LSB = 0;
      word MSB = 0;
      word combined = 0;
      Wire.beginTransmission(bq35100_addr);
      Wire.write(addr);
      Wire.endTransmission();
      Wire.requestFrom(bq35100_addr,2);
    
      if(Wire.available()<= 2){
        LSB = Wire.read();
        MSB = Wire.read();
      }
      
      combined = byteCombiner(MSB,LSB);
      return combined;
    }
    
    /* -------------- getCurrent ----------------
     *  
     *  This function gets the current reading 
     *  from the gauge
     *  
     *  Note: This function is seperate to 
     *  dataFromAddress becuase current is a 
     *  signed integer
     *  
     *  Inputs: None
     *  Output: Signed Int
     */
    int getCurrent(){
       word LSB = 0;
       word MSB = 0;
       int combined = 0;
       Wire.beginTransmission(bq35100_addr);
       Wire.write(bq35100_current_LSB_addr);
       Wire.endTransmission();
       Wire.requestFrom(bq35100_addr,2);
    
       if(Wire.available() <= 2){
         LSB = Wire.read();
         MSB = Wire.read();
       }
       combined |= LSB;
       MSB = MSB << 8;
       combined |= MSB;
       return combined;
    }
    
    /* --------------------- fromDataFlash -----------------------------
     *  
     *  This function returns data from the specified Data Flash memory
     *  address
     * 
     *  Inputs: MSB of address, LSB of address
     *  Output: unsigned long 
     */
    unsigned long fromDataFlash(byte addrMSB, byte addrLSB){
      Wire.beginTransmission(bq35100_addr);
      Wire.write(bq35100_MAC_addr);
      Wire.write(addrLSB);
      Wire.write(addrMSB);
      Wire.endTransmission();
      delay(10);
      Wire.beginTransmission(bq35100_addr);
      Wire.write(0x40);
      Wire.endTransmission();
      Wire.requestFrom(bq35100_addr,4);
    
      unsigned long firstByte = 0x00000000;
      unsigned long secondByte = 0x00000000;
      unsigned long thirdByte = 0x00000000;
      unsigned long fourthByte = 0x00000000;
     
      if(Wire.available() <= 4){
        firstByte = Wire.read();
        secondByte = Wire.read();
        thirdByte = Wire.read();
        fourthByte = Wire.read();
       }
      unsigned long combined = 0x00000000;
      firstByte = firstByte << 24;
      combined |= firstByte;
      secondByte = secondByte << 16;
      combined |= secondByte;
      thirdByte = thirdByte << 8;
      combined |= thirdByte;
      combined |= fourthByte;
      return combined;
    }
    
    bool checkEOS(){
      byte first = 0x00;
      Wire.beginTransmission(bq35100_addr);
      Wire.write(0x0B);
      Wire.endTransmission();
      Wire.requestFrom(bq35100_addr,1);
      if(Wire.available()<= 1){
        first = Wire.read();
      }
      return bitRead(first,3);
    }
    

    I hope this helps!

    Regards,

    Nick Richards