Jump to content

Recommended Posts

Posted

I do not have the board with me right now, I will try later.

 

But yesterday, after a system update to Linux 5.10, the camera switched to /dev/video1 and I had to use this fork of fswebcam with these commands:

$ media-ctl --device /dev/media1 --set-v4l2 '"ov5640 1-003c":0[fmt:YUYV8_2X8/1280x720]'
$ ./fswebcam --displayfps 1 -S 30 -d /dev/video0 -r 1280x720 -p YUV420P - > /tmp/cam_1280x720_yuv420p.jpg

 

And for reference, to use it with OpenCV I had to specify the size and format:

#include <iostream>
#include <opencv2/opencv.hpp>

int main(int, char**)
{
    VideoCapture cap;
    cap.open(1, CAP_V4L2);
    if (!cap.isOpened()) {
        cerr << "ERROR! Unable to open camera\n";
        return -1;
    }

    cap.set(cv::CAP_PROP_FRAME_WIDTH, 1280);
    cap.set(cv::CAP_PROP_FRAME_HEIGHT, 720);
    cap.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('Y','U','1','2'));

    Mat frame;
    // The first images might be black so take several before
    for(size_t i = 0; i < 10; ++i)
    {
        cap >> frame;
    }

    if (frame.empty()) {
        cerr << "ERROR! blank frame grabbed\n";
        return -1;
    }
    imwrite("/tmp/opencv_frame.jpg", frame);
    return 0;
}

 

Posted

Hello, @rreignier! Thank you very much for your advise! It worked!

 

