Dev/Caspa
This page describes the ongoing work to fully integrate a Caspa FS camera on a Lisa/L board. Any advices/suggestions/contributions are welcome.
Final Goal
The final goal is to have a Caspa FS camera connected to the Overo chip on a Lisa/L board. The Overo chip should be able to communicate with the STM32 via SPI. The link shall be used to transmit the result of the image processing computed by the Overo. However this should be flexible enough to let some room for the developer to decide which processing to do and which kind of data to send. Digital video streaming to the groundstation is also interesting.
Methods
The following lists the steps that are deemed to be important in achieving the final goal.
- Bitbake a kernel for Overo that includes the camera modules and the SPI modules
- Make sure that the SPI modules for the STM32 work properly
Caspa camera on an Overo expansion board
As a first step a simple connection between the camera and the Overo was tried using an Overo expansion board, i.e. not the the Lisa/L board.
Hardware components
Step-by-step
Create a bootable MicroSD card if you do not have one
Follow this and use LABEL1 as 'mmcblk0p1' and LABEL2 as 'mmcblk0p2'.
Load a pre-built standard image
sudo chown [user_name] /media/mmcblk0p1 sudo chown [user_name] /media/mmcblk0p2 wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/omap3-desktop-nand-image-overo-booted.tar.bz2 tar -xjf omap3-desktop-nand-image-overo-booted.tar.bz2 -C /media/mmcblk0p2 // ignore errors wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/MLO wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/u-boot.bin wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/uImage cp MLO /media/mmcblk0p1 cp u-boot.bin /media/mmcblk0p1 cp uImage /media/mmcblk0p1
Replace some files to get the camera modules working
wget http://cumulus.gumstix.org/images/angstrom/misc/caspapx/uImage-2.6.34 wget http://cumulus.gumstix.org/images/angstrom/misc/caspapx/modules-2.6.34.tgz tar -xf modules-2.6.34.tgz -C /media/mmcblk0p2/ cp uImage-2.6.34 /media/mmcblk0p1/uImage cp uImage-2.6.34 /media/mmcblk0p2/boot/uImage
Attach the camera to the Overo board
Insert the white ribbon cable contact-side-up into the Caspa connector and contact side down into the Overo connector.
Insert MicroSD card in the Overo board
Set environment variables
- Connect the expansion board to the host machine via USB B (Console)
- On the host machine do:
[sudo apt-get install ckermit] kermit -l /dev/ttyUSB0 C-Kermit>set flow-control none C-Kermit>set carrier-watch off C-Kermit>set speed 115200 /dev/ttyUSB0, 115200 bps C-Kermit>connect Connecting to /dev/ttyUSB0, speed 115200 Escape character: Ctrl-\ (ASCII 28, FS): enabled Type the escape character followed by C to get back, or followed by ? to see other options.
You have now a console connection to the Overo
- Power-up the expansion board
- Hit 'Enter' to interrupt the boot sequence
- Type in the console:
nand erase 240000 20000 reset
This makes the Overo to read the environment variables defined by the kernel in the MicroSD. You just have to do this once after setting up the card.
- Hit 'Enter' to interrupt the boot sequence again
- Type in the console:
setenv defaultdisplay lcd43; saveenv; reset
You just have to do this once after setting up the card.
Get the image
- Let the Overo boot properly
- Touch the screen and calibrate it as indicated. You just have to do this once after setting up the card.
- Type in the console:
overo login: root export DISPLAY=:0.0 mplayer tv:// -tv driver=v4l2:device=/dev/video0 -x 480 -y 272 -vo x11
The camera image should appear on the LCD display.
Based on Gumstix wiki.
WiFi digital video streaming
Here we show how to achieve WiFi digital video streaming with the [[Lisa]/L board. This setup can be used as a parallel system to the autopilot running in the STM32. However, as connection from the Overo to the STM32 is envisaged we try to prepare the Overo kernel for SPI support (not tested yet).
Hardware components
Step-by-step
The general idea is to build a Linux kernel and a filesystem image for the Overo board which supports both the Caspa camera (sensor mt9v032) and SPI connection. Aside from this we use the DSP for encoding the image and WiFi for streaming to the ground station.
It helps if you have notions of Bitbake & OpenEmbedded and git.
Get the Overo kernel building environment
$ cd ~ $ mkdir overo-oe $ cd overo-oe $ git clone git://gitorious.org/gumstix-oe/mainline.git org.openembedded.dev $ cd org.openembedded.dev $ git checkout --track -b overo4lisa-2011.03 origin/overo-2011.03
Changes to the original respository
In conf/machine/overo.conf edit the lines:
'SERIAL_CONSOLE = "115200 ttyO2' to 'SERIAL_CONSOLE = "115200 ttyS2' 'PREFERRED_PROVIDER_virtual/kernel = "linux-omap3"' to 'PREFERRED_PROVIDER_virtual/kernel = "linux-omap3-caspapx"'
3)
$ bitbake -c menuconfig linux-omap3-caspapx
> left out stuff that I don't need
> in my case I needed SPI support and so disabled all touchscreen and LCD display stuff because from what i've read they use the same pins
> added mt9v032 in the kernel, not as a module
$ cp ~/overo-oe/tmp/work/overo-angstrom-linux-gnueabi/linux-omap3-caspapx-2.6.34-r101/git/.config ~/overo-oe/org.openembedded.dev/recipes/linux/linux-omap3-caspapx/overo/defconfig
$ bitbake -c clean linux-omap3-caspapx
$ bitbake linux-omap3-caspapx
4) $ bitbake omap3-console-image > in my case i added some features in the recipe. in particular ffmpeg and mplayer.
5) Load de microSD card
6) Boot board. It fails to boot.
7) Put the microSD card back in the development machine and in /etc/inittab of the root filesystem Edit the line: S:2345:respawn:/sbin/getty 115200 ttyO2 to: S:2345:respawn:/sbin/getty 115200 ttyS2
6) Boot board. You're ready to go. Try for instance mplayer tv:// -tv driver=v4l2:device=/dev/video0 -vo jpeg if you added mplayer to the image
Create a bootable MicroSD card if you do not have one
Follow this and use LABEL1 as 'mmcblk0p1' and LABEL2 as 'mmcblk0p2'.
Load a pre-built standard image
sudo chown [user_name] /media/mmcblk0p1 sudo chown [user_name] /media/mmcblk0p2 wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/omap3-desktop-nand-image-overo-booted.tar.bz2 tar -xjf omap3-desktop-nand-image-overo-booted.tar.bz2 -C /media/mmcblk0p2 // ignore errors wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/MLO wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/u-boot.bin wget http://cumulus.gumstix.org/images/angstrom/factory/2011-03-25-1619/uImage cp MLO /media/mmcblk0p1 cp u-boot.bin /media/mmcblk0p1 cp uImage /media/mmcblk0p1
Replace some files to get the camera modules working
wget http://cumulus.gumstix.org/images/angstrom/misc/caspapx/uImage-2.6.34 wget http://cumulus.gumstix.org/images/angstrom/misc/caspapx/modules-2.6.34.tgz tar -xf modules-2.6.34.tgz -C /media/mmcblk0p2/ cp uImage-2.6.34 /media/mmcblk0p1/uImage cp uImage-2.6.34 /media/mmcblk0p2/boot/uImage
Attach the camera to the Overo board
Insert the white ribbon cable contact-side-up into the Caspa connector and contact side down into the Overo connector.
Insert MicroSD card in the Overo board
Set environment variables
- Connect the expansion board to the host machine via USB B (Console)
- On the host machine do:
[sudo apt-get install ckermit] kermit -l /dev/ttyUSB0 C-Kermit>set flow-control none C-Kermit>set carrier-watch off C-Kermit>set speed 115200 /dev/ttyUSB0, 115200 bps C-Kermit>connect Connecting to /dev/ttyUSB0, speed 115200 Escape character: Ctrl-\ (ASCII 28, FS): enabled Type the escape character followed by C to get back, or followed by ? to see other options.
You have now a console connection to the Overo
- Power-up the expansion board
- Hit 'Enter' to interrupt the boot sequence
- Type in the console:
nand erase 240000 20000 reset
This makes the Overo to read the environment variables defined by the kernel in the MicroSD. You just have to do this once after setting up the card.
- Hit 'Enter' to interrupt the boot sequence again
- Type in the console:
setenv defaultdisplay lcd43; saveenv; reset
You just have to do this once after setting up the card.
Get the image
- Let the Overo boot properly
- Touch the screen and calibrate it as indicated. You just have to do this once after setting up the card.
- Type in the console:
overo login: root export DISPLAY=:0.0 mplayer tv:// -tv driver=v4l2:device=/dev/video0 -x 480 -y 272 -vo x11
The camera image should appear on the LCD display.
Based on Gumstix wiki.
Work in progress
Bitbake a kernel for Overo that includes the camera modules and the SPI modules. Possibly also enable Wi-Fi connection for testing. The base kernel will be the LisaOveroImage. Did anyone do this before?