Introduction on IIC and GPIO on PYNQ

Greetings Everyone . I am new to pynq and Xilinx systems. I am wondering if anyone has a tutorial on how to use i2c on the PL side and how to read data from a gpio pin that is on the PL side all using pink. System I design has the IIC IP and the AXI GPIO.

I am using KRIA Robatics kit that has zynq ultrascale + as PS.

Many thanks

Hi @ntahoturi5922,

Welcome to the PYNQ community.

There’s a small example of IIC here https://www.adiuvoengineering.com/post/microzed-chronicles-pynq-and-axi-iic

AXI GPIO is well described on the documentation.

https://pynq.readthedocs.io/en/latest/pynq_libraries/axigpio.html

Mario

2 Likes

Any update for the spi driver?

I have been able to use the AXI IIC but the issue I am getting is that all the values I get are zero. I am working with Tempsensor mcp9808, 12 bit 8ch adc module ads7828. I can scan the buss and see the devices as follow:

#scanning for diveces on the i2c bus

for address in range(0x00, 0x80):
try:
# Attempt to read 1 byte from the current address
iic.send(address, [0x00], 1)
print(f"Found I2C device at address: 0x{address:02X}")
except Exception:
# No response from the current address
pass
and i get :
Found I2C device at address: 0x36
Found I2C device at address: 0x40

and when i do:
iic.receive(0x40, rx_data, 2, 0)
with rx_data = [0x00,0x00] or rx_data =
I get nothing.

any help is appriciated.

hi @ntahoturi5922,
what is the rx_data here? you should define rx_data as bytes like rx_data = bytes(2). I think it will solve your problem.

Mizan

1 Like

thanks very much. if anyone ever try this one the code should look as in the picture bellow.

1 Like