Difference between revisions of "DIGILENT MIPI-CSI Camera Set"

From Voipac Wiki
Jump to navigation Jump to search
(Created page with "Category:iMX8M Industrial Development Kit Category:iMX8M Industrial Peripherals <!-- --> <div style="float:right">__TOC__</div> This example uses Raspberry Pi Camera...")
 
 
(14 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
<div style="float:right">__TOC__</div>
 
<div style="float:right">__TOC__</div>
  
This example uses Raspberry Pi Camera Rev 1.3 (built on OV5647 MIPI sensor) as a test device for CSI Interface. On this page OV5647 sensor integration, settings and usage on i.MX8M processors are shown.<br /><br />
+
== Camera Input  ==
 +
'''''Input:''''' Connect DIGILENT Pcam 5C camera module into CSI-2 interface and check if it is detected on I2C bus<br />
 +
'''''Output:''''' Camera is found<br />
 +
 
 +
<syntaxhighlight lang="bash">
 +
root@imx8mq-voipac:~# dmesg | grep ov56
 +
[    2.383324] ov5640_mipi 1-003c: No pin available
 +
[    2.387976] ov5640_mipi 1-003c: No sensor pwdn pin available
 +
[    2.393683] ov5640_mipi 1-003c: No sensor reset pin available
 +
[    2.399479] ov5640_regulator_enable: cannot get io voltage error - err:-517
 +
[    3.018132] ov5640_mipi 1-003c: No pin available
 +
[    3.033972] ov5640_mipi 1-003c: No sensor pwdn pin available
 +
[    3.046488] ov5640_mipi 1-003c: No sensor reset pin available
 +
[    3.062091] ov5640_mipi 1-003c: 1-003c supply DVDD not found, using dummy regulator
 +
[    3.072436] ov5640_mipi 1-003c: 1-003c supply AVDD not found, using dummy regulator
 +
[    4.325257] mxc-mipi-csi2_yav 30b60000.mipi_csi: Registered sensor subdevice: ov5640_mipi 1-003c
 +
[    4.337288] ov5640_mipi 1-003c: Camera is found
 +
</syntaxhighlight>
  
'''''Note:''''' There is an issue concerning Raspberry Pi 1.3 cameras and its I2C detected. There might be some camera models that does not get identified.
 
  
== Device detection ==
+
'''''Input:''''' Connect DIGILENT Pcam 5C camera module into CSI-2 interface and capture image<br />
=== Kernel 4.1 ===
+
'''''Output:''''' The image stored in local media with name sample_image.jpeg
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
...
+
root@imx8mq-voipac:~# gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video1 ! jpegenc ! filesink location=sample_image_digi.jpeg
camera ov5647_mipi is found
+
Setting pipeline to PAUSED ...
...
+
Pipeline is live and does not need PREROLL ...
 +
Setting pipeline to PLAYING ...
 +
New clock: GstSystemClock
 +
[ 1023.907274] ov5640_mipi 1-003c: s_stream: 1
 +
[ 1024.609769] skip frame 1
 +
Got EOS from element "pipeline0".[ 1026.497200] ov5640_mipi 1-003c: s_stream: 0
 +
 
 +
Execution ended after 0:00:03.075026264
 +
Setting pipeline to PAUSED ...
 +
Setting pipeline to READY ...
 +
Setting pipeline to NULL ...
 +
Freeing pipeline ...
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Kernel 3.14 ===
+
'''''Input:''''' Connect DIGILENT Pcam 5C camera module into CSI-2 interface and capture video<br />
 +
'''''Output:''''' The image displayed on display/monitor
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
...
+
root@imx8mq-voipac:~# GST_DEBUG=GST_BUFFER:5 gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,framerate=30/1' ! autovideosink
camera ov5647_mipi is found
+
Setting pipeline to PAUSED ...
mxc_v4l2_master_attach: ipu(0:0)/csi(1:0)/mipi(1:0) doesn't match
+
Pipeline is live and does not need PREROLL ...
mxc_v4l2_master_attach: ipu0:/csi1 mipi attached ov5647_mipi:mxc_v4l2_cap1
+
Setting pipeline to PLAYING ...
ERROR: v4l2 capture: slave not found!
+
New clock: GstSystemClock
...
+
0:00:00.817426914  433 0xaaaacb3d5c00 DEBUG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb4873c0 (GstVideoMeta) of size 112
 +
0:00:00.817551951  433 0xaaaacb3d5c00 DEBUG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb487440 (GstVideoMeta) of size 112
 +
0:00:00.817603069  4[ 1575.384649] ov5640_mipi 1-003c: s_stream: 1
 +
33 0xaaaacb3d5c00 DEBUG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb4874c0 (GstVideoMeta) of size 112
 +
0:00:00.817651068  433 0xaaaacb3d5c00 DEBUG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb487540 (GstVideoMeta) of size 112
 +
[ 1576.002044] skip frame 1
 +
 
 +
CAPTURE INTERRUPTION:
 +
 
 +
[ 1582.847027] ov5640_mipi 1-003c: s_stream: 0
 +
 
 +
Execution ended after 0:00:08.249177743
 +
Setting pipeline to PAUSED ...
 +
Setting pipeline to READY ...
 +
0:00:08.326703325  433 0xaaaacb468180 DEBUG            GST_BUFFER gstbuffer.c:1448:gst_buffer_is_memory_range_writable: idx 0, length -1
 +
0:00:08.326764524  433 0xaaaacb468180 DEBUG            GST_BUFFER gstbuffer.c:1448:gst_buffer_is_memory_range_writable: idx 0, length -1
 +
0:00:08.326792003  433 0xaaaacb468180 DEBUG            GST_BUFFER gstbuffer.c:1448:gst_buffer_is_memory_range_writable: idx 0, length -1
 +
Setting pipeline to NULL ...
 +
Total showed frames (78), playing for (0:00:08.249372377), fps (9.455).
 +
Freeing pipeline ...
 +
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== I2C detect ==
+
Video should be displayed on video output (hdmi or lvds display)
CSI connector uses I2C2 to communicate with cameras. OV5647 sensor is located at 0x36 address:
+
 
 +
<br /><br />!!!!!!!!!EXISTING PART OF THE WIKI PAGE STARTS BELOW !!!!!!!!!<br /><br />
 +
 
 +
This example uses Digilent Pcam 5C is a MIPI-CSI interface camera (built on OV5640 MIPI sensor) as a test device for CSI Interface. On this page OV5640 sensor integration, settings and usage on i.MX8M processors are shown.
 +
<br />
 +
[[image:Pcam-5C.png|800px]]<br />
 +
Digilent Pcam 5C is a MIPI-CSI interface, 5 MP Fixed-Focus color camera connected to iMX Development Baseboard
 +
<br />
 +
 +
== Kernel detection ==
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
root@imx6s-tinyrex:~# i2cdetect -y 1
+
root@imx8mq-voipac:~# dmesg | grep ov56
    0  1 2 3  4  5  6  7  8  9  a  b  c  d  e  f
+
[    2.410383] ov5640_mipi 1-003c: No pin available
00:         -- -- -- -- -- -- -- -- -- -- -- -- --  
+
[    2.415040] ov5640_mipi 1-003c: No sensor pwdn pin available
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
[    2.420726] ov5640_mipi 1-003c: No sensor reset pin available
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
[    2.426512] ov5640_regulator_enable: cannot get io voltage error - err:-517
30: -- -- -- -- -- -- UU -- -- -- 3a -- -- -- -- --
+
[    2.555690] ov5640_mipi 2-003c: No pin available
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
[    2.562074] ov5640_mipi 2-003c: No sensor reset pin available
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
[    2.567861] ov5640_regulator_enable: cannot get io voltage error - err:-517
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
[    2.948998] ov5640_mipi 1-003c: No pin available
70: -- -- -- -- -- -- -- -- 
+
[    2.959199] ov5640_mipi 1-003c: No sensor reset pin available
 +
[    2.970608] ov5640_mipi 1-003c: 1-003c supply DVDD not found, using dummy regulator
 +
[    2.983356] ov5640_mipi 1-003c: 1-003c supply AVDD not found, using dummy regulator
 +
[    4.190794] mxc-mipi-csi2_yav 30b60000.mipi_csi: Registered sensor subdevice: ov5640_mipi 1-003c
 +
[    4.204863] ov5640_mipi 1-003c: Camera is found
 +
[    4.209719] ov5640_mipi 2-003c: No pin available
 +
[    4.214385] ov5640_mipi 2-003c: Failed to set power pin
 +
[    4.219626] ov5640_mipi 2-003c: retval=-16
 +
[    4.223747] ov5640_mipi: probe of 2-003c failed with error -16
 +
root@imx8mq-voipac:~#
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== GPIO control ==
+
== I2C detection ==
GPIO pins are controlled by the camera driver and access to these pins is blocked. Power on signal is recognised as GPIO 74, LED GPIO has number 54.<br /><br />
+
DIGILENT Pcam 5C camera chip is connected via I2C2. The most important address for correct detection is 0x3c.
 
 
LED located on camera module can be tested by temporarily disabling mipi kernel module and toggling corresponding GPIO pin:
 
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
root@imx6s-tinyrex:~# modprobe -r ov5647_camera_mipi
+
root@imx8mq-voipac:~# i2cdetect -y 1
root@imx6s-tinyrex:~# echo 54 > /sys/class/gpio/export
+
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
root@imx6s-tinyrex:~# echo out > /sys/class/gpio/gpio54/direction
+
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
root@imx6s-tinyrex:~# echo 1 > /sys/class/gpio/gpio54/value
+
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
root@imx6s-tinyrex:~# echo 0 > /sys/class/gpio/gpio54/value
+
20: -- -- -- UU -- -- -- UU -- -- -- -- -- -- -- --
root@imx6s-tinyrex:~# echo 54 > /sys/class/gpio/unexport
+
30: -- -- -- -- -- -- -- -- -- -- -- -- UU 3d -- --
root@imx6s-tinyrex:~# modprobe ov5647_camera_mipi
+
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +
50: -- UU -- UU -- -- -- -- -- -- -- -- -- -- -- --
 +
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +
70: -- -- -- -- -- -- -- --
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Modules listing ==
 
== Modules listing ==
=== Kernel 4.1 ===
+
=== Kernel 4.1 ???????????===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
root@imx6-tinyrexmax:~# lsmod
+
root@imx6-openrex:~# lsmod ????????????????
 
Module                  Size  Used by
 
Module                  Size  Used by
 
mxc_v4l2_capture      27624  2
 
mxc_v4l2_capture      27624  2
Line 70: Line 137:
 
v4l2_int_device        2872  4 ov5647_camera_mipi_int,adv7610_video,ipu_csi_enc,mxc_v4l2_capture
 
v4l2_int_device        2872  4 ov5647_camera_mipi_int,adv7610_video,ipu_csi_enc,mxc_v4l2_capture
 
mxc_dcic                6528  0
 
mxc_dcic                6528  0
</syntaxhighlight>
 
  
=== Kernel 3.14 ===
+
 
<syntaxhighlight lang="bash">
+
 
root@imx6s-tinyrex:~# lsmod
+
root@imx8mq-voipac:~# lsmod
 
Module                  Size  Used by
 
Module                  Size  Used by
mxc_v4l2_capture      28532 1  
+
crct10dif_ce          16384 1
ipu_bg_overlay_sdc      5401 1 mxc_v4l2_capture
+
mwifiex_pcie          45056 0
ipu_still               2528 1 mxc_v4l2_capture
+
mwifiex               294912 1 mwifiex_pcie
ipu_prp_enc            5943  1 mxc_v4l2_capture
+
galcore              610304 2
ipu_csi_enc            3863  1 mxc_v4l2_capture
+
 
ipu_fg_overlay_sdc      6217  1 mxc_v4l2_capture
 
ov5647_camera_mipi    30906  0
 
v4l2_int_device        2930 2 ov5647_camera_mipi,mxc_v4l2_capture
 
mxc_dcic                6569  0
 
evbug                  1875  0
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Resolution setting ==
 
== Resolution setting ==
 +
The camera support video streaming formats 1080p (at 30 frames per second) and 720p (at 60 frames per second)
 
=== 1280x960 ===
 
=== 1280x960 ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 127: Line 189:
 
=== Capture single JPEG picture ===
 
=== Capture single JPEG picture ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
echo 2 > /sys/bus/i2c/devices/1-0036/ov5647_mode
+
root@imx8mq-voipac:~# gst-launch-1.0 v4l2src num-buffers=1 ! jpegenc ! filesink location=sample_image.jp
gst-launch-1.0 v4l2src device="/dev/video1" num-buffers=1 ! video/x-bayer,width=1920,height=1080,framerate=30/1 ! bayer2rgb ! videoconvert ! jpegenc ! filesink location=sample_1920_1080.jpeg
+
Setting pipeline to PAUSED ...
 +
Pipeline is live and does not need PREROLL ...
 +
Setting pipeline to PLAYING ...
 +
New clock: GstSystemClock
 +
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
 +
Additional debug info:
 +
../git/libs/gst/base/gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
 +
streaming stopped, reason not-negotiated (-4)
 +
Execution ended after 0:00:00.000309960
 +
Setting pipeline to PAUSED ...
 +
Setting pipeline to READY ...
 +
Setting pipeline to NULL ...
 +
Freeing pipeline ...
 +
root@imx8mq-voipac:~# ls
 +
sample_image.jp
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
The image stored in local media with name sample_image.jpeg
  
 
=== Video preview ===
 
=== Video preview ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
echo 2 > /sys/bus/i2c/devices/1-0036/ov5647_mode
+
root@imx8mq-voipac:~# GST_DEBUG=GST_BUFFER:5 gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,framerate=30/1' ! autovideosink
gst-launch-1.0 v4l2src device="/dev/video1" ! video/x-bayer,width=1920,height=1080,framerate=30/1 ! queue ! bayer2rgb ! videoconvert ! fbdevsin
+
Setting pipeline to PAUSED ...
</syntaxhighlight>
+
Pipeline is live and does not need PREROLL ...
 
+
Setting pipeline to PLAYING ...
<syntaxhighlight lang="bash">
+
New clock: GstSystemClock
echo 3 > /sys/bus/i2c/devices/1-0036/ov5647_mode
+
0:00:00.842776580  469 0xaaaadc001c00 DEBUG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc0623c0 (GstVideoMeta) of size 112
gst-launch-1.0 v4l2src device="/dev/video1" ! video/x-bayer,width=640,height=480,framerate=15/1 ! bayer2rgb ! videoconvert ! fbdevsink
+
0:00:00.842935198  469 0xaaaadc001c00 DEBUG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc062440 (GstVideoMeta) of size 112
 +
0:00:00.843278592  469 0xaaaadc001c00 DEB[ 1415.898001] ov5640_mipi 2-003c: s_stream: 1
 +
UG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc0624c0 (GstVideoMeta) of size 112
 +
0:00:00.843338584  469 0xaaaadc001c00 DEBUG            GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc062540 (GstVideoMeta) of size 112
 +
[ 1416.119964] skip frame 1
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
The video stream from camera can be displayed on display/monitor

Latest revision as of 14:51, 11 September 2024

Camera Input

Input: Connect DIGILENT Pcam 5C camera module into CSI-2 interface and check if it is detected on I2C bus
Output: Camera is found

root@imx8mq-voipac:~# dmesg | grep ov56
[    2.383324] ov5640_mipi 1-003c: No pin available
[    2.387976] ov5640_mipi 1-003c: No sensor pwdn pin available
[    2.393683] ov5640_mipi 1-003c: No sensor reset pin available
[    2.399479] ov5640_regulator_enable: cannot get io voltage error - err:-517
[    3.018132] ov5640_mipi 1-003c: No pin available
[    3.033972] ov5640_mipi 1-003c: No sensor pwdn pin available
[    3.046488] ov5640_mipi 1-003c: No sensor reset pin available
[    3.062091] ov5640_mipi 1-003c: 1-003c supply DVDD not found, using dummy regulator
[    3.072436] ov5640_mipi 1-003c: 1-003c supply AVDD not found, using dummy regulator
[    4.325257] mxc-mipi-csi2_yav 30b60000.mipi_csi: Registered sensor subdevice: ov5640_mipi 1-003c
[    4.337288] ov5640_mipi 1-003c: Camera is found


Input: Connect DIGILENT Pcam 5C camera module into CSI-2 interface and capture image
Output: The image stored in local media with name sample_image.jpeg

root@imx8mq-voipac:~# gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video1 ! jpegenc ! filesink location=sample_image_digi.jpeg
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[ 1023.907274] ov5640_mipi 1-003c: s_stream: 1
[ 1024.609769] skip frame 1
Got EOS from element "pipeline0".[ 1026.497200] ov5640_mipi 1-003c: s_stream: 0

Execution ended after 0:00:03.075026264
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Input: Connect DIGILENT Pcam 5C camera module into CSI-2 interface and capture video
Output: The image displayed on display/monitor

root@imx8mq-voipac:~# GST_DEBUG=GST_BUFFER:5 gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,framerate=30/1' ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.817426914   433 0xaaaacb3d5c00 DEBUG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb4873c0 (GstVideoMeta) of size 112
0:00:00.817551951   433 0xaaaacb3d5c00 DEBUG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb487440 (GstVideoMeta) of size 112
0:00:00.817603069   4[ 1575.384649] ov5640_mipi 1-003c: s_stream: 1
33 0xaaaacb3d5c00 DEBUG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb4874c0 (GstVideoMeta) of size 112
0:00:00.817651068   433 0xaaaacb3d5c00 DEBUG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaacb487540 (GstVideoMeta) of size 112
[ 1576.002044] skip frame 1

CAPTURE INTERRUPTION:

[ 1582.847027] ov5640_mipi 1-003c: s_stream: 0

Execution ended after 0:00:08.249177743
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
0:00:08.326703325   433 0xaaaacb468180 DEBUG             GST_BUFFER gstbuffer.c:1448:gst_buffer_is_memory_range_writable: idx 0, length -1
0:00:08.326764524   433 0xaaaacb468180 DEBUG             GST_BUFFER gstbuffer.c:1448:gst_buffer_is_memory_range_writable: idx 0, length -1
0:00:08.326792003   433 0xaaaacb468180 DEBUG             GST_BUFFER gstbuffer.c:1448:gst_buffer_is_memory_range_writable: idx 0, length -1
Setting pipeline to NULL ...
Total showed frames (78), playing for (0:00:08.249372377), fps (9.455).
Freeing pipeline ...

Video should be displayed on video output (hdmi or lvds display)



!!!!!!!!!EXISTING PART OF THE WIKI PAGE STARTS BELOW !!!!!!!!!

This example uses Digilent Pcam 5C is a MIPI-CSI interface camera (built on OV5640 MIPI sensor) as a test device for CSI Interface. On this page OV5640 sensor integration, settings and usage on i.MX8M processors are shown.
Pcam-5C.png
Digilent Pcam 5C is a MIPI-CSI interface, 5 MP Fixed-Focus color camera connected to iMX Development Baseboard

Kernel detection

root@imx8mq-voipac:~# dmesg | grep ov56
[    2.410383] ov5640_mipi 1-003c: No pin available
[    2.415040] ov5640_mipi 1-003c: No sensor pwdn pin available
[    2.420726] ov5640_mipi 1-003c: No sensor reset pin available
[    2.426512] ov5640_regulator_enable: cannot get io voltage error - err:-517
[    2.555690] ov5640_mipi 2-003c: No pin available
[    2.562074] ov5640_mipi 2-003c: No sensor reset pin available
[    2.567861] ov5640_regulator_enable: cannot get io voltage error - err:-517
[    2.948998] ov5640_mipi 1-003c: No pin available
[    2.959199] ov5640_mipi 1-003c: No sensor reset pin available
[    2.970608] ov5640_mipi 1-003c: 1-003c supply DVDD not found, using dummy regulator
[    2.983356] ov5640_mipi 1-003c: 1-003c supply AVDD not found, using dummy regulator
[    4.190794] mxc-mipi-csi2_yav 30b60000.mipi_csi: Registered sensor subdevice: ov5640_mipi 1-003c
[    4.204863] ov5640_mipi 1-003c: Camera is found
[    4.209719] ov5640_mipi 2-003c: No pin available
[    4.214385] ov5640_mipi 2-003c: Failed to set power pin
[    4.219626] ov5640_mipi 2-003c: retval=-16
[    4.223747] ov5640_mipi: probe of 2-003c failed with error -16
root@imx8mq-voipac:~#

I2C detection

DIGILENT Pcam 5C camera chip is connected via I2C2. The most important address for correct detection is 0x3c.

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

Modules listing

Kernel 4.1 ???????????

root@imx6-openrex:~# lsmod ????????????????
Module                  Size  Used by
mxc_v4l2_capture       27624  2
ipu_bg_overlay_sdc      5385  1 mxc_v4l2_capture
ipu_still               2331  1 mxc_v4l2_capture
ipu_prp_enc             5903  1 mxc_v4l2_capture
ipu_csi_enc             3904  1 mxc_v4l2_capture
ipu_fg_overlay_sdc      6130  1 mxc_v4l2_capture
ov5647_camera_mipi_int    30566  0
adv7610_video           6373  0
v4l2_int_device         2872  4 ov5647_camera_mipi_int,adv7610_video,ipu_csi_enc,mxc_v4l2_capture
mxc_dcic                6528  0



root@imx8mq-voipac:~# lsmod
Module                  Size  Used by
crct10dif_ce           16384  1
mwifiex_pcie           45056  0
mwifiex               294912  1 mwifiex_pcie
galcore               610304  2

Resolution setting

The camera support video streaming formats 1080p (at 30 frames per second) and 720p (at 60 frames per second)

1280x960

echo 0 > /sys/bus/i2c/devices/1-0036/ov5647_mode

1280x720

echo 1 > /sys/bus/i2c/devices/1-0036/ov5647_mode

1920x1080

echo 2 > /sys/bus/i2c/devices/1-0036/ov5647_mode

640x480

echo 3 > /sys/bus/i2c/devices/1-0036/ov5647_mode

1024x768 (default)

echo 4 > /sys/bus/i2c/devices/1-0036/ov5647_mode

960x720

echo 5 > /sys/bus/i2c/devices/1-0036/ov5647_mode

640x480 (narrow angle of view)

echo 6 > /sys/bus/i2c/devices/1-0036/ov5647_mode

Gstreamer

Capture single JPEG picture

root@imx8mq-voipac:~# gst-launch-1.0 v4l2src num-buffers=1 ! jpegenc ! filesink location=sample_image.jp
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../git/libs/gst/base/gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000309960
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
root@imx8mq-voipac:~# ls
sample_image.jp

The image stored in local media with name sample_image.jpeg

Video preview

root@imx8mq-voipac:~# GST_DEBUG=GST_BUFFER:5 gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,framerate=30/1' ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.842776580   469 0xaaaadc001c00 DEBUG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc0623c0 (GstVideoMeta) of size 112
0:00:00.842935198   469 0xaaaadc001c00 DEBUG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc062440 (GstVideoMeta) of size 112
0:00:00.843278592   469 0xaaaadc001c00 DEB[ 1415.898001] ov5640_mipi 2-003c: s_stream: 1
UG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc0624c0 (GstVideoMeta) of size 112
0:00:00.843338584   469 0xaaaadc001c00 DEBUG             GST_BUFFER gstbuffer.c:2279:gst_buffer_add_meta: alloc metadata 0xaaaadc062540 (GstVideoMeta) of size 112
[ 1416.119964] skip frame 1

The video stream from camera can be displayed on display/monitor