bcm2835-v4l2 does not detect/expose the second camera on RPi Compute Module 3+ in Ubuntu Server 20.04.1

Bug #1904306 reported by Adam Black
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libv4l (Ubuntu)
New
Undecided
Unassigned

Bug Description

This is for video4linux, libv4l or related.

There appears to be an issue in or around bcm2835-v4l2 not detecting/configuring/exposing the second camera in Ubuntu Server 20.04.1 on the Raspberry Pi Compute Module 3+ hardware.

Followed the official instructions at https://www.raspberrypi.org/documentation/hardware/computemodule/cmio-camera.md and used the .dts file they supplied (https://www.raspberrypi.org/documentation/hardware/computemodule/dt-blob-dualcam.dts)

First, I confirmed that compiling the dt-blob.bin file and dropping it to /boot/dt-blob.bin made it work in Raspberry Pi OS: I could capture images from either of the cameras. (Expected behavior)

However, after switching to Ubuntu Server 20.04.1 (from https://ubuntu.com/download/raspberry-pi) and compiling the same suggested dual .dts and dropping it to /boot/firmware/dt-blob.bin the system only provides /dev/video0. In both cases ‘start_x=1’ is present in config.txt

It appears that the loop in drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c is not executed for each camera present and configured in RPi CM3+, resulting in only one camera exposed to the end user. The value of MAX_BCM2835_CAMERAS of 2 should be respected; something in the code/default configuration/environment is affecting this functionality.

Here’s what I see in dmsg:

Raspberry Pi OS:

[ 7.674728] videodev: Linux video capture interface: v2.00
[ 7.740370] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 7.740908] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 7.741486] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 7.742841] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 9.004310] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 9.013003] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 9.022054] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 9.025325] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
[ 9.033622] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.
[ 9.062931] bcm2835-v4l2: V4L2 device registered as video1 - stills mode > 1280x720
[ 9.068984] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.

$ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
        /dev/video10
        /dev/video11
        /dev/video12

bcm2835-isp (platform:bcm2835-isp):
        /dev/video13
        /dev/video14
        /dev/video15
        /dev/video16

mmal service 16.1 (platform:bcm2835-v4l2):
        /dev/video0
        /dev/video1

Ubuntu 20.04.1:

[ 12.700652] videodev: Linux video capture interface: v2.00
[ 12.995520] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 12.995871] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 12.995953] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 12.997342] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 12.997740] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 13.003552] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 13.011487] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 14.258871] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
[ 14.264316] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.

$ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
        /dev/video10
        /dev/video11
        /dev/video12

bcm2835-isp (platform:bcm2835-isp):
        /dev/video13
        /dev/video14
        /dev/video15
        /dev/video16

mmal service 16.1 (platform:bcm2835-v4l2):
        /dev/video0

Note the log line ‘V4L2 device registered as video1’ is not reported in Ubuntu.

In terms of hardware the cameras are configured properly and detectable; the hardware is exactly the same, the only difference is the OS which is swapped by means of swapping microSD cards containing Raspberry Pi OS and Ubuntu 20 respectively.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal

Revision history for this message
Adam Black (adzio1) wrote :

Vincent, could you pls help triage and remedy this?

Revision history for this message
Adam Black (adzio1) wrote :

On the Raspberry Pi OS side:

$ vcgencmd version
Aug 19 2020 17:41:31
Copyright (c) 2012 Broadcom
version e90cba19a98a0d1f2ef086b9cafcbca00778f094 (clean) (release) (start_x)

$ uname -a
Linux raspberrypi 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux

$ vcgencmd get_camera
supported=2 detected=2

Revision history for this message
Adam Black (adzio1) wrote :

Gah, I've found the issue.

Based on the investigation in this thread https://www.raspberrypi.org/forums/viewtopic.php?f=98&t=174347&start=25#p1120478 I narrowed it down to dtparam=i2c_arm=on preventing the secondary camera from being detected.

After commenting out dtparam=i2c_arm=on from /boot/firmware/syscfg.txt I now have /dev/video0 and /dev/video1 for each of the supported cameras on CM3+ in Ubuntu 20

[ 14.133985] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
[ 14.139034] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.
[ 14.151264] bcm2835-v4l2: V4L2 device registered as video1 - stills mode > 1280x720
[ 14.156258] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.

Is it expected that this, remotely related, setting affects functionality in bcm2835-camera.c? That's pretty brittle.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.