BeagleBone Green Grove i2c issues

1,263 views
Skip to first unread message

Ben Shapiro

unread,
Oct 16, 2015, 1:12:41 PM10/16/15
to BeagleBoard
(apologies if this is a double-post... my first submission does not seem to have gone through)

Hi,

I've been having a hell of a time getting the BeagleBone Green to see Grove devices connected to it.

Running i2cdetect -r 0 results in the following output regardless of which Grove sensors are connected:

# 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: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Similarly, i2cdetect -r 1 always results in the following output:

# i2cdetect  -r 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1 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: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I tried reflashing my board with the 2015-07-28 eMMC Flasher (console) image. My current uname -a output is: Linux greenbone 3.8.13-bone72 #1 SMP Tue Jun 16 21:36:04 UTC 2015 armv7l GNU/Linux.
However, flashing did not help.

I also tried on a second board. Same problem.
The BBG Alarm System code posted on the BBG product page also will not run.

Am I doing something wrong?

Thank you,
Ben




William Hermans

unread,
Oct 18, 2015, 2:10:59 PM10/18/15
to beagl...@googlegroups.com
Hi Ben,

Have you resolved your issue yet ? Personally I have not used I2C on any Beaglebone yet. However I thought I might mention that for most ( perhaps all ) devices of this nature on the Beaglebone's you need to load a device tree file, which in turn often loads needed kernel module drivers, sets the pins up, etc.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Shapiro

unread,
Oct 18, 2015, 3:25:28 PM10/18/15
to BeagleBoard
Hi William,

Thanks for writing back. I haven't resolved it, no.
I can't find any info about the proper device tree in the BBG documentation. Do you know where I could find one that includes the grove connector busses?

Ben

William Hermans

unread,
Oct 18, 2015, 4:51:40 PM10/18/15
to beagl...@googlegroups.com

Hi William,

Thanks for writing back. I haven't resolved it, no.
I can't find any info about the proper device tree in the BBG documentation. Do you know where I could find one that includes the grove connector busses?

Ben

Well, not exactly but . . . First, you need to be aware that every board, be it Beaglebone black, white, or green all have their own initial device tree file which is board specific that gets loaded at boot time.

So if you looks at the /boot/dtbs/`uname -r` . . .

$ ls /boot/dtbs/`uname -r` |grep green
am335x-bonegreen.dtb

You should get the same output from the above command. Ok so here I have to assume once your board has this file loaded at boot. Your board, should effectively behave like any other Beagelbone. With this in mind if we look at /lib/firmware/ . . .

$ ls /lib/firmware/ | grep I2C
BB-I2C1-00A0.dtbo
BB-I2C1-PCA9685-00A0.dtbo

Looks like, at least for me, I have two I2C device tree overlays which I can load. One generic I2C, and another which is unfamiliar to me, but seems to be for a specific device.

From here you should be able to load the first dtbo file if you have the same on your board, and be able to use your I2C utilities. Do however keep in mind that I am completely unfamiliar with the BBG. So I do not know anything about the grove connectors, how they work, how they're connected to board, and all that. So before going off half cocked based on what I'm saying, you should double check what you can.

But if you have further questions, I'd be glad to help. I do have interest in the BBG . . . But we already own 5 blacks . . .

William Hermans

unread,
Oct 18, 2015, 5:29:16 PM10/18/15
to beagl...@googlegroups.com
$ ls /lib/firmware/ | grep I2C
BB-I2C1-00A0.dtbo
BB-I2C1-PCA9685-00A0.dtbo

Looks like, at least for me, I have two I2C device tree overlays which I can load. One generic I2C, and another which is unfamiliar to me, but seems to be for a specific device.


So thinking about this further, I'm pretty sure if you're using the BBG specific Linux image, there should be a device tree file specifically for the I2C grove connector. Again, I'm not sure how these pins are brought out, and from which I2C peripheral, but it does make sense they have their own device tree file for the I2C grove connector . . . So if you ls /lib/firmware/ there should be a hint as to which device tree file you need to load. Based on the names.

Ben Shapiro

unread,
Oct 18, 2015, 5:43:33 PM10/18/15
to BeagleBoard
Sadly, there does not seem to be a BBG-specific image.

William Hermans

unread,
Oct 18, 2015, 5:59:53 PM10/18/15
to beagl...@googlegroups.com
My best guess is that I2C1 is brought out to the I2C connector, so enabling BB-I2C1-00A0.dtbo should work for you.

William Hermans

unread,
Oct 18, 2015, 6:40:38 PM10/18/15
to beagl...@googlegroups.com
No luck yet ? I'm doing more investigating . . . so what is the output of the command:

