bringing up i2c on the raspberry pi with arch linux


I finally figure out why i2c wasn’t working on my R-Pi. Not all the Arch Linux packages had been installed, and I needed to tweak yet another configuration file. Here’s the steps I followed to get i2c to work, as well as the i2cdetect utility.

  1. Install i2c-tools (already done earlier): sudo pacman -S i2c-tools
  2. Install lm_sensors (lower case ‘L’): sudo pacman -S lm_sensors
  3. Open /etc/modules-load.d/raspberrypi.conf in your editor of choice.
  4. Add “i2c-dev” at the bottom of the file, then save it.
  5. Reboot the Raspberry Pi.

You can see the results of this short amount of work in the screen capture at the top of this post. The utility i2cdetect now detects the i2c buss (with nothing on it at the moment). But at least it finds the devices. You can also see the devices under /dev with a simple file listing.

I found these little pearls of wisdom on this web page: DS1621 with Raspberry Pi/ArchLinuxARM

It would have been nice to have found them on the Arch Linux ARM Wiki. Believe me, I looked.

This was done on the twm file system. I’m going to update the bare Arch Linux file system, make a backup of that, and then put it out on the web for others to pick up. I’ve made my mind up that I’m going to put out a far more useful Arch Linux image for the Raspberry Pi. Arch Linux is good, and it’s powerful, but beginners wanting to use Arch Linux shouldn’t have to run the gauntlet I’ve been running to get the system to a reasonable level of operability. I’m going to put images of both my cards, one with twm and one without. They’ll be compressed 8GB images. I don’t know how far I can compress them, but believe me when I say that the compressed images will be at least 1GB in size.

I plan to make the images available via Github. When they are available I’ll post about it here. I intend to keep the images up to date with the latest Arch package releases (pacman -Syu), hopefully about every 60 days.

And for as long as I work with the R-Pi, I intend for this blog to be a resource for absolutely correct information about configuring and operating the R-Pi. I may wind up duplicating some work, but you can rest assured that I’ve tried everything I write about, and that it works reliably and consistently, at least with the hardware I own. And when I make a mistake (not if), it will be publicly corrected.

Update

I’ve updated i2c in both the base 8 GB and the base+twm 8 GB Arch Linux systems. I backed up the cards then zipped the resultant images. The base image shrank down to 653 MB and the base+twm image shrank down to 742 MB. Now I need to reach an understanding with Github about hosting the images for me. We shall see…

Update 28 February 2015

I no longer use Arch Linux. I’ve switched to Raspbian on the original Raspberry Pi, and will use a regular distribution on my Raspberry Pi 2. I do not recommend Arch Linux for either Raspberry.

tweaking arch on the pi

I continue to tweak the twm configuration. I’ve now found out what fonts to use (9×15 and 10×20 are the two I use currently). There’s a lot less eyestrain using the Samsung 1920 x 1080 monitor. And I like twm. It’s old school, like me.

I commented in an earlier post about fixing the alt function key functionality with the aluminum Apple keyboard, like this one:

If you read the Arch documentation on “fixing” the Apple keyboard function keys, you’d be led to believe the following command:

echo 2 > /sys/module/hid_apple/parameters/fnmode

which does work from the command line, will work if typed verbatim into /etc/modprobe.d/hid_apple.conf. It won’t. If you want the alt function key functionality fix to be permanent, then you need to place the following into hid_apple.conf:

options hid_apple fnmode=2

Now when the Raspberry Pi reboots with its Apple keyboard the alt function keys behave as expected, at least from the command line. If you have twm up and running, then the alt functionality stops working, meaning you can’t switch form the twm desktop to any of the other virtual desktops. Another minor issue to solve another day.

I’ve dropped the RPI.GPIO code from Sourceforge onto the twm card and I’ve compiled it. I also installed the i2c and smbus Arch ARM packages, but the i2c tools aren’t working. For whatever reason /dev/i2c isn’t there and thus i2cdetect fails. That’s a more important issue to investigate. If the Arch ARM kernel wasn’t compiled with GPIO support, then there’s not much use to continue with Arch. Everything I’ve read so far is using Raspbian for its examples, but I’m not too crazy about how that’s set up out-of-the-box.

Before I get all crazy, I think I’ll look at the kernel modules and see what’s been installed, and see if the GPIO module(s) are being loaded. I’ve not had any reason to suspect there’s a problem so far, but then I wasn’t ready to start working with the SoC peripherals. Now I am.

Update

I fixed the i2c issue. Read the next post in the series.