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.

AM335x omap_i2c omap_i2c.2: controller timed out

Other Parts Discussed in Thread: AM3354

Hi,everyone,I am using am335x evm board. (Boardname: AM33BONE, Boardversion: 00A3)
I want to use the i2c-1 controller, but I always get message "omap_i2c omap_i2c.2: controller timed out".

The linux kernel from http://arago-project.org/git/projects/?p=linux-am33x.git;a=summary .
And I modify file board-am335xevm.c like this:

static struct evm_dev_cfg beaglebone_dev_cfg[] = {
        {lcdc_init,       DEV_ON_BASEBOARD, PROFILE_NONE},// added, it works !
        {mii1_init,      DEV_ON_BASEBOARD, PROFILE_NONE},
        {usb0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
        {usb1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
        {mmc0_init,  DEV_ON_BASEBOARD, PROFILE_NONE},
        {i2c1_init,      DEV_ON_BASEBOARD, PROFILE_NONE}, // added, never work !
        {NULL, 0, 0},
};

When i operate i2c-1 (/dev/i2c-2), there is not any signal(include address signal) on CON-17 & CON-18, and get message

"omap_i2c omap_i2c.2: controller timed out", but the i2c-0(/dev/i2c-1) is OK.

Anyone can help me? Now I don't modify any other kernel code, and I don't know if need to modify/add code.

Thanks!


http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/791/p/addpost.aspx

  • A wild guess. From what I can tell, that is all you have to do in the kernel. Pinmux is handled. I assume that SCL and SDA are coming out on a expansion connector at CON-17 and CON-18. Do you have pullup resistors on those pins?

  • thank you.

    there is not pullup resistor, so the inner pullup resistor was used. but it doesn't work.
    the problem may comes from hardware.

  • Ooops. I did not notice that internal resistors on I2C1 are enabled. The pinmux mode for the I2C1 lines are defined in board-am335xevm.c as:

    OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |    AM33XX_PULL_ENBL | AM33XX_INPUT_EN

    I think that means the a pulldown is enabled. I am guessing that you need to add the pullup flag. Something like this:

    OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |    AM33XX_PULL_ENBL | AM33XX_INPUT_EN | AM33XX_PULL_UP

    From what I can see in the datasheet, the pullup current at 3.3V is relatively weak and has a wide variance 31uA to 243uA. You should see a signal but it may not be square.

  • Yes , I added this flag, but it didn't work. So I posted this subject.

    Tomorrow I will request the hardware engineer to add  external pullup resistors, and then I'll try again.

    Thank you!

     

  • Hi,

    I changed the pin-mux as below and i2c1 is working for me

    static struct pinmux_config i2c1_pin_mux[] = {
         {"spi0_d1.i2c1_sda",    OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |
    +                    AM33XX_PIN_INPUT_PULLUP},
         {"spi0_cs0.i2c1_scl",   OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |
    +                    AM33XX_PIN_INPUT_PULLUP},
         {NULL, 0},
     };

    on linux

    root@arago-armv7:~# i2cdetect -r 2

    WARNING! This program can confuse your I2C bus, cause data loss and worse!

    I will probe file /dev/i2c-2 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: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    70: -- -- -- -- -- -- -- --

     

    kindly test at your end and let me know.

    Regards

    Gururaja

  • Hi,

     

    Even i have got the same error as I2C1 Timeout during access and gives error number indicating the same. I had external pullups on the lines already then i have included the AM335x_PIN_INPUT_PULLUP for pin mux as suggested by Gururaja and the error is vanished.

     

    Thanks,

    Raja.

  • Hi,

    I want use I2C1 for eeprom on my baseboard .Now  I meet one question as follows :

    [ 1.496795] omap_i2c omap_i2c.2: Arbitration lost
    [ 2.513793] omap_i2c omap_i2c.2: timeout waiting for bus ready

    root@am335x-evm:~# i2cdetect -r 2
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c-2 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: [ 2558.385070] omap_i2c omap_i2c.2: timeout waiting for bus ready
    -- [ 2558.392089] omap_i2c omap_i2c.2: Arbitration lost
    -- [ 2558.399078] omap_i2c omap_i2c.2: Arbitration lost
    -- [ 2558.416839] omap_i2c omap_i2c.2: Arbitration lost
    -- [ 2559.435058] omap_i2c omap_i2c.2: timeout waiting for bus ready
    -- [ 2560.455047] omap_i2c omap_i2c.2: timeout waiting for bus ready
    -- [ 2560.462097] omap_i2c omap_i2c.2: Arbitration lost
    -- [ 2560.468292] omap_i2c omap_i2c.2: Arbitration lost
    -- [ 2561.505035] omap_i2c omap_i2c.2: timeout waiting for bus ready
    -- [ 2561.511840] omap_i2c omap_i2c.2: Arbitration lost
    -- [ 2562.535034] omap_i2c omap_i2c.2: timeout waiting for bus ready
    -- [ 2562.541778] omap_i2c omap_i2c.2: Arbitration lost
    -- [ 2563.565032] omap_i2c omap_i2c.2: timeout waiting for bus ready

    I have already configure i2c1_pin_mux like this :

    static struct pinmux_config i2c1_pin_mux[] = {
    {"spi0_d1.i2c1_sda", OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |
    AM33XX_PIN_INPUT_PULLUP},
    {"spi0_cs0.i2c1_scl", OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |
    AM33XX_PIN_INPUT_PULLUP},
    {NULL, 0},
    };

    In my baseborad the eeprom chip also has pull-up resistors,and I really don't know what to do,I need you help,thanks a lot 

  • What is the I2C bus voltage? What is the value of the pullup resistors? How many devices do you have on the I2C bus and are you sure they are configured to different addresses?
  • The bus voltage is 3V3 and the pullup resistor is 4.7KOhm , i2c1 bus has only one device(eeprom) 

  • All this seems OK. What is your AM335X processor revision? Have you checked the I2C waveforms with an oscilloscope? What is the I2C_CLK frequency?
  • I already checked the waveforms, when i execute read or write command , can detect some waves but it's abnormality,and the console will print  information eg:

    omap_i2c omap_i2c.2: timeout waiting for bus ready 

    ...

    In my kernel code, i set the frequency 100KHz by 

    omap_register_i2c_bus(2, 100, am335x_i2c0_boardinfo,
    ARRAY_SIZE(am335x_i2c0_boardinfo));

  • Can you post the waveforms?
  • Also please check that your I2C pinmuxing doesn't get overwritten in the kernel?

  • static struct pinmux_config i2c1_pin_mux[] = {
    {"spi0_d1.i2c1_sda", OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |
    AM33XX_PIN_INPUT_PULLUP},
    {"spi0_cs0.i2c1_scl", OMAP_MUX_MODE2 | AM33XX_SLEWCTRL_SLOW |
    AM33XX_PIN_INPUT_PULLUP},
    {NULL, 0},
    };

    static struct at24_platform_data am335x_baseboard_eeprom_info_i2c1 = {
    .byte_len = (32*1024) / 8,
    .page_size = 32,
    .flags = AT24_FLAG_ADDR16,
    };

    static struct i2c_board_info am335x_i2c1_boardinfo[] = {

    {

    /* Baseboard board EEPROM */
    I2C_BOARD_INFO("24c32", 0x50),
    .platform_data = &am335x_baseboard_eeprom_info_i2c1,

    },

    };

    setup_pin_mux(i2c1_pin_mux); 

    omap_register_i2c_bus(2, 100, am335x_i2c1_boardinfo,ARRAY_SIZE(am335x_i2c1_boardinfo));

    This modify all based on board-am335xevm.c 

    My eeprom chip is 24LC32A 

    and the abnormal waveforms as follows:

    it's a little obscure , My phone was too bad.

  • What is the time per division? This looks very very wrong.

  • 25ms. And the yellow one was the clk signal. absolutely wrong,it can't match the frequency that i set in software,but when i execute 

    i2cdetect -r 2 

    the waveforms detected was as the picture present.

  • Hi,

    My question finally solved. I find one i2c signal on my baseboard was connected to a 100K resistor  to ground,so the pullup resistor 4.7K's function was shielded,I think so.I removed the 100K resistor and now the information when i executing i2cdetect -r 2 as follows:

    root@am335x-evm:~# i2cdetect -r 2
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c-2 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: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: 50 -- -- UU -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    root@am335x-evm:~#

     It seems like i  was so careless and I really appreciated for you advice.Thank you very much.

    Best Wishs

  • Dear my friend,I have a question ,it's as same as the question asked here,in the board-am335xevm.c,I had used the i2c2,the configuration is:

    static struct pinmux_config i2c2_pin_mux[] = {
    {"uart1_ctsn.i2c2_sda", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW | AM33XX_PULL_UP | AM33XX_INPUT_EN },
    {"uart1_rtsn.i2c2_scl", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW | AM33XX_PULL_UP | AM33XX_INPUT_EN},
    {NULL, 0},
    };

    the pullup resistors is 10K,and the bus voltage is 3V3,I think it can wroks but not,the problem is:"omap_i2c omap_i2c.3: controller timed out",and then,when I skim the divice on the bus,like this:


    [CristL /]#./i2cdetect -y -r 1
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
    30: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
    40: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: UU UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    [CristL /]#./i2cdetect -y -r 3
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: [ 43.158325] omap_i2c omap_i2c.3: controller timed out
    -- [ 44.158355] omap_i2c omap_i2c.3: controller timed out
    -- [ 45.178314] omap_i2c omap_i2c.3: controller timed out
    -- [ 46.198303] omap_i2c omap_i2c.3: controller timed out
    -- [ 47.218353] omap_i2c omap_i2c.3: controller timed out
    -- [ 48.238342] omap_i2c omap_i2c.3: controller timed out
    -- [ 49.258331] omap_i2c omap_i2c.3: controller timed out
    -- [ 50.278320] omap_i2c omap_i2c.3: controller timed out
    -- [ 51.298339] omap_i2c omap_i2c.3: controller timed out
    -- [ 52.318328] omap_i2c omap_i2c.3: controller timed out
    -- [ 53.338317] omap_i2c omap_i2c.3: controller timed out
    -- [ 54.358306] omap_i2c omap_i2c.3: controller timed out
    -- [ 55.378326] omap_i2c omap_i2c.3: controller timed out
    --


    I have no idea now ,can you help me,thank you !

    CristL
  • My system is am3354, and the i2c work well when it power on, but the i2c occour the same problem when it reset or  software reboot.

    and the i2c dont work.