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.

BQ77PL900 I2C to Arduino

Other Parts Discussed in Thread: BQ77PL900

Hello,

I am struggling to set up I2C communications between an arduino and a bq77pl900evm-001 evaluation board.

Is there any C example code for the sequence of data that should be transmitted and expected in return for reading and writing registers in the bq77pl900?

The datasheet says the order of bytes for reading a register is:


1. slave   - what is this? is it something i send or the slave sends? It is clearly the slave address since it is 7 bits + R/W

2. Register address

3. slave address

4. slave drives data

5. master drives NACK and stop.

I do not know where this differs from standard I2C and if the standard I2C library for arduino will need modification to work.



I am using windows 8.1 and the TI software (drivers) that came with the EV2300 does not work. Is there some way I can see if the evaluation board has booted?

There are no LED's on the board.

(I have connected the battery voltage to the Pack+ pin and removed it again.) 

Thanks

Regards

~Jeran

  • Hello Jeran,

    I have moved your thread to the Battery Management Gas Gauge forum, as your problem is with the BQ77PL900 Device
  • I'm not aware of any C example code for the bq77PL900.  Yes, the first step should be the slave address or the bq77PL900 address.  This should be 0x10 as a 7 bit address or 0x20 for the 8 bit address.  The bytes on the bus for a read of address 0 with no status errors would be:  20; 00; 21; 00 with the appropriate starts, acks, stops and nacks. (see datasheet figure 25 or 26)

    I would expect the Arduino standard library to work, there should not be anything special to talk to the part.  Suggestions:

    • Check voltage interface compatibility, the EVM can be set for 3.3 or 5V using VLOG. Pull ups are provided from the device.
    • Be sure the Arduino i2c peripheral is set up properly including clock rate.  I don't know Arduino.
    • Use an oscilloscope to look at the signal on the bus to be sure it has pull ups and that the edges look good.
    • Check the clock rate to see it is as expected and in the range of the 'PL900
    • Check the address on the bus, you can also see start & stop.  Check for appropriate acks from the device.

    To operate the board you will need either your cells or simulation resistors on the inputs with a power supply.  Set the configuration bit jumpers to match the cell count. The device will shut down if it sees an undervoltage cell.  If you keep PACK+ connected to the battery+ the part will stay awake even if a cell is UV.  To check if it is awake, measure the VREG1 or VREG2.  There is a header on the EVM board with the voltages available.  With the voltage on it should be possible to inspect the I2C signals. Once it will talk you can read the status to see if it has an error.

    The EV2300 does not /is not supported with windows 8.

  • Nice, 
    Thanks for your response, It was helpful.

    The problem in the end was the arduino Wire library which does a lot of things in the background and wasn't able to perform the NACK.

    I got it working using SoftwareI2CLibrary available in the arduino playground.

    My code:

    /*
    Author: Jeran
    
    bq77pl900 I2C read and write
    
    pin 2 ----- SCL
    pin 3 ----- SDA
    EEPROM pin --- gnd
    external 4k7 pullup resistors
    
    */
    
    #define SCL_PIN 2 
    #define SCL_PORT PORTD 
    #define SDA_PIN 3 
    #define SDA_PORT PORTD 
    #define I2C_SLOWMODE 1 
    
    #include <SoftI2CMaster.h>
    
    #define pladdr 0x20
    
    void setup() {
        Serial.begin(9600);
      if (!i2c_init()) 
        Serial.println(F("Initialization error. SDA or SCL are low"));
      else
        Serial.println(F("I2C started"));
    
    }
    
    void loop() {
      byte host = B00001010;
    if(writei2c(0x05, host)){ //set status control register to enable host mode
      Serial.println("write successfull");
      Serial.println(host, BIN);
    }  
    
    if(readi2c(0x05)){
    Serial.println("read");}
    delay(50);
      
    }
    //======================================================================================
    boolean writei2c(byte reg_addr, byte data){
    if (!i2c_start(pladdr | I2C_WRITE)) return false;
      if (!i2c_write(reg_addr)) return false;
      if (!i2c_write(data)) return false;
      i2c_stop();
      
      return true;
    }
    
    //======================================================================================
    
    boolean readi2c(byte reg_addr){
    if (!i2c_start(pladdr | I2C_WRITE)) return false;
      if (!i2c_write(reg_addr)) return false;
      if (!i2c_rep_start(pladdr | I2C_READ)) return false;
        byte data =i2c_read(true);
      i2c_stop();
    
      Serial.println(data, BIN);
      return true;
    }

  • Hello, 

    Can we use any i2c USB adapter to flash the software bq77PL900 provided by TI  to the bq77PL900 ? thank you 

  • Rania,

    WM5295 is out of office rest of this week.

    He will return next week so he may not able to responds until early next week.

  • The EV2300 (www.ti.com/tool/EV2300) is the I2C USB adapter tool supported by the bq77PL900 EVSW www.ti.com/.../sluc103 . It must have suitable drivers installed on the PC. Those are the only software and interface supporting the part.

    The flowchart in figure 23 of the datasheet could be implemented to program the part with any software and interface suitable to your test environment.