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 on DM6446



I connect a gyro sensor SMB380 to DM6446 directly by the DC3 (i2c connector) interface.

I am now trying to read data from the SMB380 according to the file ../workdir/lsp/ti-davinci/Documentation/i2c/dev-interface.

However, I at first donot know how to decide which adapter I should access. 

On my target file system, there is only a [0] in the /dev/i2c/ .

Because the MSP430  and video codec use the i2c too,  are all i2c devices can be opened by the /dev/i2c/0?

In the header file i2c.h, extern s32 i2c_smbus_read_byte_data is defined as extern, but where is the original definition of it.

Now i2c_smbus_read_byte_data  is taken by the compiler as undefined reference.

Is any other file or library neccssary for i2c_smbus_read_byte_data ?

Any suggestion will be greatly appreciated.

Thank you very much!

 

 

  •  

    Hi,

     

    We had used a device file as /dev/i2c/0 to access some video ADCs.

    First we had to enable Bit-Banging interface during the Kernel compilation process.

     

    Regards

    Suba.

  • Yes, you can use /dev/i2c/0, you just need to specify the correct i2c address for the slave device.  For example

    #define I2C_DEVICE "/dev/i2c/0"

    #define I2C_DEV_ADDR 0x21

    main(void)

    {

    int fd;

    fd = open(I2C_DEVICE, O_RDWR);

    if (fd < 0) {

     printf("Error while opening i2c device %s\n", I2C_DEVICE);

    }

    if (ioctl(fd, I2C_SLAVE, I2C_DEV_ADDR) == -1) {

      printf("Failed to set I2C_SLAVE %#x\n", I2C_DEV_ADDR);

    }

    ...

    }

  • Hi

    I"m also try to use the SMB380 model with DVEVM DC3 I2c connector.

    I will be glad if you please to sketch the PIN-2-PIN as you used connected the sensor.

    and if you have additional information specific this sensor.

    Thanks in advance

  • Hi Masuru!

    You wrote :

    In the header file i2c.h, extern s32 i2c_smbus_read_byte_data is defined as extern, but where is the original definition of it. Now i2c_smbus_read_byte_data  is taken by the compiler as undefined reference.

    Do you solved this?

    Regards, Oleg