Using the I2C port with Ubuntu on the Beagleboard Xm

Hi All,
  I am getting very frustrated with my Beagleboard Xm or perhaps it’s
my lack of knowledge. I originally bought the BB because I need a
small flexible system with an I2C port, that I could write C programs
to communicate with other I2C devices. I have many years’ experience
in IT but not with Unix. So was very pleased with myself when I
managed to install a predefined Ubuntu 10.10 image. This was with the
aid of some very clear instructions I found on the web.
  Not having any Unix based kit, I created Ubuntu 10.10 virtual image
running under VMWare on a Windows XP desktop. Using the instructions I
then created a MicroSD image which I booted on the BB and after a few
minutes of it expanding the system, I had a working Ubuntu 10.10
system which I have since updated to version 11.04.
  By downloading various development packages I have been able create
some C programs.
  My frustration is that the system does have any I2C device drivers
installed by default. From much research it would seem I have to
compile my own custom kernel to include the I2C drives. Yet another
learning curve! I found some useful instructions on website
http://www.howtogeek.com/howto/ubuntu/how-to-customize-your-ubuntu-kernel/
from which I have made progress. I have got to the point of compiling
the kernel using the command
fakeroot make-kpkg –initrd –append-to-version=-custom kernel_image
kernel_headers
but then get the following errors:
  CHK include/generated/compile.h
  UPD include/generated/compile.h
  CC init/version.o
/bin/sh: arm-linux-gnueabi-objdump: not found
  CC init/do_mounts.o
/bin/sh: arm-linux-gnueabi-objdump: not found
  CC init/do_mounts_rd.o
/bin/sh: arm-linux-gnueabi-objdump: not found
  CC init/do_mounts_initrd.o
/bin/sh: arm-linux-gnueabi-objdump: not found
  CC init/do_mounts_md.o
/bin/sh: arm-linux-gnueabi-objdump: not found
  LD init/mounts.o
/bin/sh: arm-linux-gnueabi-ld: not found
make[2]: *** [init/mounts.o] Error 127
make[1]: *** [init] Error 2
make[1]: Leaving directory `/usr/src/linux-source-2.6.38'
make: *** [debian/stamp/build/kernel] Error 2

It would seem that I need to load a package ‘binutils-arm-linux-
gnueabi’ which I am having trouble doing.

Can anyone suggest my way forward to get a suitable development system
for C programs with access to the BB I2C port? Am I going about this
in the wrong way? Is there a better already created image, perhaps in
a different flavour of Unix I should use?
  I would really appreciate anyone’s suggest on the best way forward.

    Ernie

I am using "lm_sensors" and PERL script for I2C. It works well for me. You need to configure the GPIO pins for I2C; you can do this in an user application without re-compile the kernel.

Hi All,
I am getting very frustrated with my Beagleboard Xm or perhaps it’s
my lack of knowledge. I originally bought the BB because I need a
small flexible system with an I2C port, that I could write C programs
to communicate with other I2C devices. I have many years’ experience
in IT but not with Unix. So was very pleased with myself when I
managed to install a predefined Ubuntu 10.10 image. This was with the
aid of some very clear instructions I found on the web.
Not having any Unix based kit, I created Ubuntu 10.10 virtual image
running under VMWare on a Windows XP desktop. Using the instructions I
then created a MicroSD image which I booted on the BB and after a few
minutes of it expanding the system, I had a working Ubuntu 10.10
system which I have since updated to version 11.04.
By downloading various development packages I have been able create
some C programs.
My frustration is that the system does have any I2C device drivers
installed by default. From much research it would seem I have to
compile my own custom kernel to include the I2C drives. Yet another
learning curve! I found some useful instructions on website
http://www.howtogeek.com/howto/ubuntu/how-to-customize-your-ubuntu-kernel/
from which I have made progress. I have got to the point of compiling
the kernel using the command
fakeroot make-kpkg –initrd –append-to-version=-custom kernel_image
kernel_headers
but then get the following errors:
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
/bin/sh: arm-linux-gnueabi-objdump: not found
CC init/do_mounts.o
/bin/sh: arm-linux-gnueabi-objdump: not found
CC init/do_mounts_rd.o
/bin/sh: arm-linux-gnueabi-objdump: not found
CC init/do_mounts_initrd.o
/bin/sh: arm-linux-gnueabi-objdump: not found
CC init/do_mounts_md.o
/bin/sh: arm-linux-gnueabi-objdump: not found
LD init/mounts.o
/bin/sh: arm-linux-gnueabi-ld: not found
make[2]: *** [init/mounts.o] Error 127
make[1]: *** [init] Error 2
make[1]: Leaving directory `/usr/src/linux-source-2.6.38'
make: *** [debian/stamp/build/kernel] Error 2

