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.

AM5729: How to configure i2c4 on BBAI

Part Number: AM5729

Hi,

like to activate a second i2c on the BBAI with CPU AM5729.

This is how far I get:

i2cdetect -l
i2c-3 i2c OMAP I2C adapter I2C adapter
i2c-0 i2c OMAP I2C adapter I2C adapter

cd /boot/dtbs/4.14.108-ti-r143/

dtc -I dtb -O dts -o am5729-beagleboneai.dts am5729-beagleboneai.dtb

vi am5729-beagleboneai.dts

# activated i2c5 like this, but no clue how to assign the pins

i2c@4807c000 {
compatible = "ti,omap4-i2c";
reg = <0x4807c000 0x100>;
interrupts = <0x0 0x37 0x4>;
#address-cells = <0x1>;
#size-cells = <0x0>;
ti,hwmods = "i2c5";
#status = "disabled";
status = "okay";
clock-frequency = <100000>;
phandle = <0x1dd>;
};

dtc -I dts -O dtb -o am5729-beagleboneai.dtb am5729-beagleboneai.dts 

reboot

i2cdetect -l
i2c-3 i2c OMAP I2C adapter I2C adapter
i2c-4 i2c OMAP I2C adapter I2C adapter
i2c-0 i2c OMAP I2C adapter I2C adapter

i2cdetect -y -a -r 4
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- ^C

Response is slow because pins are not assigned and dmesg contains the timeout messages

[ 139.014548] omap_i2c 4807c000.i2c: controller timed out
[ 140.070510] omap_i2c 4807c000.i2c: controller timed out
[ 141.126452] omap_i2c 4807c000.i2c: controller timed out

Any advise how to assign the pins for i2c4?

  • Hi,

    Apologies for the long delay. Can you please check the pin mux for the i2c4 pins for BBAI.

    board/ti/am57xx/mux_data.h in U-Boot directory. 

    const struct pad_conf_entry core_padconf_array_essential_bbai[] = {
            /* Cape Bus i2c */
            /* NOTE: For the i2cj_scl and i2ci_scl signals to work properly, the INPUTENABLE bit of the
             * appropriate CTRL_CORE_PAD_x registers should be set to 0x1 because of retiming
             * purposes.
             */
            {GPMC_A0, (M7 | PIN_INPUT_PULLUP)},                     /* P9_19A: R6_GPIO7_3: gpmc_a0.i2c4_scl (Shared with F4_UART10_RTSN) */
            {GPMC_A1, (M7 | PIN_INPUT_PULLUP)},                     /* P9_20A: T9_GPIO7_4: gpmc_a1.i2c4_sda (Shared with D2_UART10_CTSN) */
    

    The mux seems to be done here. Can you dump those registers and check on BBAI if the mux is done correctly on your setup?

    Best Regards,
    Keerthy

  • Hi,

    found the solution how to add the pin definition to the .dts file 

    &i2c5 {
      pinctrl-names = "default";
      pinctrl-0 = <&i2c5_pins>;
      status = "okay";
      clock-frequency = <100000>;
    };

    #define P9_17A(mode) DRA7XX_CORE_IOPAD(0x37CC, mode) /* B24: spi2_cs0 */
    #define P9_17B(mode) DRA7XX_CORE_IOPAD(0x36B8, mode) /* F12: mcasp1_axr1 */
    #define P9_18A(mode) DRA7XX_CORE_IOPAD(0x37C8, mode) /* G17: spi2_d0 */
    #define P9_18B(mode) DRA7XX_CORE_IOPAD(0x36B4, mode) /* G12: mcasp1_axr0 */

    &dra7_pmx_core {
      i2c5_pins: i2c5 {
        pinctrl-single,pins = <
          P9_17A( PIN_OUTPUT | MUX_MODE15) /* mcasp1_axr1.i2c5_scl, spi2_cs0.off */
          P9_17B( PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE10)
          P9_18A( PIN_OUTPUT | MUX_MODE15) /* mcasp1_axr0.i2c5_sda, spi2_d0.off */
          P9_18B( PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE10)
        >;
      };
    };
    This solved my problem