BBB -- The pain of attempting to use I2C

BLUF: Unable to get a LCD address to be read from I2C port. Ultimate goal is to display text on LCD.

Greetings. I have finally thrown in the towel…I think I’ve screwed up my uEnv.txt file and will be starting from scratch (hopefully with some helpful advice).

As mentioned I am attempting to merely read the address of a I2C target (LCD display with PCF8574 backpack), which I will happily not claim to be a linux guru. As reviewing an exhaustive number of sites, articles, I loosely understand that $SLOTS is not the current development direction and to set everything up in /boot/uEnv.txt. Unfortunately, there is not a clear document describing UBoot for BBB and what the mysterious selections actually do which seem to be a form of arcane magic.

I used the following resources in my failed attempt:
https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays

https://github.com/beagleboard/bb.org-overlays/

https://stackoverflow.com/questions/47635808/enable-all-gpio-pins-on-beaglebone-including-the-emmc-pins

http://exploringbeaglebone.com/chapter6/

https://github.com/mvduin/bbb-pin-utils (show-pins)

i2ctools

(Note: Everything had been upgraded and very recently flashed to emmc. Unfortunately I can’t provide many details as I can not access the BBB anymore.
The overlays were enabled. All virtual overlays were disabled but emmc. The last attempt in trying to get the i2c to work was removing the emmc overlay. Yes, I know that was a bad idea.
Worse case I was going to be where I am now … rebuilding. The purpose of which was that in a few sites indicated that this overlay could cause issues for the buses.)

The following is from my last shell session where I believe I (stupidly) disabled my emmc from working correctly:

  1. System information

Linux beaglebone 4.9.78-ti-r94

  1. Use of correct overlay

uboot_overlay_addr0=/lib/firmware/BB-I2C2-00A0.dtbo

  1. Performed i2c check

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

  1. i2cdetect for i2c-2

i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

  1. show-pins results (for i2c-2)

P9.20 / cape i²c sda 94 slow rx up 3 i²c 2 sda i2c@4819c000 (pinmux_bb_i2c2_pins)
P9.19 / cape i²c scl 95 slow rx up 3 i²c 2 scl i2c@4819c000 (pinmux_bb_i2c2_pins)

  1. Connections:
    Using pins 19/20 (correctly connected SCL to SDA)
    Address 0x3F
    5V powered
    (working with arduino i2c)
    100 kHz

I’ve tried to use different i2c buses and overlays to no avail. I was not able to have the address revealed by using the above probing method. This really doesn’t seem difficult at all, and suspect the problem lies in my ignorance of linux and uBoot.
I plan to have the emmc re-flashed this evening and try again in the next few days, and would greatly appreciate any help, advice, and guidance.
In addition to this, are there any introductions for uBoot / overlays? I’ve skimmed http://www.denx.de/wiki/U-Boot/UBootFdtInfo, but I’m honestly seeking something more specific to the BBB so that I can digest the material with a device /system I can practice on.

V/r,
Walter

What version BeagleBone hardware?
What version software are you running?

Although you say you are running i2cdetect for bus two,
if you are running Debian 8.x or 9.x, you are actually running it for bus one.

For bus 2 , run i2cdetect -y -r 2

The Beaglebone Black (and I assume the same is true for the BeagleBone Blue) does NOT include the required pull up resistors for I2C on the board.
You must include them somewhere. A resistor in the range of 3.3K to 1.2K has to be connected from each of SDA and SCL to +3.3V.

For I2C-2 to work,you do not need to touch the uEnv.txt file or overlays.
I2C-2 is enabled, and pinned out to P9-19 and P9-20 by default in Debian 8.x and Debian 9.x

— Graham

Thank you for your reply!

Although you say you are running i2cdetect for bus two,

if you are running Debian 8.x or 9.x, you are actually running it for bus one.

For bus 2 , run i2cdetect -y -r 2

I’ll admit that has been confusing which is which. I’ve been going through Derek Molly’s Exploring Beaglebone, so I had stuck with that nomenclature.

The Beaglebone Black (and I assume the same is true for the BeagleBone Blue) does NOT include the required pull up resistors for I2C on the board.

You must include them somewhere. A resistor in the range of 3.3K to 1.2K has to be connected from each of SDA and SCL to +3.3V.

I certainly am not 100%, but I thought some of the I2C buses on the BBB had internal pullups. Either way, the I2C LCD Backpack does.

The good news is that I did more looking around and came across another article (http://hardware-libre.fr/2014/03/en-raspberry-pi-using-a-4x20-characters-display/) that indicated that care must be given to logic levels. I had not taken this into consideration (transfering from arduino to BBB) and assumed. The Arduino has 5V I2C logic whereas the BBB (and other ARM chips) require 3.3V. Powering 3.3V to the backpack resulted in the address being correctly detected. Since the LCD requires 5V I have removed the power pin and will power the LCD separately with the backpack at 3.3V. Will test tomorrow.

Ah, not the best idea, you need to translate all signals from 5v to 3.3v..

Regards,