NanoPi M4V2 : 카메라(OV13850) 사용하기

OS/NanoPi 2021. 2. 21. 00:51 Posted by 파란크리스마스

출처

NanoPi M4V2 : 카메라(ov13850)

이지미출처 : File:M4-mipi-single-camera.jpg - FriendlyARM WiKi

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ dmesg | grep ov13850
[    1.137232] ov13850 1-0010: driver version: 00.01.01
[    1.137688] ov13850 1-0010: could not get module information!
[    1.138295] ov13850 1-0010: GPIO lookup for consumer reset
[    1.138308] ov13850 1-0010: using device tree for GPIO lookup
[    1.138344] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/i2c@ff110000/ov13850@10[0]' - status (0)
[    1.138380] ov13850 1-0010: GPIO lookup for consumer pwdn
[    1.138391] ov13850 1-0010: using device tree for GPIO lookup
[    1.138423] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff110000/ov13850@10[0]' - status (0)
[    1.142534] ov13850 1-0010: Detected OV00d850 sensor, REVISION 0xb1
[    1.143438] ov13850 2-0010: driver version: 00.01.01
[    1.143893] ov13850 2-0010: could not get module information!
[    1.144472] ov13850 2-0010: GPIO lookup for consumer reset
[    1.144484] ov13850 2-0010: using device tree for GPIO lookup
[    1.144519] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/i2c@ff120000/ov13850@10[0]' - status (0)
[    1.144556] ov13850 2-0010: GPIO lookup for consumer pwdn
[    1.144567] ov13850 2-0010: using device tree for GPIO lookup
[    1.144597] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff120000/ov13850@10[0]' - status (0)
[    1.149264] ov13850 2-0010: Unexpected sensor id(000000), ret(-5)

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ v4l2-ctl -V -d /dev/video0
Format Video Capture Multiplanar:
        Width/Height      : 640/480
        Pixel Format      : 'YUYV'
        Field             : None
        Number of planes  : 1
        Flags             : 
        Colorspace        : Default
        Transfer Function : Default
        YCbCr Encoding    : Default
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 1280
           Size Image     : 614400
pi@NanoPi-M4v2:~$ v4l2-ctl -V -d /dev/video1
Format Video Capture Multiplanar:
        Width/Height      : 1920/1568
        Pixel Format      : 'YUYV'
        Field             : None
        Number of planes  : 1
        Flags             : 
        Colorspace        : Default
        Transfer Function : Default
        YCbCr Encoding    : Default
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 3840
           Size Image     : 6021120
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev0 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev1 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev2 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ media-ctl -d /dev/media0 -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, 6 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:SBGGR10_1X10/2112x1568 field:none
                 crop.bounds:(0,0)/2112x1568
                 crop:(0,0)/2112x1568]
                <- "rkisp1_dmapath":0 []
                <- "rockchip-mipi-dphy-rx":1 [ENABLED]
        pad1: Sink
                <- "rkisp1-input-params":0 [ENABLED]
        pad2: Source
                [fmt:YUYV8_2X8/2112x1568 field:none
                 crop.bounds:(0,0)/2112x1568
                 crop:(0,0)/2112x1568]
                -> "rkisp1_selfpath":0 [ENABLED]
                -> "rkisp1_mainpath":0 [ENABLED]
        pad3: Source
                -> "rkisp1-statistics":0 [ENABLED]
 
- entity 2: rkisp1_mainpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]
 
- entity 3: rkisp1_selfpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]
 
- entity 4: rkisp1_dmapath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
        pad0: Source
                -> "rkisp1-isp-subdev":0 []
 
- entity 5: rkisp1-statistics (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video3
        pad0: Sink
                <- "rkisp1-isp-subdev":3 [ENABLED]
 
- entity 6: rkisp1-input-params (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video4
        pad0: Source
                -> "rkisp1-isp-subdev":1 [ENABLED]
 
- entity 7: rockchip-mipi-dphy-rx (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                <- "ov13850 1-0010":0 [ENABLED]
        pad1: Source
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                -> "rkisp1-isp-subdev":0 [ENABLED]
 
- entity 8: ov13850 1-0010 (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
        pad0: Source
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                -> "rockchip-mipi-dphy-rx":0 [ENABLED]

카메라(ov13850) 연결 확인

pi@NanoPi-M4v2:~$ dmesg | grep Async
[    1.839621] rkisp1: Async subdev notifier completed

gst-camera 설치

pi@NanoPi-M4v2:~$ cd /tmp/
pi@NanoPi-M4v2:/tmp$ git clone https://github.com/friendlyarm/gst-camera-sh.git
Cloning into 'gst-camera-sh'...
remote: Enumerating objects: 36, done.
remote: Total 36 (delta 0), reused 0 (delta 0), pack-reused 36
Unpacking objects: 100% (36/36), done.
pi@NanoPi-M4v2:/tmp$ sudo cp gst-camera-sh/*.sh /usr/bin/

카메라(ov13850) 캡쳐

pi@NanoPi-M4v2:/tmp$ gst-camera.sh -a photo -o 1.jpg
gst-launch-1.0: no process found
====================================================
=== GStreamer 1.1 command:
=== gst-launch-1.0 rkisp num-buffers=20 device=/dev/video0 io-mode=1 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=10/1 ! jpegenc ! multifilesink location="/tmp/isp-frame%d.jpg"
====================================================
{{{{{{ start take photo
Setting pipeline to PAUSED ...
media get entity by name: lens is null
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR rkisp_control_loop_impl.cpp:99: failed to get camera module info
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
XCAM ERROR rkisp_device.cpp:72: atomisp device(/dev/video0) try subdev format failed
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.759673858
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
}}}}}} end take photo

Image sensors OV13850 & OV4689 at the i2c ports 1 & 2

pi@NanoPi-M4v2:~/mjpg-streamer/mjpg-streamer-experimental$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- 0c -- -- -- 
10: UU -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@NanoPi-M4v2:~/mjpg-streamer/mjpg-streamer-experimental$ ls -l /sys/class/video4linux/
total 0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev0 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev1 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev1
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev2 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev2
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev3 -> ../../devices/platform/ff920000.rkisp1/video4linux/v4l-subdev3
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev4 -> ../../devices/platform/ff920000.rkisp1/video4linux/v4l-subdev4
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video0 -> ../../devices/platform/ff910000.rkisp1/video4linux/video0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video1 -> ../../devices/platform/ff910000.rkisp1/video4linux/video1
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video2 -> ../../devices/platform/ff910000.rkisp1/video4linux/video2
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video3 -> ../../devices/platform/ff910000.rkisp1/video4linux/video3
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video4 -> ../../devices/platform/ff910000.rkisp1/video4linux/video4
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video5 -> ../../devices/platform/ff920000.rkisp1/video4linux/video5
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video6 -> ../../devices/platform/ff920000.rkisp1/video4linux/video6
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video7 -> ../../devices/platform/ff920000.rkisp1/video4linux/video7
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video8 -> ../../devices/platform/ff920000.rkisp1/video4linux/video8
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video9 -> ../../devices/platform/ff920000.rkisp1/video4linux/video9

화이트 밸런스 조정 (실패)

pi@NanoPi-M4v2:~$ v4l2-ctl -d 1 --set-ctrl=white_balance_temperature_auto=1
unknown control 'white_balance_temperature_auto'

댓글을 달아 주세요