I2C problems

83 views
Skip to first unread message

Astrid Hochart

unread,
Jan 25, 2021, 8:38:07 AM1/25/21
to BeagleBoard
Hello everyone,

I'm new to this subject but I'm trying to collect temperature data from this sensor : https://www.mikroe.com/thermo-9-click by using Python and a BeagleBone Black Rev C. The BBB is new and I don't have any SD card so I flashed nothing on it. My problem is that when I connect the sensor (where I moved the resistance to allow I2C mode) the BBB detects nothing : do you have any idea why ? Should I "enable" I2C pins ? 

I'll be grateful if someone can help me.

Best regards,

Vinicius Juvinski

unread,
Jan 25, 2021, 9:02:55 AM1/25/21
to beagl...@googlegroups.com
Hi

You need to load a dtb to enable the i2c
Edit uEnv.txt file and uncomment #u_boot_overlay_addr1 and add instead <file0>.dtbo add BB-I2CX-00A0.dtb where x is the i2c 1 or 2 according the port you are using. 

Sent from my iPhone


Em 25 de jan. de 2021, à(s) 10:38, Astrid Hochart <ast...@qzabre.com> escreveu:

Hello everyone,

I'm new to this subject but I'm trying to collect temperature data from this sensor : https://www.mikroe.com/thermo-9-click by using Python and a BeagleBone Black Rev C. The BBB is new and I don't have any SD card so I flashed nothing on it. My problem is that when I connect the sensor (where I moved the resistance to allow I2C mode) the BBB detects nothing : do you have any idea why ? Should I "enable" I2C pins ? 

I'll be grateful if someone can help me.

Best regards,

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/307d5c0a-d2ff-4f0a-a914-67ad2e4fdf92n%40googlegroups.com.

Steve Lentz

unread,
Jan 25, 2021, 9:03:11 AM1/25/21
to Beagle Board, Astrid Hochart
Astrid:

I debugged an I2C bus just recently - I had 3 devices, a DS3231 real time clock, a BME680 environmental sensor and a BNO055 inertial motion unit.  I had a lot of trouble with the last one.

Two suggestions:

First, use the i2cdetect and i2cdump utilities.  The basic commands to check i2C bus 2 (pins P9_19 and P9_20) are:

I2cdetect -l
I2cdetect -r 2

You can google "i2cdetect BBB” to find more info.  Using these rules out any problems with Python.  If your device is not showing up, check your wiring. If it is showing up and i2cdump works too, then you may want to check the python libraries.

Second, if you have access to an oscilloscope, use it to check SDA and SCL.  My BNO was appearing in i2cdetect and working intermittently in Python.  When I looked at it with the ’scope, it was clear that low to high transitions on SDA where taking far too long.  A 1KΩ pull-up resistor fixed this (add it close to the sensor between SDA and 3V3).  If you don’t have a scope, try adding the pull up resistor.  My devices each had a 10KΩ pull up, but this was not enough.  Be careful that the combined load does not exceed the 6 mA the BBB pins can safely sink.  

In case you need it, here’s the full list of python libraries I installed.  The first one is included in a fresh install, but check to see if it needs upgrading.  You can ignore the last 3 and use the one for your sensor instead.  Nothing else is needed.  There is a lot of old information still posted; these should work on a fresh install.  Note the odd underscore in lis3dh is correct.  

sudo pip3 install Adafruit_BBIO -U
sudo pip3 install adafruit_circuitpython-lis3dh
sudo pip3 install adafruit-circuitpython-busdevice
sudo pip3 install adafruit-circuitpython-register
sudo pip3 install adafruit-circuitpython-ds3231
sudo pip3 install adafruit-circuitpython-bme680
sudo pip3 install adafruit-circuitpython-bno055

Hope this helps,

-Steve



Astrid Hochart

unread,
Jan 25, 2021, 9:39:45 AM1/25/21
to beagl...@googlegroups.com
image.png
Hello Vinicius,

Thank you for your email. I tried what you said but I still detect nothing. Is it the line with addr0 or addr1 that I should change ?

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com


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/C6fXDoWHEg0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CB31E0E9-5C7B-4718-AA47-4603A0770CA7%40gmail.com.

Vinicius Juvinski

unread,
Jan 25, 2021, 9:44:26 AM1/25/21
to beagl...@googlegroups.com
Hi Astrid,

where are you hooking your sensor ? What pins are you using?

Astrid Hochart

unread,
Jan 25, 2021, 9:47:08 AM1/25/21
to beagl...@googlegroups.com
19 and 20 as mentioned on the pins description !

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com

