# No HDMI output with OpenCV Face Detection Webcam example

**URL:** <https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319>\
**Category:** Support\
**Created:** [February 11, 2021, 12:14pm UTC](https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319 "2021-02-11T12:14:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pawzap](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/pawzap/32/1715_2.png) [@pawzap](https://discuss.pynq.io/u/pawzap)\
**Post date:** [February 11, 2021, 12:14pm UTC](https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319/1 "2021-02-11T12:14:28Z")

</div>

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ł

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [February 18, 2021, 3:12pm UTC](https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319/2 "2021-02-18T15:12:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pawzap](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/pawzap/32/1715_2.png) [@pawzap](https://discuss.pynq.io/u/pawzap)\
**Post date:** [February 18, 2021, 3:53pm UTC](https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319/3 "2021-02-18T15:53:00Z")

</div>

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ł

---

<div class="post-metadata">

**Author:** ![pawzap](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/pawzap/32/1715_2.png) [@pawzap](https://discuss.pynq.io/u/pawzap)\
**Post date:** [February 22, 2021, 6:37pm UTC](https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319/4 "2021-02-22T18:37:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [March 5, 2021, 5:03pm UTC](https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319/5 "2021-03-05T17:03:46Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![pawzap](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/pawzap/32/1715_2.png) [@pawzap](https://discuss.pynq.io/u/pawzap)\
**Post date:** [March 5, 2021, 5:33pm UTC](https://discuss.pynq.io/t/no-hdmi-output-with-opencv-face-detection-webcam-example/2319/6 "2021-03-05T17:33:15Z")

</div>

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ł
