[Voyage-linux] ALIX.2D2 and I2C EEPROM
John Coltrane
(spam-protected)
Wed May 2 20:30:01 HKT 2012
Hello again,
you have written that your eeprom device is external, connected to the
Alix via the i2c bus ?!
Are you able to read something from the device, something that makes sense ?
cheers, John
On 05/02/2012 11:24 AM, Markus Cords wrote:
> Hello John,
>
> 1. yes, /dev/i2c-0 exist
> 2. crw-rw---- 1 root i2c 89, 0 Jan 1 2000 /dev/i2c-0
> 3. user root is using the Software
>
> lg, markus
>
>
>
> Am 02.05.2012 11:15, schrieb John Coltrane:
>> Hello Markus,
>>
>> 1. does /dev/i2c-0 exist ?
>> 2. what are it's permissions ?
>> 3. has the user you try to run your software permissions to write to
>> /dev/i2c-0 ?
>>
>> cheers, John
>>
>>
>> On 05/01/2012 01:26 PM, Markus Cords wrote:
>>> Hello,
>>>
>>> I have a ALIX 2D2 Board with Voyage 0.8.
>>> My Problem is to access the I2C EEPROM (externel) with my programm.
>>>
>>> root at voyage:/tmp# i2cdetect -y 0
>>> 0 1 2 3 4 5 6 7 8 9 a b c d e f
>>> 00: -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 40: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- --
>>> 50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> 70: -- -- -- -- -- -- -- --
>>> root at voyage:/tmp#
>>>
>>>
>>> The Address of the eeprom is 0x50
>>>
>>>
>>> with my programm:
>>> root at voyage:/tmp# ./main
>>> Failed to write to the i2c bus.
>>>
>>>
>>> [code]
>>>
>>> #include<errno.h>
>>> #include<string.h>
>>> #include<stdio.h>
>>> #include<stdlib.h>
>>> #include<unistd.h>
>>> #include<linux/i2c-dev.h>
>>> #include<sys/ioctl.h>
>>> #include<sys/types.h>
>>> #include<sys/stat.h>
>>> #include<fcntl.h>
>>>
>>> void main(void) {
>>> int file;
>>> char *filename = "/dev/i2c-0";
>>> if((file = open(filename, O_RDWR))< 0)
>>> {
>>> perror("Failed to open the i2c bus");
>>> exit(1);
>>> }
>>>
>>> int addr = 0x50;
>>> if (ioctl(file, I2C_SLAVE, addr)< 0) {
>>> printf("Failed to acquire bus access and/or talk to slave.\n");
>>> exit(1);
>>> }
>>> char buf[10] = {0};
>>>
>>> buf[0] = 0x00;
>>> buf[1] = 0xAA;
>>> if(write(file, buf, 2) != 1)
>>> {
>>> printf("Failed to write to the i2c bus.\n");
>>> printf("\n\n");
>>> }
>>> }
>>> [/code]
>>>
>>> I hope anybody can help me.
>>>
>>> Thanks,
>>> Markus
>>>
>>> _______________________________________________
>>> Voyage-linux mailing list
>>> Voyage-linux at list.voyage.hk
>>> http://list.voyage.hk/mailman/listinfo/voyage-linux
>>
>> _______________________________________________
>> Voyage-linux mailing list
>> Voyage-linux at list.voyage.hk
>> http://list.voyage.hk/mailman/listinfo/voyage-linux
>
>
> _______________________________________________
> Voyage-linux mailing list
> Voyage-linux at list.voyage.hk
> http://list.voyage.hk/mailman/listinfo/voyage-linux
More information about the Voyage-linux
mailing list