I've completed your overlay with @gsumner's regulator nodes (I've inserted my board pins), so it loads on OrangePi-PC:

&{/} {
	reg_vdd_1v5_csi: vdd-1v5-csi {
		compatible = "regulator-fixed";
		regulator-name = "vdd1v5-csi";
		regulator-min-microvolt = <1500000>;
		regulator-max-microvolt = <1500000>;
		gpio = <&pio 6 13 0>; /* PG13 */
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};

	reg_vcc_csi: vcc-csi {
		compatible = "regulator-fixed";
		regulator-name = "vcc-csi";
		regulator-min-microvolt = <2800000>;
		regulator-max-microvolt = <2800000>;
		gpio = <&pio 6 11 0>; /* PG11 */
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};

	reg_vcc_af_csi: vcc-af-csi {
		compatible = "regulator-fixed";
		regulator-name = "vcc-af-csi";
		regulator-min-microvolt = <2800000>;
		regulator-max-microvolt = <2800000>;
		gpio = <&pio 0 17 0>; /* PA17 */
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};
};

 

And the final piece, that was missing is the forked version of fswebcam, you've mentioned today. (The regular version from apt repo gave me "black square".)

 

So, despite my C++ app with ioctls may still not working (maybe I shall try rolling back to kernel 5.8 to make it), I am at least now capable of taking pictures with scripts! (And I'll definetely try OpenCV later, I have not yet installed it.)

 

So, big, BIG THANK YOU!!!

 

P.S. I've noticed one small weird thing:

The overlay I've posted in my previous comment now fails with 'ov5640_check_chip_id: failed to read chip identifier', as if it failed to power the camera on. And, I swear, it did not before trying your solution. (I never used both overlays simultaniously, so, I think, something else gets modified... maybe, by the forked fswebcam)

Posted

Hi @rdeyes,

 For me I2C 2 is detecting do you have any idea v4l2 ctrl?

root@nanopiduo2:~# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

root@nanopiduo2:/dev# v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=JPG
The pixelformat 'JPG' is invalid
root@nanopiduo2:/dev# v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=jpg
The pixelformat 'jpg' is invalid
root@nanopiduo2:/dev# v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=png
The pixelformat 'png' is invalid
root@nanopiduo2:/dev# v4l2-ctl --set-fmt-video=width=1920,height=1080
root@nanopiduo2:/dev#    v4l2-ctl -v width=1280,height=720,pixelformat=BGR3
The pixelformat 'BGR3' is invalid
root@nanopiduo2:/dev#    v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=YUYV
The pixelformat 'YUYV' is invalid
root@nanopiduo2:/dev# media-ctl --device /dev/media1 --set-v4l2 '"ov5640 1-003c":0[fmt:UYVY/1920x1080]'
Failed to enumerate /dev/media1 (-2)
root@nanopiduo2:/dev# media-ctl --device /dev/media0 --set-v4l2 '"ov5640 1-003c":0[fmt:UYVY/1920x1080]'
Unable to setup formats: Invalid argument (22)


 

Posted

Hi @srinath,

I think, there are two possibilities:

 

1. Your overlay is compiled, but not loaded. This may happen, because it tries to access nodes, that are not described. Neither within itself, nor within the device tree.

 

To check, whether it is loaded, you should inspect '/proc/device-tree'. The best way to start is

$ ls /proc/device-tree/__symbols__/

And there must be an 'i2c2' file, containing a string path to dt-node (in my case '/soc/i2c@1c2b400').

 

So now, you need to check out this node. Like I do on my system (+ rreigner's overlay with my completion)

$ ls /proc/device-tree/soc/i2c@1c2b400/
'#address-cells'   camera@3c   clocks   compatible   interrupts   name   phandle   pinctrl-0   pinctrl-names   reg   resets  '#size-cells'   status

$ cat /proc/device-tree/soc/i2c@1c2b400/status
okay

$ cat /proc/device-tree/soc/i2c@1c2b400/reg | xxd
00000000: 01c2 b400 0000 0400                      ........

$ ls /proc/device-tree/soc/i2c@1c2b400/camera@3c/
AVDD-supply  clock-names  clocks  compatible  DOVDD-supply  DVDD-supply  name  phandle  pinctrl-0  pinctrl-names  port  powerdown-gpios  reg  reset-gpios

Some files may contain gibberish, that may be resolved by piping them to xxd.

 

2. If the previous test is fine (status contains "okay" and camera@3c child node present), your i2c2 bus may just not end up as /dev/i2c-2! (I have this situation on my OrangePi-PC.)

So it is present and works fine, but it's adapter has a different number and a different name. You just need to know it and pass it's "nickname" to i2c-detect.

So you can list all i2c adapters on your system like this:

$ ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2

 

And you can access their system interface via '/sys/class/':

$ ls /sys/class/i2c-adapter/
i2c-0  i2c-1  i2c-2

$ ls -l /sys/class/i2c-adapter/i2c-*/of_node
lrwxrwxrwx 1 root root 0 Mar 17 14:08 /sys/class/i2c-adapter/i2c-1/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1c2b400
lrwxrwxrwx 1 root root 0 Mar 17 14:09 /sys/class/i2c-adapter/i2c-2/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1f02400

So, most of i2c adapters have of_node within their system interface, which is a symlink to their dt-node. Remember, how my i2c2 dt-node was called? '/soc/i2c@1c2b400'. And this is an of_node of i2c-1 adapter!

 

So to probe my i2c2 I need to tell i2cdetect to check '/dev/i2c-1':

# 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: -- -- -- -- -- -- -- --

And see camera activity on address 3c, as expected.

 

Hope, this helps

 

Upd. Now since @srinath edited comment, mine looks not related.

Posted

Hi @rdeyes,

 Thank you for the reply I complied  rreigner's overlay then I checked.

root@nanopiduo2:/proc/device-tree/__symbols__# nano i2c2
  GNU nano 4.8                          i2c2
/soc/i2c@1c2b400^@

 

I2c2 is the same port
 

root@nanopiduo2:~# ls /proc/device-tree/soc/i2c@1c2b400/
'#address-cells'   compatible   name      pinctrl-0       reg     '#size-cells'
 clocks            interrupts   phandle   pinctrl-names   resets   status

I did not find the camera@3c

 

 

added overlay
 

root@nanopiduo2:/boot/overlay-user# ls
overlays_csi.dtbo

 

 

No i2c found after complilation rreigner's overlay (Please find the attachment)

 

root@nanopiduo2:~#  ls /dev/i2c-*
ls: cannot access '/dev/i2c-*': No such file or directory


But when I remove the rreigner's overlay I2C 2 is working

root@nanopiduo2:~# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

 

I am not getting mine is also in 3C
Thnaks in advance
 

overlays_csi.dts

Posted

Since there is no camera node on i2c2, the overlay is not loaded.

 

It tries to access regulator nodes 'reg_vcc_af_csi', 'reg_vdd_1v5_csi' and 'reg_vcc_csi':

                AVDD-supply = <&reg_vcc_af_csi>;
                DOVDD-supply = <&reg_vdd_1v5_csi>;
                DVDD-supply = <&reg_vcc_csi>;

 

And there are no such nodes in "bare" device tree, so I've added them to overlay. In your "bare" device tree, there are none either, because file 'arch/arm/boot/dts/sun8i-h3-nanopi-duo2.dts' (I'm accessing this file from the root of linux kernel source btw) does not contain any and all the .dtsi files included into it are same as for mine board.

 

So you may need the regulators. And you may see them in my reply to @rreigner inserted as a code. So put them into your overlay .dts (I did this right before the &ccu node).

 

And you also need to correct the regulator pins for your board the "gpio = " strings within the regulator nodes. For that you need to find your board schematics.

It is a .pdf file and can be found at the very bottom of https://wiki.friendlyarm.com/wiki/index.php/NanoPi_Duo2

So here is the direct link to your schematics http://wiki.friendlyarm.com/wiki/images/a/ab/Schematic_NanoPi_Duo2-V1.0-1807.pdf

 

At page 11 there are pins for csi camera interface. You must find AVDD, DVDD and DOVDD pins and see their names...

 

Wait! They are not going to GPIO! On NanoPi-Duo2 they are powered on by the very default!

So this is why your camera is powered on without any overlay. You're very lucky!

1 hour ago, srinath said:

But when I remove the rreigner's overlay I2C 2 is working






root@nanopiduo2:~# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

 

Forget everything, I've said from the start. You don't need regulators. Delete those 3 strings (AVDD-supply, DOVDD-supply, DVDD-supply) from rreigner's overlay, so there are no unresolved links left. And then insert this new overlay (instead of the previous) and reboot.

 

Good luck.

Posted

Hi 

I got it thank you

root@nanopiduo2:~# ls /proc/device-tree/soc/i2c@1c2b400/
'#address-cells'   compatible   phandle         reg            status
 camera@3c         interrupts   pinctrl-0       resets
 clocks            name         pinctrl-names  '#size-cells'

I2C is also working

root@nanopiduo2:~# ls /dev/i2c-*
/dev/i2c-2
root@nanopiduo2:~#  ls /sys/class/i2c-adapter/
i2c-2
root@nanopiduo2:~# i2cdetect -y 2
     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: -- -- -- -- -- -- -- --
root@nanopiduo2:~# media-ctl --device /dev/media1 --print-topology
Media controller API version 5.10.21

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial
bus info        platform:1cb0000.camera
hw revision     0x0
driver version  5.10.21

Device topology
- entity 1: sun6i-csi (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "ov5640 2-003c":0 [ENABLED]

- entity 5: ov5640 2-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]
                -> "sun6i-csi":0 [ENABLED]

 

Now I have video1 amd media1 created

root@nanopiduo2:~# v4l2-ctl -d /dev/video1 -D
Driver Info:
        Driver name      : sun6i-video
        Card type        : sun6i-csi
        Bus info         : platform:camera
        Driver version   : 5.10.21
        Capabilities     : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : sun6i-csi
        Model            : Allwinner Video Capture Device
        Serial           :
        Bus info         : platform:1cb0000.camera
        Media version    : 5.10.21
        Hardware revision: 0x00000000 (0)
        Driver version   : 5.10.21
Interface Info:
        ID               : 0x03000003
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : sun6i-csi
        Function         : V4L2 I/O
        Pad 0x01000002   : 0: Sink, Must Connect
          Link 0x02000009: from remote pad 0x1000006 of entity 'ov5640 2-003c': Data, Enabled

how can I view the video stream 
 

root@nanopiduo2:~# media-ctl --device /dev/video1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/1920x1080]'
Failed to enumerate /dev/video1 (-25)
root@nanopiduo2:~# media-ctl --device /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/1920x1080]'

 

Thanks in advance

Posted

Hi, @srinath, nice to see your camera detected!

 

I believe, media-ctl takes only '/dev/media*' devices, passing '/dev/video*' to it was a mistake.

 

But, please, carefully read the last comment from @rreignier, he described how to take a picture.

 

As for video recording, I had not tried it myself, but I'm sure, there are options, described in fswebcam's manual entry (after a standard ritual of './configure', 'make' and 'make install' inside cloned git repo you should have it too) for that, experiment with them. Also you can make a python/C++ program with OpenCV library and try the arguments, suggested in comment from @rreignier.

Posted

Hi @rdeyes,

 Thank you for your reply. I have now python and openCV installed in my device.

 

I checked his code he is providing  format should I also need to do it?

cap.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('Y','U','1','2'));

 

Here is my simple python-openCV code

 

import cv2
import numpy as np

capture = cv2.VideoCapture(1,cv2.CAP_V4L2)

#set width  height and format
capture.set(cv2.CAP_PROP_FRAME_WIDTH, 160)
capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 120)


