1012 TORADEX

From Sensoray Technical Wiki
Revision as of 11:23, 1 June 2017 by DA (Talk | contribs)

Jump to: navigation, search

Contents

Toradex use with Sensoray Model 1012 (and 2255)

This is a work in progress. It will be completed soon.

The 1012 has been tested with the Toradex Apalis iMX6 board. Toradex provides their own support pages here. This wiki entry provides additional information for updating the kernel to support the Sensoray 1012 device. The instructions also enable the Model 2255 driver for completeness.

The Apalis iMX6 CPU provides PCIe support, needed for the 1012. Toradex also provides a convenient and recommended carrier board called the Ixora to connect the 1012 and provide other peripherals. Sensoray has tested with the iMX6Q and the Ixora V1.0A carrier board running software version V2.4 (3.10 kernel). The instructions here should be valid for future kernel versions.

In order to use the 1012 with the Toradex CPU board, you will need cross-compile a new kernel and driver modules.

Pre-requisites

  1. user should have some familiarity with kernel development and compilation
  2. C development tools installed
  3. git source countrol package installed. On Ubuntu, use "sudo apt-get install git". On Fedora, use "sudo dnf install git"
  4. microSD card
  5. Host RS-232 serial port support (or USB dongle), and cable.
  6. RS-232 adapter for the Ixora board
  7. microSD card reader for host computer

Updating the 3.10 kernel, V2.4 Toradex version for the Apalis iMX6

Prepare the microSD card

Attach a microSD card to your host system. The microSD card should be formatted with the FAT32 system and with standard DOS partition. On Linux, this is done with fdisk and mkfs.vfat. Their use is describe elsewhere. The easiest method would be to format the card on a Windows machine first.

Follow Step 1 only of the preparation procedure described here and with the additional details below. The commands are listed as bullet points to be entered in a terminal window.

Flashing Linux on IMX6 Modules

  1. In step 1, download the Apalis iMX6 Linux Image. In our case, we use version 2.4
  2. Extract the image as superuser
    • sudo tar xjvf Apalis_iMX6_LinuxImageV2.4Beta1_20150518.tar.bz2
  3. Change to the image directory that was extracted
    • cd Apalis_iMX6_LinuxImageV2.4
  4. Find the mount point of the SD card and/or mount the SD card. If unsure, type "dmesg" after plugging in the microSD into card adapter (connected to the PC). The device should be printed in the log. In Fedora and Ubuntu, a popup window usually appears showing the mounted path of the device if clicked. In our case, the microSD is /dev/sdb1. We will mount it at /media/microSD. These instructions below are optional. The important point is to know the mount point. In Fedora, it may be /run/media/user/XYZ where XYZ are random for example.
    • sudo mkdir /media/microSD
    • sudo umount /dev/sdb1
    • sudo mount /dev/sdb1 /media/microSD
  5. Install the base image to the SD card. This step may take some time
    • ./update.sh -o /media/microSD
  6. Change back to our home directory
    • cd ~

Obtain a cross-compiler

Before building the kernel, you will need a cross compiler. Native compilation on the embedded system is not recommend. It would take considerable time and their may not be enough resources. It is highly recommended to use a pre-compiled toolchain.

Building a toolchain is complex and very time consuming. Linaro has greatly simplified the process. The version number of Linaro cross-compiler may depend on what kernel version you are compiling for. Newer compilers may not be able to compile older kernels and vice-versa.

  1. For the Apalis iMX6 3.10 kernel, version 4.9 is required. We also need the arm-linux-gnueabihf variant. (Embedded-Application Binary Interface Hard Float).
  2. Extract the toolchain to your home directory (or other directory of choice)
    • tar xJvf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz
  3. Make a symbolic link to the toolchain
    • ln -s gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf gcc-linaro-4.9

Obtain and compile the source