$ cat /etc/dogtag

?

If your Linux image predates Aug 11 this year, and you've not recently updated your device tree file binaries. Then loading the current BB-I2C1-00A0.dtbo may not work. If we notice the difference between:

https://github.com/beagleboard/devicetree-source/blob/master/arch/arm/boot/dts/BB-I2C1-00A0.dts
and
https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C1-00A0.dts

We have the difference between:
compatible = "ti,beaglebone", "ti,beaglebone-black";
and
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

This would be a good indication as to why. Anyway, I'm hoping this is helping more than confusing . . .

Mike

unread,
Oct 18, 2015, 7:01:31 PM10/18/15
to beagl...@googlegroups.com
On 10/18/2015 05:59 PM, William Hermans wrote:
My best guess is that I2C1 is brought out to the I2C connector, so enabling BB-I2C1-00A0.dtbo should work for you.

On Sun, Oct 18, 2015 at 2:43 PM, Ben Shapiro <ben.s...@colorado.edu> wrote:
Sadly, there does not seem to be a BBG-specific image.
<chopped>
Why do you think that they aren't enabled?  The output of i2cdetect -r 1 shows the 4 cape eeprom addresses in use.  The output of i2cdetect shows two addresses.  How about the output of "dmesg | grep cape" "dmesg | grep i2c" ?

Mike

Robert Nelson

unread,
Oct 18, 2015, 7:48:34 PM10/18/15
to Beagle Board
Make sure you have it connected to the correct Grove connector, one is
i2c2 (same bus as the "cape eeprom") the other is usart2...

Regards,

--
Robert Nelson
https://rcn-ee.com/

Robert Nelson

unread,
Oct 18, 2015, 7:50:04 PM10/18/15
to Beagle Board
On Sun, Oct 18, 2015 at 6:47 PM, Robert Nelson <robert...@gmail.com> wrote:
> Make sure you have it connected to the correct Grove connector, one is
> i2c2 (same bus as the "cape eeprom") the other is usart2...

I should also mention... Full support for the Green is with these images:

http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Image_Testing_Snapshots

The initial seeed image just used the black for green... As it's 99%
compatiable...

Ben Shapiro

unread,
Oct 19, 2015, 12:26:04 PM10/19/15
to beagl...@googlegroups.com
Ah, thanks. I’ll try that.
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/w1_2qFvZLqU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.

Ben Shapiro

unread,
Oct 19, 2015, 12:57:41 PM10/19/15
to beagl...@googlegroups.com
So… I installed the image that Robert pointed me to. And things still aren’t working. Here’s some more info.


root@beaglebone:/lib/firmware# ls /lib/firmware/
dra7-ipu2-fw.xem4  dra7xx-m4-ipu2.xem4 vpdma-1b8.bin

None of them mention i2c in the name (as William Hermans message suggested one should).

However, this is as one would expect:
root@beaglebone:/lib/firmware# ls /boot/dtbs/`uname -r` |grep green
am335x-bonegreen-overlay.dtb
am335x-bonegreen.dtb

Output from i2cdetect is identical with before.

Other suggestions?

Ben


You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/w1_2qFvZLqU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.

William Hermans

unread,
Oct 19, 2015, 2:59:53 PM10/19/15
to beagl...@googlegroups.com
Ok, so you have no device tree files. First things first. I'm using a 4.1.x kernel so your output should be slightly different.

debian@beaglebone:~$ which dtc
/usr/local/bin/dtc
debian@beaglebone:~$ dtc --version
Version: DTC 1.4.1-ge733c7b8

You version should be something like 1.4.0-XXXX. If dtc is not installed . . .

  1. wget -c https://raw.githubusercontent.com/RobertCNelson/tools/master/pkgs/dtc.sh
  2. chmod +x dtc.sh
  3. ./dtc.sh

debian@beaglebone:~$ dtc -v
Version: DTC 1.4.0-gf345d9e4

Then, Setup and compile dtbo's . . .

$ sudo apt-get install git
$ cd bb.org-overlays/
$ ./dtc-overlay.sh

Install dtbo's
$ sudo ./install.sh


Check /lib/firmware/:
$ ls /lib/firmware/

Let me know if you have any problems with that.

William Hermans

unread,
Oct 19, 2015, 3:10:27 PM10/19/15
to beagl...@googlegroups.com
@Robert

By the way Robert . . .

debian@beaglebone:~/bb.org-overlays$ ./dtc-overlay.sh
         CLEAN (libfdt)
         CLEAN (tests)
         CLEAN