retur, frame = capture.read()
color_image = np.asanyarray(frame)

#save matrix/array as image file

isWritten = cv2.imwrite('image-2.jpg', color_image)

if isWritten:
        print('Image is successfully saved as file.')

 

error

 

Traceback (most recent call last):
  File "img.py", line 15, in <module>
    isWritten = cv2.imwrite('image-2.jpg', color_image)
TypeError: Expected Ptr<cv::UMat> for argument 'img'

 

Thanks in advance

Posted

Hi @srinath

 

Your Python script works for me.

The numpy transformation seems useless but does not prevent to write the image on my side.

But with your script, I only get black pictures.

Adding the property settings and the loop (the first images are always black, I don't know why) I have managed to get good images:

import cv2

capture = cv2.VideoCapture(1, cv2.CAP_V4L2)
capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1280.0)
capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 720.0)
capture.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('Y', 'U', '1', '2'))
for i in range(10):
    retur, frame = capture.read()
isWritten = cv2.imwrite('image-2.jpg', frame)

if isWritten:
    print('Image is successfully saved as file.')

And don't forget to set the media command before starting the script:

media-ctl --device /dev/media1 --set-v4l2 '"ov5640 1-003c":0[fmt:YUYV8_2X8/1280x720]'

 

Posted

Hi All,

 Has anybody tried to capture video stream using ffmpeg?

 

I have installed ffmpeg by using 

root@nanopiduo2:~# sudo apt install ffmpeg

 

 

As thy say in the link https://wiki.friendlyarm.com/wiki/index.php/NanoPi_Duo2

-The mjpg-streamer utility uses libjpeg to software-encode steam data. The Linux-4.14 based ROM currently doesn't support hardware-encoding. If you use a H3 boards with Linux-3.4 based ROM you can use the ffmpeg utility to hardware-encode stream data and this can greatly release CPU's resources and speed up encoding:

 

Error:

root@nanopiduo2:~# ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video1 -pix_fmt nv12 -r 30
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Trailing options were found on the commandline.
[video4linux2,v4l2 @ 0x20f5a00] ioctl(VIDIOC_STREAMON): Broken pipe
/dev/video1: Broken pipe

 

