Difference between revisions of "CaspaPX"

From Gumstix User Wiki
Jump to: navigation, search
Line 40: Line 40:
  
 
  <left-click on desktop> Applications > Multimedia > Cheese
 
  <left-click on desktop> Applications > Multimedia > Cheese
 +
 +
== Hardware ==
 +
 +
The OMAP35X processors have dedicated hardware for capturing and processing data from image sensors. The CaspaPX camera sensor outputs raw 10-bit Bayer images which is transfered to the Image Signal Processor (ISP) via a parallel interface. The ISP contains various submodules that can be exported as V4L2 devices in /dev. For additional hardware information see the external links section below.
  
 
== Customization ==
 
== Customization ==
  
=== Hardware Overview ===
+
This section describes how to customize the camera driver and kernel for your needs.
The OMAP35X processors have dedicated hardware for capturing and processing data from image sensors. The CaspaPX camera sensor outputs raw 10-bit Bayer images which is transfered to the Image Signal Processor (ISP) via a parallel interface. The ISP contains various submodules that can be exported as V4L2 devices in /dev. For additional hardware information see the external links section below. The remainder of this section will deal with
+
  
 +
=== 2.6.34 ===
  
=== MT9V032 Driver ===
+
Get the kernel source that is used in the Gumstix kernel recipe (~/overo-oe/org.openmebedded.dev/recipes/linux/linux-omap3_2.6.34.bb) and create a new branch from the recipe SRCREV.
 +
$ cd ~
 +
$ git clone git://www.sakoman.com/git/linux-omap-2.6.git
 +
$ cd linux-omap-2.6
 +
$ git checkout -b 2.6.34 cb89736af28f583598e49a05249334a194d00f1d
  
If you want to take advantage of an unimplemented sensor feature, change defaults, etc., you need to modify the driver source. First, make sure that you
+
Get the patch
 +
$ wget http://cumulus.gumstix.org/sources/mt9v032-2.6.34.patch
 +
$ patch -p1 < mt9v032-2.6.34.patch
  
You can write scripts to make it even faster.
+
Make a copy of the default kernel configuration to use as a starting point for your customizations.
 +
$ cp ~/overo-oe/org.openembedded.dev/recipes/linux/linux-omap3-2.6.34/overo/defconfig ./
 +
$ cp defconfig .config
  
 +
Add the cross compiler to your path and configure the kernel
 +
$ export PATH=/home/username/overo-oe/tmp/sysroots/i686-linux/usr/armv7a/bin:${PATH}
 +
$ make ARCH=arm menuconfig
 +
 +
Ensure that the following modules are enabled
 +
-> Device Drivers
 +
  -> Multimedia support
 +
  -> Video capture adapters
 +
    -> SoC camera support
 +
    -> mt9v032 support
 +
 +
Build kernel and modules
 +
$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage
 +
$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules
 +
 +
Install modules
 +
$ mkdir ~/linux-omap-2.6/modules
 +
$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- INSTALL_MOD_PATH=./modules modules_install
 +
 +
=== 2.6.36 ===
 +
 +
 +
=== Other Kernel Versions ===
 +
 +
The ISP code used for the 2.6.34 patch came from the arago-project. This is the OMAP3 PSP kernel integration/staging tree
 +
$ git remote add git://arago-project.org/git/projects/linux-omap3.git aragoOMAP3 PSP kernel integration/staging tree
 +
$ git fetch arago
 +
$ git checkout -b arago
 +
 +
=== MT9V032 Driver ===
 +
 +
If you want to take advantage of an unimplemented sensor feature, change defaults, etc., you need to modify the driver source. First, make sure that you change your kernel configuration to build the MT9V032 as a module unless you're only making a minor change. This will allow you to test your changes
 +
 +
Here is a convenient script for updating the driver after you've made a change:
 +
#! /bin/bash <br>
 +
make -j8 ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules;
 +
scp drivers/media/video/mt9v032.ko root@10.0.1.15:/lib/modules/2.6.34/kernel/drivers/media/video/
 +
ssh root@overo 'rmmod mt9v032; modprobe mt9v032'
  
These steps will allow you to customize the camera driver and kernel for your own application.
 
  
 
=== Image Signal Processor ===
 
=== Image Signal Processor ===
To get the best performance from the camera under other lighting conditions we need to get our hands dirty in the kernel source.
 
  
== 2.6.34 ==
+
There is some code that you can't modularize and modifying means rebuilding the kernel. Such is the case for the ISP code which is used by board-overo.c for hardware configuration. Another script like that in the previous section can be very useful.
  
Get the kernel source that is used in the Gumstix kernel recipe (~/overo-oe/org.openmebedded.dev/recipes/linux/linux-omap3_2.6.34.bb) and create a new branch from the recipe SRCREV.
+
This script rebuilds the kernel, copies it to the COM, and resets:
$ cd ~
+
$ git clone git://www.sakoman.com/git/linux-omap-2.6.git
+
$ cd linux-omap-2.6
+
$ git checkout cb89736af28f583598e49a05249334a194d00f1d
+
$ git checkout -b 2.6.34
+
  
Make a copy of the default kernel configuration to use as a starting point for your customizations.
+
  #! /bin/bash <br>
  $ cp ~/overo-oe/org.openembedded.dev/recipes/linux/linux-omap3-2.6.34/defconfig ./
+
make -j8 ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage;
  $ cp defconfig .config
+
scp arch/arm/boot/uImage root@10.0.1.15:/boot/uImage;
 +
scp arch/arm/boot/uImage root@10.0.1.15:/media/mmcblk0p1/uImage
 +
  ssh root@10.0.1.15 'shutdown -r now'
  
 
== External Links ==  
 
== External Links ==  
Line 77: Line 122:
  
 
[http://www.aptina.com/assets/downloadDocument.do?id=668 MT9V032 Datasheet]
 
[http://www.aptina.com/assets/downloadDocument.do?id=668 MT9V032 Datasheet]
 +
 +
[http://pubs.gumstix.com/boards/CASPAPX/PCB30009-R2496/ CaspaPX CAD files]

Revision as of 17:50, 8 February 2011

The MT9V032 sensor at the heart off the CaspaPX is not yet supported in the kernel, so a little work is necessary to get the camera up and running.

Quickstart

The first steps are important to verify your hardware setup and to test your customizations later.

Install Pre-built Kernel

The easiest way to get started is to replace the kernel and modules of an existing image. This method was tested on an Overo Fire with a Tobi expansion board using the desktop image available here.

Get the kernel and modules.

$ mkdir ~/caspakernel
$ cd ~/caspakernel
$ wget cumulus.gumstix.org/images/caspapx/uImage
$ wget cumulus.gumstix.org/images/caspapx/lib.tar.gz

Extract the modules.

$ tar -xf lib.tar.gz

Copy them to an Overo already running the image that you want.

$ scp lib/* root@overo:/lib/
$ scp uImage root@overo:/boot/uImage;
$ scp uImage root@overo:/media/mmcblk0p1/uImage

Reset the overo.

$ ssh root@overo 'shutdown -r now'

This method is especially convenient for making modifications to the driver or kernel. See the customization section for more information.

Test

From the serial console:

# export -DISPLAY :0.0
# gst-launch v4l2src ! xvimagesink
<or>
# mplayer tv:// -tv driver=v4l2:device=/dev/video0

From the desktop:

<left-click on desktop> Applications > Multimedia > Cheese

Hardware

The OMAP35X processors have dedicated hardware for capturing and processing data from image sensors. The CaspaPX camera sensor outputs raw 10-bit Bayer images which is transfered to the Image Signal Processor (ISP) via a parallel interface. The ISP contains various submodules that can be exported as V4L2 devices in /dev. For additional hardware information see the external links section below.

Customization

This section describes how to customize the camera driver and kernel for your needs.

2.6.34

Get the kernel source that is used in the Gumstix kernel recipe (~/overo-oe/org.openmebedded.dev/recipes/linux/linux-omap3_2.6.34.bb) and create a new branch from the recipe SRCREV.

$ cd ~
$ git clone git://www.sakoman.com/git/linux-omap-2.6.git
$ cd linux-omap-2.6
$ git checkout -b 2.6.34 cb89736af28f583598e49a05249334a194d00f1d

Get the patch

$ wget http://cumulus.gumstix.org/sources/mt9v032-2.6.34.patch
$ patch -p1 < mt9v032-2.6.34.patch

Make a copy of the default kernel configuration to use as a starting point for your customizations.

$ cp ~/overo-oe/org.openembedded.dev/recipes/linux/linux-omap3-2.6.34/overo/defconfig ./
$ cp defconfig .config

Add the cross compiler to your path and configure the kernel

$ export PATH=/home/username/overo-oe/tmp/sysroots/i686-linux/usr/armv7a/bin:${PATH}
$ make ARCH=arm menuconfig

Ensure that the following modules are enabled

-> Device Drivers
 -> Multimedia support
  -> Video capture adapters
   -> SoC camera support
    -> mt9v032 support

Build kernel and modules

$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage
$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules

Install modules

$ mkdir ~/linux-omap-2.6/modules
$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- INSTALL_MOD_PATH=./modules modules_install

2.6.36

Other Kernel Versions

The ISP code used for the 2.6.34 patch came from the arago-project. This is the OMAP3 PSP kernel integration/staging tree

$ git remote add git://arago-project.org/git/projects/linux-omap3.git aragoOMAP3 PSP kernel integration/staging tree
$ git fetch arago
$ git checkout -b arago

MT9V032 Driver

If you want to take advantage of an unimplemented sensor feature, change defaults, etc., you need to modify the driver source. First, make sure that you change your kernel configuration to build the MT9V032 as a module unless you're only making a minor change. This will allow you to test your changes

Here is a convenient script for updating the driver after you've made a change:

#! /bin/bash 
make -j8 ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules; scp drivers/media/video/mt9v032.ko root@10.0.1.15:/lib/modules/2.6.34/kernel/drivers/media/video/ ssh root@overo 'rmmod mt9v032; modprobe mt9v032'


Image Signal Processor

There is some code that you can't modularize and modifying means rebuilding the kernel. Such is the case for the ISP code which is used by board-overo.c for hardware configuration. Another script like that in the previous section can be very useful.

This script rebuilds the kernel, copies it to the COM, and resets:

#! /bin/bash 
make -j8 ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage; scp arch/arm/boot/uImage root@10.0.1.15:/boot/uImage; scp arch/arm/boot/uImage root@10.0.1.15:/media/mmcblk0p1/uImage ssh root@10.0.1.15 'shutdown -r now'

External Links

OMAP35x Technical Reference Manual

MT9V032 Datasheet

CaspaPX CAD files