Error while running the jupiter notebook on Kria KV260

Hi,
While executing the display_port_introduction notebook provided under video sub-folder of KV260 folder provided in the Jupiter lab, I encountered an error. As soon as I executed the following

isplayport = DisplayPort()

displayport.configure(VideoMode(1280, 720, 24), PIXEL_RGB)

the screen went blank. Nothing worked and I had to restart the board.
I have a Dell D2020H monitor attached to the HDMI port and a Logitech USB HD C270 webcam attached to the USB port provided on the Kria KV260 board.

The second error I encountered while running the USB_webcam notebook under the common folder which is provided with the PYNQ Jupiter lab. While acquiring the image the webcam seems not to be working because every time I run the script black images appear.

Please help. Thanks in Advance.
Nilanjan

1 Like

Hi,

With the USB camera connected, can you run this in a JupyterLab terminal and report the output?

lsusb -t

Mario

Hello,

The output of the command lsusb -t with the camera connected to the USB is

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-b189a5911382> in <module>
----> 1 lsusb -t

NameError: name 'lsusb' is not defined

Thanks
Nilanjan

You need to run the command on a terminal, if you are running the command on a Jupter notebook you need to pre-fix !, for instance

!lsusb -t

You can see how to open a terminal (shell) here Terminals — JupyterLab 3.3.0rc0 documentation

The output

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 1: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=rtl88x2bu, 480M
        |__ Port 3: Dev 6, If 3, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 6, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 3: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 5: Dev 5, If 0, Class=Vendor Specific Class, Driver=, 480M

Thank you can you also report lsusb?

The output for lsusb is

Bus 002 Device 002: ID 0424:5744 Microchip Technology, Inc. (formerly SMSC) Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0424:2740 Microchip Technology, Inc. (formerly SMSC) 
Bus 001 Device 006: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 001 Device 004: ID 2357:0115 TP-Link 
Bus 001 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 0424:2744 Microchip Technology, Inc. (formerly SMSC) Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Nilanjan

1 Like

Everything looks OK so far, a few more reports before we move to OpenCV

Please report the output of these.

  • ls /dev/video*
  • ls /dev/media*
  • dmesg | grep usb (this one should be long)

Mario

The output for ls /dev/video* is

/dev/video0  /dev/video1

The output for ls /dev/media* is

/dev/media0

The output for dmesg | grep usb is