Posted

You have the wrong pix_fmt.

 

Try: -pix_fmt yuv420p 

 

Be aware you don't get HW encode with this version. Search the forum, someone already worked on the hw encoding side.

Posted

Hi @rreignier,

 How can I bulid openCV in C++ for armbian.

 

I checked the architecture of my device

 

root@nanopiduo2:~/C/overlays# dpkg --print-architecture
armhf

 

 

In openCV in the link I have 2 cmake

1.arm-gnueabi.toolchain.cmake

2.arm.toolchain.cmake

https://github.com/opencv/opencv/tree/master/platforms/linux

I am confused which one to use. If possible could you please say step by step procedure

 

error:

 

sra@LD-MZ-NB-06:~/cpp_opencv$ arm-linux-gnueabihf-g++ read.cpp -mfloat-abi=hard `pkg-config opencv4 --cflags --libs` -o read
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_stitching
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_aruco
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_bgsegm
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_bioinspired
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_ccalib
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_dnn_objdetect
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_dnn_superres
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_dpm
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_highgui
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_face
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_freetype
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_fuzzy
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_hdf
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_hfs
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_img_hash
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_line_descriptor
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_quality
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_reg
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_rgbd
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_saliency
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_shape
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_stereo
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_structured_light
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_phase_unwrapping
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_superres
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_optflow
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_surface_matching
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_tracking
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_datasets
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_text
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_dnn
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_plot
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_ml
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_videostab
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_videoio
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_viz
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_ximgproc
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_video
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_xobjdetect
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_objdetect
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_calib3d
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_imgcodecs
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_features2d
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_flann
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_xphoto
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_photo
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_imgproc
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_core
collect2: error: ld returned 1 exit status

 

 

 

Thanks in advance

Posted

hello everyone! i've tried to connect ov5640 to op plus2e but everything what i've got is input/output error when i'm trying to open video1 device

i've installed overlay from @srinath without "AVDD-supply = <&reg_vcc_af_csi>; DOVDD-supply = <&reg_vdd_1v5_csi>; DVDD-supply = <&reg_vcc_csi>;"

but 

orangepiplus2e:~:% v4l2-ctl -d /dev/video1
Failed to open /dev/video1: Input/output error

is all what i've got =( help me please

Posted (edited)
orangepiplus2e:~:% ls /proc/device-tree/soc/i2c@1c2b400/
'#address-cells'   camera@3c   clocks   compatible   interrupts   name   phandle   pinctrl-0   pinctrl-names   reg   resets  '#size-cells'   status
orangepiplus2e:~:% ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2
orangepiplus2e:~:% sudo /sbin/i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
orangepiplus2e:~:% sudo /sbin/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: -- -- -- -- -- -- -- --
orangepiplus2e:~:% media-ctl --device /dev/media1 --print-topology
Media controller API version 5.10.21

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial
bus info        platform:1cb0000.camera
hw revision     0x0
driver version  5.10.21

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]
		-> "sun6i-csi":0 [ENABLED]

like this?) maybe i2c port is different? 

it seems to me that the camera is powered off 

 

and this is what i've got from dmesg

orangepiplus2e:Downloads:% dmesg | grep -i ov56
[    6.202318] ov5640 1-003c: supply DOVDD not found, using dummy regulator
[    6.202736] ov5640 1-003c: supply AVDD not found, using dummy regulator
[    6.202904] ov5640 1-003c: supply DVDD not found, using dummy regulator
[    6.203692] sun6i-csi 1cb0000.camera: creating ov5640 1-003c:0 -> sun6i-csi:0 link
[    6.570728] ov5640 1-003c: ov5640_read_reg: error: reg=300a
[    6.570736] ov5640 1-003c: ov5640_set_power_on: failed to read chip identifier
[   94.717747] ov5640 1-003c: ov5640_read_reg: error: reg=300a
[   94.717767] ov5640 1-003c: ov5640_set_power_on: failed to read chip identifier

I'm using wavehare ov5640 board so I think DOVDD AVDD and DVDD are not used on it

@@lexcould you help me please?)

Edited by s1mptom
Posted

Not sure i can give a good advice in this case, it is a bit confusing for me (software guy here).

Looks like your sensor is detected with I2c-1 and it should be on i2c-2 , so i think it is the way you wired this module.


 

PE12/CSI_SCK/TWI2_SCK --> CSI-SCK
PE13/CSI_SDA/TWI2_SDA --> CSI-SDA

 

and

DOVDD, AVDD, DVDD should be in your DTS in the same way as Opi one. How you wired these pins to get the right voltage is a mystery to me. :)

 

Posted

@@lex

latest update

my camera was detected (as i think) and loaded 

there's no errors in dmesg

