Hi! Xizhou Wang, sorry for my late reply, and we did utilize the i2ctools to test the LCM, and we have specified the i2c slave address based on the hardware data sheet, however, the current problem we met is i2c connection or initialization...
Below are my testing code:
------------------------------------------------------------------------
int file;
int adapter_nr = 2; /* i2C3 for iMX53 */
char filename[20];
snprintf(filename, 19, "/dev/i2c-%d", adapter_nr);
file = open(filename, O_RDWR);
if (file < 0) {
printf("Error opening i2c-2 port!, file = %d\n", file);
exit(1);
}
else
printf("Opening i2c-2 successful! \n");
int addr = 0x40; /* The I2C slave address */
if (ioctl(file, I2C_SLAVE, addr) < 0) {
printf("i2c-2 device address specifying failed!, file = %d\n", file);
exit(1);
}
else
printf("i2c-2 device address specifying successful! \n");
__s32 res;
char buf[10];
buf[0] = 0x00;
res = write(file, buf, 1);
if (res != 1) {
printf("i2c-2 write failed!\n");
printf("res = %d\n", res);
exit(1);
}
else
printf("i2c-2 write successful! \n");
------------------------------------------------------------------------
My testing always failed on the "write", res = -1, and I got same result if I use the i2ctools by:$./i2cset 2 64 0
Have tried to re-wire the LCM to i2c-1, but nothing changed.
Does the i2c device need an initialization process? Can anyone kindly provide us an advise, suggestion, or hint?
BTW, we have tried to test the i2c protocal by welding TI BQ32000 which is an clock w. i2c interface, but we always failed on the ioctl command, due to it's i2c slave address is 11010000b which was complaint for too huge. We also got no clue on why i2c slave address can not exceed 0x77... any idea?
Thanks in advance!