KeyError : "gpio" while loading overlay

Hello all,

I am trying to bring up this block design under PYNQ 2.6 on a ZCU104.

When I try to load the overlay, I get the following error:


KeyError Traceback (most recent call last)
in ()
2 from pynq import Overlay
3 # Download the # overlay
----> 4 overlay = Overlay(“design_1_wrapper.bit”)

/usr/local/lib/python3.6/dist-packages/pynq/overlay.py in init(self, bitfile_name, dtbo, download, ignore_version, device)
339 self._register_drivers()
340
→ 341 self.parser = self.device.get_bitfile_metadata(self.bitfile_name)
342
343 self.ip_dict = self.gpio_dict = self.interrupt_controllers = \

/usr/local/lib/python3.6/dist-packages/pynq/pl_server/device.py in get_bitfile_metadata(self, bitfile_name)
777 hwh_path = get_hwh_name(bitfile_name)
778 if os.path.exists(hwh_path):
→ 779 return HWH(hwh_path)
780 else:
781 raise ValueError(“Cannot find HWH file for {}.”.format(

/usr/local/lib/python3.6/dist-packages/pynq/pl_server/hwh_parser.py in init(self, hwh_name)
201 self.init_mem_dict()
202 self.init_hierarchy_dict()
→ 203 self.assign_interrupts_gpio()
204
205 def init_partial_ip_dict(self):

/usr/local/lib/python3.6/dist-packages/pynq/pl_server/hwh_parser.py in assign_interrupts_gpio(self)
508 ip, _, pin = connection.rpartition(‘/’)
509 if ip in self.ip_dict:
→ 510 self.ip_dict[ip][‘gpio’][pin] = gpio
511 elif ip in self.hierarchy_dict:
512 self.hierarchy_dict[ip][‘gpio’][pin] = gpio

KeyError: ‘gpio’


Versions :
Pynq 2.6
vivado 2020.2
zcu104 board

I have placed .hwh files and .bit file in the directory

kindly suggest find any one has information on the same.

Kind Regards,
Harish

1 Like

Hi @Harish,

First off, welcome to the community! :slight_smile:

Okay, have you made sure that the .hwh file and the .bit files have the same name? Any chance that you would be able to share your .hwh and .bit files?

All the best,
Shane

P.S. I can also see that you have included a SEM core, cool! Are you planning on some fault injection work, or are you using it for fault-protection?

@stf

Thanks for the response . Kindly find the attached .hwh and .bit file

design_1_wrapper.hwh (158.9 KB)
design_1_wrapper.zip (88.0 KB)

Hi there,

So I have been able to verify on my ZCU104 board that this is working for PYNQ 2.7.

Are you able to upgrade to PYNQ 2.7 or are you using 2.6 for a specific reason?
If not I can try and verify this with 2.6 a little later on.

All the best,
Shane

Hi Shane,

In my other project i have to deploy VTA into the board via rpc. In this case, i am getting no module named pynq error. Thats why i am using v2.6.

Kind regards,
K Harish

Hi @imharish63,

I tried this out on my zcu104 with v2.6 of Pynq and it created the Overlay object correctly for me.

Are you running this from a clean SD Card build, or have you done some modifications?
Could you maybe share a minimal example where you are seeing this error, just to make sure that I am testing the same thing?

All the best,
Shane

Hi @stf ,

I am using image from pynq without any modifications.
I am tried run the jupyter notebook and Overlay project not created.
kindly find attached image.

kind regards,
Harish

Apologies, I made a mistake, I’m able to recreate your problem looking into it now :slight_smile:

Shane

@stf
Thanks for information , Meanwhile i have generate different design altogether and tested the overlay function and it is working that case. But the above mentioned scenario , the overlay is not working. Waiting for your suggestions

Kind Regards,
harish

Hi Harish,

I believe I have a temp fix for this but it is not well tested so I’m not sure how reliable it will be. I’d be grateful if you could give it a go and report back.

Can you try editing the following file: /usr/local/lib/python3.6/dist-packages/pynq/pl_server/hwh_parser.py on your ZCU104 (you might need to edit as root).

On line 239 you should see a function:

239     def add_ps_to_ip_dict(self, mod):
240         """Add the PS block to the IP dict.
241
242         The processing system (PS) block is a special case where we want to
243         include it as well in the IP dict. We only care about the parameters
244         specified in the PS block, and hopefully we can adjust some of the
245         parameters by changing register values.
246
247         Parameters
248         ----------
249         mod : Element
250             The current PS instance under parsing.
251
252         """
253         full_name, vlnv, pars, _ = self.instance2attr[mod.get('INSTANCE')]
254         self.ip_dict[full_name] = {}
255         self.ip_dict[full_name]['parameters'] = {j.get('NAME'):
256                                                  j.get('VALUE')
257                                                  for j in pars}
258         self.ip_dict[full_name]['type'] = vlnv

Can you add to following two lines after line 254

         self.ip_dict[full_name]['gpio'] = dict()
         self.ip_dict[full_name]['interrupts'] = dict()

So that you get:

239     def add_ps_to_ip_dict(self, mod):
240         """Add the PS block to the IP dict.
241
242         The processing system (PS) block is a special case where we want to
243         include it as well in the IP dict. We only care about the parameters
244         specified in the PS block, and hopefully we can adjust some of the
245         parameters by changing register values.
246
247         Parameters
248         ----------
249         mod : Element
250             The current PS instance under parsing.
251
252         """
253         full_name, vlnv, pars, _ = self.instance2attr[mod.get('INSTANCE')]
254         self.ip_dict[full_name] = {}
255         self.ip_dict[full_name]['gpio'] = dict()
256         self.ip_dict[full_name]['interrupts'] = dict()
257         self.ip_dict[full_name]['parameters'] = {j.get('NAME'):
258                                                  j.get('VALUE')
259                                                  for j in pars}
260         self.ip_dict[full_name]['type'] = vlnv

Then restart the jupyter kernel and you should be able to see the PS GPIO in the IP Dict

All the best,
Shane

1 Like

Hello @stf,

The above fix has fixed the gpio error . Thanks fro the valuable inputs from you.

Further more, to access the ps registers using pynq.ps.Register() , i am getting no module name Register in pynq.ps error.

I have checked ps.py and found no class named Register as mentioned at pynq.ps Module — Python productivity for Zynq (Pynq) v1.0

can you suggest me any guide for ultra-scale architectures to access and configure ps registers.

Kind Regards,
K Harish

Hi @imharish63,

Can you please open a different case? I am closing this one.

These two issues are not related. On top of that, you are looking at the documentation for a very old version.

Mario