How to enable I2C P9_24 & P926 (BBB RevC)?

I’m trying to enable headers pins P9_24 & P9_26 for I2C communication with my SL030 StrongLink RFID reader.

From the documentation P9_24 & P9_26 are I2C-1 in Mode 3. By default the pin names are UART1_TXD & UART1_RXD respectively.

From this source, I2C-1 is at address 0x4802_A000.

In the command line I try the following to scan available I2C mappings:

# ls -l /sys/bus/i2c/devices/i2c-*

lrwxrwxrwx 1 root root 0 Jan 1 2000 /sys/bus/i2c/devices/i2c-0 → …/…/…/devices/ocp.3/44e0b000.i2c/i2c-0
lrwxrwxrwx 1 root root 0 Jan 1 2000 /sys/bus/i2c/devices/i2c-1 → …/…/…/devices/ocp.3/4819c000.i2c/i2c-1

It’s clear I2C at address 0x4802_A000 isn’t enabled.

So, according to this source, I can use the following command to enable the third I2C bus:

# echo BB-I2C1 > /sys/devices/bone_capemgr.9/slots

Scanning the I2C mappings again produces the following:

# ls -l /sys/bus/i2c/devices/i2c-*
lrwxrwxrwx 1 root root 0 Jan 1 2000 /sys/bus/i2c/devices/i2c-0 → …/…/…/devices/ocp.3/44e0b000.i2c/i2c-0
lrwxrwxrwx 1 root root 0 Jan 1 2000 /sys/bus/i2c/devices/i2c-1 → …/…/…/devices/ocp.3/4819c000.i2c/i2c-1
lrwxrwxrwx 1 root root 0 Sep 30 01:51 /sys/bus/i2c/devices/i2c-2 → …/…/…/devices/ocp.3/4802a000.i2c/i2c-2

Ok, great. It looks like I2C at address 0x4802_A000 is now enabled, mapped as I2C-2.

Question: After rebooting Linux I2C-2 disables again. How can I make the change permanent?

Using i2cdetect tool, my SL030 RFID Reader still doesn’t show up when probing I2C-2:

# i2cdetect -y -r 2

All addresses are displayed in a grid as ‘–’.

I did a little more searching around about the SL030 over I2C bus and came across a comment in this python code mentioning that a baud rate at 100k won’t work with the SL030 RFID Reader, and should be changed to 200k.

Then I ran this command to find out the I2C baud rate:

# dmesg | grep i2cdmesg | grep i2c

[ 0.130912] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 0.131827] input: tps65217_pwr_but as /devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0
[ 0.140210] omap_i2c 44e0b000.i2c: unable to select pin group
[ 0.140729] omap_i2c 4819c000.i2c: bus 1 rev0.11 at 100 kHz
[ 0.142049] omap_i2c 4819c000.i2c: unable to select pin group
[ 0.753827] i2c /dev entries driver
[ 55.628003] omap_i2c 4802a000.i2c: bus 2 rev0.11 at 100 kHz
[ 55.628066] omap_i2c 4802a000.i2c: unable to select pin group

It’s clear to see that I2C 4802_A000 is running at 100 kHz.

Question: How can I change the baud rate to 200 kHz?

I assume all of my step above are correct when trying to enable P9_24 & P9_26. If not, please do correct me. This is my first time usage of Linux & I2C.

Thank you very much for your time. All help is greatly appreciated. Please note I am a newbie to Linux, so step by step guides are very welcome!

Sorry, I forgot to mention I am using the latest version of Debian for BeableBone Black RevC.

Just thought I’d add an update to my findings here, if to only benefit those in the same boat as me.

It looks like Device Tree Overlays are what I’m looking for.
Adafruit have written a nice little guide of this here.

I must admit, little parts of it go over my head at the moment, but it is 1:20am after a long day at work. After a couple re-reads and trial and error, I’m sure it will sink in.

There is also a nice guide to Device Tree Overlays here. This link is also referenced in the Adafruit guide.

Luckily for me, Adafruit discuss pins P9_24 & P9_26 in their example! Although it is for enabling UART1… but close enough.

Again… to add more information on this matter, Derek Molloy has created a great video step-by-step guide about device tree overlays.

Worth checking out… http://derekmolloy.ie/gpios-on-the-beaglebone-black-using-device-tree-overlays/

I still can’t get i2cdetect to recognise the SL030 on address 0x50 on I2C-2 (I2C2-1 in the documentation, P9_24 & P9_26).
I believe I can enable P9_24 & P9_26 with a device tree overlay correctly. When setting the Pullup or Pulldown resistors in the overlay, the changes can be seen using a multimeter on the output pins, so something is working. I will need to get my hands on an oscilloscope to check/measure if the clock & data lines are working correctly. I’ve even tried adjusting the Clock Frequency from 100k all the way up to 400k.

When the SL030 is connected to I2C-1 (really I2C-2) it does show up in i2cdetect. Though it does disappear at times. Why? I have no idea. Resetting the SL030 seems to do the trick.

To enable the real I2C-1, you can either load the overlay BB-I2C1A1 in ‘lib/firmware’ or make your own overlay from this example https://github.com/beagleboard/devicetree-source/blob/master/arch/arm/boot/dts/BB-I2C1A1-00A0.dts

Any advice is greatly welcome!

I’ve hooked up P9_24 (I2C1_SCL) to my Oscilloscope and observed the following results with i2cdetect:

  • When using the following command to enable all I2C ports, P9_24 remains a constant HIGH logic. i.e. no clock signal detected
    # echo BB-I2C1 > /sys/devices/bone_capemgr.9/slots

  • When creating my own I2C device tree overlay, based on this, to enable the real I2C-1 (named I2C-2) the clock line change of logic is observable on my scope when trigerred with i2cdetect.

    # i2cdetect -y -r 2

    Below is a screenshot from my scope. Clearly the real I2C-1 is now enabled.

The only problem I now face is that i2cdetect isn’t listing my StrongLink SL030 RFID device at address 0x50. It’s as if the SL030 just doesn’t respond…

Any advice is welcome!

Here are a few more scope output screenshots of I2C-2 (really I2C-1).

Yellow = SDA

Blue = SCL

As another means of checking that the Device Tree Overlay, from this source, is working, I changed the clock-frequency to 200kHz to ensure the same output can be seen on the oscilloscope.

After loading the device tree overlay and running i2cdetect, I had the following output on my scope.

Notice in the image above that my scope is now reading 147.2kHz on the clock line as opposed to the previous measurement of 86.35kHz when the clock-frequency was set to 100kHz.

Why it’s reading 147kHz rather than 200kHz is a mystery to me. But at least it proves it’s changing as I alter & reload the device tree overlay.

As always, any input to this is much welcome.

Hi Robert, did you ever get this to work? If so, would you mind sharing the trick?