Hello team, I'm using the following code in mini2440 and the write function is always returning -1: ///////////////////////////////////////////////////////// ... fd=open("/dev/i2c/0", O_RDWR); if(fd<0) { printf("Error open!\n"); } buf[0]=0x00; buf[1]=0xff; io=ioctl(fd,0x703,0x50); if(io<0) { printf("Error ioctl!\n"); } wbyte=write(fd,buf,2); if(wbyte!=1) { printf("Wbyte: %d\n",wbyte); printf("Error write!\n"); } ... //////////////////////////////////////////////////////// Am I doing anything wrong? Best Regards, Leandro Ribeiro.
mini2440 I2C
You can try to add more specific error string. Something like: wbyte=write(fd,buf,2); if (wbyte < 0) { perror("write"); } You can post then output.
OK, thanks! I'm doing it now. But it is always returning -1. Why I can't write at the bus? Is it necessary to connect a device in the bus or I can write without any device just for testing?
If the device doesn't acknowledge the transfer then the result will be -1. I used that to scan all the addresses to see which addresses where in use... Thus if the device is not connected or you are using the wrong address then you will get -1. Thanks, Errol
I have connect MINI2440 with electronic compass (HMC5843) and run i2c example program with below contruction and then I got that below error,..that seem MINI2440 can't see my device ........What wrong ??? help me please mini2440:/usr/local/Qt/Project/i2c# ./i2c -r Open /dev/i2c-0 with 8bit mode Reading 256 bytes from 0x0 Error i2c_write_1b: No such device or address Error at line 48: read error sysmsg: No such device or address mini2440:/usr/local/Qt/Project/i2c# ./i2c -w Open /dev/i2c-0 with 8bit mode Writing 0x00-0xff into 24C08 0000| 00 Error i2c_write_2b: No such device or address Error at line 71: write error sysmsg: No such device or address
hello experts, i need the min2440 documentation(all). can anyone provide it to me because ftp:/ server site cannot respond. i tried many times but error occured. thank you.
Hello r@wboom, You can send email to me ,I will give you the newest zimage .My email is jiameijiang@friendlyarm.com
hello can anyone tell me...why we use ioctl(fd, 0X703, 0X50). as 0X703 ans 0X50; i didn't understand.