but i cannot open video =(

and v4l2-ctl -d /dev/video1 has no output(

 

orangepiplus2e:~:% v4l2-ctl --list-devices
sun6i-csi (platform:camera):
	/dev/video1

cedrus (platform:cedrus):
	/dev/video0
orangepiplus2e:~:% media-ctl --device /dev/media1 --print-topology
Media controller API version 5.10.21

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial
bus info        platform:1cb0000.camera
hw revision     0x0
driver version  5.10.21

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:YUYV8_2X8/1280x720@1/30 colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
		-> "sun6i-csi":0 [ENABLED]
orangepiplus2e:mjpg-streamer-experimental:% ./mjpg_streamer -i "./input_uvc.so -d /dev/video1 -y 3 -r 640x480 -f 30 -q 90 -n" -o "./output_http.so -w ./www"                                                                       <master>

MJPG Streamer Version: git rev: 310b29f4a94c46652b20c4b7b6e5cf24e532af39
 i: Using V4L2 device.: /dev/video1
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 30
 i: Format............: YUYV
 i: JPEG Quality......: 90
 i: TV-Norm...........: DEFAULT
 o: www-folder-path......: ./www/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: (null)
 o: username:password....: disabled
 o: commands.............: enabled
Unable to start capture: Broken pipe
 i: Can't enable video in first time
 i: cleaning up resources allocated by input thread
^Csetting signal to stop
force cancellation of threads and cleanup resources
 o: cleaning up resources allocated by server thread #00
done

broken pipe error =(

in dts i'm using i2c2 but in i2cdetect:

orangepiplus2e:mjpg-streamer-experimental:% sudo /sbin/i2cdetect -y 1                                                                                                                                                              <master>
     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: -- -- -- -- -- -- -- --
orangepiplus2e:mjpg-streamer-experimental:% sudo /sbin/i2cdetect -y 2                                                                                                                                                              <master>
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

but that's already something)) but it's still not a video(

Posted

Ouch, it is working then. The error is expected.

In mainline you need to tell the sensor (csi) the format and size you want.

 

Here is one example for streaming JPEG 1280x720:

 

media-ctl --device /dev/media1 --set-v4l2 '"ov5640 1-003c":0[fmt:JPEG_1X8/1280x720]'

 

For the mjpeg-streamer the fix is here: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/issues/56

 

PS: I overlooked you output, i still think you wired the i2c1 and not i2c2

Posted (edited)

same error

changed MJPG to JPG - broken pipe =(

i've measured PWDWN pin on camera - it's in 1 (3.3v)

after changed it to 0 and running mjpg streamer - it's goes to 1 again

this is ok?

this file i've got with fswebcam -d /dev/video1 -r 1280x720 -D 0 --jpeg 100 ~/test.jpeg

 

test.jpeg

Edited by s1mptom
Posted (edited)

I don't have the board  with me right now. But i still think i2c is not wired correctly.

Perhaps someone else can measure and give the answer.

 

Last thought:

Try GPIO_ACTIVE_LOW if you have GPIO_ACTIVE_HIGH in your DTS

Edited by @lex
last try
Posted
51 minutes ago, @lex said:

I don't have the board  with me right now. But i still think i2c is not wired correctly.

Perhaps someone else can measure and give the answer.

 

Last thought:

Try GPIO_ACTIVE_LOW if you have GPIO_ACTIVE_HIGH in your DTS

reset-gpios = <&pio 4 14 1>; /* CSI-RST-R: PE14 */

powerdown-gpios = <&pio 4 15 0>; /* CSI-STBY-R: PE15 */ 

but when i'm trying to do anything with camera - it's becoming 1 oO maybe it should working like this...

do i need vfe_v4l2 in my system?

 

soldered PWDWN pin to GND for permanent LOW... nothing has been changed(

Posted

The suggestion was to change to:

powerdown-gpios = <&pio 4 15 1>; /* CSI-STBY-R: PE15 */ 

 

vfe_v4l2 is for legacy only.

 

Can you set PG11 in u-boot and see if it works? 

I think is PD14, do it in u-boot cmd:

 

gpio set PG11
gpio status PG11

 

Posted

good news everyone @@lex :D 

So, I switched media-ctl to format: YUYV8_2X8 / 1280x720

then i started video recording with ffmpeg -t 120 -f v4l2 -channel 0 -video_size 1280x720 -i / dev / video1 -pix_fmt yuvj420p -r 30 1.mpeg

and ... success oO it works very slow but works

why is mjpeg streamer not working? (something with formats or what?

then i've changed to format: YUYV8_2X8 / 640x480 

finnaly ... 640x480 started working with mjpeg streamer =) when I tried to raise resolution - green garbage everywhere

Posted

Hi @rreignier , @rdeyes and all
I am using orange pi PC

I have used the overlay with  in my orange pi pc for camera OV5640 camera CSI interface

 

 "AVDD-supply = <&reg_vcc_af_csi>; DOVDD-supply = <&reg_vdd_1v5_csi>; DVDD-supply = <&reg_vcc_csi>;"


overlay is successfull please find the attachment,
 

root@orangepipc:~/python#  media-ctl --device /dev/media1 --print-topology
Media controller API version 5.10.21

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial
bus info        platform:1cb0000.camera
hw revision     0x0
driver version  5.10.21

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]
                -> "sun6i-csi":0 [ENABLED]

 

 

 

after connecting the camera :o

orange_pi_pc.thumb.png.ce46a5747413639cc6d97804af52016b.png

i2c2 detect command

root@orangepipc:~# ls /proc/device-tree/soc/i2c@1c2b400/camera@3c/
AVDD-supply  clock-names  clocks  compatible  DOVDD-supply  DVDD-supply  name  phandle  pinctrl-0  pinctrl-names  port  powerdown-gpios  reg  reset-gpios

root@orangepipc:~# cat /proc/device-tree/soc/i2c@1c2b400/reg | xxd
00000000: 01c2 b400 0000 0400                      ........

root@orangepipc:~#  cat /proc/device-tree/soc/i2c@1c2b400/status
okayroot@orangepipc:~# ls /proc/device-tree/soc/i2c@1c2b400/
'#address-cells'   camera@3c   clocks   compatible   interrupts   name   phandle   pinctrl-0   pinctrl-names   reg   resets  '#size-cells'   status

root@orangepipc:~#  ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2

root@orangepipc:~#  ls /sys/class/i2c-adapter/
i2c-0  i2c-1  i2c-2

root@orangepipc:~# ls -l /sys/class/i2c-adapter/i2c-*/of_node
lrwxrwxrwx 1 root root 0 Apr 22 11:10 /sys/class/i2c-adapter/i2c-1/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1c2b400
lrwxrwxrwx 1 root root 0 Apr 22 11:10 /sys/class/i2c-adapter/i2c-2/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1f02400

root@orangepipc:~# 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: -- -- -- -- -- -- -- --

root@orangepipc:~# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

 

camera is not powered in in my orange pi my user overlay for csi . Also I inclucled regulator code in the overlay @rdeyes for my orange pi pc?



Also for camera ov5640
 

root@orangepipc:~# dmesg | grep -i ov56
[    7.362807] sun6i-csi 1cb0000.camera: creating ov5640 1-003c:0 -> sun6i-csi:0 link
[    7.767201] ov5640 1-003c: ov5640_read_reg: error: reg=300a
[    7.772902] ov5640 1-003c: ov5640_set_power_on: failed to read chip identifier

 

issue:

root@orangepipc:/dev#  v4l2-ctl -d /dev/video1 -D
Failed to open /dev/video1: No such device or address

 

but I have video1 created after overlay added
 

root@orangepipc:/dev# ls
autofs           fuse       loop1         mqueue  shm     tty16  tty29  tty41  tty54  ttyS0     v4l-subdev0  vcsa6      zram1
block            gpiochip0  loop2         net     snd     tty17  tty3   tty42  tty55  ttyS1     vcs          vcsu       zram2
btrfs-control    gpiochip1  loop3         null    stderr  tty18  tty30  tty43  tty56  ttyS2     vcs1         vcsu1
bus              hwrng      loop4         ppp     stdin   tty19  tty31  tty44  tty57  ttyS3     vcs2         vcsu2
cec0             i2c-0      loop5         ptmx    stdout  tty2   tty32  tty45  tty58  ttyS4     vcs3         vcsu3
char             i2c-1      loop6         pts     tty     tty20  tty33  tty46  tty59  ttyS5     vcs4         vcsu4
console          i2c-2      loop7         ram0    tty0    tty21  tty34  tty47  tty6   ttyS6     vcs5         vcsu5
cpu_dma_latency  initctl    loop-control  ram1    tty1    tty22  tty35  tty48  tty60  ttyS7     vcs6         vcsu6
cuse             input      mapper        ram2    tty10   tty23  tty36  tty49  tty61  ubi_ctrl  vcsa         video0
disk             kmem       media0        ram3    tty11   tty24  tty37  tty5   tty62  uhid      vcsa1        video1
dri              kmsg       media1        random  tty12   tty25  tty38  tty50  tty63  uinput    vcsa2        watchdog
ecryptfs         lirc0      mem           rfkill  tty13   tty26  tty39  tty51  tty7   uleds     vcsa3        watchdog0
fd               log        mmcblk0       rtc     tty14   tty27  tty4   tty52  tty8   urandom   vcsa4        zero
full             loop0      mmcblk0p1     rtc0    tty15   tty28  tty40  tty53  tty9   v4l       vcsa5        zram0


 

overlay_csi_orangepipc.dts

Posted
On 4/21/2021 at 5:00 PM, srinath said:

Hi @rreignier , @rdeyes and all
I am using orange pi PC

I have used the overlay with  in my orange pi pc for camera OV5640 camera CSI interface

 


 "AVDD-supply = <&reg_vcc_af_csi>; DOVDD-supply = <&reg_vdd_1v5_csi>; DVDD-supply = <&reg_vcc_csi>;"


overlay is successfull please find the attachment,
 


root@orangepipc:~/python#  media-ctl --device /dev/media1 --print-topology
Media controller API version 5.10.21

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial
bus info        platform:1cb0000.camera
hw revision     0x0
driver version  5.10.21

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]
                -> "sun6i-csi":0 [ENABLED]

 

 

 

after connecting the camera :o

orange_pi_pc.thumb.png.ce46a5747413639cc6d97804af52016b.png

i2c2 detect command


root@orangepipc:~# ls /proc/device-tree/soc/i2c@1c2b400/camera@3c/
AVDD-supply  clock-names  clocks  compatible  DOVDD-supply  DVDD-supply  name  phandle  pinctrl-0  pinctrl-names  port  powerdown-gpios  reg  reset-gpios

root@orangepipc:~# cat /proc/device-tree/soc/i2c@1c2b400/reg | xxd
00000000: 01c2 b400 0000 0400                      ........

root@orangepipc:~#  cat /proc/device-tree/soc/i2c@1c2b400/status
okayroot@orangepipc:~# ls /proc/device-tree/soc/i2c@1c2b400/
'#address-cells'   camera@3c   clocks   compatible   interrupts   name   phandle   pinctrl-0   pinctrl-names   reg   resets  '#size-cells'   status

root@orangepipc:~#  ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2

root@orangepipc:~#  ls /sys/class/i2c-adapter/
i2c-0  i2c-1  i2c-2

root@orangepipc:~# ls -l /sys/class/i2c-adapter/i2c-*/of_node
lrwxrwxrwx 1 root root 0 Apr 22 11:10 /sys/class/i2c-adapter/i2c-1/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1c2b400
lrwxrwxrwx 1 root root 0 Apr 22 11:10 /sys/class/i2c-adapter/i2c-2/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1f02400

root@orangepipc:~# 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: -- -- -- -- -- -- -- --

root@orangepipc:~# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

 

camera is not powered in in my orange pi my user overlay for csi . Also I inclucled regulator code in the overlay @rdeyes for my orange pi pc?



Also for camera ov5640
 


root@orangepipc:~# dmesg | grep -i ov56
[    7.362807] sun6i-csi 1cb0000.camera: creating ov5640 1-003c:0 -> sun6i-csi:0 link
[    7.767201] ov5640 1-003c: ov5640_read_reg: error: reg=300a
[    7.772902] ov5640 1-003c: ov5640_set_power_on: failed to read chip identifier

 

issue:


root@orangepipc:/dev#  v4l2-ctl -d /dev/video1 -D
Failed to open /dev/video1: No such device or address

 

but I have video1 created after overlay added
 


root@orangepipc:/dev# ls
autofs           fuse       loop1         mqueue  shm     tty16  tty29  tty41  tty54  ttyS0     v4l-subdev0  vcsa6      zram1
block            gpiochip0  loop2         net     snd     tty17  tty3   tty42  tty55  ttyS1     vcs          vcsu       zram2
btrfs-control    gpiochip1  loop3         null    stderr  tty18  tty30  tty43  tty56  ttyS2     vcs1         vcsu1
bus              hwrng      loop4         ppp     stdin   tty19  tty31  tty44  tty57  ttyS3     vcs2         vcsu2
cec0             i2c-0      loop5         ptmx    stdout  tty2   tty32  tty45  tty58  ttyS4     vcs3         vcsu3
char             i2c-1      loop6         pts     tty     tty20  tty33  tty46  tty59  ttyS5     vcs4         vcsu4
console          i2c-2      loop7         ram0    tty0    tty21  tty34  tty47  tty6   ttyS6     vcs5         vcsu5
cpu_dma_latency  initctl    loop-control  ram1    tty1    tty22  tty35  tty48  tty60  ttyS7     vcs6         vcsu6
cuse             input      mapper        ram2    tty10   tty23  tty36  tty49  tty61  ubi_ctrl  vcsa         video0
disk             kmem       media0        ram3    tty11   tty24  tty37  tty5   tty62  uhid      vcsa1        video1
dri              kmsg       media1        random  tty12   tty25  tty38  tty50  tty63  uinput    vcsa2        watchdog
ecryptfs         lirc0      mem           rfkill  tty13   tty26  tty39  tty51  tty7   uleds     vcsa3        watchdog0
fd               log        mmcblk0       rtc     tty14   tty27  tty4   tty52  tty8   urandom   vcsa4        zero
full             loop0      mmcblk0p1     rtc0    tty15   tty28  tty40  tty53  tty9   v4l       vcsa5        zram0


 

overlay_csi_orangepipc.dts

 

 

Hi can someone help me in this issue
I have overlay and camera connected to the device but issue says cannot open the camera index in my orange pi pc

root@orangepipc:~/python# python3 capture_image.py
[ WARN:0] global ../modules/videoio/src/cap_v4l.cpp (887) open VIDEOIO(V4L2:/dev/video1): can't open camera by index
Traceback (most recent call last):
  File "capture_image.py", line 11, in <module>
    isWritten = cv2.imwrite('image-2.jpg', frame)
cv2.error: OpenCV(4.2.0) ../modules/imgcodecs/src/loadsave.cpp:715: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'

 

Posted

hello world

 

board is banana pi m2 zero, bought 1 month ago

camera is ov5640

 

 

is there anyone with some spare time to help me with the same problem? 

i will provide ssh or vnc 

i'm trying yesterday and today and i already lost 10+ hours without any success :-/

 

with all those trying to make it work i ended now in even worse scenario - without /dev/video1/ (which was ov5640)

 

so, now i will format sd card and install clean new image ( https://github.com/Qengineering/BananaPi-M2-Zero-OV5640 )

Posted (edited)
On 4/21/2021 at 6:00 PM, srinath said:

Hi @rreignier , @rdeyes and all
I am using orange pi PC

I have used the overlay with  in my orange pi pc for camera OV5640 camera CSI interface

 

 "AVDD-supply = <&reg_vcc_af_csi>; DOVDD-supply = <&reg_vdd_1v5_csi>; DVDD-supply = <&reg_vcc_csi>;"


overlay is successfull please find the attachment,
 

root@orangepipc:~/python#  media-ctl --device /dev/media1 --print-topology
Media controller API version 5.10.21

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial
bus info        platform:1cb0000.camera
hw revision     0x0
driver version  5.10.21

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]
                -> "sun6i-csi":0 [ENABLED]

 

 

 

after connecting the camera :o

orange_pi_pc.thumb.png.ce46a5747413639cc6d97804af52016b.png

i2c2 detect command

root@orangepipc:~# ls /proc/device-tree/soc/i2c@1c2b400/camera@3c/
AVDD-supply  clock-names  clocks  compatible  DOVDD-supply  DVDD-supply  name  phandle  pinctrl-0  pinctrl-names  port  powerdown-gpios  reg  reset-gpios

root@orangepipc:~# cat /proc/device-tree/soc/i2c@1c2b400/reg | xxd
00000000: 01c2 b400 0000 0400                      ........

root@orangepipc:~#  cat /proc/device-tree/soc/i2c@1c2b400/status
okayroot@orangepipc:~# ls /proc/device-tree/soc/i2c@1c2b400/
'#address-cells'   camera@3c   clocks   compatible   interrupts   name   phandle   pinctrl-0   pinctrl-names   reg   resets  '#size-cells'   status

root@orangepipc:~#  ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-2

root@orangepipc:~#  ls /sys/class/i2c-adapter/
i2c-0  i2c-1  i2c-2

root@orangepipc:~# ls -l /sys/class/i2c-adapter/i2c-*/of_node
lrwxrwxrwx 1 root root 0 Apr 22 11:10 /sys/class/i2c-adapter/i2c-1/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1c2b400
lrwxrwxrwx 1 root root 0 Apr 22 11:10 /sys/class/i2c-adapter/i2c-2/of_node -> ../../../../../firmware/devicetree/base/soc/i2c@1f02400

root@orangepipc:~# 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: -- -- -- -- -- -- -- --

root@orangepipc:~# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

 

camera is not powered in in my orange pi my user overlay for csi . Also I inclucled regulator code in the overlay @rdeyes for my orange pi pc?



Also for camera ov5640
 

root@orangepipc:~# dmesg | grep -i ov56
[    7.362807] sun6i-csi 1cb0000.camera: creating ov5640 1-003c:0 -> sun6i-csi:0 link
[    7.767201] ov5640 1-003c: ov5640_read_reg: error: reg=300a
[    7.772902] ov5640 1-003c: ov5640_set_power_on: failed to read chip identifier

 

issue:

root@orangepipc:/dev#  v4l2-ctl -d /dev/video1 -D
Failed to open /dev/video1: No such device or address

 

but I have video1 created after overlay added
 

root@orangepipc:/dev# ls
autofs           fuse       loop1         mqueue  shm     tty16  tty29  tty41  tty54  ttyS0     v4l-subdev0  vcsa6      zram1
block            gpiochip0  loop2         net     snd     tty17  tty3   tty42  tty55  ttyS1     vcs          vcsu       zram2
btrfs-control    gpiochip1  loop3         null    stderr  tty18  tty30  tty43  tty56  ttyS2     vcs1         vcsu1
bus              hwrng      loop4         ppp     stdin   tty19  tty31  tty44  tty57  ttyS3     vcs2         vcsu2
cec0             i2c-0      loop5         ptmx    stdout  tty2   tty32  tty45  tty58  ttyS4     vcs3         vcsu3
char             i2c-1      loop6         pts     tty     tty20  tty33  tty46  tty59  ttyS5     vcs4         vcsu4
console          i2c-2      loop7         ram0    tty0    tty21  tty34  tty47  tty6   ttyS6     vcs5         vcsu5
cpu_dma_latency  initctl    loop-control  ram1    tty1    tty22  tty35  tty48  tty60  ttyS7     vcs6         vcsu6
cuse             input      mapper        ram2    tty10   tty23  tty36  tty49  tty61  ubi_ctrl  vcsa         video0
disk             kmem       media0        ram3    tty11   tty24  tty37  tty5   tty62  uhid      vcsa1        video1
dri              kmsg       media1        random  tty12   tty25  tty38  tty50  tty63  uinput    vcsa2        watchdog
ecryptfs         lirc0      mem           rfkill  tty13   tty26  tty39  tty51  tty7   uleds     vcsa3        watchdog0
fd               log        mmcblk0       rtc     tty14   tty27  tty4   tty52  tty8   urandom   vcsa4        zero
full             loop0      mmcblk0p1     rtc0    tty15   tty28  tty40  tty53  tty9   v4l       vcsa5        zram0


 

overlay_csi_orangepipc.dts

 

 

Maybe you should replace the regulators. The previous examples are for different boards. I don't know the orange pi pc schematic but maybe you should check your regulators. I'm working on custom board like banana pi m64 and I'm stuck on same error. By the way I'm open to any help about this error.

 

Edited by Eemeien
added last sentence

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines