|
|
| (32 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| {{Under_Construction}}
| | On this page you will find useful informations on how to use the Camera/CMOS Sensor Interface (CSI/CSI2) of the i.MX chip found on your APF and OPOS93Dev board. |
| | Currently only the [[APF27]], [[APF6]] & [[OPOS93]] are supported. |
|
| |
|
| On this page you will find useful informations on how to use the Camera/CMOS Sensor Interface (CSI) of the i.MX chip found on your APF board.
| | ==Hardware== |
| Currently only the i.MX27/APF27 are supported.
| |
|
| |
|
| ==Hardware==
| | <tabber> |
| * All the signals of the i.MX27 CSI interface can be found on the J9 connector of the APF27Dev development board. | | |-|APF27= |
| * You should connect an external camera compatible with the CSI interface (8bits) to see something ;-). Here are the tested models: | | * All the signals of the i.MX27 CSI interface can be found on the J9 connector of the [[APF27Dev|APF27Dev development board]]. |
| ** [[OV9653]] (Omnivision sensor found in the 22T1 module from Microjet; no more available for sale :-() | | * You should connect an external camera/sensor compatible with the CSI interface (8bits data bus) to see something ;-). Here are the tested sensor models: |
| | ** [[OV9653]] / [[OV9655]] |
| | ** [[OV7670]] |
| | ** [[OV3640]] |
| | * All these sensors are controllable through an I2C interface. The one on J8 connector of [[APF27Dev]] can for example be used. |
| | |
| | |-|APF6= |
| | * [[APF6Dev]] boards have a wandcam (OV5640) compatible connector (near the PCIexpress one). |
| | * MIPI bus is used on [[APF6Dev]] |
| | |
| | |-|OPOS93= |
| | * The [[OPOS93DEV]] board has a 15-pin Raspberry Pi Camera compatible connector (located below the OPOS93 SoC). |
| | * A 2-lane MIPI CSI-2 bus is used. |
| | * Tested with the OmniVision OV5647 sensor. |
| | </tabber> |
|
| |
|
| ==Driver== | | ==Driver== |
| * CSI interface can be driven through the V4L2 (Video For Linux) standard interface. To activate it you have to: | | * From now we consider that you have a supported camera module plugged on your development board |
| <pre class="host"> | | * CSI interface can be driven through the V4L2 (Video For Linux) standard interface as soon as CSI/MIPI driver is loaded: |
| $ make linux26-menuconfig | | |
| | <tabber> |
| | |-|APF27= |
| | <pre class="apf"> |
| | # modprobe mx27_camera |
| | </pre> |
| | * Then you have to load your camera driver in order for him to "attach" to the CSI one (for example for the OV9653): |
| | <pre class="apf"> |
| | # modprobe ov96xx |
| | </pre> |
| | |
| | |-|APF6= |
| | * for kernel 3.19+ : |
| | <pre class="apf"> |
| | # modprobe -a mx6-camera mipi-csi2 ov5640-mipi |
| </pre> | | </pre> |
| <pre class="config"
| | |
| Device Drivers --->
| | |-|OPOS93= |
| Multimedia devices --->
| | * On OPOS93, the driver is automatically loaded when the camera is connected. |
| <M> Video For Linux
| | </tabber> |
| ...
| | |
| [*] Customize analog and hybrid tuner modules to build --->
| | * Now it's up to you to configure your camera with the tools/API the camera driver is offering... |
| None
| | |
| [*] Video capture adapters --->
| | ==Test== |
| ...
| | * We have a small SDL/V4L2 app to quickly test that your camera is working properly (you will also need a LCD interface): ''target/demos/camera/capture/'' |
| -M- SoC camera support
| | ** it may be installed by default on your rootfs depending on your Buildroot defconfig. |
| ...
| | ** to launch it (here to have a 640x480 camera image on a LW700 TFT): |
| <M> i.MX27 Quick Capture Interface driver
| | <pre class="apf"> |
| | # capture --width 640 --height 480 --cam_width 640 --cam_height 480 |
| </pre> | | </pre> |
|
| |
|
| | * To trigger autofocus (APF6 with 3.19+ kernel): |
| <pre class="apf"> | | <pre class="apf"> |
| # modprobe mx27_camera
| | # v4l2-ctl -c auto_focus_start=1 |
| </pre> | | </pre> |
| | |
| | |
| | * On OPOS93DEV, the pipeline must have the same configuration on every link in the pipeline. |
| | * Let's create a script: |
| | <pre class="apf"> |
| | # vi setCam.sh |
| | |
| | SOURCE=$3 |
| | FORV4L2=$4 |
| | XL=$1 |
| | YL=$2 |
| | |
| | if [[$SOURCE == ""]]; then |
| | SOURCE=SBGGR10_1X10 |
| | fi |
| | if [[$FORV4L2 == ""]]; then |
| | FORV4L2=BG10 |
| | fi |
| | if [[$XL == ""]]; then |
| | XL=640 |
| | YL=480 |
| | fi |
| | |
| | BAYER=$SOURCE/$XL\x$YL |
| | echo Setting format to $XL/x$YL in $SOURCE - $FORV4L2 |
| | media-ctl -v -V "'csidev-4ae00000.csi':0 [fmt:$BAYER field:none]" |
| | media-ctl -v -V "'csidev-4ae00000.csi':1 [fmt:$BAYER field:none]" |
| | media-ctl -v -V "'mxc_isi.0':0 [fmt:$BAYER field:none]" |
| | media-ctl -v -V "'mxc_isi.0':1 [fmt:$BAYER field:none]" |
| | media-ctl -v -V "'crossbar':0 [fmt:$BAYER field:none]" |
| | media-ctl -v -V "'crossbar':2 [fmt:$BAYER field:none]" |
| | media-ctl -v -V "'ov5647 2-0036':0 [fmt:$BAYER field:none]" |
| | media-ctl -l "'ov5647 2-0036':0 -> 'csidev-4ae00000.csi':0[1]" |
| | v4l2-ctl -d /dev/video0 --set-fmt-video=width=$XL,height=$YL,pixelformat=$FORV4L2 |
| | v4l2-ctl -d /dev/v4l-subdev3 -c exposure=855 |
| | v4l2-ctl -d /dev/v4l-subdev3 -c gain_automatic=1 |
| | v4l2-ctl -d /dev/v4l-subdev3 -c auto_exposure=0 |
| | v4l2-ctl -d /dev/v4l-subdev3 -c white_balance_automatic=1 |
| | |
| | </pre> |
| | <pre class="apf"> |
| | # chmod +x setCam.sh |
| | </pre> |
| | |
| | * Run your script (if you put some arguments, remember the entire pipeline must have the same configuration) and check that all pads have the same format. |
| | |
| | <pre class="apf"> |
| | # .setCam.sh |
| | # media-ctl -p |
| | </pre> |
| | |
| | * Try streaming to the framebuffer. |
| | <pre class="apf"> |
| | # gst-launch-1.0 --no-position v4l2src ! 'video/x-bayer,format=bggr10le,width=640,height=480,bpp=10,framerate=(fraction)10/1' ! bayer2rgbneon reduce-bpp=t show-fps=t silent=t ! fbdevsink device=/dev/fb0 |
| | </pre> |
| | |
| | ==Going further== |
| | * [[Using the i.MX27 video codec|Using the i.MX27 video codec]] |
| | |
| | ==Links== |
| | * [http://linux.bytesex.org/v4l2/ Video4Linux] |
| | |
| | [[Category:Vision]] |
On this page you will find useful informations on how to use the Camera/CMOS Sensor Interface (CSI/CSI2) of the i.MX chip found on your APF and OPOS93Dev board.
Currently only the APF27, APF6 & OPOS93 are supported.
Hardware
- All the signals of the i.MX27 CSI interface can be found on the J9 connector of the APF27Dev development board.
- You should connect an external camera/sensor compatible with the CSI interface (8bits data bus) to see something ;-). Here are the tested sensor models:
- All these sensors are controllable through an I2C interface. The one on J8 connector of APF27Dev can for example be used.
- APF6Dev boards have a wandcam (OV5640) compatible connector (near the PCIexpress one).
- MIPI bus is used on APF6Dev
- The OPOS93DEV board has a 15-pin Raspberry Pi Camera compatible connector (located below the OPOS93 SoC).
- A 2-lane MIPI CSI-2 bus is used.
- Tested with the OmniVision OV5647 sensor.
Driver
- From now we consider that you have a supported camera module plugged on your development board
- CSI interface can be driven through the V4L2 (Video For Linux) standard interface as soon as CSI/MIPI driver is loaded:
# modprobe mx27_camera
- Then you have to load your camera driver in order for him to "attach" to the CSI one (for example for the OV9653):
# modprobe ov96xx
# modprobe -a mx6-camera mipi-csi2 ov5640-mipi
- On OPOS93, the driver is automatically loaded when the camera is connected.
- Now it's up to you to configure your camera with the tools/API the camera driver is offering...
Test
- We have a small SDL/V4L2 app to quickly test that your camera is working properly (you will also need a LCD interface): target/demos/camera/capture/
- it may be installed by default on your rootfs depending on your Buildroot defconfig.
- to launch it (here to have a 640x480 camera image on a LW700 TFT):
# capture --width 640 --height 480 --cam_width 640 --cam_height 480
- To trigger autofocus (APF6 with 3.19+ kernel):
# v4l2-ctl -c auto_focus_start=1
- On OPOS93DEV, the pipeline must have the same configuration on every link in the pipeline.
- Let's create a script:
# vi setCam.sh
SOURCE=$3
FORV4L2=$4
XL=$1
YL=$2
if [[$SOURCE == ""]]; then
SOURCE=SBGGR10_1X10
fi
if [[$FORV4L2 == ""]]; then
FORV4L2=BG10
fi
if [[$XL == ""]]; then
XL=640
YL=480
fi
BAYER=$SOURCE/$XL\x$YL
echo Setting format to $XL/x$YL in $SOURCE - $FORV4L2
media-ctl -v -V "'csidev-4ae00000.csi':0 [fmt:$BAYER field:none]"
media-ctl -v -V "'csidev-4ae00000.csi':1 [fmt:$BAYER field:none]"
media-ctl -v -V "'mxc_isi.0':0 [fmt:$BAYER field:none]"
media-ctl -v -V "'mxc_isi.0':1 [fmt:$BAYER field:none]"
media-ctl -v -V "'crossbar':0 [fmt:$BAYER field:none]"
media-ctl -v -V "'crossbar':2 [fmt:$BAYER field:none]"
media-ctl -v -V "'ov5647 2-0036':0 [fmt:$BAYER field:none]"
media-ctl -l "'ov5647 2-0036':0 -> 'csidev-4ae00000.csi':0[1]"
v4l2-ctl -d /dev/video0 --set-fmt-video=width=$XL,height=$YL,pixelformat=$FORV4L2
v4l2-ctl -d /dev/v4l-subdev3 -c exposure=855
v4l2-ctl -d /dev/v4l-subdev3 -c gain_automatic=1
v4l2-ctl -d /dev/v4l-subdev3 -c auto_exposure=0
v4l2-ctl -d /dev/v4l-subdev3 -c white_balance_automatic=1
# chmod +x setCam.sh
- Run your script (if you put some arguments, remember the entire pipeline must have the same configuration) and check that all pads have the same format.
# .setCam.sh
# media-ctl -p
- Try streaming to the framebuffer.
# gst-launch-1.0 --no-position v4l2src ! 'video/x-bayer,format=bggr10le,width=640,height=480,bpp=10,framerate=(fraction)10/1' ! bayer2rgbneon reduce-bpp=t show-fps=t silent=t ! fbdevsink device=/dev/fb0
Going further
Links