- PYNQ version: 3.0.1
- Board name: PYNQ-Z2 TUL
Hello,
I’m trying to use the trace analyzer for the Arduino IOP, that’s supposed to be included in the Base Overlay. However, looking at the code in the PYNQ repo it seems that it’s actually not included in the PYNQ-Z2 base overlay. Was it forgotten or did I miss something? This is surprising as in the documentation it is mentioned that there are Trace Analyzers linked to all the IOPs:
Here is my code on Jupyter Notebook, it’s very basic and I’m going step by step. I’m gonna get myself a logic analyzer but I wanted to check out the trace analyzer for the arduino and test my UART code..
from pynq.overlays.base import BaseOverlay
base = BaseOverlay("base.bit")
trace_analyzer = base.trace_arduino
# trace_analyzer.setup(frequency_mhz=0.1, num_analyzer_samples=65535)
# from pynq.lib import MicroblazeLibrary
# UART_RXD = 0 ## Arduino pin 0 is RXD
# UART_TXD = 1 ## Arduino pin 1 is TXD
# lib = MicroblazeLibrary(base.iop_arduino, ['uart'])
# uart = lib.uart_open(UART_TXD, UART_RXD)
# read_command = [0xDE, 0xAD, 0xBE, 0xEF]
# uart.write(read_command, len(read_command)) ## Write an iterable list of bytes
# response = [0x00] * 4
# uart.read(response, 4) ## Request a 4-byte response
# uart.close()
Here’s the error message:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [14], in <cell line: 4>()
1 from pynq.overlays.base import BaseOverlay
2 base = BaseOverlay("base.bit")
----> 4 trace_analyzer = base.trace_arduino
File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py:363, in Overlay.__getattr__(self, key)
358 """Overload of __getattr__ to return a driver for an IP or
359 hierarchy. Throws an `RuntimeError` if the overlay is not loaded.
360
361 """
362 if self.is_loaded():
--> 363 return getattr(self._ip_map, key)
364 else:
365 raise RuntimeError("Overlay not currently loaded")
File /usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py:931, in _IPMap.__getattr__(self, key)
929 return mem
930 else:
--> 931 raise AttributeError(
932 "Could not find IP or hierarchy {} in overlay".format(key)
933 )
AttributeError: Could not find IP or hierarchy trace_arduino in overlay
Here’s the screenshot showing the difference in the base.py
for PYNQ-Z2 vs PYNQ-Z1:
PYNQ-Z2:
PYNQ-Z1:
You can see that there are some missing in the PYNQ-Z1 and some missing in the PYNQ-Z2