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.

BQ28Z610: How to exit the ROM mode?

Part Number: BQ28Z610
Other Parts Discussed in Thread: BQSTUDIO, , BQ40Z50-R2, BQ40Z50-R1

Hi,

I've generated the golden image and trying to flash it to my microprocessor. Here's the first several lines generated:

W: AA 3E 33 00
X: 1000
W: 16 09 00 00
W: 16 0A 00 00
W: 16 09 02 00
W: 16 0A 00 00
W: 16 00 00 00
W: 16 1A DE 83
W: 16 06 00 00

I realized that after loading the first line, it enters the ROM mode automatically. Thus, after the first time, if I run it again it was not able to detect the slave address 0xAA and just got stuck there (sending NACK through I2C bus). The problem could not be solved even if I tried to power it again. I have a few questions related to that:

1. Does the device go to ROM mode when it enters the third line? I've seen some documents online saying to enter ROM mode I need to write 0x0F00 to 0xAA which means I should see a line like W:AA 00 00 0F in the generated file, but I didn't. Even without doing that, did my device go to ROM mode automatically when it runs the third line?

2. If the problem is because my device went to ROM mode, then is there anyway for me to exit the ROM mode (without using bqstudio as the chip has already been soldered to the custom board)? I've tried sending W: 0x16 0x08 0x00 0x00, but if I try to run some command to 0xAA address after that command it still didn't work.