Already on 'master'
Already up-to-date.
fatal: reference is not a tree: f6dbc6ca9618391e4f30c415a0a09b7af35f7647

Kind of has me stuck . . . heh probably a bad idea for me to test downgrade dtc . . .

William Hermans

unread,
Oct 19, 2015, 7:52:34 PM10/19/15
to beagl...@googlegroups.com
@Robert

By the way Robert . . .

debian@beaglebone:~/bb.org-
overlays$ ./dtc-overlay.sh
         CLEAN (libfdt)
         CLEAN (tests)
         CLEAN
Already on 'master'
Already up-to-date.
fatal: reference is not a tree: f6dbc6ca9618391e4f30c415a0a09b
7af35f7647

Kind of has me stuck . . . heh probably a bad idea for me to test downgrade dtc . . .

This is where my lack of git has me in a bind, But I suppose I could have just use rm -rf bb.org-overlays/ as a "cheap escape". Instead, I wound up starting over with a fresh image . . . was looking for an excuse anyhow.

Robert Nelson

unread,
Oct 19, 2015, 7:58:13 PM10/19/15
to Beagle Board
On Mon, Oct 19, 2015 at 6:52 PM, William Hermans <yyr...@gmail.com> wrote:
@Robert

By the way Robert . . .

debian@beaglebone:~/bb.org-
overlays$ ./dtc-overlay.sh
         CLEAN (libfdt)
         CLEAN (tests)
         CLEAN
Already on 'master'
Already up-to-date.
fatal: reference is not a tree: f6dbc6ca9618391e4f30c415a0a09b
7af35f7647

Kind of has me stuck . . . heh probably a bad idea for me to test downgrade dtc . . .

This is where my lack of git has me in a bind, But I suppose I could have just use rm -rf bb.org-overlays/ as a "cheap escape". Instead, I wound up starting over with a fresh image . . . was looking for an excuse anyhow.


it's under ${HOME}/git/${project}/

Regards,

William Hermans

unread,
Oct 19, 2015, 8:05:10 PM10/19/15
to beagl...@googlegroups.com
> it's under ${HOME}/git/${project}/

Funny, I guess I timed things perfect then. All that was on an NFS share, which I did not remount until after cloning the git, installing dtc, and the dtbo's . . .





--

Ben Shapiro

unread,
Oct 19, 2015, 9:31:34 PM10/19/15
to BeagleBoard
I get this "reference is not a tree" error when following William's instructions.
Commenting out the code that tries to use that sha seems to fix the problem.

Ben Shapiro

unread,
Oct 19, 2015, 10:11:02 PM10/19/15
to BeagleBoard
Ok... so I've banged my head about this more and, have made some progress. THANK YOU for your help thus far.

Still, this are really broken. As an example, the instructions here to blink an LED don't work. They don't crash, but nothing happens on the board when I run them. Suggestions?

On the bright side: Some grove devices now show up in i2cdetect. There are others that don't. And I can't figure out how to get the non i2c port to work as gpio (for example the LED example linked to above).

Have any of you actually gotten a BBG working with common grove sensors? For example, the Digital Temp and Humidity sensor (I have the "pro" and the non-pro versions)? Some example code would be really helpful.

Jason Kridner

unread,
Oct 20, 2015, 4:01:50 PM10/20/15
to beagl...@googlegroups.com
On Mon, Oct 19, 2015 at 10:11 PM, Ben Shapiro <ben.s...@colorado.edu> wrote:
> Ok... so I've banged my head about this more and, have made some progress.
> THANK YOU for your help thus far.
>
> Still, this are really broken. As an example, the instructions here to blink
> an LED don't work. They don't crash, but nothing happens on the board when I
> run them. Suggestions?

It is difficult to check your work using the GUI (ie., clicking the
right button). Can you get to the command prompt (right there in
Cloud9 IDE) and do the following and capture the entire terminal
session and paste here?

# cat yourfile.py
# python yourfile.py

>
> On the bright side: Some grove devices now show up in i2cdetect. There are
> others that don't. And I can't figure out how to get the non i2c port to
> work as gpio (for example the LED example linked to above).

Are you doing 'i2cdetect -y 2' ?

Depending on the kernel, you might be able to use 'config-pin'

>
> Have any of you actually gotten a BBG working with common grove sensors? For
> example, the Digital Temp and Humidity sensor (I have the "pro" and the
> non-pro versions)? Some example code would be really helpful.

I have. The code shipped with the board worked for me. I'm in process
of pushing it into the bone101 code.

Ben Shapiro

