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.

AM3352 I2c2 not reading data

Other Parts Discussed in Thread: TPS65910, TPS65217

Hi,

I think I have configured i2c-0 and i2c-2 correctly but maybe not; as i2c-2 at the moment is not reading...

For i2c-2 I have

D17 (I2C2_SCL, mode 3) and D18 (I2C2_SDA, mode 3)

Kernel built OK without error and I could see

root@localhost:~#ls /dev/i2c*

i2c-0

i2c-2

Also this:

root@localhost:~# cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins

...

pin 94 (44e10978.0): 4819c000.i2c (GPIO UNCLAIMED) function pinmux_i2c2_pins group pinmux_i2c2_pins
pin 95 (44e1097c.0): 4819c000.i2c (GPIO UNCLAIMED) function pinmux_i2c2_pins group pinmux_i2c2_pins
...
pin 98 (44e10988.0): 44e0b000.i2c (GPIO UNCLAIMED) function pinmux_i2c0_pins group pinmux_i2c0_pins
pin 99 (44e1098c.0): 44e0b000.i2c (GPIO UNCLAIMED) function pinmux_i2c0_pins group pinmux_i2c0_pins

And this:


root@localhost:~# cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups
...

group: pinmux_i2c0_pins
pin 98 (44e10988.0)
pin 99 (44e1098c.0)

group: pinmux_i2c2_pins
pin 94 (44e10978.0)
pin 95 (44e1097c.0)

I know it's not working for me because when I plugged in a device I could see

root@localhost:~# i2cdetect -y -r 0


     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

But for I2C-2 I saw nothing

root@localhost:~# i2cdetect -y -r 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I also tried from the U-BOOT command:


U-Boot# i2c dev
Current bus is 0
U-Boot# i2c probe
Valid chip addresses: 24
U-Boot# i2c dev 2
Setting bus to 2
U-Boot# i2c probe
Valid chip addresses:
U-Boot#

I think I must have missed something and need some help...

My uboot

--------------------------------

under the am335x/mux.c I have added

static struct module_pin_mux midasos_i2c2_pin_mux[] = {
                {OFFSET(uart1_ctsn), (MODE(3) | RXACTIVE | PULLUP_EN | SLEWCTRL)}, /* I2C_DATA */
                {OFFSET(uart1_rtsn), (MODE(3) | RXACTIVE | PULLUP_EN | SLEWCTRL)}, /* I2C_SCLK */
                {-1},
        };

My device tree:

---------------------------------------

aliases {
                i2c0 = "/ocp/i2c@44e0b000";

                i2c2 = "/ocp/i2c@4819c000"; 

...};

pinmux_i2c2_pins {
                        pinctrl-single,pins = <0x178 0x73 0x17c 0x73>;
                        linux,phandle = <0x19>;
                        phandle = <0x19>;
};

i2c@4819c000 {
                        compatible = "ti,omap4-i2c";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        ti,hwmods = "i2c3";                       
                        reg = <0x4819c000 0x1000>;
                        interrupts = <0x1e>;
                        pinctrl-names = "default";
                        pinctrl-0=<0x19>;
                        status = "okay";
};