evilwulfie

unread,
Jan 25, 2021, 9:59:33 AM1/25/21
to beagl...@googlegroups.com
You also need pull up resistors on the I2C lines

Astrid Hochart

unread,
Jan 25, 2021, 10:32:57 AM1/25/21
to beagl...@googlegroups.com
Hello !

Thank you for your reply. So I need to have a wire from Pin19 to a resistance and then another wire from the resistance to SCL pin of my sensor ? (and same for SDA and pin 20) 

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com

Steve Lentz

unread,
Jan 25, 2021, 10:43:04 AM1/25/21
to Astrid Hochart, Beagle Board
Here is the diagram for my i2c device.  This shows where the pull-up resistors are added.  You will need something similar.  

But first check the documentation for the thermo-click to see if it already has pull-up resistors.  It may have 2K, 5K, 10K already.  Don’t allow the parallel resistance to go below 500 ohms.   



Astrid Hochart

unread,
Jan 25, 2021, 10:50:00 AM1/25/21
to Steve Lentz, Beagle Board
I just checked and they already have pull up resistors of 4.7 kohms.

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com

Steve Lentz

unread,
Jan 25, 2021, 11:00:02 AM1/25/21
to Astrid Hochart, Beagle Board
Then it is safe to add 1K.  My devices have 10K and did not work until I added the 1K resistors.

I checked in on a scope and adding 1K fixed the waveform.

-Steve



On Jan 25, 2021, at 10:49 AM, Astrid Hochart <ast...@qzabre.com> wrote:

I just checked and they already have pull up resistors of 4.7 kohms.

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com


On Mon, Jan 25, 2021 at 4:42 PM Steve Lentz <stl...@gmail.com> wrote:
Here is the diagram for my i2c device.  This shows where the pull-up resistors are added.  You will need something similar.  

But first check the documentation for the thermo-click to see if it already has pull-up resistors.  It may have 2K, 5K, 10K already.  Don’t allow the parallel resistance to go below 500 ohms.   

<PastedGraphic-1.png>

Astrid Hochart

unread,
Jan 25, 2021, 11:00:49 AM1/25/21
to Steve Lentz, Beagle Board
Can it be from the BBB ? Because I tried with another sensor which works via I2C on another MCU and my BBB doesn't recognize it neither.

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com

Dennis Lee Bieber

unread,
Jan 25, 2021, 12:35:16 PM1/25/21
to Beagleboard
On Mon, 25 Jan 2021 10:42:50 -0500, in gmane.comp.hardware.beagleboard.user
Steve Lentz <stlentz-Re5JQEe...@public.gmane.org> wrote:

>Here is the diagram for my i2c device. This shows where the pull-up resistors are added. You will need something similar.
>
>But first check the documentation for the thermo-click to see if it already has pull-up resistors. It may have 2K, 5K, 10K already. Don’t allow the parallel resistance to go below 500 ohms.
>

If I interpret the confusing schematic from
https://www.mikroe.com/thermo-9-click there appear to already be a pair of
4.7k pull-ups on the board.


--
Dennis L Bieber

Steve Lentz

unread,
Jan 25, 2021, 12:48:04 PM1/25/21
to beagl...@googlegroups.com
I can only speak from my experience. I have three Adafruit sensor breakouts connected on I2C bus 2. Each of these has its own 10K pull-up resistors. The last board did not work until I added an external 1K pull up. It is 100% reliable since then. I have built this twice and experienced the same thing both times. I spent a lot of time chasing software and asking questions on this forum. Five minutes with an oscilloscope showed me the real problem was that high values on the SDA line were not reaching 3.3V before it was sampled. Based on this, a logical next step is to add an external 1K pull up and see what happens.
> --
> 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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/e70u0g58r86qs7ct4roe7b5fjpgk6pit1f%404ax.com.

Astrid Hochart

unread,
Jan 26, 2021, 4:23:43 AM1/26/21
to beagl...@googlegroups.com
I tried 1Kohms and 10kohms but I still have nothing unfortunately..

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com

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/C6fXDoWHEg0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/F621C5DC-2FD4-4100-847E-90E367F84602%40gmail.com.

Astrid Hochart

unread,
Jan 26, 2021, 9:14:54 AM1/26/21
to beagl...@googlegroups.com
Normally the BBB automatically detects I2C devices right ?

Astrid Hochart
Product developer - QZabre LLC
www.qzabre.com

Reply all
Reply to author
Forward
0 new messages