unread,
Oct 20, 2015, 7:50:37 PM10/20/15
to beagl...@googlegroups.com
Jason, 

Thanks for trying to help. See below.

Ben

On Oct 20, 2015, at 2:01 PM, Jason Kridner <jkri...@beagleboard.org> wrote:

On Mon, Oct 19, 2015 at 10:11 PM, Ben Shapiro <ben.s...@colorado.edu> wrote:
Ok... so I've banged my head about this more and, have made some progress.
THANK YOU for your help thus far.

Still, this are really broken. As an example, the instructions here to blink
an LED don't work. They don't crash, but nothing happens on the board when I
run them. Suggestions?

It is difficult to check your work using the GUI (ie., clicking the
right button). Can you get to the command prompt (right there in
Cloud9 IDE) and do the following and capture the entire terminal
session and paste here?

# cat yourfile.py
# python yourfile.py


I’ve never used Cloud9 and have done everything from within SSH. 

In any case, here’s the file:

debian@bonehog:~/making_bbg_work$ cat blink.py
import Adafruit_BBIO.GPIO as GPIO
import time
GPIO.setup("P9_14", GPIO.OUT)
while True:
    GPIO.output("P9_14", GPIO.HIGH)
    time.sleep(0.5)
    GPIO.output("P9_14", GPIO.LOW)
    time.sleep(0.5)

Running the script produces no output, either on the console or in the behavior of any of the LEDs.


On the bright side: Some grove devices now show up in i2cdetect. There are
others that don't. And I can't figure out how to get the non i2c port to
work as gpio (for example the LED example linked to above).

Are you doing 'i2cdetect -y 2’ ?

Yes. The Grove RGB LCD shows up. And I can even issue commands to activate and change the backlight color. But I can’t get any text to appear. 


Depending on the kernel, you might be able to use 'config-pin’


I don’t know what config-pin is. And no file by that name exists on my device.


Have any of you actually gotten a BBG working with common grove sensors? For
example, the Digital Temp and Humidity sensor (I have the "pro" and the
non-pro versions)? Some example code would be really helpful.

I have. The code shipped with the board worked for me. I'm in process
of pushing it into the bone101 code.


Code shipped with the board??? Does it exist online somewhere?

Jason Kridner

unread,
Oct 20, 2015, 10:49:27 PM10/20/15
to beagl...@googlegroups.com
P9_14 is a pin, not one of the built-in LEDs. I'll ping them to make that clearer. 



On the bright side: Some grove devices now show up in i2cdetect. There are
others that don't. And I can't figure out how to get the non i2c port to
work as gpio (for example the LED example linked to above).

Are you doing 'i2cdetect -y 2’ ?

Yes. The Grove RGB LCD shows up. And I can even issue commands to activate and change the backlight color. But I can’t get any text to appear. 

I had a similar challenge, but I think if I2C works, it must be something with the commands themselves. Have you checked out the Python examples? I will check it out myself tomorrow. 

Ben Shapiro

unread,
Oct 20, 2015, 10:56:38 PM10/20/15
to beagl...@googlegroups.com
Hi Jason,

Which Python examples?

Ben

William Hermans

unread,
Oct 21, 2015, 12:22:49 AM10/21/15
to beagl...@googlegroups.com
Ben, in addition to what Jason will tell you . . .

https://github.com/graycatlabs/PyBBIO
Check out the documentation links.

Here is his USR LED blink example.
https://github.com/graycatlabs/PyBBIO/blob/master/examples/blink.py


Trust me though. I know exactly how frustrating it is to get something working on the Beaglebone( sometimes ). As there is a lot of FUD out there, and when you're inexperienced with various aspects of the hardware. It can make things difficult.

Alexanders code should be good though, and do not be put off that it was originally written for the Beaglebone white. As what works on the White generally works on the Black, and by extension should work on the green too. I've been writing code lately using a git project that was original intended for the White. . . But peripheral register addresses, etc I am finding are exactly the same. The grove stuff though . . . I know nothing about.

The majority of issues you'll run into is: If documentation, or a project is too old, they'll talk about using Angstrom. Like with Alexanders documentation from the link above covers Angstrom, and Ubuntu / Debian. Disregard the Angstrom bits. His stuff seems to usually be very thorough - though.

Jason Kridner

unread,
Oct 28, 2015, 11:34:51 AM10/28/15
to beagl...@googlegroups.com
The examples should have been pushed into our repo, so I put it in my
repo for now: https://github.com/jadonk/bone101/tree/master/examples/Grove_BBG/Software/Python
Reply all
Reply to author
Forward
0 new messages