Beaglebone USB Camera

Hi,
I am working on a beaglebone robotics platform. I have soldered together and tested most of the robot, but I need to get a webcam working. I am running Archlinux arm with a 3.2 kernel. I have tried compiling it many times, but it seems I can only get a camera to show up as a device. I have been trying to get this camera to work https://www.jacobsparts.com/items/CAM-04/ It is a piece of crap but it is UVC compliant and dirt cheap. It’s vendor:device id is 1871:0d01. It shows up as /dev/video0, but when I try to use it using opencv i get:

VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
select timeout

It also freezes up ffmpeg when I try to create a stream. I’m starting to think that I need a new webcam but if this UVC webcam didn’t work I don’t know which will. Has anybody successfully used a usb webcam with the beaglebone 3.2 and what webcam did you use? Does anybody know of a solution to my problem? I’m pretty stuck.

config.txt (85.1 KB)

I have been having problems with USB cameras on the Beaglebone. One workaround I found that partially works is to disable DMA by setting:

CONFIG_MUSB_PIO_ONLY=y

HTH,

Dave.

That unfortunately made no difference do you have any more suggestions?

The only other suggestion is to borrow a known working higher end camera such as the Logitech C615. That may narrow it down somewhat. I hope that someone with more expertise can nail these problems with DMA on the Beaglebone, which appears to work fine on the Beagleboard xM.

Okay Thanks for your help. I’m working for a competition and I found a camera that can create a video file with ffmpeg. Hopefully I can figure out how to make it stream to opencv before the 13th. I will try to work on this problem some more after the competition.

I found the same problem as you. For my case, I used an UVC camera with code from this link.
http://www.twam.info/linux/v4l2grab-grabbing-jpegs-from-v4l2-devices

Anyway, the captured image’s size can be only 320x240pixel.
Hope this bug (in beaglebone) be solved soon.

HTH,
Sorat A.

Sorat,
I am not capturing in JPEG or MJPEG format, rather the raw YUYV format. I have significant video analysis processing and do not want to uncompress/compress prior to analysis. The code that works for me at 640x480 (but NOT in DMA) is:

Have you tried this? Regards, Dave. On 03/24/2012 12:56 PM, Sorat A wrote:

Dear David,

Not yet, I will try your suggestion.
Anyway, do you have any idea of capturing through OpenCV function?

Regards
Sorat A.

I recently investigated a similar problem on a Beagleboard XM and determined the problem was in the video-4-linux (v4l2) code. The OpenCV code asks the v4l system to deliver uncompressed RGB. In my case the v4l2 code was then turning around and asking the camera for JPEG compressed images and then trying to decompress those images in software. The Beagleboard could not keep up and the result was select timeouts and scrambled image data.

You may be experiencing similar problems with your camera. Write a small test problem that asks OpenCV to grab a bunch of images from your camera. Then run that program on your Beaglebone using the Linux perf tool like so:

perf record
perf report

In my case perf reported an enormous amount of time inside libv4lconvert. The solution was to adapt the code provided above to pull YUV images from the camera, then convert them to RGB using fixed-point arithmetic.

As for the original poster: the VIDIOC_QUERYMENU errors are benign. OpenCV is asking for optional information and then complaining when the camera doesn’t provide it. If the camera did provide this information OpenCV would just ignore it anyway.

Not anything good yet, but it appears that the am335x is starting to get support of linux mainstream so it shouldn’t be too long until the crappy TI drivers are all gone and it starts working.

I heard that select timeout error may also caused my insufficient power. webcam is recognized by the system but there is not enough power to retrieve the image. I’m not really sure, but I’ll buy 4A adapter tomorrow and try again. I’ll post the results here as well.

The problem is the board’s USB drivers. The were written by TI and isochronous mode does not work right. Which is needed for webcams. I’m waiting for linux 3.8 which is when the bone will be mainlined. You can stay up to date by following the linux-omap project on git.kernel.org. Once they fully support the am33xx I’m hoping this problem will be a thing of the past. In the mean time I have found no reliable work arounds. I wish I could be more helpful and not just a bad news bear.