The instructions below refer to the instructions here. Sensoray's wiki instructions are specific to the iMX6 with a version of the kernel known to work well with the board.

  1. Download the 3.10.17 kernel from Toradex
  2. Set the cross compilation environment variables
    • export ARCH=arm
    • export PATH=~/gcc-linaro-4.9/bin:$PATH
    • export CROSS_COMPILE=arm-linux-gnueabihf-
  3. Change to the Linux source directory
    • cd linux-toradex_v24.git
  4. Install the default build parameters
    • make apalis_imx6_defconfig
  5. Select the 1012 default kernel module using either A) or B) below
    • Option A
    1. Download config file from Sensoray
    2. Copy the config file to the current .config build
      • cp config_v24_toradex .config
    • Option B (manual method)
    1. Run menuconfig
      • make menuconfig
    2. Use arrows to scroll down to "Device Drivers --->": Press Enter (<Select>)
    3. Use arrows to scroll down to: "Multimedia support": Press Enter (<Select>)
    4. Use arrows to scroll down to: "Analog TV support": Press Space Bar. Item selected will have an asterisk *.
    5. Use arrows to scroll down to: "Media USB Adapters": Press Enter
    6. Use arrows to scroll down to: "USB Sensoray 2255 Video capture device": Press Space bar to select.
    7. Press right arrow once until <Exit> is selected. Press Enter.
    8. Use arrows to scroll down to: "Media PCI Adapters": Press Space Bar to select then press Enter.
    9. Use down arrow to scroll down to: "TW686x cards (NEW)".: Press Space Bar to select and press Enter
    10. Use down arrow to scroll down to: "Philips SAA7134 support (NEW): Press Space Bar to select and press Enter. This installed other libraries that #may be useful in the future without having to recompile the entire kernel.
    11. Press right arrow once until <Exit> is selected. Press Enter. Multimedia support menu will appear.
    12. Press right arrow once until <Exit> is selected. Press Enter. This brings you back to the device drivers root menu.
    13. Press right arrow once until <Exit> is selected. Press Enter. This brings you back to the main kernel root menu.
    14. Press right arrow once until <Exit> is selected. Press Enter. A pop-up asking if you want to save your new configuration appears. <Yes> should be #selected. Press enter to save the configuration.
  6. Compile the kernel and modules
    • make clean
    • make -j3 uImage LOADADDR=10008000
    • make -j3 modules
  7. Create new DTB files
    • make imx6q-apalis-eval.dtb

Update the image

  1. Copy the new image and modules to your microSD card by updating the base image and running update.
    • cd ~/linux-toradex_v24.git
    • sudo cp ~/linux-toradex_v24.git/arch/arm/boot/uImage ~/Apalis_iMX6_LinuxImageV2.4/apalis-imx6_bin/uImage
    • sudo cp ~/linux-toradex_v24.git/arch/arm/boot/dts/imx6q-apalis-eval.dtb ~/Apalis_iMX6_LinuxImageV2.4/apalis-imx6_bin/uImage-imx6q-apalis-eval.dtb
    • sudo -E make INSTALL_MOD_PATH=~/Apalis_iMX6_LinuxImageV2.4/rootfs/ modules_install
  2. The following commands assume the microSD is mounted at the mount point /media/microSD
    • cd ~/Apalis_iMX6_LinuxImageV2.4
    • ./update.sh -o /media/microSD
  3. Unmount the microSD card or adapter
    • sudo umount /media/microSD

Update the kernel and modules on the Ixora embedded system

  1. Remove the microSD from the host development computer
  2. Power down the embedded development board
  3. Insert the microSD card into the microSD slot on the Ixora board. It is on the bottom of the board near the HDMI connector. Please refer to the following doc for the location: Ixora datasheet
  4. Connect the board via RS-232 serial console. On the host, use a terminal program such as minicom
  5. Make sure the minicom window is selected, ready for keyboard input.
  6. Power on the Ixora system.
  7. In the minicom window, press the spacebar immediately after text appears "Hit any key to stop autoboot".
  8. There should now be a prompt saying "Apalis iMX6 #". Type the following commands:
    • run setupdate
    • run update
  9. If it prompts to confirm updating the fuses, select yes.
  10. Wait for full completion and prompt to re-appear
  11. Reboot the Ixora system

Application Software on Toradex

The basic V4L capture program gstreamer is included in their distribution. The commands to use will depend on your application. You may also use your own V4L capture software or use other V4L third party applications.

Gstreamer

  1. Update the packages
    • opkg install gst-plugins-base-ffmpegcolorspace
    • opkg install gst-plugins-base
    • opkg install gst-plugins-good
    • opkg install gst-plugins-bad
    • opkg install gst-plugins-ugly
  2. Example Gstreamer pipelines for previewing on the screen
    • gst-launch v4l2src norm=NTSC device=/dev/video0 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! ximagesink
    • gst-launch v4l2src norm=NTSC device=/dev/video0 ! video/x-raw-yuv,width=640,height=480 ! mfw_v4lsink disp-width=640 disp-height=480 axis-top=50 axis-left=100
Personal tools
Namespaces

Variants
Actions
Toolbox