Enable I2C on your Rasberry Pi

The steps I followed to get i2c working:

Update to the latest firmware (needed for newer kernels):
Next update the kernel
Lastly add the module

Outputs:

https://github.com/Hexxeh/rpi-updatehttps:
root@raspberrypi:~# apt-get update
Get:1 http://ftp.uk.debian.org squeeze Release.gpg [1,672 B]
Ign http://ftp.uk.debian.org/debian/ squeeze/main Translation-en
Ign http://ftp.uk.debian.org/debian/ squeeze/main Translation-en_GB
Ign http://ftp.uk.debian.org/debian/ squeeze/non-free Translation-en
Ign http://ftp.uk.debian.org/debian/ squeeze/non-free Translation-en_GB
Get:2 http://ftp.uk.debian.org squeeze Release [111 kB]
Ign http://archive.qmh-project.org unstable Release.gpg
Ign http://archive.qmh-project.org/rpi/debian/ unstable/main Translation-en
Ign http://archive.qmh-project.org/rpi/debian/ unstable/main Translation-en_GB
Get:3 http://ftp.uk.debian.org squeeze/main armel Packages [6,424 kB]
Ign http://archive.qmh-project.org unstable Release
Ign http://archive.qmh-project.org unstable/main armel Packages
Get:4 http://archive.qmh-project.org unstable/main armel Packages [1,138 B]
Hit http://ftp.uk.debian.org squeeze/non-free armel Packages
Fetched 6,538 kB in 32s (202 kB/s)
Reading package lists... Done
W: Duplicate sources.list entry http://ftp.uk.debian.org/debian/ squeeze/main armel Packages (/var/lib/apt/lists/ftp.uk.debian.org_debian_dists_squeeze_main_binary-armel_Packages)
W: You may want to run apt-get update to correct these problems
root@raspberrypi:~#

root@raspberrypi:~# sudo apt-get install ca-certificates
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
openssl
The following NEW packages will be installed:
ca-certificates openssl
0 upgraded, 2 newly installed, 0 to remove and 42 not upgraded.
Need to get 1,053 kB/1,199 kB of archives.
After this operation, 3,043 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.uk.debian.org/debian/ squeeze/main openssl armel 0.9.8o-4squeeze12 [1,053 kB]
Fetched 1,053 kB in 0s (1,362 kB/s)
Preconfiguring packages ...
Selecting previously deselected package openssl.
(Reading database ... 46634 files and directories currently installed.)
Unpacking openssl (from .../openssl_0.9.8o-4squeeze12_armel.deb) ...
Selecting previously deselected package ca-certificates.
Unpacking ca-certificates (from .../ca-certificates_20090814+nmu3squeeze1_all.deb) ...
Processing triggers for man-db ...
Setting up openssl (0.9.8o-4squeeze12) ...
Setting up ca-certificates (20090814+nmu3squeeze1) ...
Updating certificates in /etc/ssl/certs... WARNING: Skipping duplicate certificate brasil.gov.br.pem
140 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
root@raspberrypi:~#

root@raspberrypi:~# wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && chmod +x /usr/bin/rpi-update
--2012-07-27 19:32:03-- http://goo.gl/1BOfJ
Resolving goo.gl... 173.194.41.168, 173.194.41.174, 173.194.41.163, ...
Connecting to goo.gl|173.194.41.168|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.github.com/Hexxeh/rpi-update/master/rpi-update [following]
--2012-07-27 19:32:03-- https://raw.github.com/Hexxeh/rpi-update/master/rpi-update
Resolving raw.github.com... 207.97.227.243
Connecting to raw.github.com|207.97.227.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5609 (5.5K) [text/plain]
Saving to: `/usr/bin/rpi-update'

100%[======================================>] 5,609 --.-K/s in 0s

2012-07-27 19:32:05 (54.6 MB/s) - `/usr/bin/rpi-update' saved [5609/5609]

root@raspberrypi:~#

root@raspberrypi:~# apt-get install git-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
git libcurl3-gnutls liberror-perl rsync
Suggested packages:
git-doc git-arch git-cvs git-svn git-email git-daemon-run git-gui gitk
gitweb
The following NEW packages will be installed:
git git-core libcurl3-gnutls liberror-perl rsync
0 upgraded, 5 newly installed, 0 to remove and 42 not upgraded.
Need to get 5,429 kB of archives.
After this operation, 11.3 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.uk.debian.org/debian/ squeeze/main libcurl3-gnutls armel 7.21.0-2.1+squeeze2 [254 kB]
Get:2 http://ftp.uk.debian.org/debian/ squeeze/main liberror-perl all 0.17-1 [23.6 kB]
Get:3 http://ftp.uk.debian.org/debian/ squeeze/main git armel 1:1.7.2.5-3 [4,800 kB]
Get:4 http://ftp.uk.debian.org/debian/ squeeze/main git-core all 1:1.7.2.5-3 [1,316 B]
Get:5 http://ftp.uk.debian.org/debian/ squeeze/main rsync armel 3.0.7-2 [349 kB]
Fetched 5,429 kB in 3s (1,809 kB/s)
Selecting previously deselected package libcurl3-gnutls.
(Reading database ... 47166 files and directories currently installed.)
Unpacking libcurl3-gnutls (from .../libcurl3-gnutls_7.21.0-2.1+squeeze2_armel.deb) ...
Selecting previously deselected package liberror-perl.
Unpacking liberror-perl (from .../liberror-perl_0.17-1_all.deb) ...
Selecting previously deselected package git.
Unpacking git (from .../git_1%3a1.7.2.5-3_armel.deb) ...
Selecting previously deselected package git-core.
Unpacking git-core (from .../git-core_1%3a1.7.2.5-3_all.deb) ...
Selecting previously deselected package rsync.
Unpacking rsync (from .../rsync_3.0.7-2_armel.deb) ...
Processing triggers for man-db ...
Setting up libcurl3-gnutls (7.21.0-2.1+squeeze2) ...
Setting up liberror-perl (0.17-1) ...
Setting up git (1:1.7.2.5-3) ...
Setting up git-core (1:1.7.2.5-3) ...
Setting up rsync (3.0.7-2) ...
update-rc.d: using dependency based boot sequencing
root@raspberrypi:~#