I was having a similar issue, and my solution was to write my own v4l2 interface code. its a bit incomplete, as it was purpose designed, but in my experience, most of the v4l2 cameras - especially the UVC driver ones, do not support reading RGB straight from the camera, I started having this problem years ago on my laptop. I could pull jpeg frames and yuv420 from the camera. Since I haven’t been using OpenCV much on ARM, since it really isn’t optimized for it, although maybe soon because there is an official iOS version now, I wrote all my code to use YUV. You may even be able to use the NEON vector processor to largely accelerate conversion from YUV to RGB.

  • Nathaniel

Hi,

I am trying to use the usb webcam on my beagleboard xM. When I plug the camera, I get the message as below:

usb 1-2.2: New USB device found, idVendor=18ec, idProduct=3399
[ 79.094691] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 79.103047] usb 1-2.2: Product: USB2.0 PC CAMERA
[ 79.107917] usb 1-2.2: Manufacturer: ARKMICRO
[ 79.114926] usb 1-2.2: usb_probe_device
[ 79.114960] usb 1-2.2: configuration #1 chosen from 1 choice
[ 79.115484] usb 1-2.2: adding 1-2.2:1.0 (config #1, interface 0)
[ 79.116724] usbtest 1-2.2:1.0: usb_probe_interface
[ 79.116753] usbtest 1-2.2:1.0: usb_probe_interface - got id
[ 79.117649] usb 1-2.2: adding 1-2.2:1.1 (config #1, interface 1)
[ 79.118980] usbtest 1-2.2:1.1: usb_probe_interface
[ 79.119011] usbtest 1-2.2:1.1: usb_probe_interface - got id
[ 79.119134] usb 1-2.2: adding 1-2.2:1.2 (config #1, interface 2)
[ 79.121260] usbtest 1-2.2:1.2: usb_probe_interface
[ 79.121292] usbtest 1-2.2:1.2: usb_probe_interface - got id
[ 79.121419] usb 1-2.2: adding 1-2.2:1.3 (config #1, interface 3)
[ 79.127402] usbtest 1-2.2:1.3: usb_probe_interface
[ 79.127435] usbtest 1-2.2:1.3: usb_probe_interface - got id
[ 79.128766] drivers/usb/core/inode.c: creating file ‘004’

Looking at this, I feel that the driver for it is working properly. But, I don’t know how to test the camera, I mean what setup/application to use on the beagle board? Can you please shed some light on the same? Thanks in advance.

Thanks,
Pradeep

Well first thing is to check if you have a /dev/videoN file. If you have one, the camera is most likely working. For webcams I’ve always liked mjpg-streamer. Supports v4l, v4l2, and cameras that use the UVC driver

  • Nathaniel

Hi Nathaniel,

Thanks for the reply. I checked my usb webcam on desktop and its working fine. But with With kernel 2.6.32 & angstrom distribution 2012.05 on Beagleboard, my usb webcam doesn’t seems to work. I am not able to find /dev/videoN device node. The output of usb-devices command is below:

Bus=02 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=18ec ProdID=3399 Rev=01.00
S: Manufacturer=ARKMICRO
S: Product=USB2.0 PC CAMERA
C: #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=200mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=(none)
I: If#= 1 Alt= 0 #EPs= 0 Cls=0e(video) Sub=02 Prot=00 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I: If#= 3 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio

As seen, it is not able to find the driver for the same. I would be thankful if you can share the uImage or driver for camera or point me to the version of Angstrom distribution to use for the same.

Regards,
Pradeep

Hi Nathaniel,

I am trying to understand the v4l interface in Linux. I would be grateful, if you can point me to some tutorials or book which can guide me on the same. Thanks in advance.

Regards,
Pradeep

Yeah, I’ll assemble a list and put together some of my code (i’ll send another email). Video4Linux doesn’t have the best documentation, although its better than it ever has been. As far as not having the device node, it looks like its probably supported by the UVC driver (lhttp://www.ideasonboard.org/uvc/), so install the package “kernel-module-uvcvideo” on your board.

As far as the V4L site goes, here’s the link: http://linuxtv.org/downloads/v4l-dvb-apis/. linuxtv.org is the site that maintains Video4Linux.