

bschwand
Members-
Posts
16 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
OV5640 device tree overlay for OrangePi One H3
bschwand replied to rreignier's topic in Orange Pi One
trying to get the ov5640 camera working on an OrangePiOne. armbianmonitor logs : https://paste.armbian.com/gucenokapa Using this overlay : I get some things working and mostly not at all. What works: the kernel modules load bruno@orangepione2:~$ lsmod | grep ov ov5640 36864 1 v4l2_fwnode 24576 2 ov5640,sun6i_csi v4l2_async 20480 3 ov5640,v4l2_fwnode,sun6i_csi videodev 167936 7 ov5640,sunxi_cedrus,videobuf2_common,sun6i_csi,v4l2_mem2mem,videobuf2_v4l2,v4l2_async mc 40960 8 ov5640,sunxi_cedrus,videobuf2_common,videodev,sun6i_csi,v4l2_mem2mem,videobuf2_v4l2,v4l2_async and the device appears on /dev/video1 I assume this means the camera is accessed through the i2c and detected. I see it on the i2c bus: bruno@orangepione2:~/ustreamer$ cat /sys/class/i2c-dev/i2c-1/device/1-003c/of_node/name camera bruno@orangepione2:~/ustreamer$ ls -l /sys/class/i2c-adapter/ total 0 lrwxrwxrwx 1 root root 0 Jan 1 1970 i2c-0 -> ../../devices/platform/soc/1ee0000.hdmi/i2c-0 lrwxrwxrwx 1 root root 0 Jan 1 1970 i2c-1 -> ../../devices/platform/soc/1c2b400.i2c/i2c-1 bruno@orangepione2:~/ustreamer$ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- media-ctl sees it bruno@orangepione2:~$ media-ctl -d 1 --print-topology Media controller API version 6.1.63 Media device information ------------------------ driver sun6i-csi model Allwinner A31 CSI Device serial bus info platform:1cb0000.camera hw revision 0x0 driver version 6.1.63 Device topology - entity 1: sun6i-csi (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video1 pad0: Sink <- "ov5640 1-003c":0 [ENABLED] - entity 5: ov5640 1-003c (1 pad, 1 link) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev0 pad0: Source [fmt:JPEG_1X8/640x480@1/30 colorspace:jpeg xfer:srgb ycbcr:601 quantization:full-range crop.bounds:(0,0)/2624x1964 crop:(0,4)/2624x1944] -> "sun6i-csi":0 [ENABLED] I read https://linux-sunxi.org/CSI so I know the format and size must be selected before grabbing frames this for example works correctly media-ctl --device /dev/media1 --set-v4l2 '"ov5640 1-003c":0[fmt:UYVY8_2X8/640x480@1/30]' (no error after executing that command. and I can then verify it has been selected by running media-ctl and see the pad0 Source has the format changed. Tried many other formats and sizes, they are taken correctly. What does not work: everything else. I can not grab frames with anything. For both ustreamer and ffmpeg I tried many sizes and format, always fails the same way. ffmpeg: bruno@orangepione2:~/ustreamer$ ffmpeg -input_format mjpeg -s 640x480 -i /dev/video1 output.mjpg fmpeg version 5.1.4-0+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12 (Debian 12.2.0-14) configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 [video4linux2,v4l2 @ 0xa36470] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device [video4linux2,v4l2 @ 0xa36470] Time per frame unknown [video4linux2,v4l2 @ 0xa36470] ioctl(VIDIOC_STREAMON): Broken pipe /dev/video1: Broken pipe ustreamer bruno@orangepione2:~/ustreamer$ ustreamer -d /dev/video1 -r 640x480 -m JPEG -- INFO [14503.025 main] -- Using internal blank placeholder -- INFO [14503.027 main] -- Listening HTTP on [127.0.0.1]:8080 -- INFO [14503.027 stream] -- Using V4L2 device: /dev/video1 -- INFO [14503.028 stream] -- Using desired FPS: 0 -- INFO [14503.028 http] -- Starting HTTP eventloop ... ================================================================================ -- INFO [14503.030 stream] -- Device fd=8 opened -- INFO [14503.030 stream] -- Using input channel: 0 -- INFO [14503.030 stream] -- Using resolution: 640x480 -- INFO [14503.030 stream] -- Using pixelformat: JPEG -- INFO [14503.030 stream] -- Querying HW FPS changing is not supported -- ERROR [14503.030 stream] -- Device does not support setting of HW encoding quality parameters -- INFO [14503.030 stream] -- Using IO method: MMAP -- INFO [14503.035 stream] -- Requested 5 device buffers, got 5 -- ERROR [14503.036 stream] -- Unable to start capturing: Broken pipe -- INFO [14503.038 stream] -- Device fd=8 closed -- INFO [14503.038 stream] -- Sleeping 1 seconds before new stream init ... I built ustreamer from source with debug symbols and stepped with gdb, it fails on device.c:328 if (_D_XIOCTL((enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF), &type) < 0) { which is, afaik, when the video device is opened for grabbing frames. Something else that is very strange, trying to list camera controls returns empty bruno@orangepione2:~$ v4l2-ctl -d 1 --list-ctrls bruno@orangepione2:~$ however using yavta on the video subdevice retrieves controls bruno@orangepione2:~$ yavta --no-query -l /dev/v4l-subdev0 Device /dev/v4l-subdev0 opened. --- User Controls (class 0x00980001) --- control 0x00980901 `Contrast' min 0 max 255 step 1 default 0 current 0 control 0x00980902 `Saturation' min 0 max 255 step 1 default 64 current 64 control 0x00980903 `Hue' min 0 max 359 step 1 default 0 current 0 control 0x0098090c `White Balance, Automatic' min 0 max 1 step 1 default 1 current 1 control 0x0098090e `Red Balance' min 0 max 4095 step 1 default 0 current 0 control 0x0098090f `Blue Balance' min 0 max 4095 step 1 default 0 current 0 control 0x00980911 `Exposure' min 0 max 65535 step 1 default 0 current 0 control 0x00980912 `Gain, Automatic' min 0 max 1 step 1 default 1 current 1 control 0x00980914 `Horizontal Flip' min 0 max 1 step 1 default 0 current 0 control 0x00980915 `Vertical Flip' min 0 max 1 step 1 default 0 current 0 control 0x00980918 `Power Line Frequency' min 0 max 3 step 1 default 1 current 1 0: Disabled 1: 50 Hz (*) 2: 60 Hz 3: Auto --- Camera Controls (class 0x009a0001) --- control 0x009a0901 `Auto Exposure' min 0 max 1 step 1 default 0 current 0 0: Auto Mode (*) 1: Manual Mode control 0x009a090c `Focus, Automatic Continuous' min 0 max 1 step 1 default 0 current 0 control 0x009a091c `Auto Focus, Start' min 0 max 0 step 0 default 0 control 0x009a091d `Auto Focus, Stop' min 0 max 0 step 0 default 0 control 0x009a091e `Auto Focus, Status' min 0 max 7 step 0 default 0 current 0x00000000 --- Image Source Controls (class 0x009e0001) --- control 0x009e0901 `Vertical Blanking' min 24 max 2895 step 1 default 600 current 600 control 0x009e0902 `Horizontal Blanking' min 1256 max 1256 step 1 default 1256 current 1256 control 0x009e0903 `Analogue Gain' min 0 max 1023 step 1 default 0 current 0 --- Image Processing Controls (class 0x009f0001) --- control 0x009f0901 `Link Frequency' min 0 max 22 step 1 default 13 current 13 0: 992000000 1: 888000000 2: 768000000 3: 744000000 4: 672000000 5: 672000000 6: 592000000 7: 592000000 8: 576000000 9: 576000000 10: 496000000 11: 496000000 12: 384000000 13: 384000000 (*) 14: 384000000 15: 336000000 16: 296000000 17: 288000000 18: 248000000 19: 192000000 20: 192000000 21: 192000000 22: 96000000 control 0x009f0902 `Pixel Rate' min 48000000 max 168000000 step 1 default 48000000 current 48000000 control 0x009f0903 `Test Pattern' min 0 max 4 step 1 default 0 current 0 0: Disabled (*) 1: Color bars 2: Color bars w/ rolling bar 3: Color squares 4: Color squares w/ rolling bar 22 controls found. something else that is bothersome: the adapter board for the ov5640 has one component that reaches 90 degrees (c) constantly... not sure it should be that hot all the time ! this is starting to irritate me as it seems everything is configured correctly... grr. Any suggestions ? -
I found the program v4l2-compliance it has one failure : Format ioctls (Input 0): fail: v4l2-test-formats.cpp(263): fmtdesc.description mismatch: was 'Y/UV 4:2:0 (16x16 Linear)', expected 'Y/CbCr 4:2:0 (16x16 Linear)' test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL also very strange, I expected output like this instead I get this bruno@orangepione2:~$ v4l2-ctl -d 1 --list-ctrls --list-formats ioctl: VIDIOC_ENUM_FMT Type: Video Capture [0]: 'BA81' (8-bit Bayer BGBG/GRGR) [1]: 'GBRG' (8-bit Bayer GBGB/RGRG) [2]: 'GRBG' (8-bit Bayer GRGR/BGBG) [3]: 'RGGB' (8-bit Bayer RGRG/GBGB) [4]: 'BG10' (10-bit Bayer BGBG/GRGR) [5]: 'GB10' (10-bit Bayer GBGB/RGRG) [6]: 'BA10' (10-bit Bayer GRGR/BGBG) [7]: 'RG10' (10-bit Bayer RGRG/GBGB) [8]: 'BG12' (12-bit Bayer BGBG/GRGR) [9]: 'GB12' (12-bit Bayer GBGB/RGRG) [10]: 'BA12' (12-bit Bayer GRGR/BGBG) [11]: 'RG12' (12-bit Bayer RGRG/GBGB) [12]: 'YUYV' (YUYV 4:2:2) [13]: 'YVYU' (YVYU 4:2:2) [14]: 'UYVY' (UYVY 4:2:2) [15]: 'VYUY' (VYUY 4:2:2) [16]: 'RGBP' (16-bit RGB 5-6-5) [17]: 'RGBO' (16-bit A/XRGB 1-5-5-5) [18]: 'HM12' (Y/UV 4:2:0 (16x16 Linear)) [19]: 'NV12' (Y/UV 4:2:0) [20]: 'NV21' (Y/VU 4:2:0) [21]: 'YU12' (Planar YUV 4:2:0) [22]: 'YV12' (Planar YVU 4:2:0) [23]: 'NV16' (Y/UV 4:2:2) [24]: 'NV61' (Y/VU 4:2:2) [25]: '422P' (Planar YUV 4:2:2) [26]: 'RGBP' (16-bit RGB 5-6-5) [27]: 'RGBR' (16-bit RGB 5-6-5 BE) [28]: 'JPEG' (JFIF JPEG, compressed) also bruno@orangepione2:~$ media-ctl -d 0 --print-topology Media controller API version 6.1.63 Media device information ------------------------ driver sun6i-csi model Allwinner A31 CSI Device serial bus info platform:1cb0000.camera hw revision 0x0 driver version 6.1.63 Device topology - entity 1: sun6i-csi (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video1 pad0: Sink <- "ov5640 1-003c":0 [ENABLED] - entity 5: ov5640 1-003c (1 pad, 1 link) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev0 pad0: Source [fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range crop.bounds:(0,0)/2624x1964 crop:(0,4)/2624x1944] -> "sun6i-csi":0 [ENABLED]
-
thanks, I tried that overlay now and there is some progress. A new device appeared in /dev/video, and I can see with lsmod that sun6i-csi and ov5640 kernel modules were loaded. However, trying ustreamer (https://github.com/pikvm/ustreamer) which I have used on the same board with a usb camera, unfortunately fails bruno@orangepione2:~$ sudo ustreamer --device=/dev/video0 --host=0.0.0.0 --port=8080 --resolution 1920x1080 -- INFO [680.044 main] -- Using internal blank placeholder -- INFO [680.045 main] -- Listening HTTP on [0.0.0.0]:8080 -- INFO [680.046 stream] -- Using V4L2 device: /dev/video0 -- INFO [680.046 stream] -- Using desired FPS: 0 -- INFO [680.047 http] -- Starting HTTP eventloop ... ================================================================================ -- INFO [680.049 stream] -- Device fd=8 opened -- INFO [680.049 stream] -- Using input channel: 0 -- INFO [680.049 stream] -- Using resolution: 1920x1080 -- INFO [680.049 stream] -- Using pixelformat: YUYV -- INFO [680.050 stream] -- Querying HW FPS changing is not supported -- INFO [680.050 stream] -- Using IO method: MMAP -- INFO [680.075 stream] -- Requested 5 device buffers, got 5 -- ERROR [680.076 stream] -- Unable to start capturing: Broken pipe -- INFO [680.081 stream] -- Device fd=8 closed -- INFO [680.081 stream] -- Sleeping 1 seconds before new stream init ... ================================================================================ I am going to try other formats, sizes and fps, see if it makes any difference...
-
Hi all, I am trying to get an OV5640 camera working on the orangePiOne. I found this thread and was wondering if the overlay (or some overlay) is still required. Without anything extra, the camera is not detected. It says that sun6i-csi and ov5640 kernel modules should be loaded, so I loaded them manually with modprobe but nothing happens and nothing is shown in dmesg. Adding the mentioned overlay with "sudo armbian-add-overlay csi-ov5640.dts" just gives me an error in dmesg at reboot time "failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND Error applying DT overlays, restoring original DT" uname -a Linux orangepione2 6.1.63-current-sunxi #1 SMP Mon Nov 20 10:52:19 UTC 2023 armv7l GNU/Linux boot logs on https://paste.armbian.com/unoqesepov wondering what to try next...
-
I don't understand, I did a system update/upgrade with armbian-config before posting here. so I thought I was running latest version already. ok so now I just ran directly from CLI: sudo apt update sudo apt upgrade bruno@orangepione:~$ uname -a Linux orangepione 6.4.12-edge-sunxi #2 SMP Wed Aug 23 15:32:56 UTC 2023 armv7l armv7l armv7l GNU/Linux and my usbhost is indeed powering up. dang, that was silly... thanks for pointing out my system was far out of date. Thanks and cheers !
-
armbianmonitor can not upload for whatever reason so here is the output from armbianmonitor -U armbianmonitor.log bruno@orangepione:~$ less /boot/armbianEnv.txt verbosity=1 bootlogo=false console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 rootdev=UUID=2f506a90-a24d-4930-a5bb-8d61ce45629a rootfstype=ext4 overlays=usbhost0 usbhost1 usbhost2 usbhost3 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
-
a device hooked up on the microusb OTG port does not power up anymore (webcam, used to work a long time ago then I did system update but did not configure the webcam again, until now...) bruno@orangepione:~$ sudo cat /sys/kernel/debug/gpio [sudo] password for bruno: gpiochip0: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl: gpio-15 ( |orangepi:red:status ) out lo gpio-166 ( |cd ) in lo ACTIVE LOW gpio-204 ( |usb0_id_det ) in lo IRQ gpiochip1: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl: gpio-354 ( |usb0-vbus ) out lo gpio-355 ( |sw4 ) in hi IRQ ACTIVE LOW gpio-358 ( |vdd-cpux ) out hi gpio-362 ( |orangepi:green:pwr ) out hi Looks like no power on usb0, which should be enabled in host mode I enabled in armbian-config hardware configuration usbhost 0 to 4 (shows in armbianEnv.txt ) I edited sun8i-h3-orangepi-one.dtb so that usb0 dr_mode is set to "host" (like shown here https://forum.armbian.com/topic/4814-orange-pi-one-usb-otg/?do=findComment&comment=44756 ) I perused this thread https://forum.armbian.com/topic/8686-orange-pi-lite-using-micro-usb-otg-as-host-for-usb-camera/ and verified handles and setting seem to match. Seems no matter what, usb0 is not powered. What am I missing ? Any help greatly appreciated... sun8i-h3-orangepi-one.dtb sun8i-h3-orangepi-one.dts