root@raspberrypi:~# rpi-update
Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS
Performing self-update
Autodetecting memory split
Using ARM/GPU memory split of 192MB/64MB
We're running for the first time
Setting up firmware (this will take a few minutes)
Using SoftFP libraries
/opt/vc/sbin/vcfiled: error while loading shared libraries: libvchiq_arm.so: cannot open shared object file: No such file or directory
If no errors appeared, your firmware was successfully setup
A reboot is needed to activate the new firmware
root@raspberrypi:~#

See https://github.com/Hexxeh/rpi-update/issues/7https: about the ‘libvchiq_arm.so’ error.

root@raspberrypi:~# rm /boot/.firmware_revision
root@raspberrypi:~# ldconfig
root@raspberrypi:~# rpi-update
Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS
Performing self-update
Autodetecting memory split
Using ARM/GPU memory split of 192MB/64MB
Updating firmware (this will take a few minutes)
Using SoftFP libraries
1853143535: vchiq_lib: Very incompatible VCHIQ library - cannot retrieve driver version
If no errors appeared, your firmware was successfully updated
A reboot is needed to activate the new firmware
root@raspberrypi:~#

See https://github.com/Hexxeh/rpi-update/issues/8https: about the new error.

root@raspberrypi:~# reboot
...
root@raspberrypi:~# rm /boot/.firmware_revision
root@raspberrypi:~# ldconfig
root@raspberrypi:~# rpi-update
Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS
Performing self-update
Autodetecting memory split
Using ARM/GPU memory split of 192MB/64MB
Updating firmware (this will take a few minutes)
Using SoftFP libraries
If no errors appeared, your firmware was successfully updated
A reboot is needed to activate the new firmware
root@raspberrypi:~#

Download and install the new kernel:
(thanks to http://www.bootc.net/projects/raspberry-pi-kernel/www.bootc.net)
root@raspberrypi:~# wget http://apt.bootc.net/debian/pool/main/l/linux-source-3.2.23-rpi1+/linux-image-3.2.23-rpi1+_1_armel.deb
--2012-07-27 20:27:42-- http://apt.bootc.net/debian/pool/main/l/linux-source-3.2.23-rpi1+/linux-image-3.2.23-rpi1+_1_armel.deb
Resolving apt.bootc.net... 87.117.218.55, 2001:8b0:49:200:5652:ff:fec6:215
Connecting to apt.bootc.net|87.117.218.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16250118 (15M) [application/x-debian-package]
Saving to: `linux-image-3.2.23-rpi1+_1_armel.deb'

100%[======================================>] 16,250,118 3.74M/s in 4.3s

2012-07-27 20:27:47 (3.61 MB/s) - `linux-image-3.2.23-rpi1+_1_armel.deb' saved [16250118/16250118]

root@raspberrypi:~# dpkg -i linux-image-3.2.23-rpi1+_1_armel.deb
Selecting previously deselected package linux-image-3.2.23-rpi1+.
(Reading database ... 47760 files and directories currently installed.)
Unpacking linux-image-3.2.23-rpi1+ (from linux-image-3.2.23-rpi1+_1_armel.deb) ...
Done.
Setting up linux-image-3.2.23-rpi1+ (1) ...

Hmm. There is a symbolic link /lib/modules/3.2.23-rpi1+/build
However, I can not read it: No such file or directory
Therefore, I am deleting /lib/modules/3.2.23-rpi1+/build

Hmm. The package shipped with a symbolic link /lib/modules/3.2.23-rpi1+/source
However, I can not read the target: No such file or directory
Therefore, I am deleting /lib/modules/3.2.23-rpi1+/source

Running depmod.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.2.23-rpi1+ /boot/vmlinuz-3.2.23-rpi1+

root@raspberrypi:~# cp /boot/vmlinuz-3.2.23-rpi1+ /boot/kernel.img
root@raspberrypi:~#

After another reboot:
root@raspberrypi:~# modprobe i2c-dev
root@raspberrypi:~# i2cdetect -r 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@raspberrypi:~#

Now just add devices ;-)

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>