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.

BQ27426: OPConfig Register Read and Write not working

Part Number: BQ27426
Other Parts Discussed in Thread: BQSTUDIO

Hi, 

I am attempting to disable "Battery Insertion Enable" on a BQ27426 chip. 

I have followed the technical reference guide (SLUUBB0 - December 2015) in writing to the extended data flash registers. I am interfacing with the chip directly over I2C from an MCU and not through the BQStudio software. My method is as follows:

  1. Unseal the device 
  2. Poll the sealed bit in the status register to check it has been cleared
  3. Enter configuration update mode
  4. Poll the CFGMODE bit in the flags register to check it has been set.
  5. Enable Block Memory Control
    1. (Write 0x00 to the BlockDataControl() Command Register 
  6. Set the subclass ID offset to 64 to accessthe (class) configuration (subclass) registers storing OpConfig OpConfigB OpConfigC OpConfigD
    1. Write 0x40 to the DataBlockClass() Register
  7. Read the register into a 32 byte long array
    1. NOTE: at this stage i do not read the reset default value of the first byte correctly. The reference guide states OPConfig's default value is 0x6578 where as i read 0x0078. I also read the default values of OpConfig B C and D to be the same as those referenced in the reference manual.
  8. Write a new value into the first two bytes of the read array to alter the bits of OpConfigCalculate the new checksum (same process as described in the application example
    1. NOTE: I have not successfully been able to write the high byte and read back the same value written. I have been able to write the low byte and read back the value written. I only want to clear the BIE bit in the High Byte of OpConfig. Based on the default values in the reference manual i calculate that i would need to write back 0x44 to the High Byte.
  9. Write the new Checksum to BlockDataChecksum() Register -  NOTE: this is successful and i do not recieve a NACT return
  10. Exit CFG update by sending a soft reset command.

Following the same procedure i am able to access the bytes in the STATE subclass and rewrite them. I can not do the same for the OpConfig registers. I also can not reset the device and read back the reference manual value for the OpConfig High byte but I can for all the other bytes in teh register subclass.

I have experimented with adding timing delays between commands but with no successful results.

Am I missing something prerequisite to writing to the OpConfig registers? I can not find many examples or references in the documentation for configuring the OpConfig registers for this chip.

Thanks,

  • Hello Michael,

    It looks like there may be some offset error, you get partial of the default value of 0x6578 and are only able to write and read half of the register. Check to make sure your starting position to read is correct.

    I would reference the examples in the TRM and the app note slua801.

    slua801: https://www.ti.com/lit/an/slua801/slua801.pdf?ts=1594760885169&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FBQ27426

    Sincerely,

    Wyatt Keller

  • Hi,

    Thanks for the quick response.

    Offset Location:

    Apologies, in my previous post I failed to include the step of setting the block offset location (Step 6 of the Data Memory parameter update example Application Example).

    The above should have read:

    ...

    5.Enable Block Memory Control
    a.(Write 0x00 to the BlockDataControl() Command Register)

    6.Set the subclass ID offset to 64 to accessthe (class) configuration (subclass) registers storing OpConfig OpConfigB OpConfigC OpConfigD
    a.Write 0x40 to the DataBlockClass() Register

    7. Write the block offset location using DataBlock() command (0x3F) Note: To access data located at offset 0 to 31, use offset 0x00. To access data located at offset 32 to 41, use offset 0x01.
    a.Here I write 0x00 to 0x40 as the data subclass is smaller than 32 bytes and I am only interested in byte 0 and 1.

    8.Read the register into a 32 byte long array 

    ..

    I have noticed now I am having the same issue when reading the state subclass at ID 64. I again am not reading the referenced default first byte value of subclass 82 but the other 31 bytes in the buffer align with the reference default values.

    I have also tried using the same process as the referenced example in slua801 p6. I have the same problem not reading the first byte into my byte buffer using gauge_read_data_class(). My process is as follows:

    1. Locate the parameter in the gauge TRM. For The subclass "Registers" this is ID 64 or 0x40.

    2. Copy the subclass data for this parameter into a local byte buffer using the gauge data memory access function gauge_read_data_class().

    Here I use gauge_read_data_class(NULL,0x40,pData,32) to write the 32 bytes into a buffer called pData. This returns no NACKs and populates the byte buffer. 

    The 0 indexed byte reads 0x78, index 1 reads 0x0f and index 2 reads 0x9f etc. as if it has just missed the first byte due to an offset error.

    I can then alter values in the buffer and successfully write back a checksum without an NACT response which leads me to believe I am just not reading the correct byte alignment i am trying to. 

    I can't see where in the two procedures the byte alignment is going wrong.

    Process 1 (Followed from the Data Memory Paramter Update Example in the Technical reference document SLUUBB0 - December 2015)

    • Manually write the block offset location using DataBlock() command

    Process 2 (Followed from the Example in the Gauage COmmunication SLUA801 - January 2017)

    • Read the data using gauge_read_data_class() to a byte butter.

    In process 2 using gauge_read_data_class() (page 11) there is a unsigned integer variable named nOffset = 0 which is not used. Should it be? I could only imagine it would need to be used when reading the second 32 byte block of a data class - not an issue i have here reading byte 0.

    Thanks,

    Michael

  • Hello Michael,

    We will talk with you off the forum about this issue.

    Sincerely,

    Wyatt Keller

  • There is nothing unique to the first byte in a block for a correct read sequence.

    However, the first byte in a block starts at 0x40, just after the data block register 0x3F. If you read back 0x00 from 0x40, chances are that somehow the I2C write sequence that preceded the read sequence wrote 0x00 to 0x40 and that's what you read back.

    For debug, check SCL and SDA with a scope (or better, an I2C analyzer) to know for sure what was on the bus.

    To read OpConfig, the minimum sequence (assuming the gauge is unsealed (default)) is:

    write 0x40 to I2C register 0x3E
    write 0x00 to I2C register 0x3F

    read 32 bytes starting from I2C register 0x40.

    You can try this with a known working I2C interface with bqStudio:

    * disable Auto Refresh (just click on the green Auto Refresh line in the dashboard (right top side of bqStudio)). It should turn red.
    * switch to "Advanced Comm"
    * I2C Address (Hex) = AA
    * Start Register (Hex) = 3E
    * Bytes to Write (Hex) = 40 00
    * Click Write
    * Start Register (Hex) = 40
    * Number of Bytes to Read (Decimal) = 32
    * Click Read

    This will give you the registers data class, block 0 in the Transaction Log. OpConfig will not read back with a zero first byte (unless that's indeed OpConfig's value).