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.

Linux/AM3352: AM3352 i2c-gpio open-drain is invalid.

Part Number: AM3352

Tool/software: Linux

Hi,

  I used i2c-gpio driver, But the sda can not read ack correctlly from the eeprom. The waveform of the ack is half-high. I think the sda is not input mode, when the ack arrives.

So I think the gpio open-drain mode is invalid. Please help me.

The dts follow.

gpioi2c3: i2c-3 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&i2c3_gpio>;
compatible = "i2c-gpio";
status = "okay";
gpios = <&gpio1 13 GPIO_ACTIVE_HIGH &gpio1 12 GPIO_ACTIVE_HIGH>;
i2c-gpio,sda-open-drain;
i2c-gpio,scl-open-drain;
i2c-gpio,delay-us = <5>;
};

  • i2c3_gpio: i2c3_gpio {
    pinctrl-single,pins = <
    AM33XX_IOPAD(0x830, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (T12) gpmc_ad12.gpio1[12] */
    AM33XX_IOPAD(0x834, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (R12) gpmc_ad13.gpio1[13] */
    >;
    };
  • Hi,

    AM335x I/O pins are not open drain. You will need external pullups on your I2C lines.
  • Hi ,
    I have resolved this issue.

    The dts file:
    gpioi2c3: i2c-3 {
    #address-cells = <1>;
    #size-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&i2c3_gpio>;

    compatible = "i2c-gpio";
    gpios = <&gpio1 13 GPIO_ACTIVE_HIGH /* sda */
    &gpio1 12 GPIO_ACTIVE_HIGH /* scl */
    >;
    i2c-gpio,scl-output-only;
    i2c-gpio,delay-us = <2>; /* ~100 kHz */
    status = "okay";
    };

    i2c3_gpio: i2c3_gpio {
    pinctrl-single,pins = <
    AM33XX_IOPAD(0x830, PIN_OUTPUT_PULLUP|MUX_MODE7) /* (T12) gpmc_ad12.gpio1[12] */
    AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP|MUX_MODE7) /* (R12) gpmc_ad13.gpio1[13] */
    >;
    };
    The sda must be PIN_INPUT_PULLUP and external pullups .
    The scl must be PIN_OUTPUT_PULLUP and external pullups .