2253 Toradex

From Sensoray Technical Wiki
Jump to: navigation, search

This page will guide you in using the Sensoray Model 2253 with the Toradex iMX6 development boards.

You will need a Linux host to cross-compile the driver and demo applications. You will need version 1.2.14 or later of the 2253 Linux SDK. After extracting the SDK, create another directory beside it called "toradex". In the "toradex" directory, create a file called "build.sh" containing the following script:

#!/bin/sh
set -x

DRIVER=`pwd`/../sdk_x53_linux_1.2.14/driver

if [ ! -d linux-toradex ]; then
	git clone -b toradex_imx_3.10.17_1.0.0_ga-next --single-branch  git://git.toradex.com/linux-toradex.git
fi

if [ ! -d gcc-linaro ]; then
	FILE=gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz
	if [ ! -f $FILE ]; then
		wget http://releases.linaro.org/14.11/components/toolchain/binaries/arm-linux-gnueabihf/$FILE
	fi
	tar xf $FILE
	ln -s gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf gcc-linaro
fi

export PATH=${PATH}:`pwd`/gcc-linaro/bin
export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm

cd linux-toradex

if [ x$1 = xclean ]; then
	git clean -d -f -x -q
fi

gunzip -c ../config.gz > .config
make oldconfig
make prepare
make scripts

#cp ../Module.symvers.colibri-imx6 Module.symvers
cp ../Module.symvers.apalis-imx6 Module.symvers

KDIR=`pwd`

make -C $KDIR SUBDIRS=$DRIVER clean
make -C $KDIR SUBDIRS=$DRIVER modules

You'll also need to copy a file from the board "/proc/config.gz" to the "toradex" directory. You'll also need "Module.symvers.apalis-imx6" or "Module.symvers.colibri-imx6" from Toradex support.

Now run the build script from a terminal in the "toradex" directory.

sh build.sh

Now build the demo programs from a terminal in the "sdk_x53_linux_1.2.14" directory.

cd ../sdk_x53_linux_1.2.14
make demo_armhf

If the overlay example is required, build it using the cross compiler in the "sdk_x64_linux_1.2.14" directory. (The ImageMagick libraries will not be used due to cross-compiling, resulting in styled fonts not being available.)

cd ../sdk_x53_linux_1.2.14/overlay
../../toradex/gcc-linaro/bin/arm-linux-gnueabihf-gcc -I ../driver overlay.c -o overlay

Now copy the whole "sdk_x53_linux_1.2.14" directory to the Toradex board, and run the following commands in the terminal (as root)

cd sdk_x53_linux_1.2.14/driver
cp s2253.fw /lib/firmware/
mkdir -p /lib/modules/`uname -r`/extra
cp s2253.ko /lib/modules/`uname -r`/extra/
depmod -a
modprobe s2253

The driver is now loaded on the board, and should load automatically whenever the 2253 device is plugged in. You can check "dmesg|tail" to verify the driver is loaded and 3 V4L2 "/dev/video" nodes are created.

To run the "demo.py" demonstration program, you will need to install these python packages first:

opkg install \
        python \
        python-pygtk \
        python-ctypes \
        python-threading \
        python-subprocess \
        python-mmap

There is no "mplayer2" package, so the "preview" button in the demo will not work. Instead, preview can be done using gstreamer using this command:

gst-launch-0.10 v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=720,height=480,framerate=30000/1001' ! ffmpegcolorspace ! ximagesink

To record from the terminal, use "./capture" (use -h to see options) or read "README.txt" for examples.

Personal tools
Namespaces

Variants
Actions
Toolbox