MakarenaLabs / Common-PL-Devices-on-PYNQ

Integration on PL side of Zynq7000 for PYNQ framework of common industrial devices (GPIO, I2C, SPI and UART)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not printing the received data in AxiIIC

abdur-rehman-khalid opened this issue · comments

I'm communicating with I2C GYROSCOPE sensor using this code. All the code works well, but it's not printing the received data values.

from pynq import Overlay
from pynq import MMIO
import time
from time import sleep, time

import pynq.lib as lib

class IIC:
    
    overlay = None
    i2c = None
    def init_hw(self, filepath):
        self.overlay = Overlay(filepath)
        self.overlay.download()

    def __init__(self, bitstream_file):
        # Initializing bitstream
        self.init_hw(bitstream_file)
        self.i2c = lib.AxiIIC(self.overlay.ip_dict['axi_iic_0'])

i2c = IIC("/home/xilinx/pynq/overlays/iic_test/iic.bit").i2c

add = 0x68
buf = [117]
i2c.send(add, buf, 1, 0)

test = []
i2c.receive(add, test, 3, 0)
print(test)

In this code, by sending the 0x75 and in response receiving the 0x71. But it only prints the length of not the received bytes.

image

You can see the in bridge results through the Saleae Logic Analyzer

image

What is your "I2C GYROSCOPE"? Can you share the ID or the model (or a link to eBay or similar)?

And do you have a working code (in another language or platform) that you can provide in order to check the right behavior?

Thanks Enrico for responding, I'm working on FPGA designs for these major protocol layouts like UART, I2C and SPI. My area is only in Python designs and I'm working on to create the libraries for these layouts in it. That's why, I've not the code in other languages for this core. We can collaborate to write the better class for this Axi IIC layout rather than relying on PYNQ builtin classes as you have did with UART core.

I'm using the MPU-9250 Gyroscope just for testing the I2C behaviour on this layout.