PYNQ: PYTHON PRODUCTIVITY

How to use pynq.lib.iic.AxiIIC?

Hi, is there anyone can provide an example for how to use “pynq.lib.iic.AxiIIC” on Ultra96?

I have been searching for this all the day but can’t get a good answer…

from pynq.lib.iic import AxiIIC
---- 

I guess next I need to do :

from pynq.overlays.sensors96b import Sensors96bOverlay
ol = Sensors96bOverlay("sensors96b.bit")
test = AXiIIC( ol.ip_dict["   ??? "] )                
 < ---- I don't know what I should pass here 
test.send( address, data, length, 0)          
 < ---- I don't know how to find address

I really appreciate any help !!!

Hi @faefwed,

test = AXiIIC( ol.ip_dict[" ??? "] )

The key here is the name of the AXI IIC IP. Explore the ip_dict first and you will be able to find the name of the IP. Provided the IP is in your overlay.

test.send( address, data, length, 0)

Please read the documentation here to find out what address represents

https://pynq.readthedocs.io/en/v2.6.1/pynq_libraries/axiiic.html

Mario

Hi Mario, thank you very much for responding! :kissing_heart: :kissing_heart: :kissing_heart:

As you may know, pynq for Ultra96 does not provide “base” overlay and only provide Sensors96bOverlay but I don’t have the mezzanine board ( the link to buy the mezzanine board in the official website is invalid… )

So, does that mean I need to create an overlay by myself? If it is, could you kindly tell me where I can find information about how to create an overlay to support IIC port?

By the way, I think IIC ports are connected to PS instead of PL, so it is confusing why we need to create an overlay for IIC… ( I think overlay is related to PL, and I successfully control the GPIO without using any overlays… )

I mentioned overlays because the AXiIIC is an API for the AXI IIC IP which is implemented on the programmable logic. If you want to use the pins connected to the PS, you can use standard Linux libraries to communicate with the i2c.

1 Like

Thank you very much! I will try to proceed in the direction you just figured out!