Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

ADXL343 using i2c not working on Pi 400
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADXL343 using i2c not working on Pi 400

by jamestutt on Thu Jan 20, 2022 9:57 am

I am trying to read the ADXL343 sensor on a raspberry pi 400 using the circuit python wiring and code. When I run "i2cdetect -y 1" I see that the sensor is connected, but when I run the code in Python I get this error:


Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py", line 154, in __probe_for_device
self.i2c.writeto(self.device_address, b"")
File "/usr/local/lib/python3.9/dist-packages/busio.py", line 166, in writeto
return self._i2c.writeto(address, buffer, stop=stop)
File "/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py", line 314, in write_bytes
self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py", line 160, in __probe_for_device
self.i2c.readfrom_into(self.device_address, result)
File "/usr/local/lib/python3.9/dist-packages/busio.py", line 156, in readfrom_into
return self._i2c.readfrom_into(address, buffer, stop=stop)
File "/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 56, in readfrom_into
readin = self._i2c_bus.read_bytes(address, end - start)
File "/usr/local/lib/python3.9/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 "/home/pi/RISE/ADXL_test_code.py", line 11, in <module>
accelerometer = adafruit_adxl34x.ADXL343(i2c)
File "/usr/local/lib/python3.9/dist-packages/adafruit_adxl34x.py", line 174, in __init__
self._i2c = i2c_device.I2CDevice(i2c, address)
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py", line 50, in __init__
self.__probe_for_device()
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py", line 163, in __probe_for_device
raise ValueError("No I2C device at address: 0x%x" % self.device_address)
ValueError: No I2C device at address: 0x53

0x53 is the location that i2cdetect shows the sensor as being in. I ran code for the BMP388 sensor on a Raspberry Pi Zero last year and it worked fine, but now this doesn't work either on the Pi 400. The code is directly copied from the Circuit Python page for this sensor, I have updated my Pi, all of the packages have been installed, and i2c has been enabled.

I am going to try to get things running on a Pi Zero.

jamestutt
 
Posts: 4
Joined: Thu Jan 20, 2022 9:50 am

Re: ADXL343 using i2c not working on Pi 400

by adafruit_support_carter on Thu Jan 20, 2022 11:59 am

How is the ADXL343 connected to the Pi 400?

adafruit_support_carter
 
Posts: 23544
Joined: Tue Nov 29, 2016 2:45 pm

Re: ADXL343 using i2c not working on Pi 400

by jamestutt on Thu Jan 20, 2022 12:12 pm

GPIO pins ribbon cable to T-cobbler and then on a breadboard

image01.jpg
image01.jpg (82.99 KiB) Viewed 61 times

image02.jpg
image02.jpg (113.7 KiB) Viewed 61 times

image03.jpg
image03.jpg (150.44 KiB) Viewed 61 times

jamestutt
 
Posts: 4
Joined: Thu Jan 20, 2022 9:50 am

Re: ADXL343 using i2c not working on Pi 400

by adafruit_support_carter on Thu Jan 20, 2022 1:40 pm

Thanks for photo. That all looks OK.

Try wiring up just the ADXL343. If you're not already, test by using the example from the library:
https://github.com/adafruit/Adafruit_Ci ... pletest.py

adafruit_support_carter
 
Posts: 23544
Joined: Tue Nov 29, 2016 2:45 pm

Re: ADXL343 using i2c not working on Pi 400

by jamestutt on Thu Jan 20, 2022 2:47 pm

Thanks for the help,

I just have the ADXL343 connected now and I ran the code you linked to. I am still having the same problem. When I run i2cdetect, I get this:

i2cdetect.png
i2cdetect.png (137.96 KiB) Viewed 59 times


Which suggests that the Pi is detecting something on the i2c GPIO input. Would this point to a Python problem?

jamestutt
 
Posts: 4
Joined: Thu Jan 20, 2022 9:50 am

Re: ADXL343 using i2c not working on Pi 400

by adafruit_support_carter on Thu Jan 20, 2022 4:49 pm

Seems more like a marginal connection issue. Just tested things on a Pi 4 (should be nominally same as Pi 400) and it worked as expected:
Code: Select all | TOGGLE FULL SIZE
(blinka) pi@raspberrypi:~ $ python3 adxl34x_simpletest.py
-1.725970 -1.765197 12.121019
-1.686744 2.118236 8.394492
0.000000 4.981778 7.688414
5.883990 4.864098 4.471832
5.334818 2.510502 6.590069
3.687300 -1.412158 10.159689
0.117680 -1.647517 13.964670



Try re-staging things at a different location on the breadboard. And also try different jumper wires.

adafruit_support_carter
 
Posts: 23544
Joined: Tue Nov 29, 2016 2:45 pm

Re: ADXL343 using i2c not working on Pi 400

by mjjenk39 on Thu Jan 20, 2022 9:09 pm

I am trying to use the IS31FL3741 RGB Matrix (I2C) on the Pi Zero using Blinka and circuitPython. I am getting errors with "import adafruit_is31fl3741" on a few different example programs Ive tried. They all give the same error, and its pointing to the is31fl3741 class in the is31fl3741 __init__.py file from the library. Its calling out line 92 in __init__.py "i2c: busio.I2C..." and says "ERROR: name 'busio' not defined."

Like the original poster of this thread, Ive ran updates and all that stuff. This thread is the closest thing Ive found to the issue Im having, so I thought I would comment here rather than try to post a new question thread.

mjjenk39
 
Posts: 1
Joined: Mon Nov 08, 2021 2:04 am

Re: ADXL343 using i2c not working on Pi 400

by jamestutt on Fri Jan 21, 2022 11:40 am

I replaced the ribbon cable, t-cobbler, breadboard, and jumper wires and it now works.

Thanks for all of you help with this

jamestutt
 
Posts: 4
Joined: Thu Jan 20, 2022 9:50 am

Re: ADXL343 using i2c not working on Pi 400

by adafruit_support_carter on Fri Jan 21, 2022 1:06 pm

Cool, glad you got it working. Sounds like it was a marginal connection of some kind. Annoyingly marginal since the I2C scan was working, but not the full example code. That can happen sometimes though. Good luck with your project!

adafruit_support_carter
 
Posts: 23544
Joined: Tue Nov 29, 2016 2:45 pm

Re: ADXL343 using i2c not working on Pi 400

by adafruit_support_carter on Fri Jan 21, 2022 1:07 pm

@mjjenk39 Please start a new thread for your issue.

adafruit_support_carter
 
Posts: 23544
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.