PYNQ: PYTHON PRODUCTIVITY

How to receive data using pynq.lib.iic.AxiIIC?

I can successfully send data from the pynq to the slave device (MSP430) but I am not sure how to receive data from the MSP430.

What parameter should I put in the second spot of the receive function? It seems like it’s asking me to predict the data that should be coming to it.

See info here:
https://pynq.readthedocs.io/en/v2.5.1/pynq_libraries/axiiic.html?highlight=iic#axiiic

Cathal

I’m not sure what the data parameter should be there. I know it’s supposed to be a cdata pointer but is that a register on the pynq?

The PYNQ doc is not really specific on the parameter other than that it is is bytes-like. Should it be a buffer, register, RX_FIFO ?

Figured it out! The data parameter in the receive() function should be a bytes object produced by bytes(size) function.

Example:

test = bytes(1) should return an bytes object of size 1 byte

type(test) should return “bytes”

So if I expect to receive a char from a slave device with address 0x30, I would type

test_IIC = lib.AxiIIC(ol.ip_dict["axi_iic_0"])

and test_IIC.receive(0x30,test,1,0) will output 1.

This site helped me understand as well https://www.programiz.com/python-programming/methods/built-in/bytes .