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.

BQ27441

Other Parts Discussed in Thread: BQSTUDIO

Hi Folks,

I am working on Linux based platform with fuel gauge bq27441 with below details of kernel and Ti driver version.

TI Parts                    : bq27xxx
Kernel version         :  4.9.241
TI Driver Version     : "1.2.0"
Battery                      : Li-Ion / 3.3V / 2200mAh


I have made some necessary changes into DTS, and validated successful driver probe in dmesg .

Below are the wrong parameters output current;y I am seeing,

Battery connected (in discharging mode with load connected - LED)

$ cat /sys/class/power_supply/bq27441-0/uevent 

POWER_SUPPLY_NAME                                 =bq27441-0
POWER_SUPPLY_STATUS                              =Charging
POWER_SUPPLY_PRESENT                           =1
POWER_SUPPLY_VOLTAGE_NOW                 =3842000
POWER_SUPPLY_CURRENT_NOW                =0
POWER_SUPPLY_CAPACITY                           =52
POWER_SUPPLY_CAPACITY_LEVEL              =Normal
POWER_SUPPLY_TEMP                                   =276
POWER_SUPPLY_TECHNOLOGY                    =Li-ion
POWER_SUPPLY_CHARGE_FULL                   =939000
POWER_SUPPLY_CHARGE_NOW                   =520000
POWER_SUPPLY_CHARGE_FULL_DESIGN   =1000000
POWER_SUPPLY_MANUFACTURER               =Texas Instruments

Battery not connected

$ cat /sys/class/power_supply/bq27441-0/uevent

POWER_SUPPLY_NAME           =bq27441-0
POWER_SUPPLY_PRESENT    =0


Changes  made on DTS file,      

        bat: battery {
                status = "okay";
                compatible = "bq27000-battery","ti,bq27000";
                voltage-min-design-microvolt = <2800000>;        
                energy-full-design-microwatt-hours = <3270000>;  
                charge-full-design-microamp-hours  = <3270000>;  
        };

        bq27441: fuel-gauge@55 {
                status = "okay";
                compatible = "ti,bq27441";
                reg = <0x55>;
                monitored-battery = <&bat>;
        };

From Logs,

1. Battery if not in charging state but it shows POWER_SUPPLY_STATUS charging.

2. POWER_SUPPLY_VOLTAGE_NOW(3842000) (3.7V), but POWER_SUPPLY_CAPACITY( 52) is half (should be 100% ?)

3. Also some time getting negative value for POWER_SUPPLY_CURRENT_NOW.

Battery parameters are not relating to my battery.

As from Documents, I found that I have to configure fuel gauge driver with battery parameters according to battery.


Question:

How should I configure the battery parameters  and which parameter i have to configure ?

Any help would be appreciable.