It would seem that I need to load a package ‘binutils-arm-linux-
gnueabi’ which I am having trouble doing.

If your host is ubuntu, that can be installed via:

sudo apt-get install gcc-arm-linux-gnueabi-

Then just pass:
CROSS_COMPILE=arm-linux-gnueabi-

Can anyone suggest my way forward to get a suitable development system
for C programs with access to the BB I2C port? Am I going about this
in the wrong way? Is there a better already created image, perhaps in
a different flavour of Unix I should use?

Use my demo image liste here:

http://elinux.org/BeagleBoardUbuntu#Demo_Image

Which has i2c port 2 enabled by default..

Then if you need "more" i2c device drivers, i have a pretty easy
script that takes care of most of the work of rebuilding the kernel:

Regards,

Hi Eric,

   Thanks for the information, I will investigate your suggestions.

Hi Eric,

   Thanks for the information, I will investigate more.

   Could you please give more details on how to configure I2C without
re-compiling the kernel?

       Thanks aain Ernie

HI Ernie,

I think I was wrong. Only the GPIO pin can be configured in user space program because GPIO does not need device driver support.
You need to do the configuration in kernel source code and re-compile the kernel. The file to modify is ./arch/arm/mach-omap2/board-omap3beagle.c. Look for the function "omap3_beagle_init". Do the pin configuration before the "omap3_beagle_i2c_init" function call. Also check the function "omap3_beagle_i2c_init" to see if the I2C bus #2 is commented out or not.

I think you can configure the 2 GPIO pins for I2C bus in uboot source code and rebuild it. In this case, you do not need to re-compile the kernel. I have done this before I modified the kernel source code and build my own kernel.

If you can do bit-banging, you can implement your own I2C utility in user space in C without the device driver support. Here is the thread for GPIO pin configuration:
http://markmail.org/message/odcwkpi7lturhzt5

-Eric

Eric,

    Thank you again for your reply, I will look into your suggestions.

       Ernie

Hi Robert,

  Thank you for your reply. I followed your instructions and very
quickly had my BeagleBoard Xm running your image. I can the I2c
devices listed in the /dev folder, so it all looks good. All I need to
do now is to get my I2C device built so I can test the interface.

  Not have used Ubuntu very much the only version I have used so far
had a graphical interface, how would go about installing GUI package
on your system?

    Ernie

The quickest/easiest is just to run "sudo apt-get install xubuntu-desktop"...

Although if you less then 2.5Gb of space, you'll have to cut that
down, in that case there's a script under /boot/uboot/tools/
minimal_xfce.sh...

Regards,

Hi Robert,

   Thanks again, I tried installing xubuntu-desktop which worked in
the main, until towards the end when it could not find some files.
   Checked the website where it was getting them found and correct
some version of the file were missing.

     e.g. Failed to fetch
http://ports.ubuntu.com/ubuntu-ports/pool/main/c/cups/cups-bsd_1.4.6-5ubuntu1.3_armel.deb

   Could you suggest what the problem is?

   When you use the command "sudo apt-get install xubuntu-desktop" is
"xubuntu-desktop" a file that contains a list of files to download and
install?

             Thanks again Ernie