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.

I2C problem

Hi Sir:

I works on Beaglebone black platform and use SDK 7.00.00

there are three i2c devices on the bus

I run the i2c-tool ,i2cdetect . try to detect device but only one response

Can you give me some suggestion

Best regard

Vic

  • Hi Vic,

    Is this a custom board or original BBB? Can you post the command you use and what it returns?

  • Hi Biser

    it is an external custom board connected to BBB by P8 and P9

    three devices address is 0x1a 0x3d 0x68

    I run the command , i2cdetect -y -r 1

    the result is

          0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:            -- --  --  --  --  -- --  -- -- --  -- -- --
    10: -- -- --  --  -- -- --  --  --  -- 1a -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- [ 1364.320048] omap_i2c 4802a000.i2c: controller timed out
    -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --

    " [ 1364.320048] omap_i2c 4802a000.i2c: controller timed out"

    this line pops up when  the detecting in progress at 0x3d

    Best regard

    Vic

  • Well, it seems that device at 0x3d is locking the bus somehow.

  • Hi Biser

    1.

    I remove the device 0x3d

    run "i2cdetect -y -r 1" again

    the result is

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

    device 0x68 is not detected

    2.

    I run the command "i2cget -y 1 0x68 0x6"
    the result is  ==> Error: Read failed

    3.

    If I execute another program to read device 0x68

    list the partial code

    static int get_i2c_register(int file, unsigned char addr, unsigned char reg, unsigned char *val)
    {
        unsigned char inbuf, outbuf;
        struct i2c_rdwr_ioctl_data packets;
        struct i2c_msg messages[2];

        outbuf = reg;
        messages[0].addr  = addr;
        messages[0].flags = 0;
        messages[0].len   = sizeof(outbuf);
        messages[0].buf   = &outbuf;


        messages[1].addr  = addr;
        messages[1].flags = I2C_M_RD /* | I2C_M_NOSTART*/;
        messages[1].len   = 1;
        messages[1].buf   = &inbuf;

        packets.msgs      = messages;
        packets.nmsgs     = 2;
        if(ioctl(file, I2C_RDWR, &packets) < 0) {
            perror("Unable to send data");
            return 1;
        }
        printf("val is %X \n", inbuf);

        *val = inbuf;

        return 0;
    }

    after if(ioctl(file, I2C_RDWR, &packets) < 0)

    the error message is "Remote I/O error"

    Best regard

    Vic

  • All I can say is check your hardware. You seem to have hardware issues. Do you have external pullups on the I2C lines?