PYNQ: PYTHON PRODUCTIVITY

Reading I2C Data Directly in Fabric [PYNQ-Z2]

Background

  • Using the PYNQ-Z2 with Image v2.6
  • Goal is to build a control system in RTL that uses sensor data as an input, interfaced through I2C

My goal is to build an RTL control system that uses a hall effect sensor (which has an I2C interface) as an input. For prototyping, my first control system will be in software written in Python. For this software controller I made a custom hardware overlay with Zynq, AXI-IIC, and AXI-GPIO blocks. In Jupyter, I simply instantiate the IP blocks, call the respective methods to read the sensor data, perform some software processing, and then actuate a current driver through the AXI-GPIO.

When I transition to a more high performance RTL (hardware) controller, I do not want to use the Zynq as the middle man to read in the sensor data because of latency issues. I wish to read the I2C data directly into the fabric and into my RTL controller. The only thing I want to do in software is DMA monitoring, but I do not want the processing system in the path of the control loop. Is there an easy way to do this with the AXI-IIC IP or is there an alternative way to do this?

Not sure about your setup. How is your I2C device connected? If it is connected to Pmod, then it is already connected to the fabric and you should be able to directly add control logic on the fabric.

This is my current block diagram. I have the AXI-IIC connected to J3 on the PYNQ arduino headers. The IP is connected to the Zynq through an AXI interconnect. The data is read by the Zynq, and I am currently using DMA to forward it to a controller in RTL. I am doing this to avoid having to deal with I2C transactions and instead letting Python methods do the read and writes for me, and to avoid adding an AXI interface to my custom controller. Now I am wondering if there is an easy way to bypass this AXI-IIC → Zynq → DMA → controller.