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.

1 Like

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 ?

1 Like

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 Python bytes() .