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.

Writing to data flash with BQ27531

Other Parts Discussed in Thread: BQ24192

I am trying to write to Data Flash as described in section 5.5.1, Modify WRTEMP of OpConfigB Register, of SLUUA96. The Data Flash does not change after I follow the given procedure.

I am communicating to the fuel gauge from Ubuntu Linux through i2c-dev. I send the following i2c transfers with a 100us delay after each transfer:

Write 0, 0x14, 0x04
Write 0, 0x72, 0x36
Write 0x61, 0
Write 0x3e, 0x40
Write 0x3f, 0
(Wait at least 100 microseconds *)

Write 0x4b, 0xef
Write 0x60, 0x32

Write 0, 0x41, 0
(Wait at least 100 milliseconds)

Write 0, 0x20, 0


* At this point the values are:
0x40: 0x61
0x41: 0x67
0x42: 0x4
0x43: 0x2e
0x44: 0x0
0x45: 0x6e
0x46: 0x14
0x47: 0x1
0x48: 0x4
0x49: 0x0
0x4a: 0x0
0x4b: 0x6f
0x4c: 0x3c
0x4d: 0x9
0x4e: 0x0
0x4f: 0x14
0x50: 0x4
0x51: 0x0
0x52: 0x0
0x53: 0x0
0x54: 0x0
0x55: 0x0
0x56: 0x0
0x57: 0x0
0x58: 0x0
0x59: 0x0
0x5a: 0x0
0x5b: 0x0
0x5c: 0x0
0x5d: 0x0
0x5e: 0x0
0x5f: 0x0
0x60: 0xb2


The value in 0x4b changes after writing 0xef to that location. The value in 0x60 does not change.

Am I missing anything necessary to set the Data Flash values?

Thank you for your help,

Lyle

  • Hello Lyle,

    Could you try increasing the delays to 5 milliseconds for now.

    Thanks,
    Kang Kang
  • Hello Kang,

    I tried increasing the delay to 5ms in my program, but I got the same results. I thought the problem may be my program, so I also tried the following shell script.

    echo "1. Unseal"
    i2cset -y 0 0x55 0 0x14 0x04 i
    sleep 1
    i2cset -y 0 0x55 0 0x72 0x36 i
    sleep 1

    echo "2. BlockDataControl"
    i2cset -y 0 0x55 0x61 0
    sleep 1

    echo "3. DataFlashClass"
    i2cset -y 0 0x55 0x3e 0x40
    sleep 1

    echo "4. DataFlashBlock"
    i2cset -y 0 0x55 0x3f 0
    sleep 1

    echo "5. Original byte " $(i2cget -y 0 0x55 0x4b)

    echo "6. Original checksum" $(i2cget -y 0 0x55 0x60)

    echo "8. Writing new byte"
    i2cset -y 0 0x55 0x4b 0xef
    sleep 1
    echo "8b. Value after writing " $(i2cget -y 0 0x55 0x4b)

    echo "9. Writing new checksum"
    i2cset -y 0 0x55 0x60 0x32
    sleep 1
    echo "9b. Value after writing " $(i2cget -y 0 0x55 0x60)

    echo "10. Reset"
    i2cset -y 0 0x55 0 0x41 0 i
    sleep 1

    echo "11. Seal"
    i2cset -y 0 0x55 0 0x20 0 i
    sleep 1

    When I run the script, I get the following output:

    1. Unseal
    2. BlockDataControl
    3. DataFlashClass
    4. DataFlashBlock
    5. Original byte  0x6f
    6. Original checksum 0xb2
    8. Writing new byte
    8b. Value after writing  0xef
    9. Writing new checksum
    9b. Value after writing  0xb2
    10. Reset
    11. Seal

    If it is important, we are also using a BQ24192 charger, and there is no battery connected yet.

  • SLUSBE7 states that there are no operating restrictions when VREGIN is between 2.8V and 4.5V, and no flash writes between 2.45V and 2.8V.

    I found that when VREGIN is below 3.9V, writes to Data Flash will fail.

    I don't know if this is an error in SLUSBE7, or if there is another factor that I did not consider.

  • Hello Lyle,

     

    I am not sure why you have DF write fails at 3.9 volts.

     

    Could you check your current compliance from the power supply? Could it be drawing more current than your supply can handle?