Hello. Im working on a custom board (Zybo-Z710 Pynq 2.5) but im not being able to use Axi IIC to read data from a sensor.
Im able to use other overlays but when i try to use I2C i only get “Could not send I2C data”
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-8-f53c43e925b8> in <module>()
----> 1 I2c.send(0xAD, buf, 1, option=0)
/usr/local/lib/python3.6/dist-packages/pynq/lib/iic.py in send(self, address, data, length, option)
102 self._virtaddr, address, data, length, option)
103 if sent == 0:
--> 104 raise RuntimeError("Could not send I2C data")
105 return sent
106
RuntimeError: Could not send I2C data
This is my code. Ive tested also with tx_buf=_ffi.new("unsigned char [32]")
overlay = Overlay('iic.bit')
overlay.download()
I2c=lib.AxiIIC(overlay.ip_dict["axi_iic_0"])
buf = bytes(1)
I2c.send(0x53, buf, 1, option=0)
My block design:
##Pmod Header JC
set_property -dict { PACKAGE_PIN V15 IOSTANDARD LVCMOS33 } [get_ports { i2c_sda_io }]; #IO_L10P_T1_34 Sch=jc_p[1]
set_property -dict { PACKAGE_PIN W15 IOSTANDARD LVCMOS33 } [get_ports { i2c_scl_io }]; #IO_L10N_T1_34 Sch=jc_n[1]
set_property PULLUP true [get_ports i2c_sda_io]
set_property PULLUP true [get_ports i2c_scl_io]
Pins are correctly connected but also tryied inverting sda/scl.
In linux i get:
xilinx@pynq:~$ sudo i2cdetect -l
[sudo] password for xilinx:
i2c-1 i2c Cadence I2C at e0005000 I2C adapter
i2c-0 i2c Cadence I2C at e0004000 I2C adapter
xilinx@pynq:~$ sudo i2cdetect -r -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
xilinx@pynq:~$ sudo i2cdetect -r -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
And my device tree:
i2c@e0004000 {
compatible = "cdns,i2c-r1p10";
status = "okay";
clocks = <0x1 0x26>;
interrupts = <0x0 0x19 0x4>;
reg = <0xe0004000 0x1000>;
#address-cells = <0x1>;
#size-cells = <0x0>;
clock-frequency = <100000>;
phandle = <0xe>;
};
If im connected with putty also i get this on the log "cdns-i2c e0005000.i2c: timeout waiting on completion"
Any ideas? Dont know what else to check/test. Thanks