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.

BQ27510-G3: Unsealing with Arduino

Part Number: BQ27510-G3
Other Parts Discussed in Thread: ENERGIA, BQSTUDIO, EV2400, GPCCHEM

Hi Community,

I have been struggling with unsealing my BQ27510-G3 for some time now. I follow the instructions in "www.ti.com/.../sluua97.pdf but without success.

Unfortunately I don't have any tools to check what is happening on the line. The code is probably the problem, but I am able to read/write some things on the gauge.

Specific question: I have read 15 bits from the control_status (0x0000): 1100000001000. I interpret the first 7 bits as the HighByte and the last 8 bits as the LowByte. So regarding the bits the gauge is sealed. Is this interpretation correct?

Or is there an Arduino/Energia code available to seal/unseal and write to memory?

Any help would be appreciated, thank you!

  • Hi Tobias,

    Recommend using ev2400 and bqstudio for this purpose. We do not have arduino code for this.

    Best regards,

  • Hi Nick,

    thanks for your answer.

    The gauge is already physically (PCB) connected to an Arduino, so I would like to implement it directly. Since the Wire library exists for Energia as well, I was hoping there would be some sample code. I put my functions at the end of this post, maybe someone sees the error.

    Kind regards,

    Tobias

    int ModifClasses(){
    
      // Reset
      int e[2]={0x41, 0x00};
      bytesending(e);
      
      // Unsealing
      int a= readControlWord(0x0000);   // Pre Command status
      Serial.print("StatusCommandPre:");
      Serial.println(a,BIN);
      Serial.println();
    
      int c[2]={0x14,0x04};
      bytesending(c);
      int d[2]={0x72,0x36};
      bytesending(d);
     
    
      int b= readControlWord(0x0000);   // Post Command status
      Serial.print("StatusCommandPost:");
      Serial.println(b,BIN);
      Serial.println();
    
    
      return true;
      }
    
    int bytesending(int *command){  
      if (i2cWrite((int) 0x00, command, 2))
        return true;
      
      return false;
    }
    
    int i2cWrite(int subAddress, int *data, int count)
    {
      Wire.beginTransmission(BQ27510G3_Address);
      Wire.write(subAddress);
      for (int i=0; i<count; i++)
      {
        Wire.write(data[i]);
      } 
      Wire.endTransmission(true);
      
      //int f=Wire.endTransmission(true);
      //Serial.println(f);
      
      return true;  
    }
    
    int i2cRead(int subAddress, int *data, int count)
    { 
      Wire.beginTransmission(BQ27510G3_Address);
      Wire.write(subAddress);
      Wire.endTransmission(true);
      
      Wire.requestFrom(BQ27510G3_Address, count);
      
      for (int i=0; i<count; i++)
      {
        data[i] = Wire.read();
      } 
    
      return true;
    }
    

  • Hi Tobias,

    I will review your code and get back to you later this week.

  • Hi Jessica,

    thanks!

  • I see I have forgotten a function:

    int readControlWord(int function) // Read Control Commands
    {
    int subCommandMSB = (function >> 8);
    int subCommandLSB = (function & 0x00FF);
    int command[2] = {subCommandLSB, subCommandMSB};
    int data[2] = {0, 0};

    i2cWrite((int) 0, command, 2);

    if (i2cRead((int) 0, data, 2))
    {
    return ((int)data[1] << 8) | data[0];
    }

    return false;
    }

  • Hi Tobias,

    I'm still looking through your code; however, I noticed in your original question that you said "control_status (0x0000): 1100000001000" which is only 13 bits. Your thought process seems correct but I would need the full value to say whether it is sealed or not. 

  • Hi Jessica,

    You are right, I forgot some 0's. The correct bits are: 110000000001000.

    Kind regards,

    Tobias

  • Hi Tobias,

    Nothing stands out to me in your code so I think it should be fine. Is there any way you could connect a digital analyzer to see what is being sent/received? That would help a lot with debugging. Are you able to read/write commands in general or is seal/unseal the only thing that isn't working?

    There should be 16 bits, not 15. If it isn't too much trouble it is easier to read hexadecimals. If there is a 0 before the 11 then there is an error with that code you are reading back but if it starts with 11 it will be in full access sealed mode.

  • Hello Jessica,

    thank you very much for your help and dedication.

    Unfortunately, I do not have a digital analyzer.

    So far I can read all values of type voltage, SOC,... and also read the device_ type (0x0001) (I get 510 as device type), so reading the control_status (0x0000) should be correct too. I thought it can only be 15 bits because bit7 of the highbyte is empty according to the documentation? If I record the answer of 0x0000 in HEX, I get 6008, which is the same as converted to BIN.

    In my opinion the complete read operation of my code works and also the writing of single bytes (function: i2cWrite), because this function is also needed for read functions. The problem can only be the writing of multiple bytes. E.g. writing sealing (0x0020) and reseting (0x0041) commands does not change my control_status (0x0000) bits either.

    Maybe I can read and plot the SCL and SDA lines with a second Arduino for debugging.

    Kind reagrds,

    Tobias

  • Hello Tobias,

    Without some debug equipment it will be hard to pinpoint where the issue is. A logic analyzer on the comm lines with the use of an EV2400 and bqStudio you will probably be able to find the issue fairly quickly.

    Logic analyzers can be picked up for fairly cheap online. Also you will need the EV2400 and bqStudio to upload the chem ID to the gauge that's recommended from the GPCCHEM tool.

    Sincerely,

    Wyatt Keller

  • Hi Wyatt,

    thanks for your answer!

    I wanted to avoid EV2400 and bqStudio, but ...

    Is there a list of common batteries where the ChemID is known so I can purchase one? Very high accuracy is not required.

    Regards,

    Tobias

  • Hello Tobias,

    I think you would've run into issues later with very inaccurate gauging if you did not use the GPCCHEM tool for this gauge. It's always best to have the EV2400 for any development of BQ TI products to make debug quicker.

    The GPCCHEM tool will find a match for whatever lithium battery you use.

    Sincerely,

    Wyatt Keller

  • Hi Wyatt,

    Thank you very much for your input! I was hoping to avoid the hardware and neglect the inaccuracy, but it seems not so simple.

    Regards,

    Tobias