Enable picamera connected directly to RaspberryPi's CSI port for a Yocto custom image

115 views Asked by At

The camera is not detected. I am trying to configure yocto build to enable picamera V2, but it's not working.

This is my custom-image.bb:

IMAGE_INSTALL += " \
    packagegroup-core-boot \
    packagegroup-core-x11-base \
    xserver-xorg \
    xdg-user-dirs \
    xf86-video-fbdev \
    v4l-utils \
"

inherit core-image

And I added folder to my layer recipes-kernel/linux/ contains linux_raspberrypi_%.bbappend that run the following bcm2835_v4l2.config:


CONFIG_VIDEO_V4L2=y
CONFIG_VIDEOBUF2_CORE=y
CONFIG_VIDEOBUF2_MEMOPS=y
CONFIG_VIDEOBUF2_VMALLOC=y
CONFIG_VIDEOBUF2_DMA_CONTIG=y
CONFIG_BCM2835_V4L2=m

The issue that the camera is not listed in /dev or dmesg that's why I tried to add bcm2835_v4l2 to kernel modules as it's not listed too.

these also are my configurations in conf/local.conf:

KERNEL_MODULE_AUTOLOAD += "bcm2835-v4l2"
ENABLE_V4L2_CAMERA = "1"
``

I added this line which helped at fixing the issue:

    MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-module-bcm2835-v4l2"

But still the QT app is not able to open the camera, here's the logs:

    [  143.785992] bcm2835-v4l2-0: vidioc_s_fmt_vid_cap device busy
[  143.791802] bcm2835-v4l2-0: vidioc_s_fmt_vid_cap device busy
[  144.173679] bcm2835-v4l2-0: Failed to enable capture port - error -1. Disabling camera port again
[  144.191116] ------------[ cut here ]------------
[  144.195868] WARNING: CPU: 1 PID: 457 at drivers/media/common/videobuf2/videobuf2-core.c:1552 vb2_start_streaming+0xf4/0x17c [videobuf2_common]
[  144.208963] Modules linked in: bcm2835_v4l2(C) videobuf2_vmalloc videobuf2_memops bcm2835_mmal_vchiq(C) videobuf2_v4l2 videobuf2_common videodev mc vc_sm_cma(C)
[  144.223678] CPU: 1 PID: 457 Comm: camera_source:s Tainted: G        WC        5.15.34-v7l #1
[  144.232254] Hardware name: BCM2711
[  144.235706] Backtrace: 
[  144.238193] [<c0c559f4>] (dump_backtrace) from [<c0c55c40>] (show_stack+0x20/0x24)
[  144.245900]  r7:00000610 r6:00000000 r5:c104df3c r4:60070013
[  144.251643] [<c0c55c20>] (show_stack) from [<c0c5b1d8>] (dump_stack_lvl+0x70/0x94)
[  144.259339] [<c0c5b168>] (dump_stack_lvl) from [<c0c5b214>] (dump_stack+0x18/0x1c)
[  144.267040]  r7:00000610 r6:00000009 r5:bf071c34 r4:bf075da8
[  144.272781] [<c0c5b1fc>] (dump_stack) from [<c0222030>] (__warn+0xfc/0x158)
[  144.279862] [<c0221f34>] (__warn) from [<c0c56380>] (warn_slowpath_fmt+0x8c/0xa8)
[  144.287473]  r7:00000610 r6:bf075da8 r5:00000000 r4:c384c000
[  144.293214] [<c0c562f8>] (warn_slowpath_fmt) from [<bf071c34>] (vb2_start_streaming+0xf4/0x17c [videobuf2_common])
[  144.303780]  r9:bf01d144 r8:c181d3b0 r7:c384c000 r6:c181d660 r5:c181d560 r4:ffffffff
[  144.311637] [<bf071b40>] (vb2_start_streaming [videobuf2_common]) from [<bf071d4c>] (vb2_core_streamon+0x90/0x180 [videobuf2_common])
[  144.323905]  r7:c384c000 r6:00000000 r5:c2ab9780 r4:c181d560
[  144.329646] [<bf071cbc>] (vb2_core_streamon [videobuf2_common]) from [<bf08a1d8>] (vb2_ioctl_streamon+0x58/0x90 [videobuf2_v4l2])
[  144.341546]  r5:c2ab9780 r4:00000001
[  144.345173] [<bf08a180>] (vb2_ioctl_streamon [videobuf2_v4l2]) from [<bf01d170>] (v4l_streamon+0x2c/0x30 [videodev])
[  144.356036]  r5:40045612 r4:bf08a180
[  144.359663] [<bf01d144>] (v4l_streamon [videodev]) from [<bf021930>] (__video_do_ioctl+0x248/0x47c [videodev])
[  144.370096]  r5:40045612 r4:c181d058
[  144.373722] [<bf0216e8>] (__video_do_ioctl [videodev]) from [<bf022efc>] (video_usercopy+0x2e8/0x66c [videodev])
[  144.384325]  r10:00000000 r9:c384de3c r8:c384c000 r7:00000000 r6:c2ab9781 r5:40045612
[  144.392271]  r4:40045612
[  144.394839] [<bf022c14>] (video_usercopy [videodev]) from [<bf0232a0>] (video_ioctl2+0x20/0x24 [videodev])
[  144.404910]  r10:0000001c r9:c2ab9780 r8:022cf550 r7:c384c000 r6:c2ab9781 r5:00000000
[  144.412856]  r4:bf023280
[  144.415425] [<bf023280>] (video_ioctl2 [videodev]) from [<bf01b144>] (v4l2_ioctl+0x4c/0x60 [videodev])
[  144.425149] [<bf01b0f8>] (v4l2_ioctl [videodev]) from [<c048138c>] (sys_ioctl+0x114/0xa94)
[  144.433693]  r5:00000000 r4:40045612
[  144.437320] [<c0481278>] (sys_ioctl) from [<c0200060>] (ret_fast_syscall+0x0/0x1c)
[  144.445016] Exception stack(0xc384dfa8 to 0xc384dff0)
[  144.450148] dfa0:                   a91d01a8 00000000 0000001c 40045612 022cf550 a4c599e8
[  144.458451] dfc0: a91d01a8 00000000 022cf548 00000036 022cf548 a91ab1a8 00000002 07f00010
[  144.466752] dfe0: 00000036 a4c599d0 b60b8529 b6031ae6
[  144.471881]  r10:00000036 r9:c384c000 r8:c0200264 r7:00000036 r6:022cf548 r5:00000000
[  144.479827]  r4:a91d01a8
[  144.482470] ---[ end trace b10cbe6f2ae07ec8 ]---
0

There are 0 answers