Difference between revisions of "iMX6 TinyRex Camera"
Jump to navigation
Jump to search
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:iMX6 TinyRex Development | + | [[Category:iMX6 TinyRex Development Kit]] |
[[Category:iMX6 TinyRex Peripherals]] | [[Category:iMX6 TinyRex Peripherals]] | ||
<!-- --> | <!-- --> | ||
<div style="float:right">__TOC__</div> | <div style="float:right">__TOC__</div> | ||
− | This example uses Raspberry Pi Camera Rev 1.3 ( | + | 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.MX6 processors are shown.<br /><br /> |
− | '''''Note:''''' There is an issue concerning Raspberry Pi 1.3 cameras and its I2C detected. There might be some models that does not get identified. | + | '''''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 == | == Device detection == | ||
Line 42: | Line 42: | ||
== GPIO control == | == GPIO control == | ||
− | GPIO pins are controlled by the camera driver and access to | + | 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 /> |
+ | |||
+ | 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@imx6s-tinyrex:~# modprobe -r ov5647_camera_mipi | ||
Line 53: | Line 55: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == Modules == | + | == Modules listing == |
=== Kernel 4.1 === | === Kernel 4.1 === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 86: | Line 88: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == Resolution | + | == Resolution setting == |
=== 1280x960 === | === 1280x960 === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 117: | Line 119: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === 640x480 (narrow angle of view) | + | === 640x480 (narrow angle of view) === |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
echo 6 > /sys/bus/i2c/devices/1-0036/ov5647_mode | echo 6 > /sys/bus/i2c/devices/1-0036/ov5647_mode |
Latest revision as of 09:08, 24 April 2022
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.MX6 processors are shown.
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
Kernel 4.1
... camera ov5647_mipi is found ...
Kernel 3.14
... camera ov5647_mipi is found mxc_v4l2_master_attach: ipu(0:0)/csi(1:0)/mipi(1:0) doesn't match mxc_v4l2_master_attach: ipu0:/csi1 mipi attached ov5647_mipi:mxc_v4l2_cap1 ERROR: v4l2 capture: slave not found! ...
I2C detect
CSI connector uses I2C2 to communicate with cameras. OV5647 sensor is located at 0x36 address:
root@imx6s-tinyrex:~# i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- UU -- -- -- 3a -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
GPIO control
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.
LED located on camera module can be tested by temporarily disabling mipi kernel module and toggling corresponding GPIO pin:
root@imx6s-tinyrex:~# modprobe -r ov5647_camera_mipi root@imx6s-tinyrex:~# echo 54 > /sys/class/gpio/export root@imx6s-tinyrex:~# echo out > /sys/class/gpio/gpio54/direction root@imx6s-tinyrex:~# echo 1 > /sys/class/gpio/gpio54/value root@imx6s-tinyrex:~# echo 0 > /sys/class/gpio/gpio54/value root@imx6s-tinyrex:~# echo 54 > /sys/class/gpio/unexport root@imx6s-tinyrex:~# modprobe ov5647_camera_mipi
Modules listing
Kernel 4.1
root@imx6-tinyrexmax:~# 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
Kernel 3.14
root@imx6s-tinyrex:~# lsmod Module Size Used by mxc_v4l2_capture 28532 1 ipu_bg_overlay_sdc 5401 1 mxc_v4l2_capture ipu_still 2528 1 mxc_v4l2_capture ipu_prp_enc 5943 1 mxc_v4l2_capture 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
Resolution setting
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
echo 2 > /sys/bus/i2c/devices/1-0036/ov5647_mode 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
Video preview
echo 2 > /sys/bus/i2c/devices/1-0036/ov5647_mode gst-launch-1.0 v4l2src device="/dev/video1" ! video/x-bayer,width=1920,height=1080,framerate=30/1 ! queue ! bayer2rgb ! videoconvert ! fbdevsin
echo 3 > /sys/bus/i2c/devices/1-0036/ov5647_mode gst-launch-1.0 v4l2src device="/dev/video1" ! video/x-bayer,width=640,height=480,framerate=15/1 ! bayer2rgb ! videoconvert ! fbdevsink