On BBB - How to use I2C-1 ? It exists but maybe needs pins setup ? BBB Rev C & Debian 9

On Beaglebone Black (BBB) - How to use I2C-1 ? It exists but maybe needs pins setup ? BBB Rev C & Debian 9.

1 Like

I2C-1 is used for internal power management and on board EEPROM access purposes.
Unless you have a specific need, I suggest you use I2C-2 for external control purposes.
It is already pinned-out by default on P9-17 and P9-18
— Graham

Thanks for the replay.

Herein is an example of the continued frustration when trying to learn about the BBB. I can never tell what is being talked about because it keeps changing - folders, commands, versions. This is a BBB Rev C that I bought last summer and put Debian 9 linux on it’s eMMC memory to boot from.

I just want an I2C bus that can access all of an 24C16 EEPROM that uses the address range from 50-57 hex. I can talk fine using bus ‘2’ on pins 19-20 of P9 to the first four of those addresses, but the upper ones are blocked tmk by the ‘cape’ auto-detect system. I’ve all kinds of conflicting and incomplete info on how to de-allocate these addresses. I’m not sure what the implications are for doing so, either - i.e. can I still use shields but manually configure, perhaps remove the on-board EEPROM, IDK. (I’ve not tried using shields yet) So instead I thought I’d be better off using I2C ‘1’ - the ones on pins 17-18.

My documentation and testing shows that there are three I2C busses, ‘0’, '1’and ‘2’. Bus ‘0’ is the internal system one you describe, Bus ‘1’ exists and is supposed to be on pins 17 and 18 but I can’t generate any activity on it (pin config ?) and bus ‘2’ I’ve used to access an EEPROM on P9 pins 19 and 20, but addreses 54-57 are used by the system. These bus ‘1’ and bus ‘2’ allocations are shown in the picture I’m including:


and here is what happens when I do i2cdetect -l:

i2cdetect -l
i2c-1 i2c OMAP I2C adapter I2C adapter
i2c-2 i2c OMAP I2C adapter I2C adapter
i2c-0 i2c OMAP I2C adapter I2C adapter

The ‘bus number’ I’m using is the one that i2c-detect and node.js library 12c-bus recognize. The on-board documentaion of my beagleboard, at local ethernet address “” shows a picture that says ‘2 I2C ports’. It calls the pins of one ‘I2C1_SCL’ and ‘I2C1_SDA’ on P9 pins 17 and 18. This port I want to turn on somehow. The second one is called by this document, ‘I2C2_SCL’ and ‘I2C2_SDA’ on pns 19 and 20 of P9. I’ve successfully used some addresses on this one by calling it bus ‘2’ in the i2cdetect et-al tools and in node.js.

An additional concern is that if I enable the I2C on port P9 pins 17-18, then will completely lose the ability to have an SPI port at the same time ? It’s unclear to me so far why so many I/O pins are shared, creating exclusions, yet so many other I/O pins are left as simple GPIO. I mean, can’t we have both two I2C and 2 SPI at the same time, all on different pins ?

I was hoping to use the BBB and especially think that it’s two PRU units could be handy. But I’m becoming disheartened by all this searching coming up with nothing, all the while just wishing it was in the Reference Manual.

Use the I2C1 pins on P9.24 and P9.26 and you won't conflict with any
SPI pins. Load the universal cape and use config-pin to set the pins
to i2c mode.

The core chip on the BBB (and just about _every_ non-trivial SoC) has
a lot of pin multiplexing to enable more features. The BBB suffers
slightly in addition due to the fact that not all pins are available
on the P8/P9 headers, further limiting options. A good reference for
the pin multiplexing is this spreadsheet (forked from selsinork, I
added details on pin usage for various CNC capes):


...and of course the AM335x data-sheet and TRM from TI.

It can be frustrating trying to work through the various pin
multiplexing options, but it would be a *LOT* more frustrating not
having _any_ pinmux options! :slight_smile:

Thank you for this response.

It’s good to know that I can indeed use other pins for the I2C1. I’m still new to the BBB and to Linux, so I need to look into how to ‘load the universal cape’. Is there a reference explaining this ?

I played around with config-pin some but am not sure what it’s really doing nor when it applies. For ex. I can tell a pin to be GPIO or I2C. If that is so, is config-pin changing just the electrical nature of the pins, like IN vs OUT, slew rate, etc. or is it also connecting it to a different I/O subsystem ? And if it’s connecting it to a different I?O subsystem like GPIO or I2C then is it also enabling and/or configuring that as well ?

When I first got the BBB I breezed over the provided docs on the unit and various sites, and bought Malloy’s book (outdated). Perhaps there was something in the provided doc’s that I didn’t realize would help me with this. I’ll have to take another look.

I come from an electronics background and understand what the hardware is doing, generally. Usually I program device access and application code in C or assembler, but on simpler systems like a standalone micro-controller (i.e. not an SOC). But the layers that Linux has, especially when it keeps changing, adds a huge amount of complexity and detail that I’m still getting used to. I want to use node.js to to a lot of this work. I’m taking an online course about embedded Linux to help with it all. I betting that it’ll pay off later, though.

I tried this git for info but it’s outdated and uses slots:

But my uEnv.txt file has the universal cape setting on by default anyways.

config-pin seems to work on some pins but not others: I get this :

sudo config-pin P9_26 i2c
P9_26 pinmux file not found!
bash: /sys/devices/platform/ocp/ocpP9_26_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp

But some other pins it works.
Missing pin mux data ? IDK how to check that or set it yet.

I meant to mention that I can access an I2C EEPROM at all addresses 50-57 on I2C-1 on pins 17-18. Now if I could only move those pins and get back the SPI for future use…

sudo /opt/scripts/tools/version.sh


debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
[sudo] password for debian:
dogtag:[BeagleBoard.org Debian Image 2018-06-17]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.03-00002-gac9cce7c6a]:[location: dd MBR]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.044344] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.045549] gpio-of-helper ocp:cape-universal: ready

Run these 7 command to get the kernel/u-boot and overlays to the latest version:

debian@beaglebone:~$ cd /opt/scripts/tools/
debian@beaglebone:/opt/scripts/tools$ git pull
debian@beaglebone:/opt/scripts/tools$ sudo ./developers/update_bootloader.sh
debian@beaglebone:/opt/scripts/tools$ sudo apt update
debian@beaglebone:/opt/scripts/tools$ sudo apt install --only-upgrade
bb-cape-overlays bb-customizations
debian@beaglebone:/opt/scripts/tools$ sudo ./update_kernel.sh
debian@beaglebone:/opt/scripts/tools$ sudo reboot