ADXL345 not working
Hi
I folowed this procedure https://wiki.up-community.org/Adafruit#Using_Adafruit_ADXL345_Triple-Axis_Accelerometer_Breakout_board_on_UP but it doesn't work. Full traceback:
sudo python examples/simpletest.py Traceback (most recent call last): File "examples/simpletest.py", line 12, in <module> accel = Adafruit_ADXL345.ADXL345() File "build/bdist.linux-x86_64/egg/Adafruit_ADXL345/ADXL345.py", line 65, in __init__ File "build/bdist.linux-x86_64/egg/Adafruit_GPIO/I2C.py", line 152, in readU8 File "build/bdist.linux-x86_64/egg/Adafruit_PureIO/smbus.py", line 155, in read_byte_data IOError: [Errno 6] No such device or address
I noticed I have the same error when I don't use sudo. Could it be because my I2C bus is not detected at all ?
I have an up squared, maybe the the tutorial above only works for up board ?
Thanks
Comments
-
Ok so I was right : those instructions must be slightly modified to work with UP Square. What I did :
On this link, I got info about i2c for UP Square http://wiki.up-community.org/Pinout_UP2 , I ran this command to get my bus number :ls /sys/bus/pci/devices/*/i2c_designware.0/ | grep i2c i2c-4 ls /sys/bus/pci/devices/*/i2c_designware.1/ | grep i2c i2c-5
So first thing, I don't get the same result as Wiki page. I have no idea if it's a problem but I will go for no.
Then, I checked for my device address :
sudo i2cdetect -y -r 5 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- 53 -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
In the file, examples/simpletest.py, I changed this
accel = Adafruit_ADXL345.ADXL345()
by this :
accel = Adafruit_ADXL345.ADXL345(address=0x53, busnum=5)
-
Hi @erenaud ,
Is now your ADXL345 working with your fix? If so, please redefine the discussion title as [RESOLVED] ADXL345 not working
Thank you!