Post Go back to editing

MAX17332 Linux Driver losing communication with chip

Category: Software
Product Number: MAX17332
Software Version: max172xx_linux_driver_v1_0_4

Hello everyone,

We bought MAX17332 Development kit and we want to use it with i.MX8M Mini application processor. So I downloaded max172xx_linux_driver_v1_0_4.zip from Analog devices and installed it with instructions from README. My Linux kernel version is 6.1. Then I hooked up MAX17332 I2C to I2C2 of i.MX8M Mini and connected ALRT pin to GPIO1_IO1. Li-Ion battery with capacity of 4800 mAh is connected to MAX17332, and we are connecting/disconnecting 5V charger, and sometimes connecting load on SYSP and SYSN pins. Device tree node is shown bellow:

&i2c2 {
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";

   max17332@36 {
   compatible = "maxim,max17332";
   status = "okay";
   reg = <0x36>;
   interrupt-parent = <&gpio1>;
   interrupts = <1 0>;
   rsense = <10>; /* miliOhm */
   talrt-min = <0>; /* DegreeC */
   talrt-max = <70>; /* DegreeC */
   valrt-min = <3200>; /* mV */
   valrt-max = <4600>; /* mV */
   salrt-min = <1>; /* Percent */
   salrt-max = <99>; /* Percent */
   ialrt-min = <(-5000)>; /* mA */
   ialrt-max = <5000>; /* mA */
   };
};

When I try to read /sys/class/power_supply/max1720x_battery/capacity it returns number like 180, and then 20, and then again number bigger than 100, but I suppose that it needs to be between 0 and 100. Readings of current fluctuate from postitive to negative, and differ from readings on our RIGOL power supply.  We are losing communication with MAX17332, and then we need to reboot Linux to establish communication. 

Errors that appear:

root@maaxboardmini:~# cat /sys/class/power_supply/max1720x_battery/device/max17330_protstat
[  849.933330] max1720x 1-0036: Protection Status Register reading failed (-11)
cat: /sys/class/power_supply/max1720x_battery/device/max17330_protstat: Resource temporarily unavailable

[  831.889895] power_supply max1720x_battery: driver failed to report `charge_now' property: -110
cat: /sys/class/power_supply/max1720x_battery/charge_now: Connection timed out

After this errors communication is never back, and reboot is only solution. Communication loss is also happening while we didn't changed anything, we didn't attached or disconnected charger if it is already connected, and we didn't attached or disconnected load.

Do someone know what can be reason for losing communication with the chip via Linux driver, is it some hardware issue maybe or software issue in Linux driver? Also the bad readings of capacity and current are in question.

Thanks in advance,

Nenad Gajic



tagged
[edited by: GenevaCooper at 12:01 AM (GMT -5) on 13 Jan 2024]
Parents Reply
  • Problem is solved!

    I looked little bit deeper into the MAX17332EVKIT board and I saw that there are pull up resistors on I2C pulled up to I2CPU which is generated from USB VBUS. We wanted to use I2C directly without USB so we didn't connected USB, and because of that I2C lines were pulled up to nothing (I2CPU was 0). So I hooked up 3V3 from our i.MX8M Mini board to I2CPU (USB cable is still disconnected) and everything started to work. Now SDA, SCL and ALRT pins are pulled up to 3V3. We get good readings of capacity (between 0 and 100) and same as with using Model Gauge application on Windows. Current readings are doubled for some reason compared to readings from power source, but that isn't problem. 

    Best regards,

    Nenad

Children
No Data