Thanks & Regards

  • Hello Rutvij,

    Refer the TRM and check all parameters related to charging

    6.4.2.3.13 Voltage at Charge Termination

    I would also recommend that you check and associate the command to the bit/byte and check if the right one is being read. You can use bqStudio to read the same value and compare it.

  • Hi Shirish,

    Thank you for the quick reply.

    Currently I don't have bridge hardware (required for bqStudio) available with me.
    So alternatively can you suggest how to configure them from Device-tree/Linux driver for v4.9  ?


    Thanks & Regards,

  • Hello Rutvij,

    Can you check which commands are being read to report those values? This will help.

    I think at least 2 of those values may be correct if it refers to FCC and RSOC

  • Hi Shirish,

    I have checked the driver file bq27xxx_battery.c, which uses the below list of commands to get reading, please check this.

    [BQ27421] = {
                    [BQ27XXX_REG_CTRL] = 0x00,
                    [BQ27XXX_REG_TEMP] = 0x02,
                    [BQ27XXX_REG_INT_TEMP] = 0x1e,
                    [BQ27XXX_REG_VOLT] = 0x04,
                    [BQ27XXX_REG_AI] = 0x10,
                    [BQ27XXX_REG_FLAGS] = 0x06,
                    [BQ27XXX_REG_TTE] = INVALID_REG_ADDR,
                    [BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
                    [BQ27XXX_REG_TTES] = INVALID_REG_ADDR,
                    [BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
                    [BQ27XXX_REG_NAC] = 0x08,
                    [BQ27XXX_REG_FCC] = 0x0e,
                    [BQ27XXX_REG_CYCT] = INVALID_REG_ADDR,
                    [BQ27XXX_REG_AE] = INVALID_REG_ADDR,
                    [BQ27XXX_REG_SOC] = 0x1c,
                    [BQ27XXX_REG_DCAP] = 0x3c,
                    [BQ27XXX_REG_AP] = 0x18,
            },
    

    yes, may be 2 of those values are right, but not sure about it.

    as i an not able to check fuel gauge with bqStudio, i have try to read all parameter using "Arduino SparkFun Library ". but, I am getting same result.

    State Of Charge  | Current Now | Charge Status  parameter are getting wrong.

    I have this TI board : bq27441 EVM.

  • Hello Rutvij,

    The units that the gauge returns is different from what the driver returns. There is a conversion formula applied that should be clear on going into the details of the code.

    At a higher level i see that FCC is close to design capacity, so that is fine.

    POWER_SUPPLY_CHARGE_FULL                   =939000
    POWER_SUPPLY_CHARGE_NOW                   =520000

    520000/1000000 = 52% shows correct state of charge. This would be scaled to FCC is a learning cycle was completed.

    Similarly you can trace the command of POWER_SUPPLY_STATUS and relate it to the command to figure out if it matches the TRM. The products have been tested and been in mass production for a long time, so you can always assume that the product works correctly and go from there.

  • Hi Shirish,

    I have configure the FG with below parameter ,

        capacity                    : 2000 mAh
        energy                       : 7600 mW
        terminate_voltage   : 3350 mV    
        taper_rate                 : 200   

    Now I am getting the below response,

    POWER_SUPPLY_NAME                               =bq27441
    POWER_SUPPLY_STATUS                            =Charging
    POWER_SUPPLY_PRESENT                         =1
    POWER_SUPPLY_VOLTAGE_NOW               =3821000
    POWER_SUPPLY_CURRENT_NOW              =-5000
    POWER_SUPPLY_CAPACITY                        =48
    POWER_SUPPLY_CAPACITY_LEVEL           =Normal
    POWER_SUPPLY_TEMP                                =270
    POWER_SUPPLY_TECHNOLOGY                 =Li-ion
    POWER_SUPPLY_CHARGE_FULL                =1937000
    POWER_SUPPLY_CHARGE_NOW                =970000
    POWER_SUPPLY_CHARGE_FULL_DESIGN    =2000000
    POWER_SUPPLY_MANUFACTURER            =Texas Instruments

    I did trace the POWER_SUPPLY_STATUS, status is updated from FLAGS() register parameter (CHG).

    Now the query is what it's indicating ?

    1) Is battery currently charged through external power source? If yes then its wrong.

    2) What does this CHG is going to represent ?

    Also, on StateOfHealth(SOH) parameter, is it going to representing the life of battery?

    I want to derive some parameter like ,

    1) How much remaining time for battery full charge?

    2) How much remaining time for full discharge?

    3) Battery health condition.


    So any advice on how to get these ?

    --
    Thanks
    Rutvij Trivedi.

  • Hello Rutvij,

    See TRM section 4.4 Flags(): 0x06 and 0x07

    CHG flag does not indicate that pack is charging

  • Hello Rutvij,

    Change your code to read StateOfCharge(): 0x1C and 0x1D

    This is in section 4.13 of TRM

    You can find all commands from the TRM and update your code

  • Please click the "resolved" button to close this thread if your question has been answered.