3. Does the device has to go to ROM mode in order to flash the golden image to the processor? 

  • Hi,

    1. You are right, sending 0x0F00 to 0x00 sends the device to ROM mode, but for backward compatibility with some older devices 0x0033 also works, and it can be written to 0x3E as well. Once it is in ROM mode the device address changes from 0xAA to 0x16 as well.

    2. To exit ROM mode, you will have to send W:0x16 0x08 without any data.

    3. The device needs to go to ROM mode only if you need to update the firmware. If you only need to write the data flash, it is not necessary to go to ROM mode. I have some steps documented that you can follow:

    bq28z610 Production Programming.pdf

  • Hi,

    Thank you so much for your quick reply. We are currently trying to update the firmware since the chip is already in our board and will not be able to connect to bqstudio. We are trying to flash the golden image to our processor through I2C bus. I was stuck in the ROM mode and was not able to get back to the normal mode (sending things to 0xAA address), here's what I tried and if you could let me know what's wrong, it'll be much appreciated!

    W:0x16 0x08 // trying to exit ROM mode

    W: AA 3E 33 00 // trying to run the program from the beginning
    X: 1000
    W: 16 09 00 00
    W: 16 0A 00 00
    W: 16 09 02 00
    W: 16 0A 00 00
    W: 16 00 00 00
    W: 16 1A DE 83
    W: 16 06 00 00

    Is this the correct way of doing this? I still got stuck in the second line, getting a NACK from I2C bus. But if I remove the second line and still sending stuff to the address 0x16, it was able to continue. I'm not sure what is going on in this case and how can I get out of it. Are there any documents explaining how to update the firmware for this so that I can take a look?

    Thank you very much
  • Hi,

    I would first check if you can exit the ROM mode.

    I have the following sequence that I ran and captured on a beagle on my bq28z610:

    The sequence is as follows:

    W:AA 00 0F // Go to ROM mode, if it is already in ROM mode this command will NACK since it can not respond at address 0xAA in ROM mode

    R:16 0D // Read 0x0D, if it is in ROM mode it will return ROM version. For bq28z610 it should be 9101, if it is not in ROM mode and value is <100

    W:16 08 // Exit ROM command

    R:AA 0D // read 0x0D, if it could not exit ROM mode it will NACK since it cannot respond at address 0xAA when it is in ROM mode

    If the gauge can not exit ROM mode, most likely the firmware you are trying to update to is not compatible with the device you have.

    Can you please tell me the fw version of the silicon that you ordered for the pack, and the version you are trying to update to?

    Regards,

    Swami

  • Hi Swami,

    Thank you so much for your reply.

    I've tried to send those commands you gave me, seems like my device is stuck on the ROM mode as anything begins with 0xAA can only receive a NACK.

    As for the firmware updating, we are currently using the bq28z610 EVM with the firmware version v0.17 to generate the golden image. Then converted the bqfs file into a header file, include it in our project and try to flash it from our processor to the fuel gauge. The way we flash it is to send each line of command through I2C bus using the I2C read/write command written by us. When we are trying to load the golden image to the fuel gauge, our device got stuck in ROM mode. I was able to go through some commands before it got stuck in the ROM mode, but afterwards it was never able to talk to the address 0xAA again. Is there anyway for us to get out of it as the command W:16 08 doesn't really help me to get out of ROM mode? Or are there any other reasons that might cause that? Your help is much appreciated!

    Regards,

  • Hi,
    Apart from wrong firmware, if anything is corrupted in the instruction flash, it will not exit ROM mode.
    If your golden file is v0.17 and the firmware on your devices is also v0.17, then it will be better to only update the data flash in firmware mode than to update in ROM mode, since writing only the data flash in fw mode is much safer.
    The only way to diagnose what went wrong would be to upload an srec using bqStudio from this device and compare it to the srec of your golden file.
    Regards,
    Swami
  • Hi Swami,

    In that case are there any ways for us to check if there's something corrupted in the instruction flash? Also according to the datasheet, if instruction flash is corrupted, the device will enter Permanent Fail mode. Are there any values that we can check to see if the device entered permanent fail mode?

    If there is something wrong with the instruction flash, is it still possible for us to fix it? Or the only choice is to replace the chip?

    Please let me know, thank you so much!

    Regards,
  • Hi Swami,

    I just saw this paragraph below from the 'update firmware at production' manual. I think this might be our problem as well. The first time when we run the firmware we didn't let it finish programming properly, however the fuel gauges were already in the ROM mode. This probably explained why sending W: 0x16 0x08 didn't help me to exit ROM mode again. I'm just wondering when it mentions 'exiting the ROM mode while the firmware or data flash is not fully programmed can place the device in an unrecoverable mode', how unrecoverable does it refer to? Does the hardware break down completely so we have to replace it with a new one or is there any software way of recovering this?

    Please let me know, your help is much appreciated

    Regards

  • Hi,
    Unfortunately, if the programming was interrupted, it could create a situation where the boot ROM can not execute properly since it does use some locations in the Flash. Even though the hardware is not physically damaged, this situation is not recoverable, and you will have to replace the device.
    Unless necessary, we don't recommend programming the devices in ROM mode for this reason.
    Programming in ROM mode is only required when changing or upgrading firmware on the device, all other programming should be performed in firmware mode.
    Regards,
    Swami
  • Hi Swami,

    Thanks for the reply.

    Based on what you've told me so far if I understand correctly we should not be entering ROM mode at all if all we want to do is load the golden file (which is written to data flash). The caveat to this is that the firmware version of the BQ28 must be the same as the version of BQ studio being used to generate the golden files?

    I think the issue we were running into is that we were attempting to load a file that may not in fact be a golden file and is therefore entering ROM mode mistakenly. With regards to that could you please comment on the following?

    1. Are we able to load the golden file using I2C commands issued  by our host microcontroller instead of BQ studio?

    2. What format should the golden file be? in .srec ? As the firmware updating file is in .srec as well, is there anyway to see if the srec file we have right now is golden file or firmware updating file? (as I'm taking over the job from someone else so I'm not sure what exactly the file is)

    3. Is the golden file version tied to the version of BQstudio? If our fuel gauge firmware does not match the golden file version how do we generate a different version that will match to avoid having to update the firmware?

    4. Attached is the one of the golden files we generated (converted it to bqfs already), however the first few lines are still bringing us to the ROM mode. I've attached the file to this post and could you take a look and let me know if this file makes sense or not?

    I'm sorry if I'm asking a lot of questions but this project is pretty urgent and seems like we are not on the right track. If you could clarify those to me, it'll be much appreciated!

    Please let me know, thanks a lot

    Regards,

    golden_file.txt

  • Hi,
    The golden file you have attached is a bqfs file. With this format you will have to go to ROM mode since the file contains Data Flash as well as Instruction Flash.
    Typically you don't need to program both Data Flash as well as Instruction flash and it is safer to program only the Data Flash, and this can be done without going in ROM mode.
    To do this, it is much easier to follow the instructions in the section "Programming using hex dump file:" of the previously attached document in this thread "bq28z610 Production Programming.pdf"
    There are instruction in section 12.2.45 of the Technical reference manual for bq28z610 ( www.ti.com/.../sluua65c.pdf ) that can be implemented in your micro to write the Data Flash using the data from the hex dump.
    The bqStudio version is not tied to the version of firmware running on your device or the srec or bqfs, dffs or gg.csv file that you read from the device.
    Regards,
    Swami
  • Hi Swami,

    Thanks for the reply.

    We just generated the .gg file using bqstudio and trying to load it to our processor. The .gg file looks much different, here's the first several lines generated:

    * Texas Instruments Data Flash Binary Image File.
    * All values are hexadecimal and begin at Data Flash Offset zero.
    *
    * File created on Tue Oct 09 09:51:02 2018
    * Device Name bq28z610
    * Device Identifier bq28z610 v0.19 build 24
    * Off-
    * set +0 +1 +2 +3 +4 +5 +6 +7
    0000: 45 2F 05 C2 28 BF 0C 78
    0008: 65 40 D5 8A 82 49 00 00
    0010: 40 00 00 00 00 00 00 00
    0018: 00 FF FF FF FF FF FF FF
    0020: FF FF FF FF FF FF FF FF
    0028: FF FF FF FF FF FF FF FF
    0030: FF FF FF FF FF FF FF FF

    If I want to write the data to the device using something similar to the format of the previous bqfs file, does the interpretation below look correct? 


    W: AA 3E 00 40 45 2F 05 C2 28 BF 0C 78 65 40 D5 8A 82 49 00 00 40 00 00 00 00 00 00 00
    W: AA 3E 20 40 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

    I'm also wondering do we need to update the instruction flash at least once before start using the fuel gauge from manufacturing? As I'm assuming the srec file must be containing some parameters that need to be set up. Then afterwards if we need to update the golden file we can write only to the data flash? Or it is okay for us to keep the instruction flash from the manufacturer and always only update data flash?

    Let me know, thank you so much for your help!

    Regards

  • Hi,
    Yes your interpretation is correct, you should be able to update the data flash with this procedure.
    Unless you need to change the firmware version of the device, you should not update the instruction flash. It does not have anything there that is configurable.
    The Srec file consists on the three sections:
    1. Data Flash (User settings and gauge settings including the chemistry information)
    2. Instruction Flash (Firmware for the gauge processor)
    3. Information block (Information about the hardware and firmware ID of the device)

    2 and 3 are only changed when moving from one firmware version to another (e.g. you can program bq40z50-R2 on a bq40z50-R1 device to use the next version of the device, this will require programming of instruction flash as well as Information block)

    In your case I would recommend only programming the data flash.
    Regards,
    Swami
  • Hi Swami,

    Thank you so much for your reply.

    We just tried to update to dataflash using the method as described above. Seems like we cannot successfully write to the dataflash. I'm getting an ACK from the I2C bus but if we try to read back from the dataflash, we still read the default values even if we just wrote other values in. Just wondering what might be the issue that causes unsuccessful write to the dataflash?

    Please let me know! Your help is much appreciated

    Regards,

  • Hi Swami,

    I actually just realized that my colleague has asked a similar question before in the E2E community, here's the link to the original post:
    e2e.ti.com/.../721723

    The other TI employee mentioned that it's not really possible to update the dataflash without using bqstudio. I'm just wondering am I missing anything in my I2C command or it is just not possible to update the dataflash. Does a checksum need to be added at the end of each command?

    Please get back to me and thank you for the help

  • Hi Emil,
    According to your communication through another channel you have resolved this issue. If you have any times to share with other users, please do post here. Otherwise we will close this thread out. Thanks!