Tool/software:
Hi,
I tried to communicate with the I2C device in the J721e EVM Board(Common board) using C code. But I cannot access the device. I am attaching my code here.
void Config_value(); int i2cfile = 0; void main() { char *bus = "/dev/i2c-3"; // assigning a pointer to the path //Opening the bus if((i2cfile = open(bus, O_RDWR)) < 0) { printf("Failed to open the bus. \n"); exit(1); } // Get I2C device, if(ioctl(i2cfile, I2C_SLAVE, 0x28)<0) { printf("Error\n"); exit(1); } printf("\nCommunication Started\n"); Config_value(); } void Config_value() { char i2cconfig[3] = {0}; i2cconfig[0] = 0x0E;//Configuration register 14 i2cconfig[1] = 0x3F; write(i2cfile,i2cconfig,2); }
After executing the above code I checked the register using the command "i2cget -f -y 3 0x22 0x0E b". The value is not changing.
I can change the value using "i2cset -f -y 3 0x22 0x0E 0x3F b". Slave address is 0x22.
Regards,
Rejin