Error no device found when loading overlay

I am following the step of from Overlay Tutorial — Python productivity for Zynq (Pynq) v1.0

Currently I’m using Jupyter Notebook on the Ultra96 v2 through ssh tunnel and I encountered the following error when trying to load the overlay.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-4-6407a7cc4fde> in <module>()
      1 from pynq import Overlay
----> 2 ol = Overlay('/home/xilinx/pynq/overlays/adder/adder.bit')

/usr/local/lib/python3.6/dist-packages/pynq/overlay.py in __init__(self, bitfile_name, dtbo, download, ignore_version, device)
    335 
    336         """
--> 337         super().__init__(bitfile_name, dtbo, partial=False, device=device)
    338 
    339         self._register_drivers()

/usr/local/lib/python3.6/dist-packages/pynq/bitstream.py in __init__(self, bitfile_name, dtbo, partial, device)
    109         if device is None:
    110             from .pl_server.device import Device
--> 111             device = Device.active_device
    112         self.device = device
    113 

/usr/local/lib/python3.6/dist-packages/pynq/pl_server/device.py in active_device(cls)
     94         if not hasattr(cls, '_active_device'):
     95             if len(cls.devices) == 0:
---> 96                 raise RuntimeError("No Devices Found")
     97             cls._active_device = cls.devices[0]
     98         return cls._active_device

RuntimeError: No Devices Found

Does anyone know how do I fix this?

1 Like

This error is usually a result of /dev/xlnk not existing. Can you check if the device is there? What image are you running?

Peter

Hi peter,

I am facing the same issue as well, I have check and dev/xink is there, how do I proceed?

Hello. Im having the same issue on my Zybo using pynq 2.6 as base.

from pynq.overlays.base import BaseOverlay
ol = BaseOverlay("base.bit")

RuntimeError: No Devices Found
xilinx@pynq:~$ ls /dev/xlnk
ls: cannot access '/dev/xlnk': No such file or directory
xilinx@pynq:~$ ls /sys/class/fpga_manager/
ls: cannot access '/sys/class/fpga_manager/': No such file or directory

Any ideas @PeterOgden ? I used this files (kernel) to the boot partition of the sd.

The board appears to boot correctly but cant load any bitfile.

Some extra info, not sure if relevant:

xilinx@pynq:~$ sudo systemctl start  xilinx-apf-driver.service
[sudo] password for xilinx: 
Job for xilinx-apf-driver.service failed because the control process exited with error code.
See "systemctl status xilinx-apf-driver.service" and "journalctl -xe" for details.
xilinx@pynq:~$ systemctl status xilinx-apf-driver.service
● xilinx-apf-driver.service - Xilinx APF Driver Service.
   Loaded: loaded (/etc/systemd/system/xilinx-apf-driver.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2021-10-11 22:37:24 UTC; 7s ago
  Process: 1632 ExecStart=/sbin/modprobe xlnk-eng (code=exited, status=1/FAILURE)
 Main PID: 1632 (code=exited, status=1/FAILURE)
xilinx@pynq:~$ sudo depmod
depmod: ERROR: could not open directory /lib/modules/3.17.0-xilinx-dirty: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
1 Like

RuntimeError Traceback (most recent call last)
in ()
1 from pynq.overlays.base import BaseOverlay
----> 2 base = BaseOverlay(“base.bit”)

/usr/local/lib/python3.6/dist-packages/pynq/overlays/base/base.py in init(self, bitfile, **kwargs)
84
85 def init(self, bitfile, **kwargs):
—> 86 super().init(bitfile, **kwargs)
87 if self.is_loaded():
88 self.iop_pmoda.mbtype = “Pmod”

/usr/local/lib/python3.6/dist-packages/pynq/overlay.py in init(self, bitfile_name, dtbo, download, ignore_version, device)
334
335 “”"
→ 336 super().init(bitfile_name, dtbo, partial=False, device=device)
337
338 self._register_drivers()

/usr/local/lib/python3.6/dist-packages/pynq/bitstream.py in init(self, bitfile_name, dtbo, partial, device)
109 if device is None:
110 from .pl_server.device import Device
→ 111 device = Device.active_device
112 self.device = device
113

/usr/local/lib/python3.6/dist-packages/pynq/pl_server/device.py in active_device(cls)
92 if not hasattr(cls, ‘_active_device’):
93 if len(cls.devices) == 0:
—> 94 raise RuntimeError(“No Devices Found”)
95 cls._active_device = cls.devices[0]
96 return cls._active_device

RuntimeError: No Devices Found

the same :face_with_thermometer: !

I have the same problem.

I logged in via SSH to my PYNQ-ZU board. Then ran

sudo -s 
source /etc/profile.d/pynq_venv.sh 
python3

In Python prompt, I ran some lines of code and get the following error:

>>> from pynq.overlays.base import BaseOverlay
>>> from pynq.lib.video import *
>>> base = BaseOverlay("base.bit")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xilinx/pynq/overlays/base/base.py", line 48, in __init__
    super().__init__(*args, **kwargs)
  File "/home/xilinx/pynq/overlay.py", line 336, in __init__
    super().__init__(bitfile_name, dtbo, partial=False, device=device)
  File "/home/xilinx/pynq/bitstream.py", line 111, in __init__
    device = Device.active_device
  File "/home/xilinx/pynq/pl_server/device.py", line 94, in active_device
    raise RuntimeError("No Devices Found")
RuntimeError: No Devices Found

Hi there,

Looks like this is happening because when you login as root you enter a new environment, and lose the XILINX_XRT environment variable. This is usually set by calling xrt_setup.sh on startup along with pynq_venv.sh in /etc/profile.d/, which is why we don’t see these errors in jupyter lab.

Running

export XILINX_XRT=/usr

before your python call should resolve this.

Thanks
Shawn

2 Likes

Thank you for spotting the problem. It can work in the terminal now.
If I don’t change to root user, it will print out the following error message when loading a bitstream.

>>> base = BaseOverlay("base.bit")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xilinx/pynq/overlays/base/base.py", line 48, in __init__
    super().__init__(*args, **kwargs)
  File "/home/xilinx/pynq/overlay.py", line 354, in __init__
    self.download()
  File "/home/xilinx/pynq/overlays/base/base.py", line 91, in download
    super().download()
  File "/home/xilinx/pynq/overlay.py", line 416, in download
    Clocks.set_pl_clk(i, div0, div1)
  File "/home/xilinx/pynq/ps.py", line 331, in set_pl_clk
    cls._instance.set_pl_clk(clk_idx, div0, div1, clk_mhz)
  File "/home/xilinx/pynq/ps.py", line 339, in _instance
    cls._real_instance = _ClocksUltrascale()
  File "/home/xilinx/pynq/ps.py", line 491, in __init__
    self._crf_mmio = MMIO(self.CRF_APB_ADDRESS, 0x100)
  File "/home/xilinx/pynq/mmio.py", line 100, in __init__
    self.array = self.device.mmap(base_addr, length)
  File "/home/xilinx/pynq/pl_server/embedded_device.py", line 527, in mmap
    raise EnvironmentError('Root permissions required.')
OSError: Root permissions required.

Unfortunately that’s expected behavior! We run everything on pynq as root – you’ll notice that the jupyter terminal is the root user by default. PYNQ touches a lot of devices and memories that require elevated privileges. There’s a nice explanation by Peter from a while back on why pynq works this way.

Thanks
Shawn

1 Like

I got it and appreciate that.

Hai