hi,I have a LogicPD's OMAPL138 EVM board, now i want to test this board's i2c driver in linux.In the LogicPD evm's schemetic, OMAPL138's I2C0 port is connect to IO EXPANDER tca6416pw,and this chip output pin is connect to LED, so my experience purpose is light this led from i2c0 driver in linux.
when logic evm linux kenerl started, i could see device node /dev/i2c-1. so i write code like follow:
#define CMD_BYTE_INPUT0 0x00
#define CMD_BYTE_INPUT1 0x01
#define CMD_BYTE_OUTPUT0 0x02
#define CMD_BYTE_OUTPUT1 0x03
#define CMD_BYTE_POLARITY0 0x04
#define CMD_BYTE_POLARITY1 0x05
#define CMD_BYTE_CONFIG0 0x06
#define CMD_BYTE_CONFIG1 0x07
#define I2C_ADDR_GPIO_EX (0x0021)
#define I2C_SLAVE 0x0703
#define I2C_TENBIT 0x0704
const char *i2c0="/dev/i2c-1";
char i2cdata[3];
int main(int argc,char *argb[])
{
int i2cfd;
char gpio_bit=0;
printf("opening i2c:%s\n",i2c0);
if(i2cfd=open(i2c0,O_RDWR)<0)
{
printf("open i2c fail!\n");
return i2cfd;
}
else
{
printf("open successful!\n");
}
ioctl(i2cfd,I2C_TENBIT,0);
ioctl(i2cfd,I2C_SLAVE,I2C_ADDR_GPIO_EX);
i2cdata[0]=CMD_BYTE_POLARITY0;
i2cdata[1]=0;
i2cdata[2]=0;
printf("write first cmd\n");
if(write(i2cfd,&i2cdata[0],3)==-1)
{
printf("write first cmd error\n");
}
....
....
....
}
i compiled this file successful,but when i executed in linux,it has nothing from I2C0 port pin(I check i2c0 port pin by oscilloscope).
what's wrong about this?could you give me some guide for this?
thanks in advance!