Linux Software User Manual (i.MX6)

From BlueWiki

Revision as of 09:31, 15 September 2016 by Harald.krapfenbauer (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

1 Introduction

Bluetechnix offers a Board Support Package that is based on the U-Boot boot loader and the Linux kernel.

The build environment is LTIB, the Linux Target Image Builder, which is Freescale's preferred way to offer Linux board support packages. Bluetechnix provides a patch set that is installed on top of Freescale's i.MX6 LTIB BSP.

Our BSP offers patches for Linux and U-Boot to work with our i.MX6 products, as well as additional device drivers for components on our i.MX6 modules and base boards. Our aim is to fully support our hardware through device drivers. We also provide unit tests so that testing a board is easy and custom development can start precisely.

We also offer elaborate helper scripts that are part of our releases that we hope make development easier for you.

1.1 Support

  • We also do your custom hardware and software development. In case you are interested, send an e-mail to Office.
  • In case you need HW/SW support for Bluetechnix i.MX6 products, please write to Support.
  • Freescale provides lots of documentation for LTIB, the i.MX6 processor, and Linux/Android/WinCE development on these processors. Visit their website at http://www.freescale.com!
  • Each BSP bundle from Freescale contains lots of documentation we recommend to read. Unpack the archive
Lx.x.x_x.x.x_docs.tar.gz

1.2 Quick Start Guide

Here is how to start with your core module CM-i.MX6 and your development board DEV-i.MX6.

  • Plug in the core module into the development board.
  • Configure the DIP switches on the development board for SPI-NOR boot.
  • Connect 12VDC to X5.
  • Hold down S6 until the RGB LED turns white.
  • Connect a monitor via HDMI (X20) or connect to the serial terminal (X27) to see the board's boot messages.

1.3 Development host setup

We support Linux distribution Ubuntu 10.04 LTS 32-bit. (Most packages will also build on 64-bit.)

Since BSP version 3.1.0, Ubuntu 14.04 LTS 64-bit is supported and recommended.


  • If you want to build inside a virtual machine, first download a pre-installed image for your virtualization software (VirtualBox, VMWare, etc.) or install Ubuntu in your virtual machine.
  • A physical PC with Ubuntu on it is preferred over a virtual machine.
  • Ubuntu uses dash as the preferred shell. However, we want bash. So, reconfigure /bin/sh to point to /bin/bash instead of /bin/dash:
sudo dpkg-reconfigure dash

Select no when asked if it should link dash to /bin/sh.

  • LTIB has some package dependencies that you have to install on a freshly set up Ubuntu:
sudo apt-get install build-essential zlib1g-dev libncurses5-dev m4 bison rpm ccache \
flex liblzo2-dev uuid-dev gettext libglib2.0-dev git-core libfreetype6-dev libtool \
texinfo texlive automake
  • On 64-bit Ubuntu 14.04 development systems install as well:
sudo apt-get install libc6-dev-i386 lib32z1
  • LTIB needs sudo permissions to execute rpm commands as root. If this is not yet set up, LTIB will fail the very first time, and tell you exactly what you have to do.
  • You probably need access to the serial console (UART) which is available via a USB-UART converter and a USB Mini-B jack.
  • We recommend to install a TFTP Server.
  • We recommend as well to set up an NFS Server to be able to mount the target's root file system via NFS.
  • Optionally, you may want to set up a DHCP Server.

2 Software Releases

2.1 Support table

2.1.1 CM-i.MX6 + DEV-i.MX6

Feature U-Boot support since Linux support since Comment
ADC inputs n/a 0.1.0 From touch controllers; 4 inputs
Audio Codec n/a 0.1.0 Headphone-Out, Line-In, Mic-In
Backlight n/a 0.1.0 PWM backlight for LVDS displays
Bluetooth n/a 0.1.0
Buzzer n/a 0.1.0
CAN n/a 0.1.0 2 CAN available
cpufreq n/a 0.1.0 CPU frequency and voltage scaling
Debug UART 0.1.0 0.1.0 via USB connector
eMMC flash 0.1.0 0.1.0 Possible boot medium, 2 GiB
Ethernet 0.1.0 0.1.0 Gigabit Ethernet
Ethernet MAC address storage in IIM 0.1.0 n/a Store MAC address in i.MX6 OCOTP
HDMI n/a 0.1.0
HDMI Audio n/a 0.1.0
ISM Connector n/a 0.1.0 for Image Sensor Modules; Parallel CSI interface
LVDS displays n/a 0.1.0 2 LVDS available. Display type: Promate
MIPI CSI camera interface n/a 1.0.0 with OV5640 camera and ADP-i.MX6x-MIPI adapter
MIPI DSI display interface n/a n/a
PCIe n/a 0.1.0 Mini PCI Express connector available
Power button n/a 1.0.0 Press to power off cleanly. Wake up from Suspend.
RGB-LED 0.1.0 0.1.0
RTC n/a 0.1.0
SATA 0.1.0 0.1.0 Possible boot medium. NOT AVAILABLE ON i.MX6 SOLO.
SD card 0.1.0 0.1.0 Possible boot medium
SPDIF Out n/a 0.1.0
SPI NOR flash 0.1.0 0.1.0 Primary boot medium, 2 MiB
Standby power save mode n/a 1.0.0
Suspend-to-RAM power save mode n/a 1.0.0
Touch controllers n/a 0.1.0 Resistive; 2 available; for Promate LVDS displays
USB hub on USB Host 1 n/a 0.1.0
USB-OTG n/a 0.1.0
Wi-Fi Wireless LAN n/a 0.1.0

2.1.2 CM-i.MX6 + DEV-i.MX6 + Image Sensor Module

Feature U-Boot support since Linux support since Comment
ISM GStreamer plug-in n/a 1.0.0 Bayer-to-RGB conversion support
ISM-MT9M025 n/a 1.0.0 Grayscale/Bayer image sensor module
ISM-MT9M131 n/a 0.1.0 YUV image sensor module
ISM-MT9P031 n/a 1.0.0 Grayscale/Bayer image sensor module

2.1.3 CM-i.MX6 + DEV-i.MX6 + EXT-i.MX53-COMM

Feature U-Boot support since Linux support since Comment
Acceleration sensor (3-axis) n/a 0.1.0
GPS n/a 0.1.0
GSM/GPRS n/a 0.1.0
Gyroscope n/a 0.1.0
Magnetometer n/a 0.1.0
UMTS/GPS n/a 0.1.0

2.2 Deliverables

We provide a binary SD card image and a source installation package for each release.

File Type
mx6-ltib-patchset-X.Y.Z.tar.bz2 Source installation package, on top of Freescale BSP
cmimx6dq-sdcard-image-X.Y.Z.bin.bz2 Bootable SD card binary image (compressed) for CM-i.MX6 Dual/Quad.

Contains firmware for eMMC, SPI-NOR, and SATA.

See #Firmware Update for instructions.

cmimx6s-sdcard-image-X.Y.Z.bin.bz2 Bootable SD card binary image (compressed) for CM-i.MX6 Solo.

Contains firmware for eMMC and SPI-NOR.

See #Firmware Update for instructions.


2.3 Release 3.1.0

Release date
2015-07-20
Supported hardware
CM-i.MX6 Quad V1.2.x
CM-i.MX6 Dual V1.2.x
CM-i.MX6 Solo V1.2.x
DEV-i.MX6 V1.1.x
Download path
https://support.bluetechnix.at/releases/imx/mx6/bsp-3.1.0/
Base board support package
Freescale (http://www.freescale.com/)
L3.0.35_4.1.0_ER_SOURCE (L3.0.35_4.1.0_130816_source.tar.gz)
L3.0.35_4.1.0_MM_CODECS (IMX_MMCODEC_3.0.35_4.1.0_BUNDLE_CODA.tar.gz)
L3.0.35_4.1.0_AACP_CODECS (IMX_AACPD_3.0.7-2.tar.gz)
Release Notes
List of changes:
Support BSP compilation on Ubuntu 14.04 64-bit operating system.
m25p80 SPI flash kernel driver: Support W25Q16D SPI Flash (JEDEC ID 0xef6015).
m25p80 SPI flash kernel driver: Implement OTP support for SPI-NOR flash in m25p80 driver. Currently only M25PX16 SPI flash supported.
mtd-utils package: Enable flash_otp_write and flash_otp_lock commands.
ISM-MT9M025 unit test: Reduced frame rate to 37fps, due to a data integrity issue on the Devboard with higher frame rates

2.4 Release 3.0.0

Release date
2014-06-16
Supported hardware
CM-i.MX6 Quad V1.2.x
CM-i.MX6 Dual V1.2.x
CM-i.MX6 Solo V1.2.x
DEV-i.MX6 V1.1.x
Download path
https://support.bluetechnix.at/releases/imx/mx6/bsp-3.0.0/
Base board support package
Freescale (http://www.freescale.com/)
L3.0.35_4.1.0_ER_SOURCE (L3.0.35_4.1.0_130816_source.tar.gz)
L3.0.35_4.1.0_MM_CODECS (IMX_MMCODEC_3.0.35_4.1.0_BUNDLE_CODA.tar.gz)
L3.0.35_4.1.0_AACP_CODECS (IMX_AACPD_3.0.7-2.tar.gz)
Release Notes
List of changes:
Category Summary Status
Unintended Behaviour Default configuration: Cannot log in with SSH fixed
Usability When using newer armhf tool chain, some packages don't compile fixed
Feature Missing For h/w v1.2.x, enable WDOG output to reset PMIC voltages properly fixed
Bug hdmi_hd720.sh Unit Test fails fixed
Feature Request Upgrade to Freescale BSP v4.1.0 fixed

2.5 Release 2.0.0

Release date
2013-11-05
Supported hardware
CM-i.MX6 Quad V1.1.x
CM-i.MX6 Dual V1.1.x
CM-i.MX6 Solo V1.1.x
DEV-i.MX6 V1.1.x
Download path
https://support.bluetechnix.at/releases/imx/mx6/bsp-2.0.0/
Base board support package
Freescale (http://www.freescale.com/)
L3.0.35_4.0.0_ER_SOURCE (L3.0.35_4.0.0_130424_source.tar.gz)
L3.0.35_4.0.0_MM_CODECS (IMX_MMCODEC_3.0.35_4.0.0_BUNDLE_CODA.tar.gz)
L3.0.35_4.0.0_AACP_CODECS (IMX_AACPD_3.0.7.tar.gz)
Release Notes
List of changes:
Category Summary Status
Feature Missing Changes for CM-i.MX6Q V1.1 and DEV-i.MX6 V1.1 fixed
Crashes WDOG: We must not assert WDOG1_B output on HW V1.1.x fixed
Usability Change display framebuffer format to RGB565 for compatibility fixed
Feature Missing Add support for CM-i.MX6 Solo in deploy scripts fixed
Bug Gstreamer: Multi file sink: SIGSEGV fixed
Bug gst-ffmpeg: Unresolved symbol fixed
Feature Request Support eCAM-CM-i.MX Base Board fixed
Unintended Behaviour Monitor attached to HDMI port only displays VGA resolution fixed

2.6 Release 1.0.0 (X-Grade)

Release date
2013-08-26
Supported hardware
CM-i.MX6 Quad V1.0.x
DEV-i.MX6 V1.0.x
Download path
https://support.bluetechnix.at/releases/imx/mx6/bsp-1.0.0-xgrade/
Base board support package
Freescale (http://www.freescale.com/)
L3.0.35_4.0.0_ER_SOURCE (L3.0.35_4.0.0_130424_source.tar.gz)
L3.0.35_4.0.0_MM_CODECS (IMX_MMCODEC_3.0.35_4.0.0_BUNDLE_CODA.tar.gz)
L3.0.35_4.0.0_AACP_CODECS (IMX_AACPD_3.0.7.tar.gz)
Release Notes
This is an X-Grade release.
List of changes:
Category Summary Status
Unintended Behaviour Flash setup does not work if run from e.g. USB stick fixed
Unintended Behaviour Dependency of USB-HOST and USB-OTG no change required
Feature Missing AR0132AT (MT9M025 successor) Image Sensor must be supported fixed
Feature Missing Adapt GStreamer plug-ins to support ISM modules fixed
Feature Missing Update to Freescale BSP L3.0.35_4.0.0 fixed
Bug SPI Flash Setup Script needs update fixed
Bug After suspend, WiFi/BT won't operate anymore fixed
Bug "unbalanced disables for AD7843-3V3" fixed
Bug When booting from SATA, SATA does not work in U-Boot fixed
Bug U-Boot Environment: Variables duplicated? fixed
Bug Gigabit-Ethernet does not work properly fixed
Stability irq 285: nobody cared fixed
Usability SPI Flash: U-boot env is destroyed when U-Boot partition is updated fixed
Feature Request ARM DS-5/DSTREAM support fixed
Feature Request Add shell script that builds eMMC, SPI, SATA firmware (e.g. for the NFS root file system) fixed
Feature Request Switch off Ethernet PHY voltages in Standby-Modes (in Linux) fixed
Feature Request Support OV5640 MIPI-CSI2 camera with ADP-MIPI and DEV-i.MX6 fixed
Feature Request Add support for CM-i.MX6 Solo fixed
Feature Request Don't use DHCP in U-Boot scripts by default fixed

2.7 Release 0.1.0 (X-Grade)

This release is deprecated.

Release date
2013-05-15
Supported hardware
CM-i.MX6Q-C-I-Q24S2048F2N2048 V1.0.x
CM-i.MX6Q-C-C-Q24S2048F2N2048 V1.0.x
DEV-i.MX6 V1.0.x
Download path
https://support.bluetechnix.at/releases/imx/mx6/bsp-0.1.0-xgrade/
Base board support package
Freescale (http://www.freescale.com/)
L3.0.35_1.1.0_SOURCE (L3.0.35_1.1.0_121218_source.tar.gz)
L3.0.35_1.1.0_MM_CODECS (IMX_MMCODEC_3.0.5_Bundle.tar.gz)
L3.0.35_1.1.0_AACP_CODEC (IMX_AACPD_3.0.5_BUNDLE_CODA.tar.gz)
Release Notes
Initial release.
This is an X-Grade release.

3 Firmware Update

So you downloaded the SD card image from one of the releases above.


Create your bootable SD card

  • Unpack the SD card image. It comes BZIP2-compressed.
Linux:
bunzip2 cmimx6dq-sdcard-image-X.Y.Z.bin.bz2
Windows:
If .bz2 files are currently unsupported on your system, install 7zip.
  • Take an SD card (min. size is 1 GiB) and insert it into your PC's card reader. Now we copy the uncompressed image to this card.
Linux:
Look at the kernel log with dmesg and search for your SD card's block device. It looks like sde or mmcblk0.
Check if the automounter has mounted the SD card with mount. In case your block device appears in the output, unmount any partitions from the SD card, e.g.,
umount /dev/sde
Then start the copying (Take your card's block device in the of= argument!)
dd if=cmimx6dq-sdcard-image-X.Y.Z.bin of=/dev/sdX bs=1M
sync
Windows:
See here.


Boot your CM-i.MX6 from this card

  • Insert the SD card into the SD slot on the DEV-i.MX6 board.
  • Select SD boot with the DIP switches on the DEV-i.MX6. (See the Hardware User Manual.)
  • Power on the target (PWRON button on DEV-i.MX6).
  • You need access to the serial terminal now!
  • Start the firmware update. You have to choose between four possibilities:
    • SPI-NOR plus eMMC: Uses SPI-NOR boot mode later. Boot loader in SPI-NOR, Linux kernel and Root-FS in eMMC flash.
    • eMMC: Uses eMMC boot mode later. All firmware programmed to eMMC flash.
    • SATA: Uses SATA boot mode later. You need a harddisk attached to your DEV-i.MX6. All firmware programmed to the harddisk.
    • SD card: You are already running Linux from SD card, you are finished!


On the Linux prompt, log in by typing
root
Depending on which flash medium you want to program, execute one of these commands:
SPI-NOR + eMMC
/opt/blt/flash-setup/spi/setup_spiboot.sh
eMMC
/opt/blt/flash-setup/emmc/setup_emmcboot.sh
SATA
/opt/blt/flash-setup/sata/setup_sataboot.sh
  • Power off
poweroff
  • Do not forget to change the boot mode now if you do not want to boot from SD card the next time.

4 Install and build the BSP from source

  • Download the Freescale i.MX6 Linux Board Support Package (BSP) from the Freescale web site.
    • See the #Software Releases section for the version of the board support package. You will need exactly the version given for the Bluetechnix patch set to apply cleanly.
    • Note you have to register on the Freescale web site in order to download the BSP.
    • For downloading, open http://www.freescale.com/, type the exact name into the search window, and you will be directed directly to the download.
  • Download the latest Bluetechnix patch set for i.MX6 products which fits your hardware. See #Software Releases for the download link.
  • Unpack the Freescale BSP archive::
tar -xzf Lx.x.x_x.x.x_xxxxxx_source.tar.gz
  • Now, we enter the newly created directory, and install LTIB:
cd Lx.x.x_x.x.x_xxxxxx_source
./install
  • Now, you have to accept the license agreement and type a path. We use /home/bluetechnix/ltibinstall/ as the installation path, but you are free to choose another.
  • The next step is to install the Bluetechnix patch set, which adds support for Bluetechnix i.MX6 products. Unpack the release package now:
tar -xjf mx6-ltib-patchset-x.x.x.tar.bz2
  • You have to provide the path where you just installed LTIB:
cd mx6-ltib-patchset-x.x.x
./install /home/bluetechnix/ltibinstall/ltib/
  • Unpack the Freescale Multimedia Codecs archive:
tar -xzf IMX_MMCODEC_x.x.x_Bundle.tar.gz
  • Copy package archives for LTIB to LTIB's installation directory:
cd IMX_MMCODEC_x.x.x_Bundle
cd "ltib codecs"
cp * /home/bluetechnix/ltibinstall/ltib/pkgs/
  • Unpack the Freescale AAC Plus Codec archive:
tar -xzf IMX_AACPD_x.x.x_BUNDLE_CODA.tar.gz
  • Copy package archive to LTIB's installation directory:
cd IMX_AACP_x.x.x_BUNDLE_CODA
cd "ltib codecs"
cp * /home/bluetechnix/ltibinstall/ltib/pkgs/
  • LTIB uses GIT (https://git-scm.com/) version control to apply patches. You have to configure GIT minimally:
git config --global user.email "your.name@company.com"
git config --global user.name "Your Name"
  • Next, we go to LTIB's directory and call ltib the first time. There is a custom configuration file for your i.MX6 product:
cd /home/bluetechnix/ltibinstall/ltib/
./ltib --preconfig config/platform/imx/cmimx6dq.cf
  • If LTIB fails because of missing sudo permissions, do not worry, just follow the instructions and then rerun above command.
  • Now, LTIB installs the packages to /opt/freescale/pkgs.
  • After some time, you will get a configuration dialog. If you want to build for CM-i.MX6 Solo, you have to change the default configuration. For Dual or Quad processor, no change is required.

(CM-i.MX6 Solo only) Find this option:

--- Choose your board for u-boot
    board (cmimx6q)  --->

(CM-i.MX6 Solo only) Change it to:

    board (cmimx6s)  --->
  • Choose Exit now and save the configuration.
  • Finally, LTIB starts downloading the tool chain, then compiles the Linux kernel and the U-Boot boot loader, and creates the root file system. If everything works, the final message is
Build Succeeded
If the build fails, it is worth to simply restart LTIB
./ltib
Note the first build will take up to some hours to complete!

5 The U-Boot boot loader

The main task for the boot loader is to initialize hardware appropriately (especially the RAM), and to load the Linux kernel. Via environment variables, you can configure U-Boot as you wish: Network settings, where to load the Linux kernel from, set up the kernel's command line, etc.

In most cases, you will not need to change and recompile U-Boot, but simply alter the environment variables so that U-Boot's behaviour fits your needs.

5.1 U-Boot development

U-Boot sources are unpacked in the following directory within LTIB:

rpm/BUILD/u-boot-2009.08/

If you do not have this directory, you can tell LTIB to unpack the sources for you. Patches are automatically applied.

./ltib -m prep -p u-boot

The following script (re-)compiles U-Boot and installs the u-boot.bin image in /tftpboot as well. We assume that your working directory is ltib/.

./build_uboot.sh

5.2 U-Boot for different boot media

The U-Boot binary supports various boot media: SPI flash, eMMC, SD card, SATA hard disk.

To install U-Boot to one of these (out of Linux), you simply copy it to the start of the media, e.g.

dd if=u-boot.bin of=/dev/mmcblk0

Note that u-boot.bin contains 1kbytes padding at its beginning. This way, partition tables, as mostly present on SD or SATA, will not overwrite U-Boot. (But: Writing U-Boot anywhere as shown above WILL overwrite your partition table!)

To install U-Boot without overwriting the partition table, use command

dd if=u-boot.bin of=/dev/mmcblk0 bs=1K seek=1 skip=1

5.2.1 Environment storage

One must decide where the U-Boot environment is saved at compile time. The default is SPI-NOR flash, because it is always available.

You can use our U-Boot compile script to choose where the environment is stored.

./build_uboot.sh spiflash
./build_uboot.sh sd1
./build_uboot.sh emmc
./build_uboot.sh sata

5.2.2 Linux kernel loading and kernel parameters

Set the U-Boot variable bootcmd according to your wishes:

  • set bootcmd run bootcmd_net
Loads the uImage via TFTP and mounts the rootfs via NFS (don't forget to set the variables "ipaddr","serverip" and "netmask")
If you want to use DHCP you have to change variables:
bootcmd_net: "dhcp" instead of "tftpboot"
bootargs_nfs: use "ip=dhcp"
The complete commands for changing the variables for DHCP are:
setenv bootargs_nfs 'setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${nfsroot},v3,tcp ip=dhcp'
setenv bootcmd_net 'run bootargs_base bootargs_nfs; dhcp ${loadaddr} ${kernel}; bootm'
  • set bootcmd run bootcmd_sd
Loads uImage from SD Card, Linux rootfs comes from ext4 partition on the SD Card
  • set bootcmd run bootcmd_emmc
Loads uImage from eMMC, Linux rootfs comes from ext4 partition on eMMC
  • set bootcmd run bootcmd_sata
Loads uImage from SATA
  • These pre-defined script variables will do the following steps (use print to show their content):
    • Fill the bootargs variable with basic kernel parameters.
    • Add boot media-specific kernel parameters to bootargs.
    • Load the Linux kernel binary from the desired media to RAM.
    • Boot Linux.

6 Linux kernel development

Linux kernel sources are unpacked by default and can be found in

ltib/rpm/BUILD/linux

If you are developing within the Linux kernel, you will need the following steps frequently (we assume that your working directory is ltib/rpm/BUILD/linux):

  • Set some environment variables for cross-compiling so that "make" will do what is expected:
. set_cross_envs
  • Change the kernel configuration:
make menuconfig
  • Store your current config:
cp .config arch/arm/configs/imx6_defconfig
  • Incremental build

We recommend to compile the kernel after any changes by using the following script. It takes care of updating kernel modules correctly and installs the kernel image (uImage) to /tftpboot for loading via TFTP.

We assume that your working directory is ltib/.

./build_kernel.sh

7 Deployment

There are two possibilities for deployment to your i.MX6 target.

You can create a bootable SD card on your development PC or you can boot via NFS (in which case the bootable file system resides on your development PC and is loaded via Ethernet).

If you want to use a different boot medium than these two (i.e., eMMC, SPI-NOR or SATA), you first have to choose one of the just mentioned methods and then execute a script on your running target, which in its turn programs the firmware to eMMC, SPI-NOR or SATA.

After setting the boot mode jumpers and resetting the i.MX6, it now boots from the new boot medium. You can confirm the current boot medium by determining the "Boot Device:" output of U-Boot.

7.1 Setting up a bootable SD card

In the main ltib folder, you will find a Linux shell script for deployment to an SD card. Usage:

setup_sdcard.sh <SD card's device file> -c -s <partition size in MB>

The -c switch copies additional firmware to your SD card for setting up boot media other than SD card from your running target (eMMC, SPI-NOR, and/or SATA).

Please follow these step-by-step instructions:

  • Insert an SD card into your Linux PC
  • Execute ./setup_sdcard.sh and provide the SD card's device file (e.g. /dev/sde or /dev/mmcblk0) as argument
  • Do not forget the -c switch if you needed
  • This will take a while, so please wait patiently.
  • Insert the SD card into the development board.
  • Set the development board to SD card boot mode and power up the module.
    • If your development board does not support SD card boot, boot U-Boot from the default source (usually SPI-NOR flash). Stop autoboot by pressing any key. To load Linux from the SD Card, now enter
run bootcmd_sd
  • If you have attached a monitor/LCD to the primary display device, you will see the Linux boot logo there.

7.2 Setting up NFS boot

NFS boot gets the Linux kernel image via TFTP from your PC. It mounts the Linux root file system (ltib/rootfs/) transparently from your PC. You need a working Ethernet connection to your PC.

  • Boot U-Boot on your i.MX6 module from the default source (usually SPI-NOR flash). Stop autoboot by pressing any key.
  • Configure the necessary environment variables as described in #Linux kernel loading and kernel parameters (and save if needed)
  • Then enter
run bootcmd_net
  • U-Boot will now load the kernel image (uImage) from your PC and boot it.
  • The Linux kernel will configure the network and mount the rootfs via NFS.
  • You must not shut down the eth0 network device in Linux or interrupt the Ethernet connection!

Installing the firmware for setting up new boot media via NFS:

  • Go to the main ltib folder and run the following script:
./install_deploy_images.sh rootfs/opt/blt/ 
It copies
  • the compressed rootfs
  • the kernel image
  • different U-boot builds and setup-scripts for SATA, eMMC, SPI Flash boot
to "opt/blt/flash-setup" inside the rootfs.
These scripts are the same as the ones you get on your SD card using setup_sdcard.sh with -c.

7.3 Instructions for deployment onto SPI-NOR flash (and eMMC) and boot from SPI-NOR

You can set up the SPI-NOR as a boot source only from your running target (either from SD card or NFS boot).

  • If you are using an SD card, set the base board to SD card boot mode and power up the module.
    • If your base board does not support SD card boot, boot U-Boot from the default source (usually SPI-NOR flash). Stop autoboot by pressing any key. Then enter
run bootcmd_sd
  • The module will boot Linux from the SD card.
  • Connect a USB cable to access the serial port (UART) of the base board.
  • Log in by entering
root
  • Now set up the SPI-NOR flash with the provided script (Attention: This will also update the boot loader in the SPI-NOR flash!)
cd /opt/blt/flash-setup/spi
./setup_spiboot.sh
  • You will receive the following message if setup is complete
=== Flash setup successful!
  • Shut down Linux now
poweroff
  • Remove power from the board and change the boot mode to SPI-NOR. Deployment is complete now!

7.4 Instructions for deployment onto/boot from SATA

The procedure is similar to deployment onto/boot from SPI-NOR flash.

The used script is:

cd /opt/blt/flash-setup/sata
./setup_sataboot.sh

7.5 Instructions for deployment onto/boot from eMMC

The procedure is similar to deployment onto/boot from SPI-NOR flash.

The used script is:

cd /opt/blt/flash-setup/emmc
./setup_emmcboot.sh

7.6 Other combinations

Individual combinations are possible as well. Please see the setup_sdcard.sh script and modify it according to your wishes.

8 Detailed Description

In alphabetical order.

8.1 Acceleration sensor (3-axis) MMA8453

EXT-i.MX53-COMM   ≥ V1.0
  • Load the kernel module
modprobe mxc_mma8451
  • There is one demo application from the mmatools package which is of use:
gstest
(Constant read-out)
  • You can use the
evtest
application to read out the event device (usually /dev/input/event0 if no other input device is connected/loaded).
  • To select evtest for compilation, go to the LTIB configuration dialog
./ltib -c
Package list  --->
[*] evtest
  • Display the input devices
cat /proc/bus/input/devices
I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="mma845x"
P: Phys=
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=event1 
B: PROP=0
B: EV=9
B: ABS=7
  • Enable the sensor
echo 1 > /sys/devices/virtual/input/input1/enable
evtest /dev/input/event1

8.2 Audio Codec

DEV-i.MX6   ≥V1.1
  • The SGTL5000 audio codec features Headphone-Out (green), Mic-In (pink), and Line-In (blue) connectors on the development board.
  • For testing and simple PCM operation, you can use arecord and aplay (from the alsa-utils package) in Linux to record and play .wav files.
  • Gstreamer also supports this ALSA sound card. It can be used for recording and playing as well (typical application: combined audio-video playback).

Unit tests

The first kind of unit test is an automatic test. You have to physically connect the pertinent interfaces with a cable. A tone is played on the output channel, and recorded on the input channel. The recording is checked afterwards if it matches the tone.

  • Connect Headphone-Out and Line-In.
/opt/blt/unit-tests/audio-autocheck-hpout-linein.sh
  • Connect Headphone-Out and Mic-In.
/opt/blt/unit-tests/audio-autocheck-hpout-micin.sh

In the following two tests you have to attach headphones or a speaker to Headphone-Out. An input device is used as well.

  • The following test relays a signal from Line-In to Headphone-Out:
/opt/blt/unit-tests/audio-loop-linein-hpout.sh
  • This one relays a signal from a microphone to Headphone-Out:
/opt/blt/unit-tests/audio-loop-micin-hpout.sh

8.3 Backlight Control for LCDs

DEV-i.MX6   ≥V1.0
  • The LCD backlight is regulated with a PWM output.
  • In Linux, the driver pwm-backlight is used
  • To control backlight intensity, write any value between 0 (off) and 100 (brightest) to the SYSFS control file
/sys/devices/platform/pwm-backlight.x/backlight/pwm-backlight.x/brightness

x=0 → LVDS Displays

x=3 → MIPI DSI Display

For details see: #PWM

8.4 Bluetooth (Lesswire WiBear-SF module)

DEV-i.MX6   ≥V1.0
LTIB configuration
  • In the ltib/ folder, start LTIB's configuration dialog:
./ltib -c
  • Select packages
Package list  --->
  [*] cmimx6-support
  [*] bluez-hcidump                                                     
  [*] bluez-utils 
  • Exit from LTIB and save your new configuration (you will be asked).
Test in Linux
  • Connect a Bluetooth antenna to X31.
  • Load kernel module:
modprobe btmrvl_sdio
  • Check if Bluetooth interface was detected
hciconfig
hci0:	Type: UKNW
	BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
	DOWN 
	RX bytes:0 acl:0 sco:0 events:0 errors:0
	TX bytes:0 acl:0 sco:0 commands:0 errors:0
  • Activate the interface (use device identifier from above, in red)
hciconfig hci0 up
  • Show all information
hciconfig -a hci0
hci0:	Type: UKNW
	BD Address: 00:06:C6:27:02:A8 ACL MTU: 1021:7 SCO MTU: 240:3
	UP RUNNING PSCAN ISCAN 
	RX bytes:421 acl:0 sco:0 events:13 errors:0
	TX bytes:101 acl:0 sco:0 commands:12 errors:0
	Features: 0xff 0xef 0x8d 0xfe 0x9b 0xff 0x79 0x83
 	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3 
	Link policy: 
	Link mode: SLAVE ACCEPT 
	Name: 
	Class: 0x000000
	Service Classes: Unspecified
	Device Class: Miscellaneous, 
	HCI Ver:  (0x4) HCI Rev: 0x8300 LMP Ver:  (0x4) LMP Subver: 0x501
	Manufacturer: not assigned (72)
  • Scan for other devices
hcitool -i hci0 scan
Scanning ...
	90:21:55:A8:2A:8E	DeviceName
  • Get surrounding device addresses and classes
hcitool inq
Inquiring ...
	90:21:55:A8:2A:8E	clock offset: 0x78ea	class: 0x5a020c
  • Get info on a device (use device identifier from above, in green)
hcitool info 90:21:55:A8:2A:8E
Requesting information ...
 	BD Address:  90:21:55:A8:2A:8E
  	Device Name: DeviceName
 	LMP Version:  (0x4) LMP Subversion: 0x4217
 	Manufacturer: Broadcom Corporation (15)
 	Features: 0xbf 0xfe 0x8f 0xfe 0x9b 0xff 0x79 0x83
  	[...]

Note: Bluetooth and Wi-Fi of the Wibear module can operate concurrently (both over SDIO).

8.5 Boot Modes

DEV-i.MX6   ≥V1.0

The DEV-i.MX6 base board allows configuration of the CM-i.MX6 module's boot mode via two DIP switches.


SPI-NOR
S2
12345678
S1
12345678


eMMC (USDHC2)

Settings: 8-bit, high speed, normal boot

S2
12345678
S1
12345678


SD Card on development board (USDHC1)

Settings: 4-bit, fast boot

S2
12345678
S1
12345678


SATA
S2
12345678
S1
12345678


USB-OTG
S2
12345678
S1
12345678


Fuse Boot
S2
12345678
S1
12345678


Mapping of DIP-Switch Settings to i.MX eFuses
Switch i.MX6 eFuse
S1-1 BOOT_CFG1[6]
S1-2 BOOT_CFG1[5]
S1-3 BOOT_CFG1[4]
S1-4 BOOT_CFG1[3]
S1-5 BOOT_CFG1[2]
S1-6 BOOT_CFG1[0]
S1-7 BOOT_MODE[1]
S1-8 BOOT_MODE[0]
Switch i.MX6 eFuse
S2-1 BOOT_CFG2[6]
S2-2 BOOT_CFG2[5]
S2-3 BOOT_CFG2[2]
S2-4 BOOT_CFG2[4]
S2-5 BOOT_CFG2[3]
S2-6 BOOT_CFG2[7]
S2-7 BOOT_CFG2[1]
S2-8 BOOT_CFG3[2]


Fuses with fixed value on DEV-i.MX6 development board
i.MX6 eFuse Value
BOOT_CFG1[1] 0
BOOT_CFG1[7] 0
BOOT_CFG2[0] 0
BOOT_CFG3[6] 0
BOOT_CFG3[7] 0
BOOT_CFG4[0] 0
BOOT_CFG4[1] 0
BOOT_CFG4[2] 0
BOOT_CFG4[3] 1
BOOT_CFG4[4] 0
BOOT_CFG4[5] 0
BOOT_CFG4[7] 0

8.6 Buzzer

DEV-i.MX6   ≥V1.0

The buzzer is controlled by a PWM signal.

In Linux, we use the pwm-backlight device driver for convenience. The associated device file is:

/sys/devices/platform/pwm-backlight.2/backlight/pwm-backlight.2/brightness
  • Turn buzzer on:
echo 50 > /sys/devices/platform/pwm-backlight.2/backlight/pwm-backlight.2/brightness
  • Turn buzzer off:
echo 0 > /sys/devices/platform/pwm-backlight.2/backlight/pwm-backlight.2/brightness
  • Unit test
/opt/blt/unit-tests/buzzer-pwm.sh

8.7 Camera Module ISM-AR0132AT/ISM-MT9M025

DEV-i.MX6   ≥V1.0

This module is available with Monochrome or Bayer-RGB field array. They cannot be distinguished in software!

Kernel module
ism-mt9m025_camera.ko
  • Kernel module parameters
    • testpattern: Test pattern: 0=disable (default), 1=solid color, 2=color bar, 3=fade-to-gray color bar, 4=walking 1s
    • autoexposure: Auto exposure: 0=disable, 1=enable (default)
    • hdrmode: High dynamic range mode: 0=disable (default), 1=enable
    • sensorwidth: Sensor width, default 1280
    • sensorheight: Sensor height, default 960
    • datawidth: Data width: 8 (default), 12 bits
    • rotate: Rotate by 180°, 0=no (default), 1=yes
    • binning: Enable digital binning for resolutions of VGA or smaller, 0=no, 1=yes (default)
Camera Control Utility

Basic initialization of the sensor chip is done by the device driver, but this utility allows customers to easily evaluate and configure sensor values according to their needs.

/opt/blt/camctl/mt9m025-ctl
  • Usage:
./mt9m025-ctl <register> ...........read register value
./mt9m025-ctl <register> <value> ...write register value
<register> is in hex 16-bit, e.g. 0x3000
<value> is either hex 16-bit (0x2400) or decimal (9216)
Unit test
/opt/blt/unit-tests/ism_mt9m025.sh
GStreamer examples - Monochrome type

Use /dev/video18 instead of /dev/video19 on CM-i.MX6 Solo.

  • Live view on LVDS1, full resolution, 45fps
FPS=45
modprobe -r ism-mt9m025-camera
modprobe ism-mt9m025-camera
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=1 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Live view on LVDS1, 800x600, 45fps, rotate
FPS=45
HEIGHT=600
WIDTH=800
modprobe -r ism-mt9m025-camera
modprobe ism-mt9m025-camera  sensorwidth=$WIDTH sensorheight=$HEIGHT rotate=1
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=1 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Record video, full res, 25fps
FPS=25
HEIGHT=960
WIDTH=1280
modprobe -r ism-mt9m025-camera
modprobe ism-mt9m025-camera sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=1 fps-n=$FPS num-buffers=150 ! ismconv ! mfw_ipucsc ! vpuenc ! mp4mux ! filesink location=recording.mp4
GStreamer examples - RGB Bayer type

Use /dev/video18 instead of /dev/video19 on CM-i.MX6 Solo.

  • Live view on LVDS1, full resolution, 45fps
FPS=45
modprobe -r ism-mt9m025-camera
modprobe ism-mt9m025-camera
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=2 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Live view on LVDS1, 800x600, 45fps, rotate
FPS=45
HEIGHT=600
WIDTH=800
modprobe -r ism-mt9m025-camera
modprobe ism-mt9m025-camera  sensorwidth=$WIDTH sensorheight=$HEIGHT rotate=1
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=2 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Record video, full res, 25fps
FPS=25
HEIGHT=960
WIDTH=1280
modprobe -r ism-mt9m025-camera
modprobe ism-mt9m025-camera sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=2 fps-n=$FPS num-buffers=150 ! ismconv ! mfw_ipucsc ! vpuenc ! mp4mux ! filesink location=recording.mp4

8.8 Camera Module ISM-MT9M131

DEV-i.MX6   ≥V1.0
Overview
  • The camera supports SXGA (1280x1024) at 15 fps, VGA (640x480) at 30 fps.
  • The Linux device driver uses the camera chip in YUV mode.
  • Live view and capturing is fully supported by i.MX hardware (because the camera sends YUV and no Bayer RGB pattern).
Assembling

When assembling, be sure to use connector i.MX of the ISM-MT9M131!

Kernel module
ism-mt9xx31_camera.ko

Note: This driver handles ISM-MT9M131 and ISM-MT9P031 cameras.

  • Kernel module parameters
    • testpattern: Test pattern: 0=disable (default), 1..7=different test patterns
    • sensorwidth: Sensor width, default 1280
    • sensorheight: Sensor height, default 1024
Camera Control Utility

Basic initialization of the sensor chip is done by the device driver, but this utility allows customers to easily evaluate and configure sensor values according to their needs.

/opt/blt/camctl/mt9xx31-ctl
  • Usage:
./mt9xx31-ctl <register> ...........read register value
./mt9xx31-ctl <register> <value> ...write register value
<register> is in hex 16-bit, e.g. 0x3000
<value> is either hex 16-bit (0x2400) or decimal (9216)
GStreamer examples
  • Live view on LVDS1, full resolution, 16fps
modprobe -r ism_mt9xx31_camera
modprobe ism_mt9xx31_camera
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Live view on LVDS1 - 1024x768, 25 fps
WIDTH=1024
HEIGHT=768
modprobe -r ism_mt9xx31_camera
modprobe ism_mt9xx31_camera sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Live view on LVDS1 - 800x600, 40fps
WIDTH=800
HEIGHT=600
modprobe -r ism_mt9xx31_camera
modprobe ism_mt9xx31_camera sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc fps-n=40 device=/dev/video0 ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Record video
WIDTH=1280
HEIGHT=1024
modprobe -r ism_mt9xx31_camera
modprobe ism_mt9xx31_camera sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc num-buffers=150 ! queue ! vpuenc ! mp4mux ! filesink location=recording.mp4
Unit test
/opt/blt/unit-tests/ism_mt9m131.sh

8.9 Camera Module ISM-MT9P031

DEV-i.MX6   ≥V1.0

This module is available with Monochrome or Bayer-RGB field array. They cannot be distinguished in software!

Kernel module
ism-mt9xx31_camera.ko

Note: This driver handles ISM-MT9M131 and ISM-MT9P031 cameras.

  • Kernel module parameters
    • testpattern: Test pattern: 0=disable (default), 1=Color field, 2=Horizontal gradient, 3=Vertical gradient, 4=Diagonal gradient, 5=Classic test pattern, 6=Walking 1s, 7=Monochrome horizontal bars, 8=Monochrome vertical bars, 9=Vertical color bars
    • sensorwidth: Sensor width, default 2592
    • sensorheight: Sensor height, default 1944
    • datawidth: Data width: 8 (default), 12 bits
    • rotate: Rotate by 180°, 0=no (default), 1=yes
    • shutterwidth: Shutter width, default (sensorheight-1)
Camera Control Utility

Basic initialization of the sensor chip is done by the device driver, but this utility allows customers to easily evaluate and configure sensor values according to their needs.

/opt/blt/camctl/mt9xx31-ctl
  • Usage:
./mt9xx31-ctl <register> ...........read register value
./mt9xx31-ctl <register> <value> ...write register value
<register> is in hex 16-bit, e.g. 0x3000
<value> is either hex 16-bit (0x2400) or decimal (9216)
Unit test
/opt/blt/unit-tests/ism_mt9p031.sh
GStreamer examples - Monochrome type
  • Live view on LVDS1, full resolution, 12fps
SHUTTERWIDTH=150
FPS=12
modprobe -r ism-mt9xx31-camera
modprobe ism-mt9xx31-camera  shutterwidth=$SHUTTERWIDTH
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=1 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Live view on LVDS1, 800x600, 32fps
SHUTTERWIDTH=100
FPS=32
HEIGHT=600
WIDTH=800
modprobe -r ism-mt9xx31-camera
modprobe ism-mt9xx31-camera  shutterwidth=$SHUTTERWIDTH sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=1 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Record video, 1080p, 25fps
SHUTTERWIDTH=100
FPS=25
HEIGHT=1080
WIDTH=1920
modprobe -r ism-mt9xx31-camera
modprobe ism-mt9xx31-camera  shutterwidth=$SHUTTERWIDTH sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=1 fps-n=$FPS num-buffers=100 ! ismconv ! mfw_ipucsc ! vpuenc ! mp4mux ! filesink location=recording.mp4
GStreamer examples - Bayer RGB type
  • Live view on LVDS1, full resolution, 12fps
SHUTTERWIDTH=200
FPS=12
modprobe -r ism-mt9xx31-camera
modprobe ism-mt9xx31-camera  shutterwidth=$SHUTTERWIDTH
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=3 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Live view on LVDS1, full resolution, 12fps, rotate by 180°
SHUTTERWIDTH=400
FPS=12
modprobe -r ism-mt9xx31-camera
modprobe ism-mt9xx31-camera  shutterwidth=$SHUTTERWIDTH rotate=1
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=4 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Live view on LVDS1, 800x600, 32fps
SHUTTERWIDTH=200
FPS=32
HEIGHT=600
WIDTH=800
modprobe -r ism-mt9xx31-camera
modprobe ism-mt9xx31-camera  shutterwidth=$SHUTTERWIDTH sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=3 fps-n=$FPS ! ismconv ! mfw_v4lsink device=/dev/video19 disp-width=800 disp-height=600
  • Record video, 1080p, 25fps
SHUTTERWIDTH=300
FPS=25
HEIGHT=1080
WIDTH=1920
modprobe -r ism-mt9xx31-camera
modprobe ism-mt9xx31-camera  shutterwidth=$SHUTTERWIDTH sensorwidth=$WIDTH sensorheight=$HEIGHT
modprobe mxc_v4l2_capture
gst-launch -e mfw_v4lsrc device=/dev/video0 color-mode=3 fps-n=$FPS num-buffers=100 ! ismconv ! mfw_ipucsc ! vpuenc ! mp4mux ! filesink  location=recording.mp4

8.10 Camera Module OV5640 (MIPI CSI)

DEV-i.MX6   ≥V1.0

Please contact Sales for a suitable adapter (ADP-i.MX6x-MIPI).

Note: This camera is the same as used with Freescale's Sabre SD board.

  • Load kernel modules
modprobe ov5640_camera_mipi
modprobe mxc_v4l2_capture
  • Gstreamer live-view example (HDMI display)
    • VGA, 30 fps
gst-launch -e mfw_v4lsrc capture-mode=0 device=/dev/video1 fps-n=30 fps-d=1 ! mfw_v4lsink device=/dev/video16
    • 720P, 30 fps
gst-launch -e mfw_v4lsrc capture-mode=4 device=/dev/video1 fps-n=30 fps-d=1 ! mfw_v4lsink device=/dev/video16
    • Max. resolution 2592x1944, 15 fps
gst-launch -e mfw_v4lsrc capture-mode=6 device=/dev/video1 fps-n=15 fps-d=1 ! mfw_v4lsink device=/dev/video16

8.11 CAN

DEV-i.MX6   ≥V1.0

Two CAN interfaces are available on the DEV-i.MX6.

Kernel modules

The CAN interfaces need the kernel modules flexcan and can_raw in order to work correctly:

modprobe flexcan
modprobe can_raw
Termination resistors

Do not forget to enable termination resistors by setting JP1 and JP2 to not marked positions.

Configure interface
  • Set the bit rate in Linux
echo 1000000 > /sys/devices/platform/FlexCAN.0/bitrate
  • Turning on the interface
ifconfig can0 up
  • Receive:
for i in `seq 1 100`; do cantest can0; done
  • Send:
for i in `seq 1 50`; do cantest can0 123#AABBCCDD; usleep 1000; cantest can0 1F334455#1122334455667788; usleep 1000; done
Unit Tests
  • Unit test (Loop): Connect the CANH and CANL lines of both CAN interfaces together.
/opt/blt/unit-tests/can-loop.sh
  • For the following unit tests you have to physically connect two CAN interfaces and run two scripts. One CAN interface is used as a transmitter and the other one is the receiver. You can run CAN0 as sender and CAN1 as receiver or vice versa. If you run only one sender and no receiver, you will get a no buffer space error.
/opt/blt/unit-tests/can0-recv.sh
/opt/blt/unit-tests/can0-send.sh
/opt/blt/unit-tests/can1-recv.sh
/opt/blt/unit-tests/can1-send.sh

8.12 DDR3 SDRAM

CM-i.MX6   ≥V1.0

memtester can be used to test the board's DDR3 RAM.

  • Example:
memtester 100M 1
Memtester will try to allocate the amount of memory specified.
The first parameter defines the size of the memory to be allocated, the second parameter determines the number of iterations.
Unit tests
  • 1 minute test
/opt/blt/unit-tests/ddr3-short.sh
  • 39 minutes test
/opt/blt/unit-tests/ddr3-long.sh
  • Test with GPU Unit Test in parallel (1 hour)
/opt/blt/unit-tests/ddr3+gpu.sh

8.13 Display Interfaces

DEV-i.MX6   ≥V1.0

The CM-i.MX6 has five display interfaces, from which 4 are connected on the development board. They can be operated concurrently on the CM-i.MX6 Dual/Quad, which incorporates two IPUs, and each can drive 2 displays. On CM-i.MX6 Solo, two display interfaces may be active concurrently.

The following is a list of displays that are registered by default for the CM-i.MX6 Dual/Quad.

      Background DI Overlay DI
IPU Display Interface DEV-i.MX6 Name Framebuffer Device Video Device Name Framebuffer Device Video Device
0 0 HDMI DISP3 BG /dev/fb0 /dev/video16 DISP3 FG /dev/fb1 /dev/video17
0 1 MIPI-DSI DISP3 BG - DI1 /dev/fb2 /dev/video18
1 0 LVDS0 DISP4 BG /dev/fb5 /dev/video21
1 1 LVDS1 DISP4 BG - DI1 /dev/fb3 /dev/video19 DISP4 FG /dev/fb4 /dev/video20

The following is a list of displays that are registered by default for the CM-i.MX6 Solo.

      Background DI Overlay DI
IPU Display Interface DEV-i.MX6 Name Framebuffer Device Video Device Name Framebuffer Device Video Device
0 0 HDMI DISP3 BG /dev/fb0 /dev/video16 DISP3 FG /dev/fb1 /dev/video17
0 1 LVDS1 DISP3 BG - DI1 /dev/fb2 /dev/video18

The registration of display interfaces is done in the board file rpm/BUILD/linux/arch/arm/arm-mx6/board-cmimx6.c.

static struct ipuv3_fb_platform_data devimx6_fb_data[] = {
	{
		.disp_dev = "hdmi",
		[...]
	},
	{
		.disp_dev = "mipi_dsi",
		[...]
	},
	{
		.disp_dev = "ldb",
		[...]
	},
	{
		.disp_dev = "ldb",
		[...]
	},
};
static void __init cmimx6_board_init(void)
{

	[...]

	if (cpu_is_mx6q()) {
		imx6q_add_ipuv3fb(0, &devimx6_fb_data[0]); /* HDMI */
		imx6q_add_ipuv3fb(1, &devimx6_fb_data[1]); /* MIPI-DSI */
		imx6q_add_ipuv3fb(2, &devimx6_fb_data[2]); /* LVDS1 */
		imx6q_add_ipuv3fb(3, &devimx6_fb_data[3]); /* LVDS0 */
	} else {
		imx6q_add_ipuv3fb(0, &devimx6_fb_data[0]); /* HDMI */
		imx6q_add_ipuv3fb(1, &devimx6_fb_data[2]); /* LVDS1 */
	}

Mapping of IPU/DI to a specific display is also done in the board file.

HDMI

static struct fsl_mxc_hdmi_core_platform_data hdmi_core_data = {
	.ipu_id = 0,
	.disp_id = 0,
};

LVDS1, LVDS0

static struct fsl_mxc_ldb_platform_data ldb_data = {
	.ipu_id = 1,
	.disp_id = 1,
	.ext_ref = 1,
	.mode = LDB_SEP1,
	.sec_ipu_id = 1,
	.sec_disp_id = 0,
};
static void __init cmimx6_board_init(void)
{

	[...]

	if (cpu_is_mx6dl()) {
		ldb_data.ipu_id = 0;
		ldb_data.sec_ipu_id = 0;
	}

MIPI-DSI

static struct mipi_dsi_platform_data mipi_dsi_pdata = {
	.ipu_id		= 0,
	.disp_id	= 1,
	.lcd_panel	= "TRULY-WVGA",
	.reset		= mx6_reset_mipi_dsi,
};
Activating frame buffers

You can determine from the above table which frame-buffers correspond to which displays.

If you want to turn on (unblank) a specific frame-buffer (e.g. "x") you have to do:

echo 0 > /sys/class/graphics/fbx/blank

To blank it (default):

echo 1 > /sys/class/graphics/fbx/blank

8.14 eMMC Flash memory

CM-i.MX6   ≥V1.0
Block device files

The eMMC's block device file in Linux is:

/dev/mmcblk0

(It's always enumerated first.)

Partitions are named

/dev/mmcblk0p1
/dev/mmcblk0p2
...
Unit test in Linux
/opt/blt/unit-tests/emmc-usdhc2.sh

Attention: Parts of eMMC are overwritten!

U-Boot

bootcmd_emmc - This script loads and boots the Linux kernel from eMMC with proper kernel parameters

Information about the MMC subsystem: help mmc

Firmware update on eMMC

#Instructions for deployment onto/boot from eMMC

8.15 Ethernet

DEV-i.MX6   ≥V1.0

The i.MX6 has an on-chip Gigabit Ethernet Controller (IEEE1588 compliant) with 10/100/1000 Mbps that is commonly named FEC (Fast Ethernet Controller).

MAC address

You can assign a fixed MAC address to a CM-i.MX6 module by blowing the associated OCOTP fuses on the i.MX6. Look here for information: #Fuse programming (U-Boot)

Alternatively, you can set U-Boot's ethaddr variable to the desired address and save the environment to flash afterwards. (But this is not persistent.)

For Linux, you can set the MAC address of the FEC with a kernel argument: fec_mac=XX:XX:XX:XX:XX:XX. To set the same MAC address in Linux as you have set in U-Boot, you can use the following U-Boot commands. Then, Linux will adopt whatever MAC address was configured in U-Boot at each boot.

set bootargs_base $(bootargs_base) 'fec_mac=$(ethaddr)'
save
Default network configuration used by U-Boot
  • IP address 192.168.1.6
  • Netmask 255.255.255.0
  • Server IP address 192.168.1.1
  • MAC address 02:06:DE:AD:BE:EF
Performance Test with netcat

It is known from Freescale that the maximum data transfer is less that 1 Gigabit per second. We have measured the throughput using the netcat tool in a typical setup. Communication was a standard PC with gigabit NIC.

Connected via Gigabit Ethernet Switch
  MiB/s
netcat receive 44.16912533
netcat send 32.82043723
Connected via 100 MBit Ethernet Switch
  MiB/s
netcat receive 11.28150133
netcat send 10.30946022

8.16 Fuse programming (U-Boot)

CM-i.MX6   ≥V1.0
  • Fuse programming is done with the U-Boot command
imxotp

!!!CAUTION!!! i.MX6 fuses are one-time programmable!

  • Usage:
imxotp read <index>
 - read fuse at 'index'
imxotp blow [--force] <index> <value>
 - blow fuse at 'index' with hex value 'value'
  • Conversion of an address to <index>:
index = (address - otp_base) / 0x10
e.g.: addr is 0x021bc410, otp_base is 0x021bc400 -> index = 1

8.16.1 Boot Fuses Example

As an example we want to configure the fuses to boot from SPI-NOR.

Program SPI-NOR boot to fuses

We refer to chapter #Boot Modes to figure out the hexadecimal value of BOOT_CFG for SPI-NOR boot:

BOOT_CFG4 = 0x08
BOOT_CFG3 = 0x00
BOOT_CFG2 = 0x00
BOOT_CFG1 = 0x30 

Hence, BOOT_CFG has the value 0x08000030 for SPI-NOR boot.

This value must be written to OCOTP register 0x450.

For U-Boot, we determine the index according to above equation:

index = (0x450-0x400)/0x10 = 0x5

Now we type in U-boot:

imxotp blow 5 0x08000030

Please take notice that U-boot interprets all numbers as hexadecimal (even without the "0x" prefix).

Now we can do a read-back with

imxotp read 5
Set boot mode permanently

As a next step we want to program the BT_FUSE_SEL to "1". This fuse determines whether using fuses for boot configuration or GPIO pin values. If we write this to "1" we can override the boot-mode switches permanently. BT_FUSE_SEL is Bit 4 ((1<<4) = 0x10) at address 0x460, so

index = (0x460-0x400)/0x10 = 0x6
imxotp blow 6 0x10

Hint: For blow commands, you have to use the --force switch to actually write the fuses.

8.16.2 MAC Address Fuses Example

As an example we want to program a MAC address for the Fast Ethernet Controller (FEC) to Fuses.

We are using address 12:10:08:06:04:02.

Lower 32 bits go to OCOTP register 0x620, which means, the index in U-Boot is 0x22. Upper 16 bits go to OCOTP register 0x630, U-Boot index is 0x23.

Read current values
imxotp read 22
imxotp read 23

(Please note that U-Boot treats the index as hexadecimal value always, even without the 0x prefix.)

They are zero on a new module.

Write lower part
imxotp blow 22 0x08060402
Write upper part
imxotp blow 23 0x1210

Hint: You have to use the --force switch to actually write the fuses.

Now, if you restart U-Boot, it will display the message

Net:   got MAC address from IIM: 12:10:08:06:04:02

If you get also this warning message,

Warning: FEC0 MAC addresses don't match:
Address in SROM is         12:10:08:06:04:02
Address in environment is  02:06:de:ad:be:ef

it means that the U-Boot variable ethaddr is also set to a different value. To solve this problem, use the command

set ethaddr

(without an argument).

8.17 GPS module (Condor C1919)

EXT-i.MX53-COMM   ≥V1.0
DEV-i.MX6   ≥V1.1
  • Connect a GPS antenna to X10.
  • The GPS module is enabled at boot.
Display data
  • Get GPS data:
minicom -D /dev/ttymxc2 -b 9600
  • Quit: Press Ctrl+A, then Z, then X, then Enter.

8.18 GSM/GPRS module ublox LEON-G100

EXT-i.MX53-COMM   ≥V1.0
LTIB configuration
  • In ltib/ folder, start LTIB's configuration dialog:
./ltib -c
  • Go to
Package list  --->
  • Select the following packages:
[*] minicom
[*] ppp
[*]   Install support for PPP packet filtering (needs driver support)
  • Exit from LTIB and save your new configuration (you will be asked).
  • LTIB will build minicom and ppp now.
Basic test in Linux
modprobe bsd_comp
modprobe ppp_async
modprobe ppp_deflate
modprobe ppp_generic
modprobe mx6_bt_rfkill
echo 0 > /sys/class/rfkill/rfkill0/state
echo 1 > /sys/class/rfkill/rfkill0/state

We use the program minicom to test communication with the GSM/GPRS module.

minicom -D /dev/ttymxc1 -b 230400 -s
  • Go to Serial port setup.
  • Turn off Hardware Flow Control (Press key F).
  • Press ENTER to leave the menu.
  • Press ESC to leave the main menu.

Now, type garbage into the terminal until you can see what you type. This means that the autobauding function of the module has successfully detected our baud rate.

We can request some information from the module (input bold):

AT+CGMI
u-blox

OK
AT+CGMM
LEON-G100

OK
AT+CGMR
07.30.03

OK
Establish an Internet connection with PPPD

Now that we have checked the communication with the modem, we demonstrate how to establish an Internet connection.

  • First - if you have not done already - shut down your EXT-i.MX53-COMM and insert a SIM card on the bottom side. Connect a GSM antenna to connector X3. Then boot up Linux again.
  • Edit the file
/etc/chatscripts/ppp-gprs

The file contains the required configuration such as PIN, APN (access point name), and phone number. You have to customize items marked red:

ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED
ECHO OFF
# for modem's autobauding
 'UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU'
 'AT+CMEE=2'
TIMEOUT 3
'OK' 'AT+CPIN?'
'READY-AT+CPIN="3561"-' 
'OK' 'ATZ'
'OK' 'AT&K0'
TIMEOUT 10
'OK' 'AT+CGDCONT=1,"IP","web.yesss.at"'
'OK' 'ATD*99#'
'CONNECT' \d\c
  • If you booted via NFS, you have to remove the default route before starting pppd
route del default
  • Try establishing the connection with the following command. Note that if the connection fails at the first attempt, it is worthwhile to try again.
pppd call gprs-modem nodetach

If everything works fine, then you will see a similar output:

root@sbc-imx51:~# pppd call ppp nodetach
abort on (BUSY)
abort on (NO CARRIER)
abort on (VOICE)
abort on (NO DIALTONE)
abort on (NO DIAL TONE)
abort on (NO ANSWER)
abort on (DELAYED)
send (AT+CMEE=2^M)
timeout set to 3 seconds
expect (OK)
AT+CMEE=2^M^M
OK
 -- got it

send (AT+CPIN?^M)
expect (READY)
^M
AT+CPIN?^M^M
+CPIN: READY
 -- got it

send (^M)
expect (OK)
^M
^M
OK
 -- got it

send (ATZ^M)
expect (OK)
^M
^MATZ^M^M
OK
 -- got it

send (AT&K0^M)
timeout set to 10 seconds
expect (OK)
^M
AT&K0^M^M
OK
 -- got it

send (AT+CGDCONT=1,"IP","web.yesss.at"^M)
expect (OK)
^M
AT+CGDCONT=1,"IP","web.yesss.at"^M^M
OK
 -- got it

send (ATD*99#^M)
expect (CONNECT)
^M
ATD*99#^M^M
CONNECT
 -- got it

send (\d)
Serial connection established.
using channel 2
Using interface ppp0
Connect: ppp0 <--> /dev/ttymxc1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x71dfe05e> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x71dfe05e> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [CCP ConfReq id=0x1 <mppe -H -M -S -L -D -C> <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 15 12 06 00 00 00 00 1a 04 78 00 18 04 78 00 15]
rcvd [IPCP ConfReq id=0x1 <addr 10.114.147.229>]
sent [IPCP ConfAck id=0x1 <addr 10.114.147.229>]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfNak id=0x2 <addr 10.114.147.229> <ms-dns1 194.24.128.100> <ms-dns3 81.3.216.100>]
sent [IPCP ConfReq id=0x3 <addr 10.114.147.229> <ms-dns1 194.24.128.100> <ms-dns3 81.3.216.100>]
rcvd [IPCP ConfAck id=0x3 <addr 10.114.147.229> <ms-dns1 194.24.128.100> <ms-dns3 81.3.216.100>]
replacing old default route to eth0 [192.168.1.1]
local  IP address 10.114.147.229
remote IP address 10.114.147.229
primary   DNS address 194.24.128.100
secondary DNS address 81.3.216.100
Script /etc/ppp/ip-up started (pid 2701)
Script /etc/ppp/ip-up finished (pid 2701), status = 0x0

To disconnect, hit [ Ctrl+c ].

Debugging

What you may try if you don't get a connection

  • You may test the effects of AT commands directly with
minicom -o

An init sequence could be:

AT+CPIN="1234"
ATZ
AT&K0
ATQ0
  • You may enable verbose error messages instead of the generic ERROR:
AT+CMEE=2
  • Check if your service provider's signal is available with the +COPS command:
AT+COPS=?

You should see your service provider in the list.

  • If anything goes wrong after seeing the CONNECT from the modem, you may have a look at PPPD's configuration file
/etc/ppp/peers/gprs-modem

Help resources

  • The ppp and chat man pages, usually installed on Linux PCs:
man ppp
man chat

8.19 Gyroscope (ST-Microelectronics L3G4200D)

EXT-i.MX53-COMM   ≥V1.0
LTIB configuration
  • In ltib/ folder, start LTIB's configuration dialog:
./ltib -c
  • Go to
Package list  --->
  • Select the following packages:
[*] evtest 
  • Exit from LTIB and save your new configuration (you will be asked).
  • LTIB will build evtest now.
Test in Linux
  • Load the kernel module
modprobe l3g4200d
  • Enable the device
echo 1 > /sys/devices/platform/imx-i2c.2/i2c-2/2-0068/enable_device
  • Display the input devices
cat /proc/bus/input/devices
  • You may find an input device similar to the following in your devices file.
I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="l3g4200d"
P: Phys=
S: Sysfs=/devices/platform/imx-i2c.2/i2c-2/2-0068/input/input1
U: Uniq=
H: Handlers=event0
B: EV=9
B: ABS=7
  • Use the Handlers information (marked red) to start the evtest application, which displays all input events on the terminal.
evtest /dev/input/event0

8.20 HDMI

DEV-i.MX6   ≥V1.0
Which frame buffer device in Linux is HDMI?

Usually /dev/fb0, but please see the #Display Interfaces chapter for mapping ofLinux frame buffers and video devices.

To check, you can read the file

/sys/class/graphics/fbx/fsl_disp_dev_property

(Replace x with the number of the frame buffer!)

It reads 'hdmi' for HDMI.

Unit test (Please set a video mode before with horizontal resolution = 1280 pixel!)
/opt/blt/unit-tests/hdmi_hd720.sh
Unit test for Audio over HDMI
/opt/blt/unit-tests/audio-hdmi.sh
How to change video mode in Linux

If a device is attached to the HDMI port, supported modes are read out from the display via EDID.

You can see the list of supported video modes by reading the file

/sys/class/graphics/fbx/modes

To set a mode, write the corresponding line to the mode file, e.g.,

echo 'D:1280x1024p-60' > /sys/class/graphics/fbx/modes

8.21 LED (RGB)

DEV-i.MX6   ≥V1.0
  • U-Boot turns it to white when it comes up
  • Linux turns it to blue during boot
  • Controlling the RGB LED in Linux:
echo [0..255] > /sys/class/leds/rgb-[r,g,b]/brightness
  • Unit test
/opt/blt/unit-tests/rgb-led.sh
  • necessary Kernel configuration
 <*>   LED Support for Toshiba TCA62724FMG I2C chip
 [*]     Blue LED default on
 [*]   LED Trigger support
 <*>   LED Default ON Trigger 

8.22 LVDS Displays

DEV-i.MX6   ≥V1.0

Supported display: Promate 97G104S2N2F-2

The video mode used in the Linux kernel for this type of display is named PROMATE-SVGA. It is defined in linux/drivers/video/mxc/ldb.c:

static struct fb_videomode ldb_modedb[] = {
[...]
	{
	 /* Promate LVDS TFT 97G104S2N2F-2 800x600 */
	 "PROMATE-SVGA", 60, 800, 600, 25132,
[...]

See the #Display Interfaces chapter for mapping to Linux frame buffers and video devices.

Backlight control: See #Backlight Control for LCDs

8.23 Magnetometer (Freescale MAG3110 module)

EXT-i.MX53-COMM   ≥V1.0
LTIB configuration
  • In ltib/ folder, start LTIB's configuration dialog:
./ltib -c
  • Go to
Package list  --->
  • Select the following packages:
[*] evtest 
  • Exit from LTIB and save your new configuration (you will be asked).
  • LTIB will build evtest now.
Test in Linux
  • Load the kernel module
modprobe mag3110
  • Enable the sensor
echo 1 > /sys/devices/virtual/input/input1/enable
  • Display the input devices
cat /proc/bus/input/devices
  • Search for the following device (mag3110) and note the Handlers line:
I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="mag3110"
P: Phys=
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=event0
B: EV=9
B: ABS=7
  • Start evtest to see the magnetometer's output:
evtest /dev/input/event0

8.24 MIPI CSI

See #Camera Module OV5640 (MIPI CSI)

8.25 MIPI-DSI Display

DEV-i.MX6   ≥V1.0
  • No display available yet.
  • Connector available, compatible to Freescale SabreSD MIPI-DSI connector.

See the #Display Interfaces chapter for mapping to Linux frame buffers and video devices.

Backlight control: See #Backlight Control for LCDs.

8.26 PCI-Express

DEV-i.MX6   ≥V1.0

The development board features a Mini-PCI-E connector.

We have used a PCIE-to-SATA card to test PCI-E (Chipset: ASMedia ASM1061).

Link to card: [1]

  • Execute unit test

Connect a SATA disk to the above PCI-E card, which is attached to the development board.

modprobe ahci
/opt/blt/unit-tests/pcie-sata.sh

8.27 Power Save Modes

DEV-i.MX6   ≥V1.0
Standby Mode
echo standby > /sys/power/state
Suspend-to-RAM mode
echo mem > /sys/power/state
Define wakeup sources

Wakeup sources are controlled via wakeup files in the SYSFS tree.

  • Write enabled to a file to enable a wakeup source.
  • Write disabled to a file to disable a wakeup source.
  • Read the file with cat to see the status.
Wakeup Source related file
UART1 (ttymxc1) /sys/devices/platform/imx-uart.1/tty/ttymxc1/power/wakeup
UART2 (ttymxc2) /sys/devices/platform/imx-uart.2/tty/ttymxc2/power/wakeup
Debug-UART (ttymxc3) /sys/devices/platform/imx-uart.3/tty/ttymxc3/power/wakeup
USB-OTG host /sys/devices/platform/fsl-usb2-otg/power/wakeup
USB-Host (connect/disconnect) /sys/devices/platform/fsl-ehci.1/power/wakeup
/sys/devices/platform/fsl-ehci.1/usb2/power/wakeup
/sys/devices/platform/fsl-ehci.1/usb2/2-1/power/wakeup
PMIC pushbutton /sys/devices/platform/imx-i2c.0/i2c-0/0-003c/power/wakeup
Don't suspend the Debug UART terminal

Add 'no_console_suspend' to kernel parameters in U-Boot

Test sequence (Wake up with keypress in serial terminal)
echo disabled > /sys/devices/platform/imx-uart.1/tty/ttymxc1/power/wakeup
echo disabled > /sys/devices/platform/imx-uart.2/tty/ttymxc2/power/wakeup
echo enabled > /sys/devices/platform/imx-uart.3/tty/ttymxc3/power/wakeup
echo disabled > /sys/devices/platform/fsl-usb2-otg/power/wakeup
echo disabled > /sys/devices/platform/fsl-ehci.0/power/wakeup
echo disabled > /sys/devices/platform/fsl-ehci.0/usb1/power/wakeup
echo disabled > /sys/devices/platform/fsl-usb2-udc/power/wakeup
echo disabled > /sys/devices/platform/fsl-ehci.1/power/wakeup
echo disabled > /sys/devices/platform/fsl-ehci.1/usb2/power/wakeup
echo disabled > /sys/devices/platform/fsl-ehci.1/usb2/2-1/power/wakeup
echo disabled > /sys/devices/platform/imx-i2c.0/i2c-0/0-003c/power/wakeup
echo mem > /sys/power/state

8.28 PWM

DEV-i.MX6   ≥V1.0

The following is a list of the available PWM Channels and their connections.

The PWM frequency is fixed and can not be changed from user space.

The PWM duty cycle can be set by writing a percent value (0..100) to the corresponding brightness file of the pwm-backlight driver.

PWM Description turn on turn off
PWM_OUT1 2x LVDS Displays echo 100 > /sys/devices/platform/pwm-backlight.0/backlight/pwm-backlight.0/brightness echo 0 > /sys/devices/platform/pwm-backlight.0/backlight/pwm-backlight.0/brightness
PWM_OUT2 GPIO Extension Connector echo 100 > /sys/devices/platform/pwm-backlight.1/backlight/pwm-backlight.1/brightness echo 0 > /sys/devices/platform/pwm-backlight.1/backlight/pwm-backlight.1/brightness
PWM_OUT3 Buzzer echo 50 > /sys/devices/platform/pwm-backlight.2/backlight/pwm-backlight.2/brightness echo 0 > /sys/devices/platform/pwm-backlight.2/backlight/pwm-backlight.2/brightness
PWM_OUT4 MIPI DSI Connector echo 100 > /sys/devices/platform/pwm-backlight.3/backlight/pwm-backlight.3/brightness echo 0 > /sys/devices/platform/pwm-backlight.3/backlight/pwm-backlight.3/brightness
  • Linux platform file entries (linux/arch/arm/mach-mx6/board-cmimx6.c):
static struct platform_pwm_backlight_data cmimx6_pwm0_backlight_data = {
	.pwm_id = 0,
	.max_brightness = 100,
	.dft_brightness = 80,
	.pwm_period_ns = 50000, // 20 kHz
};

#if 0
static struct platform_pwm_backlight_data cmimx6_pwm1_backlight_data = {
	.pwm_id = 1,
	.max_brightness = 100,
	.dft_brightness = 0,
	.pwm_period_ns = 50000,
};
#endif

static struct platform_pwm_backlight_data cmimx6_pwm2_backlight_data = {
	.pwm_id = 2,
	.max_brightness = 100,
	.dft_brightness = 0,
	.pwm_period_ns = 833333, // 1.2 kHz
};

static struct platform_pwm_backlight_data cmimx6_pwm3_backlight_data = {
	.pwm_id = 3,
	.max_brightness = 100,
	.dft_brightness = 80,
	.pwm_period_ns = 50000, // 20 kHz
};

As you can see from the above code, the default values for PWM0-3 are:

PWM Channel default frequency
PWM0 20kHz
PWM1 off
PWM2 1.2kHz
PWM3 20kHz

Please note that as PWM1 is deactivated per default, the associated SYSFS control file will not exist.

8.29 RFKILL interface

DEV-i.MX6   ≥V1.0

rfkill is a sub-system of the Linux kernel used to activate and deactivate wireless communications hardware thus allowing for power consumption.

In our case it can turn on/off the GPRS and the UMTS module on the EXT-DEV-i.MX53-COMM.

To use it, load the kernel module

modprobe mx6_bt_rfkill

Turn wireless modules on:

echo 1 > /sys/class/rfkill/rfkill0/state

Turn wireless modules off:

echo 0 > /sys/class/rfkill/rfkill0/state

NB: rfkill does not deactivate the WIFI/Bluetooth module on the i.MX6 development board.

8.30 RTC

DEV-i.MX6   ≥V1.0

The CM-i.MX6 board contains an RTC on I2C2 which is by default mapped to /dev/rtc0. Linux will automatically backup and restore the system time from this RTC.

  • The Linux configuration option for this RTC can be found at

Linux Kernel Configuration

 Device Drivers  --->
   <*> Real Time Clock  --->
     <*>   NXP PCF2129A

For the RTC to work, you have to populate a coin cell in battery holder G1 (nominal voltage 3V; sizes MC621, V364, SC621) on the board.

  • Unit test
/opt/blt/unit-tests/rtc.sh

8.31 SATA

DEV-i.MX6   ≥V1.0
  • In Linux, SATA devices are /dev/sdX devices
  • Update U-Boot on SATA disk with running U-Boot:
tftpboot u-boot.bin
sata init
sata write $(loadaddr) 0x0 0x200

(Note that numbers are in blocks, i.e. Bytes/512)

Unit test
/opt/blt/unit-tests/sata.sh
U-boot

The contents of the U-boot variable for SATA boot bootcmd_sata are:

run bootargs_base bootargs_sata; sata read ${loadaddr} 0x800 0x2000; bootm

Get help for the sata command:

help sata
Firmware update

See #Instructions for deployment onto/boot from SATA

8.32 SD Card

DEV-i.MX6   ≥V1.1
Block device files

The SD Card's block device file is

/dev/mmcblk1

Partitions

/dev/mmcblk1p1
/dev/mmcblk1p2
...
Unit test in Linux
/opt/blt/unit-tests/sd-usdhc1.sh

Attention: The unit test will overwrite the SD card!

U-Boot

bootcmd_sd - This script loads and boots the Linux kernel from SD card with proper kernel parameters.

Information about the MMC subsystem: help mmc

Firmware update on SD card

See #Setting up a bootable SD card

8.33 SPDIF Out

DEV-i.MX6   ≥V1.0

The SPDIF signal is available on the yellow Cinch connector on the development board.

  • Supported bit-rates:
    • 32kHz
    • 44,1kHz
    • 48kHz
  • Unit test
/opt/blt/unit-tests/audio-spdifout.sh

8.34 SPI Flash memory

CM-i.MX6   ≥V1.0
Unit test
/opt/blt/unit-tests/spi-flash.sh

Attention: Parts of the SPI flash get overwritten! (But U-Boot will be kept.)

Write to SPI-NOR in Linux
Use dd.
Write to SPI-NOR in U-Boot
Use the sf commands (help sf).
Delete/reset U-Boot environment

If your U-Boot environment comes from SPI flash and you want to reset it

destroyenv

see also: #Instructions for deployment onto SPI-NOR flash (and eMMC) and boot from SPI-NOR

8.35 Touch panel (resistive) AD7843

DEV-i.MX6   ≥V1.0
Configuration in Linux (CM-i.MX6 Dual/Quad)

Attach display as LVDS1:

modprobe -r ads7846
echo 0 > /sys/class/graphics/fb3/blank
echo 100 > /sys/class/backlight/pwm-backlight.0/brightness
modprobe ads7846
sleep 1
export TSLIB_FBDEVICE=/dev/fb3
export TSLIB_TSDEVICE=/dev/input/event2
export TSLIB_CONFFILE=/usr/etc/ts.conf
rm /usr/etc/pointercal

Attach display as LVDS0:

modprobe -r ads7846
echo 0 > /sys/class/graphics/fb5/blank
echo 100 > /sys/class/backlight/pwm-backlight.0/brightness
modprobe ads7846
sleep 1
export TSLIB_FBDEVICE=/dev/fb5
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CONFFILE=/usr/etc/ts.conf
rm /usr/etc/pointercal
Configuration in Linux (CM-i.MX6 Solo)

Attach display as LVDS1:

modprobe -r ads7846
echo 0 > /sys/class/graphics/fb2/blank
echo 100 > /sys/class/backlight/pwm-backlight.0/brightness
modprobe ads7846
sleep 1
export TSLIB_FBDEVICE=/dev/fb2
export TSLIB_TSDEVICE=/dev/input/event2
export TSLIB_CONFFILE=/usr/etc/ts.conf
rm /usr/etc/pointercal
Calibrate display
ts_calibrate
Test display
ts_test

8.36 UMTS (on Sierra Wireless SL8082 module)

EXT-i.MX53-COMM   ≥V1.0
Configuration and test
  • In ltib/ folder, start LTIB's configuration dialog:
./ltib -c
  • Go to
Package list  --->
  • Select the following packages:
[*] minicom
[*] usbutils
  • Exit from LTIB and save your new configuration (you will be asked).
  • LTIB will build minicom and usbutils now.
  • Connect a antenna to X4.

After the i.MX6 has booted, load the kernel modules:

modprobe mx6_bt_rfkill
modprobe sierra
modprobe bsd_comp
modprobe ppp_async
modprobe ppp_deflate
modprobe ppp_generic

Check if the module was detected with lsusb.

root@cmimx6 ~$ lsusb
[...]
Bus 00x Device 00y: ID 1199:68a3 Sierra Wireless, Inc.
[...]

You may also get more information, please use the bus and device numbers from the output above:

lsusb -sx:y -v

Next, check if the /dev/ttyUSBX character devices were created (typically four). Among these, it is the last device that is detected which is used as the AT commands configuration interface.

dmesg
sierra 2-1.6:1.0: Sierra USB modem converter detected
usb 2-1.6: Sierra USB modem converter now attached to ttyUSB0
sierra 2-1.6:1.1: Sierra USB modem converter detected
usb 2-1.6: Sierra USB modem converter now attached to ttyUSB1
sierra 2-1.6:1.2: Sierra USB modem converter detected
usb 2-1.6: Sierra USB modem converter now attached to ttyUSB2
sierra 2-1.6:1.3: Sierra USB modem converter detected
usb 2-1.6: Sierra USB modem converter now attached to ttyUSB3


We use the program minicom to test communication with the GPS/UMTS module.

minicom -D /dev/ttyUSB3 -b 9600

and request some information from the module (input bold):

AT+CGMI
Sierra Wireless, Incorporated

OK
AT+CGMM 
SL8082

OK
AT+CGMR
S2_0_0_3AP R666 CARMD-EN-10526 2011/02/03 10:31:00

OK


Establish a connection with PPPD

We assume you have checked that basic communication with the modem works. Now we will demonstrate how to establish a connection.

If you booted via NFS, you have to remove the default route before starting pppd

route del default

If anything does not work correctly you can restart the UMTS module with

echo 0 > /sys/class/rfkill/rfkill0/state
sleep 10
echo 1 > /sys/class/rfkill/rfkill0/state
route del default
  • First - if you have not done already - shut down your EXT-i.MX53-COMM and insert a SIM card on the bottom side. Connect a UMTS antenna to connector X4. Then boot up Linux again.
  • Edit the file
/etc/chatscripts/ppp-umts

The file contains the required configuration such as PIN, APN (access point name), and phone number. You have to customize items marked red:

ABORT BUSY
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
TIMEOUT 10
 'AT+CMEE=2'
'OK' 'AT+CPIN?'
'READY-AT+CPIN="3561"-' 
'OK' 'ATZ'
'OK' 'AT+CGDCONT=1,"IP","web.yesss.at"'
'OK' 'ATD*99#'
'CONNECT' \d\c
  • Edit the file
/etc/ppp/peers/umts-modem 

and set the correct device file (e.g. /dev/ttyUSB3).

Afterwards, try establishing the connection with the following command. Note that if connection fails, it's worth that you retry.

pppd call umts-modem nodetach


If everything works fine, then you will see a similar output:

abort on (BUSY)
abort on (NO CARRIER)
abort on (VOICE)
abort on (NO DIALTONE)
abort on (NO DIAL TONE)
abort on (NO ANSWER)
abort on (DELAYED)
send (AT+CMEE=2^M)
timeout set to 3 seconds
expect (OK)
AT+CMEE=2^M^M
OK
 -- got it

send (AT+CPIN?^M)
expect (READY)
^M
AT+CPIN?^M^M
+CPIN: READY
 -- got it

send (^M)
expect (OK)
^M
^M
OK
 -- got it

send (ATZ^M)
expect (OK)
^M
^MATZ^M^M
OK
 -- got it

send (AT&K0^M)
timeout set to 10 seconds
expect (OK)
^M
AT&K0^M^M
OK
 -- got it

send (AT+CGDCONT=1,"IP","web.yesss.at"^M)
expect (OK)
^M
AT+CGDCONT=1,"IP","web.yesss.at"^M^M
OK
 -- got it

send (ATD*99#^M)
expect (CONNECT)
^M
ATD*99#^M^M
CONNECT
 -- got it

send (\d)
Serial connection established.
using channel 2
Using interface ppp0
Connect: ppp0 <--> /dev/ttymxc1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x71dfe05e> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x71dfe05e> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x78d8680c> <pcomp> <accomp>]
sent [CCP ConfReq id=0x1 <mppe -H -M -S -L -D -C> <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 15 12 06 00 00 00 00 1a 04 78 00 18 04 78 00 15]
rcvd [IPCP ConfReq id=0x1 <addr 10.114.147.229>]
sent [IPCP ConfAck id=0x1 <addr 10.114.147.229>]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfNak id=0x2 <addr 10.114.147.229> <ms-dns1 194.24.128.100> <ms-dns3 81.3.216.100>]
sent [IPCP ConfReq id=0x3 <addr 10.114.147.229> <ms-dns1 194.24.128.100> <ms-dns3 81.3.216.100>]
rcvd [IPCP ConfAck id=0x3 <addr 10.114.147.229> <ms-dns1 194.24.128.100> <ms-dns3 81.3.216.100>]
replacing old default route to eth0 [192.168.1.1]
local  IP address 10.114.147.229
remote IP address 10.114.147.229
primary   DNS address 194.24.128.100
secondary DNS address 81.3.216.100
Script /etc/ppp/ip-up started (pid 2701)
Script /etc/ppp/ip-up finished (pid 2701), status = 0x0

To disconnect, hit [ Ctrl+c ].

Send an SMS
  • An SMS can be written with the AT commands:
AT+CMGF=1
AT+CMGS=<receiver's phone number><CR><message><CTRL-Z>
Debugging

What you may try if you don't get a connection

  • You may test the effects of AT commands directly with
minicom -o

An init sequence could be:

AT+CPIN="1234"
ATZ
AT&K0
ATQ0
  • You may enable verbose error messages instead of the generic ERROR:
AT+CMEE=2
  • Check if your service provider's signal is available with the +COPS command:
AT+COPS=?

You should see your service provider in the list.

  • If anything goes wrong after seeing the CONNECT from the modem, you may have a look at PPPD's configuration file
/etc/ppp/peers/umts-modem

8.37 USB Host/Hub

DEV-i.MX6   ≥V1.0
  • The Linux driver for USB Host is automatically loaded (part of the kernel).
  • The USB Host I/F is connected to a 7-port USB hub on the development board. Of these, 4 are available via USB-A jacks.
Unit test

Connect one or more USB flash disks to the USB jacks on the development board.

/opt/blt/unit-tests/usbhost.sh

8.38 USB OTG

DEV-i.MX6   ≥V1.0

The Linux driver for USB Host is automatically loaded (part of the kernel).

Unit test for Host mode

Plug in a USB flash disk to the USB-OTG port (Mini-AB connector) on the development board.

/opt/blt/unit-tests/usbotg-hostrole.sh

If you want to operate the port in device mode, then you have to load a gadget kernel module. By default, the following gadgets are available:

g_audio.ko
g_ether.ko
g_file_storage.ko
g_serial.ko
(/lib/modules/3.0.35-00033-g35fb26f/kernel/drivers/usb/gadget)

E.g., via the Ethernet gadget, you can establish an Ethernet connection on top of USB with a PC. Most Linux operating systems detect this automatically and create a usb0 network device.

8.39 Wireless LAN (Lesswire WiBear-SF module)

DEV-i.MX6   ≥V1.0

NB: WIFI and Bluetooth can operate concurrently (both via SDIO).

Load the kernel modules
modprobe mx6_bt_rfkill
modprobe libertas_sdio

Check if your device is detected (wlan0)

iwconfig

Activate the device

ifconfig wlan0 up

On the i.MX6, get some information about ciphers supported by your Wi-Fi (marked blue).

iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: xxxxxx
                    ESSID:"your_ssid_here"
                    Mode:Managed
                    Frequency:2.437 GHz (Channel 6)
                    Quality=41/100  Signal level=-89 dBm  Noise level=-96 dBm
                    Encryption key:on
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    IE: WPA Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                      Preauthentication Supported
Un-encrypted connection (WIFI not requiring password)

Associate to your access point

iwconfig wlan0 essid MyWLAN

and get an IP address

udhcpc -i wlan0
udhcpc (v1.15.0) started
Sending discover...
Sending discover...
Sending select for 192.168.1.171...
Lease of 192.168.1.171 obtained, lease time 43200
Deleting routers
adding dns 192.168.1.1

Last, you can test the network interface.

ping -c 1 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=0.295 ms

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.295/0.295/0.295 ms 


WPA2 encryption example using wpa_supplicant

In the i.MX6's root file system, create the following configuration file. For the ciphers (again marked blue), choose TKIP or CCMP, depending on your iwlist output.

#/etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
network={
	ssid="your_ssid_here"
	scan_ssid=1
	proto=WPA RSN
	key_mgmt=WPA-PSK
	pairwise=CCMP
	group=CCMP
	psk="your_passphrase_here"
}


Start wpa_supplicant

/usr/local/sbin/wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B

You can control the connection status. Look for a valid access point.

iwconfig
[...]
wlan0     IEEE 802.11b/g  ESSID:"your_ssid_here"
          Mode:Managed  Frequency:2.437 GHz  Access Point: 0A:C9:0E:48:C1:40

Next, you can start a DHCP client or manually configure the network interface.

udhcpc -i wlan0 -b

Unloading module

modprobe -r libertas_sdio

Debugging SDIO

modprobe libertas libertas_debug=0x00400000
modprobe libertas_sdio
modprobe -r libertas_sdio
Personal tools