Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEBCAM is recognized but does not work #4

Open
Cobac-Net opened this issue Oct 2, 2024 · 1 comment
Open

WEBCAM is recognized but does not work #4

Cobac-Net opened this issue Oct 2, 2024 · 1 comment

Comments

@Cobac-Net
Copy link

Thank you for providing the image file, which is easy to use. I am building an image system by porting my own display circuit and Pcam5C control to PYNQ.

I went further and connected a WEBCAM (a general USB-connected camera), but I cannot capture images.

The situation is as follows:

  • Zybo Z7-10
  • Verify that the WEBCAM is recognized using the lsusb command.
  • External power supply, USB host jumper pin (JP2), etc. are set up

1. Unable to capture on PYNQ

Execute the following in Jupyter Notebook

import cv2
cap = cv2.VideoCapture(0, cv2.CAP_V4L2)
print(cap.isOpened())
print(cap.grab())
print(cap.read())

The following result is obtained and images cannot be read

True
False
(False, None)

2. Error in fswebcam command

When I executed the fswebcam command on Linux, the following error occurred.

% fswebcam test.jpg
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 352x288.
Error starting stream.
VIDIOC_STREAMON: Cannot allocate memory
Unable to use mmap. Using read instead.
Unable to use read.

3. Repeated rebuilds did not solve the problem

I fixed the items in "pynq.cfg" that seemed related and rebuilt, but the result was the same.

I would appreciate any solutions or hints for rebuilding.

@nick-petrovsky
Copy link
Owner

Thank you for providing the image file, which is easy to use.

You are welcome.

I think it is rather software issues than hardware, USB host worked as expected, at least with dummy USB flash sticks.

I managed to build same test environment using old USB camera DEFENDER C-090. I can confirm that the problem is occurs.
dmesg -T output is:

[Sun Oct 23 05:55:09 2022] chipidea-usb2 e0002000.usb: Rejecting highmem page from CMA.

Fast googling into issue give some results from Armbian community. Mentioned failures are connect to the kernel issues with V4L2 subsystem or something else, PYNQ 3.0.1 shipped with kernel from PetaLinux 2022.1 Linux pynq 5.15.19-xilinx-v2022.1 #1 SMP PREEMPT Mon Apr 11 17:52:14 UTC 2022 armv7l armv7l armv7l GNU/Linux. According forums probably versions 5.15 are known as affected.

Value of CONFIG_CMA_SIZE_MBYTES, seems to be okey for small images:

cat /proc/config.gz | gunzip | grep CMA_SIZE
CONFIG_CMA_SIZE_MBYTES=128

In my point of view, easiest way is just to update kernel to >5.15 or apply some V4L2 patches (I don't know which).

If you manage to resolve issue, please write back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants