UVC problems with Beaglebone

This appears to be an issue with the USB DMA driver on the Beaglebone. When I first transitioned from the Bagleboard XM I noticed that shared memory UVC streaming would not work for me. Sometime around February 9, I built a 3.1 kernel from scratch which worked albeit with surprisingly high CPU load. Later kernels (3.2.x) would not work for me. Yesterday someone else suggested rebuilding the kernel with USB DMA disabled (CONFIG_MUSB_PIO_ONLY=y). This appears to work. The CPU load is about half that of the 3.1 kernel (around 10% when streaming 640x480 YUYV at 15fps).

I hope in future that there is a fix for USB-DMA, but this works for me right now.

Regards,

Dave.

Dear Mr.David,

Thank you very much for your answers.
I will try your solution. :slight_smile:

Regards,
Sorat A.

เมื่อ วันอังคารที่ 20 มีนาคม ค.ศ. 2012, 0 นาฬิกา 23 นาที 27 วินาที UTC+7, David เขียนว่า:

I have found that 640x480 only works intermittently with the 3.2.9+ kernel (DMA disabled) - images are very dark.

Please ignore my last comment. It appears that my camera has a very slow AGC after initialization.

Apologies for any confusion. :-[

Dave.

Dear Mr.David

Just report, I already try rebuilding the

kernel with USB DMA disabled (CONFIG_MUSB_PIO_ONLY=y),
the output images from camera looks broken, it filled with stripes and noises. Be at the end of one’s wits for now.

Anyway, really thanks for your help

Regards,
Sorat A.

Dear Mr. David,

just FYI,
finally I found that your suggestion is work, but only in case captured (image) size < 640x480 pixels.

and Thank you again :slight_smile:

Regards
Sorat A.

Hello,

a Linux newbie here, but with the same issues with UVC webcams and BeagleBone. My question is, what steps are there to either disable DMA on the USB controller at runtime, or recompile the kernel, with an option (like CONFIG_MUSB_PIO_ONLY) changed?

Thanks for the time,
Mihai Pomarlan

I recompiled the kernel with CONFIG_MUSB_PIO_ONLY=y. I believe that there is an option that you can pass to a module at load time, but I do not have the details at this time. I think they are in the kernel config help.

HTH,

Dave.

Hello Mr. David,

I’m a student and I’m working with BeagleBoard REVC4. Currently I have problems with USB WEB camera (with UVC support). When I boot kernel (version 3.5.0-dirty) on BB I do the following:

“depmod -a”

then in folder /lib/modules/3.5.0-dirty/kernel/drivers/media/video/uvc I type

“insmod uvcvideo.ko”

The following appears on console:
[ 119.566070] uvcvideo: Unknown symbol vb2_queue_init (err 0)
[ 119.572753] uvcvideo: Unknown symbol vb2_streamoff (err 0)
[ 119.578643] uvcvideo: Unknown symbol vb2_queue_release (err 0)
[ 119.584869] uvcvideo: Unknown symbol vb2_poll (err 0)
[ 119.590332] uvcvideo: Unknown symbol vb2_dqbuf (err 0)
[ 119.595825] uvcvideo: Unknown symbol vb2_reqbufs (err 0)
[ 119.601593] uvcvideo: Unknown symbol vb2_streamon (err 0)
[ 119.607360] uvcvideo: Unknown symbol vb2_querybuf (err 0)
[ 119.613067] uvcvideo: Unknown symbol vb2_qbuf (err 0)
[ 119.618469] uvcvideo: Unknown symbol vb2_buffer_done (err 0)
[ 119.624450] uvcvideo: Unknown symbol vb2_plane_vaddr (err 0)
[ 119.630554] uvcvideo: Unknown symbol vb2_vmalloc_memops (err 0)
[ 119.636962] uvcvideo: Unknown symbol vb2_mmap (err 0)
insmod: error inserting ‘uvcvideo.ko’: -1 Unknown symbol in module

then I try with: “modprobe uvcvideo”

and I get:

[ 141.286560] usbcore: registered new interface driver uvcvideo
[ 141.292755] USB Video Class driver (1.1.1)

After that in file /lib/modules/3.5.0-dirty/kernel/drivers/usb/gadget I type

“insmod g_webcam,ko”

and I get:

[ 337.707519] gadget: uvc_function_bind
[ 337.724212] gadget: Webcam Video Gadget
[ 337.728363] gadget: g_webcam ready
[ 337.732147] musb-hdrc musb-hdrc: MUSB HDRC host driver
[ 337.738922] musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 2
[ 337.747161] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[ 337.754272] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 337.761901] usb usb2: Product: MUSB HDRC host driver
[ 337.767181] usb usb2: Manufacturer: Linux 3.5.0-dirty musb-hcd
[ 337.773345] usb usb2: SerialNumber: musb-hdrc
[ 337.780517] hub 2-0:1.0: USB hub found
[ 337.784637] hub 2-0:1.0: 1 port detected

After that i plug my USB WEB camera directly in the USB port (not the OTG one) and I get nothing. There isn’t “video” in /dev.

I tried connecting USB WEB camera with BB through high-speed USB hub (powered with external 5 V) but still I get nothing…

Could you tell me what am I missing?

