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.

BQ27Z746: Questions from driver code reference for BQ27z746

Part Number: BQ27Z746
Other Parts Discussed in Thread: BQSTUDIO, BQ27426, EV2400, BQ27000

Hello Gauge team, 

one of my customer is referencing a driver code of below link while he's developing a battery module w/ bq27z746.  would you help answer to questions below? 

[ shared TI battery driver for bq27z746 IC.
/bq27xxx_battery.c  : https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/power/supply/bq27xxx_battery.c?h=v6.1.11
bq27xxx_battery_i2c.c : https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/power/supply/bq27xxx_battery_i2c.c?h=v6.1.11 


Q1. There are many chips data in above driver but no data is available for bq27z746 chip . So which chip data we should take as reference ?

Q2. What is the value of unseal_key for bq27z746 chip.

Q3. For bq27z746_dm_regs, we added default data as below .

static struct bq27xxx_dm_reg bq27z746_dm_regs[] = {

       [BQ27XXX_DM_DESIGN_CAPACITY]   = { 82, 12, 2,    0, 32767 },

       [BQ27XXX_DM_DESIGN_ENERGY]     = { 82, 14, 2,    0, 32767 },

       [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 18, 2, 2800,  3700 },

};

 Please check and share updated bq27z746_dm_regs  data if required. ] 


 

  • TI doesn't maintain Linux drivers. These are maintained by the open source community.

    The bq27z746 has data flash for configuration and uses SBS commands for gauging results. I recommend configuring the gauge with the Golden Image from bqStudio during production (using the .bq.fs format, see /cfs-file/__key/communityserver-discussions-components-files/196/5164.Flash-Stream-File-Format.pdf) and writing a minimal driver that just reads gauging results with SBS commands (e.g. command 0x2C/2D, Relative State Of Charge). There is no need for a complex driver that can configure the gauge.

    You approach with Q3 is not necessary for this gauge because it is supposed to be programmed with the Golden Image during production, not like other gauges (e.g. bq27426) which require a driver to program parameters like Design Capacity.

    The idea is to fully program Flash with the .bq.fs file and then treat the gauge like a black box that reports results.

  • Hello,

    Thank You for your answer.

    Is there some way to configure data post production?

    Suppose the device is with the end user. In such a case, how can we change battery parameters (RSOC, DesignCap etc.) on the chip using some software means?

  • Yes, you can update data memory parameters. See TRM www.ti.com/.../sluuca6.pdf, 15.2.63 Data Flash Access() 0x4000–0x5FFF.

    Note that addresses are FW version dependent. You can get the address for each parameter in bqStudio if you enable Advanced View in Preferences, Data Memory.

  • This update of data is possible only when the device is physically present and connected to EV2400 etc., right?

    Suppose we want to update data via a software update on a device present with the end user.

    So how can we update the data on that device without having the device with us.

  • You can update the gauge when it's attached to a host uC via I2C using either the instructions in the TRM or "playing back" the I2C instructions from a FS file.

  • Hi. Thank you for your answers.

    Can you please help to share a step-by-step guide when sudden changes in parameters are requested to be updated on the phone released in market.

    I am new to this, so please explain in detail. Thank You. 

  • The step by step instructions are in the TRM www.ti.com/.../sluuca6.pdf, 15.2.63 Data Flash Access() 0x4000–0x5FFF. Note that for the gauge to accept the data written as explained in the TRM, you will have to write the checksum to register 0x60 and the total length (number of address bytes plus number of data bytes plus 2 (check sum and length bytes)) to register 0x61.
    The checksum is (0xFF-(sum of address and data bytes) & 0xFF)

    The addresses for each parameter are in bqStudio, "Data Memory". Please enable "Show Advanced Views" in Window->Preferences.All Global Settings to view addresses.

    Note that the gauge must be unsealed before you can write to Data Flash. See TRM, 10.3 Security Modes

  • Options bits

    #define BQ27XXX_O_ZERO BIT(0)
    #define BQ27XXX_O_OTDC BIT(1) /* has OTC/OTD overtemperature flags */
    #define BQ27XXX_O_UTOT BIT(2) /* has OT overtemperature flag */
    #define BQ27XXX_O_CFGUP BIT(3)
    #define BQ27XXX_O_RAM BIT(4)
    #define BQ27Z746_O_BITS BIT(5)
    #define BQ27XXX_O_SOC_SI BIT(6) /* SoC is single register */
    #define BQ27XXX_O_HAS_CI BIT(7) /* has Capacity Inaccurate flag */
    #define BQ27XXX_O_MUL_CHEM BIT(8) /* multiple chemistries supported */

    Flags bits

    /* BQ27XXX Flags */
    #define BQ27XXX_FLAG_DSC BIT(0)
    #define BQ27XXX_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */
    #define BQ27XXX_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */
    #define BQ27XXX_FLAG_CFGUP BIT(4)
    #define BQ27XXX_FLAG_FC BIT(9)
    #define BQ27XXX_FLAG_OTD BIT(14)
    #define BQ27XXX_FLAG_OTC BIT(15)
    #define BQ27XXX_FLAG_UT BIT(14)
    #define BQ27XXX_FLAG_OT BIT(15)

    /* BQ27000 has different layout for Flags register */
    #define BQ27000_FLAG_EDVF BIT(0) /* Final End-of-Discharge-Voltage flag */
    #define BQ27000_FLAG_EDV1 BIT(1) /* First End-of-Discharge-Voltage flag */
    #define BQ27000_FLAG_CI BIT(4) /* Capacity Inaccurate flag */
    #define BQ27000_FLAG_FC BIT(5)
    #define BQ27000_FLAG_CHGS BIT(7) /* Charge state flag */

    /* BQ27Z746 has different layout for Flags register */
    #define BQ27Z746_FLAG_FDC BIT(4) /* Battery fully discharged */
    #define BQ27Z746_FLAG_FC BIT(5) /* Battery fully charged */
    #define BQ27Z746_FLAG_DIS_CH BIT(6) /* Battery is discharging */

    For our IC, BQ27Z746, which options & flags bits do we use?

    Also, where can we refer about them in the TRM 

  • The Flags bits are in the TRM www.ti.com/.../sluuca6.pdf, 15.1.6 0x0A/0B BatteryStatus().

    >For our IC, BQ27Z746, which options & flags bits do we use?

    These bits are read-only so you don't have to use them. They won't control the gauge but they can tell the host what's happening with the gauge and battery.

  • Hi, 

    Thank you for your continuous support~

    I have created a .bq.fs file using golden image of bqStudio.

    What is the next step?

    How to flash the gauge with the .bq.fs file. What hardware setup is needed.

  • You can use any system that can communicate with the gauge via I2C and execute all write instructions from the .bq.fs file.

    See https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1107287/faq-bqstudio-what-is-the-ti-bms-flashstream-file-format

    TI doesn't sell production tools. Customers usually parse the FlashStream file in their production environment and translate the instructions to I2C commands.

    Or this can be done on the host uC and a simple driver.