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.

Query on Flashing Flow

Other Parts Discussed in Thread: BQ27500

 Hi,

  In http://focus.tij.co.jp/jp/lit/an/slua449d/slua449d.pdf

  First We need to save the contents of the instruction flash, Then Erase it. After Writing DFI - We need to restore it.

  What is the purpose of saving the contents of instruction flash, erasing and restoring it. If i only need to update the DFI File.

  Is this mandatory?

 Also, I want to read back the Instruction Flash Checksum and DataFlash Checksum. I get a value of 0xff00 for both of them.

 I am able to read back the Device ID, Firmware Version. For some reason IF Flash and Data Flash Checksum return only 0xff00.

Code Fragment:

1)

  ret = i2c_smbus_write_word_data(i2c_client, 0x00, 0x0001);

  value =  i2c_smbus_read_word_data(i2c_client, 0x00); // returns the value 0x500

  For the above commands, A value of 0x500 is printed. Which is correct.

2)

  ret = i2c_smbus_write_word_data(i2c_client, 0x00, 0x0002);

  value =  i2c_smbus_read_word_data(i2c_client, 0x00); // Returns the Value 0x120

 The above command the value 0x120 which is correct.

 

3) However for the DF Checksum and Instruction Flash Checksum.

  ret = i2c_smbus_write_word_data(i2c_client, 0x00, 0x0022);

  value =  i2c_smbus_read_word_data(i2c_client, 0x00); // Returns value 0xFF00

  The above prints 0xff00 (or 65280)

Also,

  ret = i2c_smbus_write_word_data(i2c_client, 0x00, 0x0004);

  value =  i2c_smbus_read_word_data(i2c_client, 0x00); //return value 0xFF00

 Am i missing something? Am i supposed to read the addresses 0x0004 and 0x0022 differently?

 

Thank you,

 

Regards,

sriram

 

 

  • Sriram,

    Erasing and rewriting the first 2 lines is really a safety measure.  If the part resets before you complete your write of the data flash, it will try to boot the firmware by default.  If the dataflash is corrupt, this will fail and the part will effectively crash and stop communicating.  In addition, since the corrupt data is in flash, it is persistent and you can't pull the part back out of that mode by power cycling it.

    The sequence you are asking about will prevent the part from booting into firmware mode, meaning that if your device PORs for some reason before you finish writing your data flash, the device will stay in ROM mode and allow you to finish programming it.

    With regards to reading IF and DF checksums:

    I looked at the datasheet for the 27500V120 and it does not appear to have command 0x0022 (IF CHECKSUM) implemented.  I tested on my  board and it appears to have no effect.  Why are you trying to checksum the instruction flash?

    With regards to the DF checksum:  The device will not let you read this parameter if  it is in SEALED mode (SS bit is set in the CONTROL_STATUS register).  First, check to see if your device is sealed. 

    Also, I'd like to warn you about the DF checksum.  The gauge will be continually updating the resistance tables, qmax, etc. over its lifetime.  As a result, the DF checksum will be continually changing.

    Cheers,
    Charles

  • Charles,

       I did understand what happens when data flash is half written/corrupted. Device Locks Up. However i could not understand the safety measure aspect.

       Actually, i was able to successfully flash the data flash with the golden File. The device comes out of ROM Mode after flashing and i do a power on reset and

      set the IT_ENABLE bit on next power on.

      Now, How do i test/verify if the a calibrated BQ chip is reporting correct values. In other words if the calibration is done correctly?

      Are there any tests do to this? I have some queries and appreciate your support.

       1) I tried to Drain a Fully Charged Battery under more or less constant load and i check that the "Time to Empty Now" Value is approximately correct (15 minutes accuracy)

            which seems to be okay (Since the load varies a little during operation)

       2) Like this i can check whether "Time to Full" reports correctly under constant load.

      3) Also i find that rsoc is 0% when the voltage is around 3.593V. (Where does this value come from?)

          Supplied 3.7V to (What is the minimum cell voltage supported by the system during discharge?)

      Can you please let me know what tests i can run to verify if the BQ27500 has been correctly calibrated? (I do understand that it depends on the data supplied to BQ Easy)

     4) What tests need to be carried out before SEALING the chip?

     5)  Also i would like to know is there any way (i2c read using 0xAA) to find out if the BQ chip is calibrated or not?

     6) Also i would like to know if we need to connect to connect a Fully Discharged battery and allow the BQ to learn about the battery?

         Are there any instructions on this? Or i can connect the battery (with any voltage) to the BQ chip and it should report correctly because of the calibration?

     

    Thank you.

    Regards,

    sriram

     

     

     

     

     

  • Sriram,

    To guarantee accuracy of the gauge, you need to produce a 'golden image' by running a learning cycle with the battery.  Instructions on how to do this are in the application note at: http://www.ti.com/litv/pdf/slua544, which is linked to on the product web page.  You'll need to do this to be completely accurate.  Note that you need to use the evaluation software (also downloadable from the product web page) to execute this process.

    You only have to do this once, but the process can be fairly tricky, so please let me know if you have any difficulty.

    Thanks,

    Charles