[    1.914330] usbcore: registered new interface driver usbfs
[    1.914354] usbcore: registered new interface driver hub
[    1.914375] usbcore: registered new device driver usb
[    2.821531] usbcore: registered new interface driver asix
[    2.821568] usbcore: registered new interface driver ax88179_178a
[    2.821587] usbcore: registered new interface driver cdc_ether
[    2.821605] usbcore: registered new interface driver net1080
[    2.821624] usbcore: registered new interface driver cdc_subset
[    2.821644] usbcore: registered new interface driver zaurus
[    2.821673] usbcore: registered new interface driver cdc_ncm
[    2.822504] usbcore: registered new interface driver uas
[    2.822534] usbcore: registered new interface driver usb-storage
[    2.824443] usbcore: registered new interface driver uvcvideo
[    2.825245] usbcore: registered new interface driver bcm203x
[    2.825269] usbcore: registered new interface driver bpa10x
[    2.825293] usbcore: registered new interface driver bfusb
[    2.825315] usbcore: registered new interface driver btusb
[    2.825351] usbcore: registered new interface driver ath3k
[    2.849752] usbcore: registered new interface driver usbhid
[    2.849754] usbhid: USB HID core driver
[    2.852800] usbcore: registered new interface driver snd-usb-audio
[    3.557934] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/status
[    3.568200] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/pinctrl-names
[    3.579076] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/pinctrl-0
[    3.589606] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/dwc3@fe200000/status
[    3.601090] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/dwc3@fe200000/dr_mode
[    3.612660] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/dwc3@fe200000/snps,usb3_lpm_capable
[    3.625445] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/dwc3@fe200000/phy-names
[    3.637189] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/dwc3@fe200000/phys
[    3.648499] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /amba/usb0@ff9d0000/dwc3@fe200000/maximum-speed
[    3.864987] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/usbhub
[    3.937009] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/pinctrl_usb0_default
[    4.043500] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    4.043505] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.043509] usb usb1: Product: xHCI Host Controller
[    4.043513] usb usb1: Manufacturer: Linux 5.4.0-1017-xilinx-zynqmp xhci-hcd
[    4.043516] usb usb1: SerialNumber: xhci-hcd.1.auto
[    4.044192] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.04
[    4.044196] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.044202] usb usb2: Product: xHCI Host Controller
[    4.044206] usb usb2: Manufacturer: Linux 5.4.0-1017-xilinx-zynqmp xhci-hcd
[    4.044209] usb usb2: SerialNumber: xhci-hcd.1.auto
[    9.467914] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[    9.616420] usb 1-1: New USB device found, idVendor=0424, idProduct=2744, bcdDevice= 2.21
[    9.616427] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    9.616431] usb 1-1: Product: USB2744
[    9.616435] usb 1-1: Manufacturer: Microchip Tech
[    9.743943] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[    9.768270] usb 2-1: New USB device found, idVendor=0424, idProduct=5744, bcdDevice= 2.21
[    9.768278] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=0
[    9.768282] usb 2-1: Product: USB5744
[    9.768285] usb 2-1: Manufacturer: Microchip Tech
[   10.027945] usb 1-1.1: new full-speed USB device number 3 using xhci-hcd
[   10.130240] usb 1-1.1: New USB device found, idVendor=046d, idProduct=c534, bcdDevice=29.01
[   10.130250] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   10.130253] usb 1-1.1: Product: USB Receiver
[   10.130257] usb 1-1.1: Manufacturer: Logitech
[   10.222346] input: Logitech USB Receiver as /devices/platform/amba/ff9d0000.usb0/fe200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1.1/1-1.1:1.0/0003:046D:C534.0001/input/input0
[   10.280463] hid-generic 0003:046D:C534.0001: input: USB HID v1.11 Keyboard [Logitech USB Receiver] on usb-xhci-hcd.1.auto-1.1/input0
[   10.284121] input: Logitech USB Receiver Mouse as /devices/platform/amba/ff9d0000.usb0/fe200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1.1/1-1.1:1.1/0003:046D:C534.0002/input/input1
[   10.284400] input: Logitech USB Receiver Consumer Control as /devices/platform/amba/ff9d0000.usb0/fe200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1.1/1-1.1:1.1/0003:046D:C534.0002/input/input2
[   10.344227] input: Logitech USB Receiver System Control as /devices/platform/amba/ff9d0000.usb0/fe200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1.1/1-1.1:1.1/0003:046D:C534.0002/input/input3
[   10.344344] hid-generic 0003:046D:C534.0002: input: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-xhci-hcd.1.auto-1.1/input1
[   10.423953] usb 1-1.2: new high-speed USB device number 4 using xhci-hcd
[   10.524625] usb 1-1.2: New USB device found, idVendor=2357, idProduct=0115, bcdDevice= 2.10
[   10.524639] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   10.524654] usb 1-1.2: Product: 802.11ac NIC
[   10.524658] usb 1-1.2: Manufacturer: Realtek
[   10.524661] usb 1-1.2: SerialNumber: 123456
[   10.651931] usb 1-1.5: new high-speed USB device number 5 using xhci-hcd
[   10.752765] usb 1-1.5: New USB device found, idVendor=0424, idProduct=2740, bcdDevice= 2.00
[   10.752782] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   10.752790] usb 1-1.5: Product: Hub Controller
[   10.752794] usb 1-1.5: Manufacturer: Microchip Tech
[   13.083907] usbcore: registered new interface driver rtl88x2bu
[  694.706061] usb 1-1.3: new high-speed USB device number 6 using xhci-hcd
[  695.023412] usb 1-1.3: New USB device found, idVendor=046d, idProduct=0825, bcdDevice= 6.04
[  695.023423] usb 1-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=1
[  695.023427] usb 1-1.3: Product: C270 HD WEBCAM
[  695.023430] usb 1-1.3: SerialNumber: BB259C60
[  695.282397] input: C270 HD WEBCAM as /devices/platform/amba/ff9d0000.usb0/fe200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1.3/1-1.3:1.0/input/input6
[  695.470039] usb 1-1.3: set resolution quirk: cval->res = 384
[ 1263.256693] usb 1-1.3: reset high-speed USB device number 6 using xhci-hcd

Nilanjan

Hi,

Everything looks normal in the logs…

Regarding the DisplayPort, do you see the Ubuntu login screen in your monitor?

Can you run this in a Jupyter Notebook? and report results

