Board: PYNQ-Z2
PYNQ Version: 3.0.1
Bitstream: base.bit
I am trying to talk to a device or I2C. The device is the LIS3DH accelerometer from Adafruit.
I can communicate with the device using a basic arduino through the arduino ide.
However, when I try connecting to my PYNQ board using the arduino pins, I cannot get it to communicate.
First, when trying to use the linux command i2cdetect (through the terminal connected to the PYNQ board) I get the following:
i2cdetect -y 0
00:
10:
20:
30: cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
--
40:
50: cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
-- cdns-i2c e0004000.i2c: timeout waiting on completion
--
60:
70:
i2cdetect -y 1
00:
10:
20:
30: -- -- -- -- -- -- -- --
40:
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60:
70:
Alternatively, I try to use SMBus through a Jupyter notebook (need to install smbus2 library in python on the board first)
from smbus2 import SMBus
with SMBus(0) as bus:
data = bus.read_byte_data(0x18, 0x0F)
print(f"Device ID: 0x{data:02X} (should be 0x33 for LIS3DH)")
Results:
I get the following error:
TimeoutError: [Errno 110] Connection timed out
And it is linked to the read line.
Also, when I do this I see the message cdns-i2c e0004000.i2c: timeout waiting on completion
appear in the terminal connected to the PYNQ board.
So it is essentially the same error.
Is the I2C connection on the arduino part of the PYNQ board not enabled by default in the base.bit overlay? If not, how do I enable it. Or is there an alternative way to do this using the PMOD pins or something else that I can get working with the base overlay?