I2C

Started by koennie, October 31, 2012, 01:18:59 PM

Previous topic - Next topic

koennie

Hi all,

I want to work with I2C. But I am having problems accesing the I/O pins.

root@olinuxino:~# ./i2c -w 0 0x48 1 0x00
SLAVE ADDRESS: 0x48
NUMBER OF BYTES TO WRITE: 1
MEMORY ALLOCATED AT ADDRESS: 0x12008
Failed to open control file: No such file or directory
/dev/i2c-0 --> root@olinuxino:~#


It seems I have to enable /dev/i2c-0 somehow...
Can anyone help me?

Thanx

olimex


koennie

Currently working with Open Embedded generated Kernel 2.6.35

The rootfs I have tried the pre compiled debian and TV-concole enabled from Dimitar.
I also compiled my own with open embedded.

On all of these: /dev/i2c-0 seems to be missing.

I have checked the I2C pins on the uext connector as described in the nunchuck tutorial.

koennie

The problem might be the fact that I compiled the program on my host PC
So the executable runs but doesn't have the right dependencies.

I would like to compile the program on the olinuxino, how can I enable GCC there?

Thanx

jlumme

With "file" command, you can always see the type of the executable.
Indeed, you do need to either a) cross-compile your program b) get compiler on your distribution you are using on the olinuxino, and compile there.

If you are using a debian based distribution, such as Ubuntu, you can get arm compiler with this:
sudo apt-get install gcc-arm-linux-gnueabi
If your package manager doesn't have one, you can always compile one for yourself, you can find instructions for that around..

After that you need to compile your program with passing the cross compiling prefix to make:
make ARCH=arm CROSS_COMPILE=gcc-arm-linux-gnueabi- *your_normal_make_stuffs*

koennie

Thanx, I already compiled the program with arm-linux-gcc.
This way the executable works, but /dev/i2c-0 can't be found.

The problem is I have to build the program on the olinuxino, because that way i2c will be enabled there.

I have tried installing arm-linux-gcc on the sd card but this didn't seem to work.
It is described in the MOD-IO2 README.pdf:
First you must compile the i2c-tool:
# gcc i2c-tool.c -o i2c-tool

I just can't seem to find any instructions on how to enable gcc on the olinuxino...

olimex

if you use the Arch Linux image you will have I2C and GCC :-)

koennie