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.

[FAQ] BQSTUDIO: How do I interpret the lines in a bq.fs file for use with my SMBus gauge?

Part Number: BQSTUDIO

I generated a bq.fs file using Battery Management Studio (bqStudio) for my SBS compliant SMBus gas gauge. What is the format of this file?

  • Flash Stream File Format for SMB

    1.   Introduction

    The following sections describe the file format for the TI BMS FlashStream (.bq.fs) files .  These files contain instructions for SMBus operations required for updating a device’s instruction flash (IF) and data flash (DF).

    2.   File Structure

    The .bqfs file is an ASCII text file which contains both commands and data.  Each line of the file represents one command and potentially XX bytes of data, as described below. Comment lines start with a semicolon. No line will contain more than 96 data bytes.  The first two characters of each line represent the command, followed by a “:”.

     

    “SWC:” - indicates the line is a command to write a SMBus command (0 bytes)

    “SWW:” - indicates the line is a command to write a SMBus word (2 bytes)

    “SWB:” - indicates the line is a command to write a SMBus block of one of more bytes of data

    “SCW” - indicates the line is a command to read and compare a SMBus word (2 bytes)

    “SCL:” - indicates the line is a command to read and compare a SMBus block of one of more bytes of data and validate the block length

    “X:” – indicates the line is a command to wait a minimum given number of milliseconds before proceeding (decimal).

     

    White space is used to separate fields within the .bqfs file.  Each line contains one and only one of the above commands.

     

     

    3.   SMBus Write Command

    The SMBus write command “SWC:” instructs the host to write a single byte SMBus command to a given SMBus address.  The format of this sequence is:

    “SWC: smbAddr smbCommand”

     

    For example, the following:

     

    SWC: 16 08

     

    Indicates the host should write the SMBus command 0x08 to the device addressed at 0x16.

     

     

    4.   SMBus Write Word

    The SMBus write command “SWW:” instructs the host to write a word (2 bytes MSB first) using SMBus command to a given SMBus address.  The format of this sequence is:

    “SWW: smbAddr smbCommand smbWordLSB smbWordMSB”

     

    For example, the following:

     

    SWW: 16 08 AA AB

     

    Indicates the host should write the bytes 0xAA(LSB of word) and 0xAB(MSB of word) using SMBus command 0x08 to the device addressed at 0x16.

     

     

    5.   SMBus Write Block

    The SMBus write command “SWB:” instructs the host to write a block of bytes using SMBus command to a given SMBus address.  The format of this sequence is:

    “SWB: smbAddr smbCommand smbBlockByte1 [smbBlockByte2 …]”

     

    For example, the following:

     

    SWB: 16 08 AA AB AC

     

    Indicates the host should write the block of bytes 0xAA, 0xAB, 0xAC using SMBus command 0x08 to the device addressed at 0x16.

     

     

     

    6.   SMBus Read Word and Compare

    The SMBus read Word and compare command “SRW:” instructs the host to read a word using SMBus command from a given SMBus address and compare with specified values. The format of this sequence is:

    “SCW: smbAddr smbCommand wordLSB wordMSB”

     

    For example, the following:

     

    SCW: 16 08 AA AB

     

    indicates the host should read a word using SMBus command 0x08 from the device addressed at 0x16 and compare with 0xAA(LSB) and 0xAB(MSB).

     

     

    .

    7.   SMBus Read Block and Compare exact block length and optionally compare bytes

    The SMBus read block and compare exact length command “SCL:” instructs the host to read a block of data using SMBus command from a given SMBus address and compare the length and optionally compare bytes.  The format of this sequence is:

    “SCL: smbAddr smbCommand blockLength [blockByte1 blockByte2 …]”

     

    For example, the following:

     

    SCL: 16 08 02 AA AB

     

    indicates the host should read a data block using SMBus command 0x08 from the device addressed at 0x16 and compare that the length is exactly 2 bytes and compare the bytes with 0xAA(byte1) and 0xAB(byte2).

     

     

    8.   The Wait Command

    The wait command indicates that the host should wait a minimum of the given number of milliseconds before continuing to the next row of the flash stream. The maximum allowed value is 20000 milliseconds. Any value greater than 20000 has undefined behavior.

    For example, the following:

     

    X: 200

     

    Indicates that the host must wait at least 200ms before continuing.

    Note: The number that follows “X:” is a decimal number. This is different from all other commands. In general all bytes are specified as a hexadecimal value except in this command..