adzio Posted April 3, 2021 Posted April 3, 2021 Thank you Armbian guys for providing and supporting a working 5.10 image for the Rock Pi 4C board. Has anyone been successful in configuring and using a matched CSI camera with a 5.x kernel for this board? If so, can you share the required conf steps here? Radxa's website (https://wiki.radxa.com/Rockpi4/MIPI_Camera) claims that their provided Debian image supports both RPi ov5647 and RPi imx219 based cameras so that confirms hardware compatibility but so far I haven't been able to capture images/video with neither on Armbian when attached to a Rock Pi 4C. $ ls -l /dev/video* crw-rw---- 1 root video 81, 0 Apr 3 07:30 /dev/video0 crw-rw---- 1 root video 81, 1 Apr 3 07:30 /dev/video1 crw-rw---- 1 root video 81, 2 Apr 3 07:30 /dev/video2 crw-rw---- 1 root video 81, 3 Apr 3 07:30 /dev/video3 exist, v4l2-compliance and v4l2-ctl --list-formats-ext work and provide good output. However, capturing the actual photo doesn't work: $ fswebcam -d /dev/video0 -r 2048x1536 --jpeg 95 test.jpg --- Opening /dev/video0... Trying source module v4l2... /dev/video0 opened. No input was specified, using the first. Unable to query input 0. VIDIOC_ENUMINPUT: Inappropriate ioctl for device I had enabled ov5647 manually in /etc/modules $ lsmod | grep ov ov5647 20480 0 v4l2_fwnode 28672 1 ov5647 governor_performance 16384 0 videodev 299008 8 rockchip_vdec,v4l2_fwnode,ov5647,videobuf2_v4l2,hantro_vpu,rockchip_rga,videobuf2_common,v4l2_mem2mem mc 61440 7 rockchip_vdec,videodev,ov5647,videobuf2_v4l2,hantro_vpu,videobuf2_common,v4l2_mem2mem But still no joy, one gets the dreaded VIDIOC_ENUMINPUT error. What else am I missing? I’ve seen references to disabling twi2 but I’m unable to find where to make this change in 5.10 if that's indeed the cause. 1 Quote
JMCC Posted April 3, 2021 Posted April 3, 2021 34 minutes ago, adzio said: What else am I missing? You need to use the legacy kernel for the camera to work, not current. And you also need to install the multimedia framework: Remember, you need an Armbian Buster Legacy Desktop image, and install the framework as described in the post. For last, you need to enable the camera using a overlay: $ sudo armbian-config Then select System > Hardware > rpi-cam-imx219 Please post the results of your tests. I have been looking for someone to test the imx219 for a while (I only have a ov5647) 0 Quote
@lex Posted April 3, 2021 Posted April 3, 2021 2 hours ago, adzio said: But still no joy, one gets the dreaded VIDIOC_ENUMINPUT error. In order to use the imx219 sensor (or any other sensor) in mainline kernel 5.x you need to tell the sensor which format and size the sensor must deliver the frames using v4l2-ctl prior to grabbing the frames. Something like: v4l2-ctl --set-subdev-fmt pad=0,width=1280,height=960,code=0x3001 -d /dev/v4l-subdev1 v4l2-ctl --set-subdev-fmt pad=0,width=1280,height=960,code=0x3001 -d /dev/v4l-subdev0 v4l2-ctl --set-subdev-fmt pad=2,width=800,height=600,code=0x2008 -d /dev/v4l-subdev0 Collabora has a complete setup and a patched libcamera where you can pull some images from the sensor in mainline 5.x. For this, you need an updated rkisp driver and imx219 device node in dts (if you don't have it yet!) and fresh compiled v4l2-ctl. You can refer to: https://gitlab.collabora.com/koike/linux/-/commit/7842ca07b75828785ffcd217362a82eaa9cc1e21 You can also refer to the work done here for further information: https://github.com/initBasti/NanoPC-T4_armbian_configuration#testing-the-camera- 1 Quote
adzio Posted April 3, 2021 Author Posted April 3, 2021 Thanks @JMCC and @@lex for the replies and support. The reason I was asking about mainline (here 5.10) was because a lot of the OEM legacy kernel distros I've come across have a kernel bug affecting the on-board PCIe M.2 preventing my use case with that connector. The issue was said to have been fixed around mainline 5.8 that's why I tried 5.10 Armbian and it worked for me. However, the PCIe issue seems to be absent in your 4.4 Debian Buster as well so that's good news, it means that I have two options: I can try the legacy suggestion before having to do patching for 5.10. Unfortunately with legacy after following the instructions I'm running into issues with both ov5764 and imx219 on Rock PI 4C. Perhaps a hardware configuration oddity with this particular SBC? dmesg | egrep 'video|ov5' [ 1.467376] Linux video capture interface: v2.00 [ 2.360737] ov5647 4-0036: Unsupported clock frequency: 6000000 [ 2.360759] ov5647: probe of 4-0036 failed with error -22 [ 2.365727] usbcore: registered new interface driver uvcvideo dmesg | egrep 'video|imx' [ 1.463369] Linux video capture interface: v2.00 [ 2.356761] imx219 4-0010: Reading register 100 from 10 failed [ 2.356936] imx219 4-0010: Reading register 100 from 10 failed [ 2.363981] imx219 4-0010: Error -5 setting default controls [ 2.364008] imx219: probe of 4-0010 failed with error -5 [ 2.368743] usbcore: registered new interface driver uvcvideo That's with one corresponding overlay active at any given time. The error during capture has changed from "VIDIOC_ENUMINPUT: Inappropriate ioctl for device" to "VIDIOC_S_INPUT: Inappropriate ioctl for device" What else am I missing this time? Quick Qs @JMCC: will this work with the server version of legacy buster? I prefer the more lightweight server version and won't be displaying a desktop as a target solution. Would I be forced by the framework to install x11/xfce? Also, is this suggested solution, too, expected to work for OV13850 and Firefly-RK3399? 0 Quote
JMCC Posted April 3, 2021 Posted April 3, 2021 1 hour ago, adzio said: What else am I missing this time? RK BSP kernel uses a special camera interface (RK-ISP1). The best way to make it work, in my experience, is with the RK GStreamer plugin. In the MM Framework documentation (1st post) you have a link to the TInkerBoard wiki, where they explain how to use it. The plugin is ready to go when you install the MM Framework. 1 hour ago, adzio said: will this work with the server version of legacy buster? The media-buster-legacy-rk3399 package will install desktop. You have two options: 1. Disable desktop with "systemctl disable lightdm" 2. Install only the required packages manually without installing the media-buster-legacy-rk3399 metapackage, and probably do some manual config changes. Option 1. seems easier to me. 1 hour ago, adzio said: is this suggested solution, too, expected to work for OV13850 and Firefly-RK3399? Probably so, but I don't own the hardware, nor have developed for it. I am not sure if the necessary kernel configs and DT nodes are present in the kernel. If they are not, you can add them and make a PR. 0 Quote
adzio Posted April 4, 2021 Author Posted April 4, 2021 Cool, thanks, you've confirmed my suspicions. I retried with buster server 4.4.213, mostly to start from foundation and retrace steps. Installed ok just like before, and still seeing the probe error (-5) in dmesg for imx219. Also, media-ctl -p does not report anything as entity 7. v4l2-compliance and v4l2-ctl --list-formats-ext show expected output, so it doesn't look like electrical conn problems. I'm assuming that since media-ctl output is not as expected, there is no point in trying to validate with gstreamer just yet, something's amiss. I started building rkisp before posting on this thread, would that be one of the prerequsites now, given all of the above? Is /dev/video0 correctly designated as a "Sink"? I'm starting to think there might be a GPIO mismatch between this board's CSI and tinkerboard's if tinkerboard works. $ media-ctl -p Media controller API version 0.1.0 Media device information ------------------------ driver rkisp1 model rkisp1 serial bus info hw revision 0x0 driver version 0.0.0 Device topology - entity 1: rkisp1-isp-subdev (4 pads, 0 link) type V4L2 subdev subtype Unknown flags 0 pad0: Sink pad1: Sink pad2: Source pad3: Source - entity 2: rkisp1_mainpath (1 pad, 0 link) type Node subtype V4L flags 0 device node name /dev/video0 pad0: Sink - entity 3: rkisp1_selfpath (1 pad, 0 link) type Node subtype V4L flags 0 device node name /dev/video1 pad0: Sink - entity 4: rkisp1-statistics (1 pad, 0 link) type Node subtype V4L flags 0 device node name /dev/video2 pad0: Sink - entity 5: rkisp1-input-params (1 pad, 0 link) type Node subtype V4L flags 0 device node name /dev/video3 pad0: Source - entity 6: rockchip-mipi-dphy-rx (2 pads, 0 link) type V4L2 subdev subtype Unknown flags 0 pad0: Sink pad1: Source v4l2-compliance SHA: not available, 64 bits Compliance test for device /dev/video0: Driver Info: Driver name : rkisp1_v00 Card type : rkisp1_mainpath Bus info : platform:ff910000.rkisp1 Driver version : 4.4.213 Capabilities : 0x84201000 Video Capture Multiplanar Streaming Extended Pix Format Device Capabilities Device Caps : 0x04201000 Video Capture Multiplanar Streaming Extended Pix Format Media Driver Info: Driver name : rkisp1 Model : rkisp1 Serial : Bus info : Media version : 0.1.0 Hardware revision: 0x00000000 (0) Driver version : 0.0.0 Entity Info: ID : 2 Name : rkisp1_mainpath Type : V4L2 I/O Pad : 0: Sink Required ioctls: test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second /dev/video0 open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) fail: v4l2-test-input-output.cpp(420): G_INPUT not supported for a capture device test VIDIOC_G/S/ENUMINPUT: FAIL test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK fail: v4l2-test-controls.cpp(590): g_ext_ctrls does not support count == 0 test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0 Format ioctls: fail: v4l2-test-formats.cpp(273): duplicate format 42474752 (RGGB) test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) fail: v4l2-test-formats.cpp(330): !colorspace fail: v4l2-test-formats.cpp(453): testColorspace(pix_mp.pixelformat, pix_mp.colorspace, pix_mp.ycbcr_enc, pix_mp.quantization) test VIDIOC_G_FMT: FAIL test VIDIOC_TRY_FMT: OK (Not Supported) test VIDIOC_S_FMT: OK (Not Supported) test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) fail: v4l2-test-formats.cpp(1333): doioctl(node, VIDIOC_G_SELECTION, &sel) != EINVAL test Cropping: FAIL test Composing: OK (Not Supported) test Scaling: OK Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK fail: v4l2-test-buffers.cpp(546): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing, probably due to earlier failing format tests. test VIDIOC_EXPBUF: OK (Not Supported) Total: 44, Succeeded: 39, Failed: 5, Warnings: 0 $ v4l2-ctl --list-formats-ext -d /dev/video0 ioctl: VIDIOC_ENUM_FMT Type: Video Capture Multiplanar [0]: 'YUYV' (YUYV 4:2:2) [1]: '422P' (Planar YVU 4:2:2) [2]: 'NV16' (Y/CbCr 4:2:2) [3]: 'NV61' (Y/CrCb 4:2:2) [4]: 'YM16' (Planar YUV 4:2:2 (N-C)) [5]: 'NV21' (Y/CrCb 4:2:0) [6]: 'NV12' (Y/CbCr 4:2:0) [7]: 'NM21' (Y/CrCb 4:2:0 (N-C)) [8]: 'NM12' (Y/CbCr 4:2:0 (N-C)) [9]: 'YU12' (Planar YUV 4:2:0) [10]: 'YM24' (Planar YUV 4:4:4 (N-C)) [11]: 'RGGB' (8-bit Bayer RGRG/GBGB) [12]: 'GRBG' (8-bit Bayer GRGR/BGBG) [13]: 'GBRG' (8-bit Bayer GBGB/RGRG) [14]: 'BA81' (8-bit Bayer BGBG/GRGR) [15]: 'RGGB' (8-bit Bayer RGRG/GBGB) [16]: 'BA10' (10-bit Bayer GRGR/BGBG) [17]: 'GB10' (10-bit Bayer GBGB/RGRG) [18]: 'BG10' (10-bit Bayer BGBG/GRGR) [19]: 'RG12' (12-bit Bayer RGRG/GBGB) [20]: 'BA12' (12-bit Bayer GRGR/BGBG) [21]: 'GB12' (12-bit Bayer GBGB/RGRG) [22]: 'BG12' (12-bit Bayer BGBG/GRGR) $ v4l2-ctl --list-formats-ext -d /dev/video3 ioctl: VIDIOC_ENUM_FMT Type: Video Capture 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.