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.

Bq27210: Override EEPROM reg's at 0x46-0x4f seems to change values without INIT set to '1'

Other Parts Discussed in Thread: BQ27210

Hi,

I'm trying to override default eeprom values by writing to 0x46-0x4f.
After setting these 10 values I also do WRTLMD and WRTNAC before clearing INIT bit in mode reg.
At first test it seems to work fine, charge/discharge reports "good" capacity values.

However, my code is only looking at the INIT bit in mode reg to detect if any changes has happened.
With this implementation it seems values can change in the 0x46-0x4f area without setting the INIT bit.
The thing is that out of these 10 values only two differs; ILMD and SEDVF.

My battery has 250mAh and my wanted EDVF threshold is 3400mV.
I just got one piece of hw in my hand that have set these values to 2000mAh and 3000mV.

The result is that capacity is reported very low (<4%) until charge is completed which sets it to 100%.
Then a discharge seems to report 100% until we get close to battery critical, then 0%.
Not a very useful capacity information I'm afraid.

Have I misunderstood something or how can I detect changes in setup params?

Best regards,
/Peter

  • Hi,

    Now I have investigated the bq27210 a bit more and learned the hard way ;-)

    The problem manifests itself as two registry errors out of the ten that can be changed, I have a vague theory, but it feels a bit vague...

    How I interpreted the manual to begin with:
    1. If INIT bit = '1 ', bq needs to be setup
    2. Set FRST bit to '1' in the MODE reg
    3. Write cmd key 0xA9 to CTRL reg
    4. Poll MODE reg FRST bit until it is '0 '
    5. DONE, all set to write new params

    But then I did the following test:
    1. If INIT bit = '1', bq needs to be setup 
    2. NEW STEP: Clear INIT bit
    3. Set FRST bit to '1' in the MODE reg
    4. Write cmd key 0xA9 to CTRL reg
    5. Poll MODE reg FRST bit until it is '0 ''
    6. NEW STEP: Check if the INIT bit = '1' BUT IT WAS NOT

    New interpretation of the manual:
    It turns out that when FRST is read to '0', the command is only "accepted" (it does not mean "done").
    Intensive polling of INIT bit until it becomes '1 'was made and it takes about 2.6 seconds!

    And then to write all the setup params takes about 1.7 seconds.

    My weak theory is based a bit on "unpredictable behavior":
    I did FRST command and thought 'accepted' == 'done'.
    Then I made the setup of params and then I zeroed INIT bit.
    FRST command was not finished until after I made the setup of params or right in the middle or something...
    This "soup" made the fuelgauge confused and ended up with having the first two params = "default" value and INIT bit became '0 '.

    Good eh ;-))

    Joking aside, when "my" values ​​are set and used by the fuelgauge, the charging curves seems ok.
    Now I have also added a fallback in FW so it can calculate remaining capacity using only the battery voltage.
    It is good to have this if the params are invalid or CI='1' (and I use only Vbat at "critical battery initial charging").

    However, I will propose to program correct params in the EEPROM during production (requires 21V pulse).

    Sincerely,
    /Peter

  • Would be nice to get some feedback from someone with deep knowledge about fuelgauges, especially bq27210 of course.

    Thx,
    /Peter

     

  • Hello Peter,

    I believe your interpretation of there being a difference in time between the FRST command being accepted and completed is correct.  I will see if I can find out some timing information on the FRST command.  But, it does appear you have come to a resolution for your situation.

  • Hi Jared,

    Thanks for your reply and confirmation of my findings, appreciated!

    My workaround seems to work fine and checking both INIT bit and all register values at startup makes me confident that it could be the final solution.

    Don't put to much effort in finding the FRST command timing unless there is a significant faster way to get the information from the fuel gauge (2.6 seconds).

    Best regards,
    /Peter

  • Hi

    Just a silly question? How do you do to read the INIT bit? Can I read directly the MODE register? Or must I write int CTRL register the command before reading mode? Just I want to be sure I'm doing this correctly.

    Thanks in advance.

    Eduardo