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.

Trying to read a second I2C bus gives "controller timed out"

Other Parts Discussed in Thread: AM3354

I'm using a custom board based heavily on the AM335x EVM but with a AM3354 device. I'm trying to add a device to my board on I2C-1, (currently I only have devices on I2C-0). When I run a check for devices on I2C-1 I get errors in u-boot:

U-Boot# i2c dev 1
Setting bus to 1
U-Boot# i2c probe
Valid chip addresses:i2c_probe: pads on bus 1 probably not configured (status=0x10)
i2c_probe: pads on bus 1 probably not configured (status=0x10)
i2c_probe: pads on bus 1 probably not configured (status=0x10)
i2c_probe: pads on bus 1 probably not configured (status=0x10)

And in the kernel:

[root /]# i2cdetect -y -r 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          [ 1188.831062] omap_i2c 4802a000.i2c: controller timed out
-- [ 1189.831029] omap_i2c 4802a000.i2c: controller timed out
-- [ 1190.851032] omap_i2c 4802a000.i2c: controller timed out
...
...
70: [ 1299.991028] omap_i2c 4802a000.i2c: controller timed out
-- [ 1301.011026] omap_i2c 4802a000.i2c: controller timed out
-- [ 1302.031024] omap_i2c 4802a000.i2c: controller timed out
-- [ 1303.051030] omap_i2c 4802a000.i2c: controller timed out
-- [ 1304.071025] omap_i2c 4802a000.i2c: controller timed out
-- [ 1305.091028] omap_i2c 4802a000.i2c: controller timed out
-- [ 1306.111024] omap_i2c 4802a000.i2c: controller timed out
-- [ 1307.131027] omap_i2c 4802a000.i2c: controller timed out
--

I guess I'm missing something when it comes to enabling a second I2C bus. I didn't make any bootloader changes, so I'm not surprised the bootloader commands failed to work, but I would have thought the kernel could have worked independently. I added the configuration of the I2C1 pins in the device tree:

i2c1_pins: pinmux_i2c1_pins {
	pinctrl-single,pins = <
		0x168 (PIN_INPUT | MUX_MODE3)	/* uart0_ctsn.i2c1_sda */
		0x16c (PIN_INPUT | MUX_MODE3)	/* uart0_rtsn.i2c1_scl */
		0x1A0 (PIN_INPUT | MUX_MODE7) /* mcasp0_aclkr.mcasp0_axr2 */
		0x060 (PIN_INPUT | MUX_MODE7) /* gpmc_a8.mcasp0_aclkx */
		0x064 (PIN_INPUT | MUX_MODE7) /* gpmc_a9.mcasp0_fsx */

	>;
};

And I also "enabled" the I2C-1 bus by setting the status to ok:

i2c1: i2c@4802a000 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c1_pins>;

	status = "okay";
	clock-frequency = <200000>;   /* 400KHz is our max, 100KHz is the processor min */

	crtouch: crtouch@49 {
		reg = <0x49>;
	};
};

Despite these changes it seems that there's more to be done. Can someone point me in the right direction for enabling I2C-1 please? (both in the bootloader and kernel would be helpful)

  • Hi Mike,

    In bootloader you need to :
    1. Add appropriate information in ti_armv7_common.h, in the /* I2C IP block */ section of the file.
    2. Add appropriate pinmux settings in mux.c & call enable_i2c1_pin_mux(); in board.c file.

    In kernel, your configurations are correct. Can you verify that the pins set in i2c1_pins: pinmux_i2c1_pins are not set anywhere else in the dts & dtsi files you use?

    Best Regards,
    Yordan
  • Yordan,

    Yordan Kovachev said:
    Hi Mike,

    In bootloader you need to :
    1. Add appropriate information in ti_armv7_common.h, in the /* I2C IP block */ section of the file.
    2. Add appropriate pinmux settings in mux.c & call enable_i2c1_pin_mux(); in board.c file.

    Thank you very much for your excellent insight. I have made the adjustments to the bootloader as you suggested and now I can probe and see my device on I2C-1:

    U-Boot# i2c dev 1
    Setting bus to 1
    U-Boot# i2c probe
    Valid chip addresses: 49

    And I can read from it as well, reading the Device ID (0x13) register I see the correct response (0x12):

    U-Boot# i2c md 0x49 0x13
    0013: 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    With no further changes in the kernel, I now see my device there as well:

    [root /]# i2cdetect -r 1
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c-1 using read byte commands.
    I will probe address range 0x03-0x77.
    Continue? [Y/n] Y
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- 49 -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    [root /]# i2cget 0x1 0x49 0x13 b
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will read from device file /dev/i2c-1, chip address 0x49, data address
    0x13, using read byte data.
    Continue? [Y/n] Y
    0x12

    So I guess the u-boot code had to be in place in order for things to work correctly in the kernel. Thanks for you assistance.