Thanks

  • Hi,

    I will forward this to the Linux team.
  • Sorry do you mean you will forward it to the Linux team or I will forward it myself? Where is Linux team support forum?

    Many thanks
  • I have done it. Feedback will be posted here.
  • Hi,

    Does i2cdetect -l detects i2c2 in your kernel?
    Is it possible to check the sda line, when executing i2cdetect -y 2? Is there any change in the state?

    If yes, then you need to add your device in the i2c2 dts node, like:

    &i2c2 {
    <your_ext_device_name>: <ext_device_name>@2d {
    reg = <0x2d>;
    };
    };

    You can reference the &i2c0 dts node in am335x-evm.dts or am335x-evmsk.dts in your kernel sources.

    In a similar manner, devices connected to I2C0 bus, are "told" to use that i2c bus, i.e. have a look at board/ti/am335x/board.c:
    /*
    * The GP EVM, IDK and EVM SK use a TPS65910 PMIC. For all
    * MPU frequencies we support we use a CORE voltage of
    * 1.1375V. For MPU voltage we need to switch based on
    * the frequency we are running at.
    */
    if (i2c_probe(TPS65910_CTRL_I2C_ADDR))
    return;
    ....................................
    /* Tell the TPS65910 to use i2c */
    tps65910_set_i2c_control();

    Hope this helps.

    Best Regards,
    Yordan

  • Hi,

    I have a few questions -

    (1) Our PCB is customised to tps65217 rather than tps65910.

    Looking at 'board.c' it's calling 'TPS65910_CTRL_I2C_ADDR', which is defined in
    'tps65910.h' as 'TPS65910_CTRL_I2C_ADDR=0x2d'

    Looking at 'tps65217.h' it doesn't have equvalent 'TPS65217_CTRL_I2C_ADDR' specified. It does have 'TPS65217_CHIP_PM=0x24' though. Should I use TPS65217_CHIP_PM instead?

    Similarly 'tps65910_set_i2c_control()' function is defined in 'pmic_tps65910.c'; however there isn't a 'tps65217_set_i2c_control()'. What should I do?

    (2) dts- it seems my customised device tree uses a different syntax, in my original post I have i2c-2 configured as

    //i2c2
    i2c@4819c000 {
    compatible = "ti,omap4-i2c";
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    ti,hwmods = "i2c3";
    reg = <0x4819c000 0x1000>;
    interrupts = <0x1e>;
    pinctrl-names = "default";
    pinctrl-0=<0x19>;
    status = "okay";
    };

    which I copied/modified from the already existing i2c0

    i2c@44e0b000 {
    compatible = "ti,omap4-i2c";
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    ti,hwmods = "i2c1";
    clocks = <0x10>;
    clock-names = "fck";
    reg = <0x44e0b000 0x1000>;
    interrupts = <0x46>;
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <0x15>;
    clock-frequency = <0x61a80>;
    sleep-sequence = <0x22d251f>;
    wake-sequence = <0x22d252b>;

    tps@24 {
    reg = <0x24>;
    compatible = "ti,tps65217";
    ti,pmic-shutdown-controller;
    };
    }

    Do you mean I should move the tps@24 from i2c@440b000 to i2c@4819c000? I will try it in a minute...

    (3) do I care about the functions called under 'get_dpll_ddr_params' specified in 'board.c'

    The original was

    get_dpll_ddr_params
    {
    ...
    enable_i2c0_pin_mux();
    i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
    ...
    }

    and I have changed to

    get_dpll_ddr_params
    {
    ...
    enable_i2c0_pin_mux();
    enable_i2c2_pin_mux();
    i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
    i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C2_SLAVE);
    ...
    }

    Although I have no idea what value I should give to 'CONFIG_SYS_OMAP24_I2C2_SLAVE'

    (4) I have to add '&cmper->i2c2clkctrl,' to 'enable_basic_clocks' under 'clock_am33xx.c'; or the system hangs if I typed 'i2c prob' under u-boot; or 'i2cdetect -y -r 2' under kernel. Am I doing it correctly?

    (5) I will scope the I2C-2 line in a minute...

    Thanks for your help.
  • Hi,

    Sorry I think I might have misunderstood something...

    The desired environment has both i2c-0 and i2c-2 (note no i2c-1).

    As described we adapt 'tps65217' regulator rather than 'tps65910' under i2c-0 bus.

    i2c@44e0b000 {
    compatible = "ti,omap4-i2c";
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    ti,hwmods = "i2c1";
    clocks = <0x10>;
    clock-names = "fck";
    reg = <0x44e0b000 0x1000>;
    interrupts = <0x46>;
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <0x15>;
    clock-frequency = <0x61a80>;
    sleep-sequence = <0x22d251f>;
    wake-sequence = <0x22d252b>;

    tps@24 {
    reg = <0x24>;
    compatible = "ti,tps65217";
    ti,pmic-shutdown-controller;
    regulators { ... };
    };

    As kernel worked fine with these regulators I think I2c-0 is fine (please let me know otherwise)

    As for the i2c-2 bus, which I plugged in an external device but didn't see the data:

    root@localhost:~# i2cdetect -y -r 2

    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --

    I am not sure is that in my device tree I have added

    i2c@4819c000 {
    compatible = "ti,omap4-i2c";
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    ti,hwmods = "i2c3";
    reg = <0x4819c000 0x1000>;
    interrupts = <0x1e>;
    pinctrl-names = "default";
    pinctrl-0=<0x19>;
    status = "okay";
    };

    Do I need to add a node to i2c-2 as suggested? e.g.

    <your_ext_device_name>: <ext_device_name>@2d {
    reg = <0x2d>;

    the address 0x2d, do I need to make the uboot aware somehow and is there anything else (apart from the muxpins) on the u-boot I should be changing? (note my version is 'u-boot-2014.07+gitAUTOINC+fb6ab76dad-gfb6ab76') for example, do I need to add 'i2c_init' for i2c-2 under 'get_dpll_ddr_params'? and add '&cmper->i2c2clkctrl,' to 'enable_basic_clocks' under 'clock_am33xx.c'?

    I will put a scope on the I2C2_SCL/SDA line tomorrow. Many thanks for your help.
  • Thanks for the help I have worked it out. For the record below is the extra bit from my initial post, worked in my case.

    (1) defined CONFIG_SYS_OMAP24_I2C_SLAVE2 = 1
    (2) added '&cmper->i2c2clkctrl,' to 'enable_basic_clocks' under 'clock_am33xx.c'

    Thanks again.