Trouble with the PiCam v2 on Ubuntu 20.04

422 views
Skip to first unread message

camp .

unread,
Sep 22, 2021, 7:41:05 PM9/22/21
to HomeBrew Robotics Club
    I'm having trouble with PiCam v2. You may recall this is the same PiCam I went around the horn on prior to changing fps from 30 to 5. I've moved the two Pi's (one for the base, the other for the camera) from one robot to another. Suddenly nothing worked. Long story short the IP addresses changed (DHCP). The two Pi's switched addresses and a third unknown IoT device (presumably) took an address to which one of the Pi's had been prior.  Regardless, long story short I've got the IP and hostname situation straightened out but there is a problem with the camera that is software related. Specifically when I try and load the driver I get:
 
[INFO] [1632345874.890685590] [v4l2_camera]: Requesting format: 0x0
[ERROR] [1632345874.890832348] [v4l2_camera]: Failed requesting pixel format: Device or resource busy (16)
[INFO] [1632345874.891418270] [v4l2_camera]: Requesting format: 640x480
[ERROR] [1632345874.891503047] [v4l2_camera]: Failed requesting pixel format: Device or resource busy (16)
[INFO] [1632345874.898178596] [v4l2_camera]: Starting camera
[ERROR] [1632345874.898343131] [v4l2_camera]: Failed mapping device memory
 
ubuntu@smartyhead:~$ v4l2-ctl -d /dev/video0 -p 5
Cannot open device /dev/video0, exiting.
 
I run below and able to set fps.
 
ubuntu@smartyhead:~$ sudo modprobe v4l2loopback
ubuntu@smartyhead:~$ v4l2-ctl -d /dev/video0 -p 5
Frame rate set to 5.000 fps
 
Note: this actually creates the "video0" volume.
 
I then run "ros2 run v4l2_camera v4l2_camera_node" I get the above error: "Device or resource busy" or "Failed mapping device memory."
 
On another note when I try and mount /dev/video0 it says, "mount: /boot: /dev/video0 is not a block device."
 
Suggestions?

Thanks,
Camp

Marco Walther

unread,
Sep 23, 2021, 2:02:34 AM9/23/21
to hbrob...@googlegroups.com, camp .
On 9/22/21 4:41 PM, camp . wrote:
>     I'm having trouble with PiCam v2. You may recall this is the same
> PiCam I went around the horn on prior to changing fps from 30 to 5. I've
> moved the two Pi's (one for the base, the other for the camera) from one
> robot to another. Suddenly nothing worked. Long story short the IP
> addresses changed (DHCP). The two Pi's switched addresses and a third
> unknown IoT device (presumably) took an address to which one of the Pi's
> had been prior.  Regardless, long story short I've got the IP and
> hostname situation straightened out but there is a problem with the
> camera that is software related.
Why oh why do people not DHCP-reserve specific IPs for the nodes which
are expected to act a servers?! Either that or take the time to
configure zeroconf/avahi and use the hostnames.

> Specifically when I try and load the
> driver I get:
>
> [INFO] [1632345874.890685590] [v4l2_camera]: Requesting format: 0x0
> [ERROR] [1632345874.890832348] [v4l2_camera]: Failed requesting pixel
> format: Device or resource busy (16)
> [INFO] [1632345874.891418270] [v4l2_camera]: Requesting format: 640x480
> [ERROR] [1632345874.891503047] [v4l2_camera]: Failed requesting pixel
> format: Device or resource busy (16)
> [INFO] [1632345874.898178596] [v4l2_camera]: Starting camera
> [ERROR] [1632345874.898343131] [v4l2_camera]: Failed mapping device memory

are there more lines in dmesg related to the camera? Those don't look
like the first messages:-(

Can you include the complete output of the dmesg command?
>
> ubuntu@smartyhead:~$ v4l2-ctl -d /dev/video0 -p 5
> Cannot open device /dev/video0, exiting.
>
> I run below and able to set fps.
>
> ubuntu@smartyhead:~$ sudo modprobe v4l2loopback

What are you expecting to do with the v4l2loopback? This will create a
[virtual] camera?! I use that in two ways, to loop an Android/wifi
camera into the system and to loop the output of OBS as input into Zoom
and friends. Not sure, what you're trying to do.


> ubuntu@smartyhead:~$ v4l2-ctl -d /dev/video0 -p 5
> Frame rate set to 5.000 fps

But that looks like there is no other camera found, That's why the
loopback will claim the video0. So, something is wrong with your camera?!

Did you move/loose the cable or something?!
>
> Note: this actually creates the "video0" volume.

It's *not* a volume. It's a device.
>
> I then run "ros2 run v4l2_camera v4l2_camera_node" I get the above
> error: "Device or resource busy" or "Failed mapping device memory."
>
> On another note when I try and mount /dev/video0 it says, "mount: /boot:
> /dev/video0 is not a block device."

As expected. Why would you want to mount a video device?

-- Marco

>
> Suggestions?
>
> Thanks,
> Camp
>
> --
> You received this message because you are subscribed to the Google
> Groups "HomeBrew Robotics Club" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hbrobotics+...@googlegroups.com
> <mailto:hbrobotics+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/hbrobotics/2088409116.864844.1632354060721%40mail.yahoo.com
> <https://groups.google.com/d/msgid/hbrobotics/2088409116.864844.1632354060721%40mail.yahoo.com?utm_medium=email&utm_source=footer>.

camp .

unread,
Sep 23, 2021, 7:09:30 AM9/23/21
to hbrob...@googlegroups.com, Marco Walther
Thanks, Marco!
Ralph Gnauck stepped me through "dmesg" at the SIG. He pointed out that plugging in the camera should create /dev/video0. I actually tried a new camera and cable but got the same symptom. I'll go at it again today with that new information and look for /dev/video0 after re-seating the cable.

Thanks again,
--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hbrobotics/6e52fa8d-b24a-6511-b38c-c559a1331c2f%40gmail.com.

camp .

unread,
Sep 23, 2021, 3:15:01 PM9/23/21
to hbrob...@googlegroups.com, Marco Walther
    The problem was I had plugged into the "Display" socket, not the "Camera" socket. It's all so obvious once you figure it out. Word to the wise... they are the same connectors, so read the silkscreen. ;-)
 
LocoJo
 
Thanks,
Camp

To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hbrobotics/1393804157.992932.1632395360861%40mail.yahoo.com.
Reply all
Reply to author
Forward
0 new messages