Could not find IP or hierarchy iop_pmoda in overlay

Hello:
I found one problem while I try to load overlay.
My error message as the following, does anyone can help me what is happen?

from time import sleep
from pynq.overlays.base.base import BaseOverlay
base = BaseOverlay("/home/xilinx/jupyter_notebooks/design_LED/design_LED.bit")


AttributeError Traceback (most recent call last)
in
----> 1 base = BaseOverlay("/home/xilinx/jupyter_notebooks/design_LED/design_LED.bit")

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/overlays/base/base.py in init(self, bitfile, **kwargs)
86 super().init(bitfile, **kwargs)
87 if self.is_loaded():
—> 88 self.iop_pmoda.mbtype = “Pmod”
89 self.iop_pmodb.mbtype = “Pmod”
90 self.iop_arduino.mbtype = “Arduino”

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/overlay.py in getattr(self, key)
364 “”"
365 if self.is_loaded():
→ 366 return getattr(self._ip_map, key)
367 else:
368 raise RuntimeError(“Overlay not currently loaded”)

/usr/local/share/pynq-venv/lib/python3.8/site-packages/pynq/overlay.py in getattr(self, key)
901 return mem
902 else:
→ 903 raise AttributeError(
904 “Could not find IP or hierarchy {} in overlay”.format(key))
905

AttributeError: Could not find IP or hierarchy iop_pmoda in overlay

Hi @lwpan1216,

If you are loading your own custom overlay, you should be using Overlay rather than BaseOverlay.

BaseOverlay derives from Overlay, but it is specialized for the peripherals present on the base overlay.

Mario

Hi marioruiz,
Thank you so much!
I can overlay my bit stream file successful, but there is another issue while I want to use Xilinx exampler to import LED and Button function on my PYNQ-Z2 platform.
It would appeared error message "BaseOverlay’ has no attribute ‘leds’,
AttributeError Traceback (most recent call last)
in
7 rgbled_position = [4,5]
8
----> 9 for led in base.leds:
10 led.on()
11 while (base.buttons[3].read()==0):

The following code was copy from xilinx/pynq/base/board/_btns_leds.ipynb
Would you please also help give some comment for which of mistake from it?

AttributeError: type object ‘BaseOverlay’ has no attribute ‘leds’

from pynq.overlays.base.base import BaseOverlay
base = BaseOverlay

Delay1 = 0.3
Delay2 = 0.1
color = 0
rgbled_position = [4,5]

for led in base.leds:
led.on()
while (base.buttons[3].read()==0):
if (base.buttons[0].read()==1):
color = (color+1) % 8
for led in rgbled_position:
base.rgbleds[led].write(color)
base.rgbleds[led].write(color)
sleep(Delay1)

elif (base.buttons[1].read()==1):
for led in base.leds:
led.off()
sleep(Delay2)
for led in base.leds:
led.toggle()
sleep(Delay2)

elif (base.buttons[2].read()==1):
    for led in reversed(base.leds):
        led.off()
    sleep(Delay2)
    for led in reversed(base.leds):
        led.toggle()
        sleep(Delay2)                  

print(‘End of this demo …’)
for led in base.leds:
led.off()
for led in rgbled_position:
base.rgbleds[led].off()

Are you executing the notebook or copying and pasting?

When the base object is being created, the class BaseOverlay is not been initialized with the bitstream. Please see the reference notebook here PYNQ/board_btns_leds.ipynb at master · Xilinx/PYNQ · GitHub

Please use the built-in features in Jupyter to read the documentation of the different classes and methods. For example,

pynq.Overlay?

Full documentation for the pynq package here pynq Package — Python productivity for Zynq (Pynq)

You can also follow the PYNQ Workshop GitHub - Xilinx/PYNQ_Workshop to get yourself more familiar with PYNQ

Mario

Hi marioruiz, many thanks.
Yes, I execute it on jupyter notebook.
I’ll study the data for detail.

Thank you for your great help.

Sincerely,
Lwpan