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: Configure "Operation Config A :GMSEL" to EOS mode

Part Number: BQ35100
Other Parts Discussed in Thread: BQSTUDIO

Hi,

I struggle to configure BQ35100 Operation Config A. I try to configure from a MCU with I2C communication (I don't use BQSTUDIO)

Here is the procedure I follow:

  1. Set GE high
  2. Wait for CONTROL STATUS INITCOMP to be 1
  3. Read HW version and check with 0xA8
  4. Configure Operation Config A:
    1. Write on I2C at BQ35100 ADDR: 0x3E 0xB1 0x41
    2. Write on I2C at BQ35100 ADDR: 0x40 0x02 (EOS and internal temperature sensor)
    3. Write on I2C at BQ35100 ADDR: 0x60 0x0B ==> I'm not sure about my checksum, I do  0xFF - (0xB1 + 0x41 + 0x02) and keep it on 1 byte. On www.ti.com/.../slua801.pdf , you use only Data (0x02 here) to calculate the checksum which gives 0xFD.
    4. Write on I2C at BQ35100 ADDR: 0x61 0x05 ==> 4 + 1 data byte (0x02)

  5. I read Operation Config A to check my configuration:
    1. Write on I2C at BQ35100 ADDR: 0x3E 0xB1 0x41
    2. Read on I2C at BQ35100 ADDR: Write 0x40 and read one byte ==> I get 0xF3 (The first time I read, I always get 0xF3 ?)
    3. Read on I2C at BQ35100 ADDR: Write 0x40 and read one byte ==> I get 0x80 default value for Operation Config A which means that I didn't correctly written the reg
    4. Read on I2C at BQ35100 ADDR: Write 0x60 and read one byte==> I get 0xD7 which is wrong

What's wrong with my procedure?

Thanks

  • I think the issue is with the 0x40. i am not sure where that is coming from. From what i can tell you are trying to write [Operation Config A] = 0x82 ([TEMPS = 1, GMSEL1 = 1). If this is the goal the procedure is 

    1) Write (0xAA, 0x3E, [0xB1, 0x41, 0x82])

    2) Write (0xAA, 0x60, [0x8B, 0x05])

    in summary step 1 is writing the DF address and value. Step 2 is writting the checksum and length

    CHKSUM = byte(0xB1 + 0x41 + 0x82) = 0x74, Then NOT(0x74) = 0x8B

    Length = Address + Data + chksum + length

    length = 2 + 1 + 1 + 1

    to read it back 

    1) Write (0xAA, 0x3E, [0xB1, 0x41, 0x82])

    2) Read (0xAA, 0x3E, 2)

    on the read the first two bytes returned will be the address read. Followed by the data. 

    Hope this helps,

    Eric Vos

  • > I think the issue is with the 0x40

    It comes from www.ti.com/.../slua790.pdf, section 3 (DataFlashAccess for the bq34110and bq35100). It is written that we need to send 0x40 (MACDATA) before sending the value we want to write.

    I try your suggestion:

    // ManufacturerAccessControl (0x3e)
    pData[0] = MANUFACTURER_ACCESS_CONTROL;
    // Address
    pData[1] = 0xB1;
    pData[2] = 0x41;
    // Data
    pData[3] = 0x82;
    i2c_write(I2C(0),0x55,pData, 4);
    // CMD_CHECK_SUM (0x60)
    pData[0] = CMD_CHECK_SUM;
    // CHECKSUM
    pData[1] = 0x8B;
    // LENGTH
    pData[2] = 0x05;
    i2c_write(I2C(0),0x55,pData, 3);
    // READ
    // ManufacturerAccessControl (0x3e)
    pData[0] = MANUFACTURER_ACCESS_CONTROL;
    // Next two bytes are the address we will write to
    pData[1] = 0xB1;
    pData[2] = 0x41;
    pData[3] = 0x82;
    i2c_write(I2C(0),0x55,pData, 4);
    // READ 1st time
    i2c_write(I2C(0),0x55,MANUFACTURER_ACCESS_CONTROL, 1, NO_STOP);
    i2c_read(I2C(0),0x55,3);
    // MANUFACTURER_ACCESS_CONTROL: 0x2301c201
    // =================[MANUFACTURER_ACCESS_CONTROL len=004]==================
    // 0000| 01 C2 01 .. .. .. .. .. | .. .. .. .. .. .. .. .. | .B..............
    // ------------------------------------------------------------------------
    // READ 2nd time
    i2c_write(I2C(0),0x55,MANUFACTURER_ACCESS_CONTROL, 1, NO_STOP);
    i2c_read(I2C(0),0x55,3);
    // MANUFACTURER_ACCESS_CONTROL: 0xf38041b1
    // =================[MANUFACTURER_ACCESS_CONTROL len=004]==================
    // 0000| B1 41 80 .. .. .. .. .. | .. .. .. .. .. .. .. .. | 1A..............
    // ------------------------------------------------------------------------

    I2C function works because I'm able to read CONTROL STATUS and HW VERSION correctly

    0x55 is I2C address without R/W bit: 01010101

    As you can see, first time I read data at 0x3E, I get strange data (0x01,0xC2,0x01) then second time (0xB1, 0x41,0x80) which seems to be what you say ADDR + DATA. So DATA is still 0x80, it didn't change.

    > to read it back
    > 1) Write (0xAA, 0x3E, [0xB1, 0x41, 0x82])
    > 2) Read (0xAA, 0x3E, 2)

    When you read, you follow normal procedure:

    WRITE 0XAA,0x3E,(NO_STOP), 0xAB READ (ADDR1) (ADDR2) (DATA1)

    ?

  • Ok I found my problem


    I followed your procedure but there was timing problem

    After a write to ManufacturerAccessControl (0x3e), wait at least 100us before sending next command and it works


    Thanks for your help