I2C Communication with Adafruit SHT40 Breakout - BBB Wireless

I am having trouble getting my BeagleBone Black Wireless to communicate with an Adafruit Sensirion SHT40 breakout board. The BeagleBone does not seem to be able to see that the sensor is connected at I2C address 0x44.

I have tried using both i2cdetect and the Adafruit-Blinka Python3 library along with the example code from the Adafruit CircuitPython SHT4x library.

debian@beaglebone:~$ uname -a
Linux beaglebone 5.10.120-ti-r46 #1buster SMP PREEMPT Tue Jun 28 20:04:59 UTC 2022 armv7l GNU/Linux

debian@beaglebone:~$ sudo i2cdetect -y -r 2
[sudo] password for debian:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –

debian@beaglebone:~/Adafruit_CircuitPython_SHT4x/examples$ python3 sht4x_simpletest.py
Traceback (most recent call last):
File “/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py”, line 174, in __probe_for_device
self.i2c.writeto(self.device_address, b"")
File “/usr/local/lib/python3.7/dist-packages/busio.py”, line 169, in writeto
return self._i2c.writeto(address, buffer, stop=stop)
File “/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py”, line 52, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File “/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py”, line 314, in write_bytes
self._device.write(buf)
OSError: [Errno 95] Operation not supported

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py”, line 180, in __probe_for_device
self.i2c.readfrom_into(self.device_address, result)
File “/usr/local/lib/python3.7/dist-packages/busio.py”, line 159, in readfrom_into
return self._i2c.readfrom_into(address, buffer, stop=stop)
File “/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py”, line 59, in readfrom_into
readin = self._i2c_bus.read_bytes(address, end - start)
File “/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py”, line 181, in read_bytes
return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “sht4x_simpletest.py”, line 10, in
sht = adafruit_sht4x.SHT4x(i2c)
File “/usr/local/lib/python3.7/dist-packages/adafruit_sht4x.py”, line 130, in init
self.i2c_device = i2c_device.I2CDevice(i2c_bus, address)
File “/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py”, line 61, in init
self.__probe_for_device()
File “/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py”, line 183, in __probe_for_device
raise ValueError(“No I2C device at address: 0x%x” % self.device_address)
ValueError: No I2C device at address: 0x44

The SHT40 is wired as follows:
P9.1 → GND
P9.3 → VIN
P9.19 → SCL
P9.20 → SDA

In both instances it doesn’t seem like the processor can see that anything is connected to the pins. Any help would be appreciated. I am at a loss for what to do next.

I am having trouble getting my BeagleBone Black Wireless to communicate with an
Adafruit Sensirion SHT40 breakout board. The BeagleBone does not seem to be ab
le to see that the sensor is connected at I2C address 0x44.

are you sure that p9.19 and 20 are set up for i2c?
have you had successes with other i2c devices on bus 2?

i’d check the uEnv.txt that there is
uboot_overlay_addr N =/lib/firmware/BB-I2C2-00A0.dtbo
line and/or that there are config-pin calls somewhere in your
startup scripts that set those two pins for i2c.

I have tried using both i2cdetect and the Adafruit-Blinka Python3
library along with the example code from the Adafruit CircuitPython
SHT4x library.

unless and until i2cdetect shows something, trying other higher
level stuff is a waste of time.

I tried a SCD41 device and had the same results. I have also ran the config-pin tool in the command line but that did not help either.

config-pin P9.19 i2c
config-pin P9.20 i2c

I checked /boot/uEnv.txt and it did not contain the line
uboot_overlay_addr N =/lib/firmware/BB-I2C2-00A0.dtbo
I added it at N=0 and rebooted. This did not help either.

Do you have any further ideas or suggestions?

Hello,

uboot_overlay_addr0=/lib/firmware/file0.dtbo

Where file0 is the BB-I2C2-00A0 device tree blob.

What kernel are you using? If 4.19.x, you can always use it that way but you may find it easy to use the BeagleBone-DeviceTrees repo. online at github.com.

git clone it, cd BeagleBone-DeviceTrees, make.

sudo make install afterwards.

Then, put the i2c-2 .dtbo in the u-boot_overlay_addr0= section.

Seth

P.S. If this does not make sense, let me know. If you are using Kernel 5.4.x or 5.10.x, let me know. I will find a workaround. Try P9.21/22 instead also. The 19/20 is for Cape Compatibility.

  1. BeagleBoard.org - bone101
  2. GitHub - beagleboard/BeagleBoard-DeviceTrees: Linux kernel device trees and device tree overlays for BeagleBoard.org open hardware single board computers and add-on boards.

I tried a SCD41 device and had the same results.

at that point i’d take one step back and verify all the basics and the wiring
with a multimeter: is there 5v (or 3.3v) where you do expect it, and are
the i2c pins pulled high when NOTHING is connected (= the i2c idle state).

do note that your adafruit breakout board has its own pullups, so i’d
disconnect that breakout and check the beagle pins.

I checked /boot/uEnv.txt and it did not contain the line
uboot_overlay_addr N =/lib/firmware/BB-I2C2-00A0.dtbo
I added it at N=0 and rebooted. This did not help either.

odd. i’d also check the output of dmesg, see if that does report all
three i2c busses (zero isn’t a/v on the headers, but i2c1 and i2c2 are).

at work we’re using beagles (almost all flavours), with that specific dtbo
overlay and a bunch of custom stuff on i2c2 successfully, but with
4.19 kernels so far. this does include various sensirion chips (but not
a standalone sht) and we find they’re reasonably well-behaved as
far as i2c is concerned.

Do you have any further ideas or suggestions?

sorry, none that are likely to help you.

if this was my box i’d now test all involved pieces, separately and
individually: talk i2c to the sht (or the scd41) with a bus pirate, and
observe the i2c waveforms of i2cdetect on the beagle with a
logic analyser/storage osci.