[i2c] Reading TPS65010 using I2C.

Arnold abo_gwapo at yahoo.com
Tue Oct 24 05:45:49 CEST 2006


Hi All,

I'm trying to read the tps65010 register using the
i2c-dev.c driver. Unfortunately, I am encountering
some error. I just followed the howto on the
documentation on i2c dev-interface. It seems that i
can not configure the slave address. I just followed
the example on the documentation, and it says there
that I need to configure the slave address. Do I
really need it? Because when I try to read the
register without setting the slave address the
operation succeeds, but I am not sure if the values I
got are correct. I got a 0xffff when using an
i2c_smbus_read_word_data function. Here is the error
message printed...

# ./i2c_test
ioctl, cmd=0x703, arg=0x48
client->addr == addr
-EBUSY === arg == 48
Error ioctl

I am also attaching the simple application I made:

#define I2C_SLAVE     0x0703

int main(void)
{

  int i;
  int file;
  int adapter_nr = 0; /* probably dynamically
determined */
  char filename[20];
  int addr = 0x48; /* The I2C address */

  char reg = 0x0E; /* Device register to access */
  char buf[32];
  long res;

  sprintf(filename,"/dev/i2c-%d",adapter_nr);
  if ((file = open(filename,O_RDWR)) < 0) {
    printf("Error Opening File\n");
    exit(1);
  }

  if (ioctl(file,I2C_SLAVE,addr) < 0) {
    printf("Error ioctl \n");
    exit(1);
  }
  /* Using SMBus commands */
  res = i2c_smbus_read_word_data(file,reg);
        printf("read a word = %x \n",res);

  close(file);
  return 0;
}

Is there anyone who knows what the problem or may have
encountered the same problem? Please give me a hand on
this. I've been working on this very simple thing for
almost a month now. thank you.








__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the i2c mailing list