0

I'm trying to communicate with an LTC2959 (datasheet) battery fuel gauge via I2C from my linux-based SBC. I'm not succeeding and I suspect a hardware or device-tree issue.

The IC address is 0xC6 which is outside of the standard 0x03 to 0x77 address range but I understand I should be able to bit shift it to 0x63 and access via linux.

My SBC has two onboard I2C devices, and EEPROM (datasheet) and PMIC, which I can communicate with so I'm confident the bus and the OS's interface to it is healthy. The IC datasheet says

The LTC2959 uses an I2C/SMBus-compatible 2-wire interface supporting multiple devices on a single bus. Connected devices can only pull the bus lines low and must never drive the bus high. The bus wires are externally connected to a positive supply via current sources or pull-up resistors

It's not clear to me that this is compatible with how the interface is configured in linux.

The device tree source configures the SCL line as "open drain", but not the SDA line and in the pinctrl definition there is bias-disable not bias-pullup.

Excerpt from the devicetree source (.dts):

/ {

//snip

        ahb {
                apb {
                        flx4: flexcom@fc018000 {
                                atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
                                status = "okay";

                                i2c@600 {
                                        dmas = <0>, <0>;
                                        pinctrl-names = "default";
                                        pinctrl-0 = <&pinctrl_flx4_i2c>;
                                        sda-gpios = <&pioA PIN_PC28 GPIO_ACTIVE_HIGH>;
                                        scl-gpios = <&pioA PIN_PC29 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
                                        i2c-analog-filter;
                                        i2c-digital-filter;
                                        i2c-digital-filter-width-ns = <35>;
                                        status = "okay";

                                        eeprom: eeprom@50 {
                                                compatible = "microchip,24c32", "atmel,24c32";
                                                reg = <0x50>;
                                                read-only;
                                                pagesize = <32>;
                                                status = "okay";
                                        };

                                        pmic: pmic@5b {
                                                compatible = "active-semi,act8945a";
                                                reg = <0x5b>;
                                                status = "okay";

                                                regulators {
                                                        //snip
                                                };
                                        };
                                };
                        };

//snip

                        pioA: pinctrl@fc038000 {
                                
//snip

                                pinctrl_flx4_i2c: flx4_i2c {
                                        pinmux = <PIN_PC28__FLEXCOM4_IO0>,      //SDA
                                                 <PIN_PC29__FLEXCOM4_IO1>;      //SCL
                                        bias-disable;
                                };

                        };
                };
        };
};

That said, the EEPROM chip seems to have the same requirement for external pullup on SDA, and is operating fine.

What am I missing?

1
  • Do you see the fuel gauge on the I2C bus using i2cdetect? Anyhow, I miss it's driver in the device tree section.
    – Philippos
    Commented May 24 at 11:34

0

You must log in to answer this question.

Browse other questions tagged .