Krcevina,
     Apparently there is a problem when USB DMA is enabled for isochronous transfers (which UVC uses) . I am told that TI have been working on this for years, but there is still no fix :frowning: . The workaround that I use is to recompile the kernel with USB DMA disabled (CONFIG_MUSB_PIO_ONLY=y).

HTH,

Dave.

Thank You Mr. David for your quick replay.

Now I can see video0 on /dev/.

When I type “gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240 ! fakesink”

i got the following message:

Setting pipeline to PAUSED …
ERROR: Pipeline doesn’t want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Device ‘/dev/video0’ is not a capture device.
Additional debug info:
v4l2_calls.c(510): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Capabilities: 0x4000002
Setting pipeline to NULL …
Freeing pipeline …

So, still to work :slight_smile: If I eventually get it work I will report here so that maybe that information can benefit someone.

Hello Halil,

If I can remember correctly, the problem was bad EHCI port. I solved it by applying these two patches:

[PATCH 1/2] ARM: OMAP: USB: Fixup ehci_hcd_omap_probe error path

A recent commit, [PATCH] Fix OMAP EHCI suspend/resume failure
(i693) '354ab856' causes ehci probe to fail on omap3xxx. This
exposed bugs in the ehci_hcd_omap_probe error path causing
an oops.

On the error path, call usb_remove_hcd if usb_add_hcd has been
called, and call usb_put_hcd if usb_alloc_hcd has been called.

Tested on BB-xM.

Signed-off-by: Russ.Dill <at> [ti.com](http://ti.com)

I have experienced many problems with BB but at the end everything worked. You got to love it. I’m glad that you solved your current problem. Prepare yourself for many more :smiley:

Cheers!

Its this still the solution? I have video working mostly, I’m just using the straight API, wrote my own framegrabber code and I can pull mjpeg frames and small yuyv frames. If the input size of the image gets to a certain point, the driver just truncates the transmission to about 70 - 80k of image data.

  • Nathaniel

Hello, Krcevina! (and anyone else willing to help)

I am trying to use the BeagleBone to run OpenCV but have been having issues capturing images of reasonable quality from the Playstation 3 Eye webcam. I am able to run my vision applications on my desktop with absolutely no problem, but receive timeout errors when trying to capture 640x480 frames on the BeagleBone, exactly as described in this thread.

I have tried a number of different things, but haven’t been unable to resolve the issue. It sounds like your fix is the most promising. However, I am brand new to embedded Linux and am not very familiar with the kernel build process. I was hoping that you could provide just a little bit more detail of how you applied these patches.

So far, I have found these two pages the most helpful:

http://cwraig.id.au/?p=507

http://www.angstrom-distribution.org/building-angstrom

Where exactly do I need to apply your patches, and what steps do I need to take to make sure they get applied? If I am correct, I should be modifying/adding things in this directory: /setup-scripts/sources/meta-ti/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/

I also see in the “defconfig” file that the default settings for the following lines are:

# CONFIG_USB_EHCI_HCD is not set

CONFIG_USB_MUSB_HDRC=y

and

CONFIG_MUSB_PIO_ONLY=y

What should I use for these settings? From a terminal call to dmesg, I see that my desktop is using EHCI_HCD to interface with the camera, while I believe the BeagleBone is using MUSB.

Thank you in advance for your help. I am trying to get this working as part of my thesis work, and have come to a dead stop trying to deal with this hardware issue.

-Mike

I found a fix that gave (very slight) improvement: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=35689&p=305745

Details in this thread: https://groups.google.com/forum/?fromgroups=#!topic/beagleboard/G5Xs2JuwD_4

Its looking like something in the uvcvideo driver or v4l2 is the culprit.

Hey Andrei,

I have spent tons of time trying to track down the issue, but I really don’t have the embedded Linux know-how to have made much headway. I have been able to get 640x480 frames but only at a very low framerate, and if I jump through some hoops in starting my program up. I found that (if you are trying to use OpenCV, like me) OpenCV actually doesn’t work at setting the framerate (at least for cameras controlled under the V4L2 API – you can confirm this by ‘set’ and ‘get’ calls on the camera capture object). I used Martin’s custom capture code from here: https://bitbucket.org/beldenfox/cvcapture/src/b7f279b278aa?at=default.

I just compiled OCVCapture along with the rest of my project and used the capture.cpp file as an example for how to capture from the OCVCapture object in my own project. If I remember right, 15fps worked “stock” but I had to go through some trickery to get 30 fps to work.

Here are a couple of other places that I have posted to – you might find these resources helpful. (You may want to ctrl+F to filter through to find my posts)

http://bear24rw.blogspot.com/2009/11/ps3-eye-driver-patch.html
https://groups.google.com/forum/?fromgroups#!topic/beagleboard/G5Xs2JuwD_4

And here is a git repo that I have used for saving my capture code into. Its been awhile since I touched it and I really just intended to use it for my own purpose, so I apologize if its all a little bit jankey.
https://github.com/mdarling39/PS3EyeCapture.git

I bought a BeagleBone black, myself, hoping that it would resolve the issue but haven’t had the time to try it out yet (I have shifted my thesis focus to less frustrating things for now). I will try and answer any questions I can, but you are probably better-versed in Linux than I am. I have some email correspondence with other people I can share with you privately, but I don’t know that any of it was very helpful to me anyways.

Best of luck.

-Mike