Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => iMX233 => Topic started by: koennie on October 31, 2012, 01:18:59 PM

Title: I2C
Post by: koennie on October 31, 2012, 01:18:59 PM
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
Title: Re: I2C
Post by: olimex on October 31, 2012, 01:26:43 PM
which Linux/kernel etc you are using?
check this: http://olimex.wordpress.com/2012/09/25/imx233-olinuxino-i2c-tutorial-using-wii-nunchuk/
Title: Re: I2C
Post by: koennie on October 31, 2012, 01:39:23 PM
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.
Title: Re: I2C
Post by: koennie on October 31, 2012, 05:34:15 PM
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
Title: Re: I2C
Post by: jlumme on November 01, 2012, 10:19:14 AM
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*
Title: Re: I2C
Post by: koennie on November 01, 2012, 12:37:22 PM
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...
Title: Re: I2C
Post by: olimex on November 01, 2012, 01:36:58 PM
if you use the Arch Linux image you will have I2C and GCC :-)
Title: Re: I2C
Post by: koennie on November 01, 2012, 02:26:54 PM
Thanks!