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.

BQ27421-G1: How to implement the DFI writing algorithm and verify

Part Number: BQ27421-G1

I want to write Golden Image files( *.gm.fs) into BQ27421 ROM.

Based on slua801("Gauge Communication") and  slua595( "Going to Production With the bq274xx Family of Gas Gauges") document, whether I  use gauge_execute_fs(), it can achieve the goal.

If not, whether I need to do Figure 6("Production Flow") and  Figure 7("DFI Write Flow").

If I need to do Figure 6 and 7, I have some questions.

1. What does "Load Golden DFI file to test system"  mean ? Does it mean to use gauge_execute_fs() ?


2. How can I do "Read the Flash image into a byte array such as yDataFlashImage[0~0x3FF]" and "Read 96 bytes form data register address 0x04 to 0x63"?

gauge_read() only support to read 32 bytes,and it does not read 400 bytes Flash image.


3. How do I verify that writing DFI is successful?

  • Hi Nicorn,

    You can use the C code that is available in the app note "Gauge Communication" to download your gm.fs file.

    All the contents that are written to the device are compared. See Section 5 of the app note for the details. 

    The gauge_execute_fs() should return the pointer to the text which failed if the download is not successful.

    Andy

  • I execute the C code of "Gauge Communication", and it occurs "ioctl error Device or resource busy, errno:16" in gauge_address().

    I use "lsof" command to check who uses /dev/i2c-0 , but no body uses it.

    I try to execute system("i2cget -f -y 0 0x55 0x3D"), it is working well.

    How do I solve the problem "ioctl error Device or resource busy, errno:16", thanks?

    Result:

    lsof command:


    Source Code:

    #define GAUGE_DEVICE_ADDRESS 0xAA

  • Hi Nicorn,

    Unfortunately,  what you mentioned is more like a software issue than a device issue.  I'm not an expert on your host and therefore not able to tell you what might be wrong. 

    What I can tell you is that the code mentioned int the app note has been used by lots of customers and hence the code itself is all good.  You may want to try some simple i2c read or write operations on your host and see if all of them can succeed.

    Andy