Greetings everyone,
I’m fairly new to the PYNQ framework. I have a PYNQ-ZU board which I am trying to use with a MIPI CSI-2 camera to capture some frames and get familiar with it. I saw that the base overlay of the PYNQ-ZU already supports such interface, but it seems specified that the supported camera is the PCAM 5C from Digilent. I tried using the framework to acquire a frame from my different camera (an Alvium MIPI CSI-2 from Allied Vision), but to no avail. I’m suspecting that I may need to integrate my own IP to interact with the camera since maybe the commands sent to the camera are the ones required for the PCAM and they may differ from mine but I wanted to make sure first if I was doing something wrong.
Here’s a code snippet which I used from a Jupyter notebook:
from pynq.overlays.base import BaseOverlay
from pynq.lib.video import *
import cv2
import numpy as np
base = BaseOverlay("base.bit")
handle=base.mipi.initialize()
framemode = VideoMode(800, 640, 8)
vdma0 = base.mipi.axi_vdma_0
vdma0.readchannel.mode = framemode
vdma0.readchannel.start()
frame = vdma0.readchannel.readframe()
PIL.Image.fromarray(frame)
vdma0.readchannel.stop()
Now, when calling readframe() the code freezes and after stopping the execution the traceback shows the following:
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-4-d0d4466487b0> in <module>()
----> 1 frame = vdma0.readchannel.readframe()
2 PIL.Image.fromarray(frame)
/usr/local/lib/python3.6/dist-packages/pynq/lib/video/dma.py in readframe(self)
199 loop = asyncio.get_event_loop()
200 loop.run_until_complete(
--> 201 asyncio.ensure_future(self._interrupt.wait()))
202 pass
203 self._mmio.write(0x34, 0x1000)
/usr/lib/python3.6/asyncio/base_events.py in run_until_complete(self, future)
453 future.add_done_callback(_run_until_complete_cb)
454 try:
--> 455 self.run_forever()
456 except:
457 if new_task and future.done() and not future.cancelled():
/usr/lib/python3.6/asyncio/base_events.py in run_forever(self)
420 events._set_running_loop(self)
421 while True:
--> 422 self._run_once()
423 if self._stopping:
424 break
/usr/lib/python3.6/asyncio/base_events.py in _run_once(self)
1394 timeout * 1e3, dt * 1e3)
1395 else:
-> 1396 event_list = self._selector.select(timeout)
1397 self._process_events(event_list)
1398
/usr/lib/python3.6/selectors.py in select(self, timeout)
443 ready = []
444 try:
--> 445 fd_event_list = self._epoll.poll(timeout, max_ev)
446 except InterruptedError:
447 return ready
KeyboardInterrupt:
From what I’m understanding, I suspect that due to the fact that the configurations between the two MIPI cameras are different it may be impossible for me using this overlay to grab frames from this camera. This camera also supports the V4L2 drivers, but I don’t know whether the PYNQ image that I’m using (v2.6) supports it already and - if so - if there is any way of using it.
Thank you!