from pynq.lib.video import *
displayport = DisplayPort()
displayport.modes

Regarding the webcam, please try this on a notebook as well

import cv2
import PIL.Image
capture = cv2.VideoCapture(0)

print(f"Is webcam open: {capture.isOpened()}")

ret, frame = capture.read()

print(f"Frame read successfully?: {ret}")
PIL.Image.fromarray(frame[:,:,[2,1,0]])
capture.release()

If everything works you should see the captured frame. If not, try to change the integer in VideoCapture, this number is directly related to to the /dev/video*

Mario

Hello,
I am able to see the Ubuntu login screen in my monitor
The output for

from pynq.lib.video import *
displayport = DisplayPort()
displayport.modes

is

[VideoMode: width=1600 height=900 bpp=24 fps=60,
 VideoMode: width=1280 height=800 bpp=24 fps=60,
 VideoMode: width=1152 height=864 bpp=24 fps=75,
 VideoMode: width=1280 height=720 bpp=24 fps=60,
 VideoMode: width=1280 height=720 bpp=24 fps=60,
 VideoMode: width=1280 height=720 bpp=24 fps=50,
 VideoMode: width=1024 height=768 bpp=24 fps=75,
 VideoMode: width=1024 height=768 bpp=24 fps=60,
 VideoMode: width=800 height=600 bpp=24 fps=75,
 VideoMode: width=800 height=600 bpp=24 fps=60,
 VideoMode: width=720 height=576 bpp=24 fps=50,
 VideoMode: width=720 height=480 bpp=24 fps=60,
 VideoMode: width=720 height=480 bpp=24 fps=60,
 VideoMode: width=640 height=480 bpp=24 fps=75,
 VideoMode: width=640 height=480 bpp=24 fps=60,
 VideoMode: width=640 height=480 bpp=24 fps=60,
 VideoMode: width=720 height=400 bpp=24 fps=70]

and the output for

import cv2
import PIL.Image
capture = cv2.VideoCapture(0)

print(f"Is webcam open: {capture.isOpened()}")

ret, frame = capture.read()

print(f"Frame read successfully?: {ret}")
PIL.Image.fromarray(frame[:,:,[2,1,0]])
capture.release()

is

Is webcam open: True
Frame read successfully?: True

but no image appear

When I changed the the integer in VideoCapture , the output is

Is webcam open: False
Frame read successfully?: False

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-efb2faae8102> in <module>
      8 
      9 print(f"Frame read successfully?: {ret}")
---> 10 PIL.Image.fromarray(frame[:,:,[2,1,0]])
     11 capture.release()

TypeError: 'NoneType' object is not subscriptable
1 Like

Apologies, can you try again with this code:

import cv2
import PIL.Image
capture = cv2.VideoCapture(0)

print(f"Is webcam open: {capture.isOpened()}")

ret, frame = capture.read()

print(f"Frame read successfully?: {ret}")
img = PIL.Image.fromarray(frame[:,:,[2,1,0]])
capture.release()
img

The image may have not shown because the .release() was last executed on the cell.

When I changed the the integer in VideoCapture , the output is
This indicates that the right value is 0.

Regarding the displayPort can you try the notebook common/display_port_introduction.ipynb? This one does not use a webcam, so if this works we can rule out a problem with DisplayPort.

Mario

1 Like

The output for the code is

Is webcam open: True
Frame read successfully?: True

along with a total black image

When I changed the the integer in VideoCapture , the output is
This indicates that the right value is 0. Yes.

Regarding the displayPort can you try the notebook common/display_port_introduction.ipynb ? This one does not use a webcam, so if this works we can rule out a problem with DisplayPort.
The same initial problem occurs…

As soon as I executed the following

isplayport = DisplayPort()

displayport.configure(VideoMode(1280, 720, 24), PIXEL_RGB)

the screen went blank. Nothing worked and I had to restart the board.

Hi,

That’s intriguing, did you verify the webcam in other machine?

Regarding the DisplayPort, can you try different modes (from the ones supported)?

Mario

Hi,
The webcam is working fine in windows as well as Ubuntu that I have in my laptop.

Also regarding the monitor I ran the whole program (common/display_port_introduction.ipynb)
,and not one cell at a time, and it worked. The webcam also showed the output. But neither the script that you send earlier nor the script in Jupiter lab common/usb_webcam.ipynb is working.

I apologize for a delayed reply.

Nilanjan

1 Like