No HDMI output with OpenCV Face Detection Webcam example

Hi!
I have tried to display Video on HDMI, but there was not any activity on a screen. A Python processing hangs without any information and this is the result of Jupyter kernel interruption:

Mode = VideoMode(1280,720,24)
hdmi_out = base.video.hdmi_out
hdmi_out.configure(Mode,PIXEL_RGB)
hdmi_out.start()

Frequency: 74250000


KeyboardInterrupt Traceback (most recent call last)
in ()
3 hdmi_out = base.video.hdmi_out
4 #hdmi_out = DisplayPort()
----> 5 hdmi_out.configure(Mode,PIXEL_RGB)
6 hdmi_out.start()

/usr/local/lib/python3.6/dist-packages/pynq/lib/video/hierarchies.py in configure(self, mode, pixelformat)
299 self._hdmi.mode = mode
300 self._vdma.writechannel.mode = mode
→ 301 self._hdmi.start()
302 return self._closecontextmanager()
303

/usr/local/lib/python3.6/dist-packages/pynq/lib/video/xilinx_hdmi.py in start(self)
184 while _hdmi_lib.HdmiTx_ready(self.handle):
185 _hdmi_lib.HdmiTx_handle_events(self.handle)
→ 186 while not _hdmi_lib.HdmiTx_ready(self.handle):
187 _hdmi_lib.HdmiTx_handle_events(self.handle)
188

KeyboardInterrupt:

Can someone give me a hint how to solve this? What could be a reason? The monitor is connected and it is also possible to read its EDID.

Thanks
Paweł

1 Like

Which board? Which PYNQ version? What does your cable setup look like?

This is a custom board based on ZynqMP. I use PYNQ 2.5. The board can display Video on HDMI with using Linux kernel drivers. The Vivado design for HDMI is very similar to ZCU104. The only important difference is a clocking. The board uses Si570 programmable oscillator, instead of IDT8T49N240. By default PYNQ does not have a driver for the chip. As a workaround I set the required frequency with using Linux driver.

Paweł

1 Like

I added a driver for Si570, but the problem still exists. Jupyter processing hangs in the same place:

/usr/local/lib/python3.6/dist-packages/pynq/lib/video/xilinx_hdmi.py in start(self)
** 184 while _hdmi_lib.HdmiTx_ready(self.handle):**
** 185 _hdmi_lib.HdmiTx_handle_events(self.handle)**
→ 186 while not _hdmi_lib.HdmiTx_ready(self.handle):
** 187 _hdmi_lib.HdmiTx_handle_events(self.handle)**

Does anybody know how to solve the problem?

You will have to write your own Python / C driver for that clock chip. I think Pynq-ZU board also has that kind of clock chip…

Hi @rock! Thanks for your reply.

Yes, I did it. I wrote the driver for Si570 and it works. The problem with HDMI still exists. Firstly Jupyter hangs on while loop in xilinx_hdmi.py (line 186) as I wrote in my previous message. When I commented that fragment then it hangs on another part when I tried to display image:

# Capture webcam image
import numpy as np

ret, frame_vga = videoIn.read()
#frame_vga?

# Display webcam image via HDMI Out
if (ret):      
    outframe = hdmi_out.newframe()
    outframe[0:720,0:1280,:] = frame_vga[0:720,0:1280,:]
    hdmi_out.writeframe(outframe)
else:
    raise RuntimeError("Failed to read from camera.")

There was not any HDMI output on the monitor. After interruption:


KeyboardInterrupt Traceback (most recent call last)
in ()
9 outframe = hdmi_out.newframe()
10 outframe[0:720,0:1280,:] = frame_vga[0:720,0:1280,:]
—> 11 hdmi_out.writeframe(outframe)
12 else:
13 raise RuntimeError(“Failed to read from camera.”)

/usr/local/lib/python3.6/dist-packages/pynq/lib/video/hierarchies.py in writeframe(self, frame)
389
390 “”"
→ 391 self._vdma.writechannel.writeframe(frame)
392
393 async def writeframe_async(self, frame):

/usr/local/lib/python3.6/dist-packages/pynq/lib/video/dma.py in writeframe(self, frame)
456 loop = asyncio.get_event_loop()
457 loop.run_until_complete(
→ 458 asyncio.ensure_future(self._interrupt.wait()))
459 self._mmio.write(0x04, 0x1000)
460 self._writeframe_internal(frame)

/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:

Do you have any idea what could be wrong? Is it a problem with system interrupts for Video IPs?

Thanks
Paweł

1 Like