Difference between revisions of "CM-FX6: Linux: Debian"

From Compulab Mediawiki
Jump to: navigation, search
(WiFi Initialization)
(CAN interface configuration)
Line 242: Line 242:
 
# amixer cset numid=11,iface=MIXER,name='Input Mux' 0
 
# amixer cset numid=11,iface=MIXER,name='Input Mux' 0
 
# arecord -t wav /tmp/out.wav
 
# arecord -t wav /tmp/out.wav
 +
</pre>
 +
 +
=== Controller–area network (CAN) ===
 +
 +
CM-FX6 features two CAN bus interfaces. The CAN bus interfaces are implemented with the i.MX6 on chip “Flexible Controller Area Network” (FlexCAN) communication modules. FlexCAN supports the following main features:
 +
* Compliant with the CAN 2.0B protocol specification
 +
* Programmable bit rate up to 1 Mb/sec
 +
 +
For information on enabling CAN kernel support, please, see the [[CM-FX6:_Linux:_Kernel#Controller.E2.80.93area_network_.28CAN.29_support|Linux Kernel for CM-FX6]] page.
 +
 +
===== CAN interface configuration =====
 +
It is recommended configure the CAN interface, with the {{filename|iproute2}} utilities.
 +
 +
* To make sure the right {{filename|ip}} utility is used, run:
 +
<pre>
 +
# ip -V
 +
ip utility, iproute2-ss140804
 +
</pre>
 +
 +
* Configure the CAN interface bit-rate to 125 Kbits/sec (values of up to 1Mbit/sec are supported):
 +
<pre>
 +
# ip link set can0 type can bitrate 125000
 +
</pre>
 +
 +
* Enable the CAN interface:
 +
<pre>
 +
# ip link set can0 up
 +
flexcan imx6q-flexcan.0: writing ctrl=0x0e312005
 +
</pre>
 +
 +
===== Send/Receive packets =====
 +
 +
Use {{filename|cansend}} and {{filename|candump}} utilities to send and receive packets via CAN interface.
 +
 +
* Send standard CAN frame (on the first device):
 +
<pre>
 +
# cansend can0 111#1122334455667788
 +
</pre>
 +
 +
* Send extended CAN frame (on the first device):
 +
<pre>
 +
# cansend can0 11111111#1122334455667788
 +
</pre>
 +
 +
* Dump all received data frames as well as error frames (on the second device):
 +
<pre>
 +
# candump any,0:0,#FFFFFFFF
 +
  can0  111  [8] 11 22 33 44 55 66 77 88
 +
  can0  11111111  [8] 11 22 33 44 55 66 77 88
 
</pre>
 
</pre>
  

Revision as of 12:08, 11 November 2014

Overview

The example run-time Linux filesystem image for the CompuLab CM-FX6 System-on-Module / Computer-on-Module is based on Debian GNU/Linux Sid. The CompuLab Linux package for CM-FX6 includes ready to run NAND flash image, Linux kernel configuration and source code patches, and an archive of the root filesystem, used to create the image.

The default Debian Sid Linux image includes more than 400 software packages. Among them:

  • Core system
  • Debian package management system
  • X11 Windowing System
  • Enlightenment desktop manager
  • SSH server and client
  • ALSA configuration and usage utilities
  • CAN Bus utilities
  • Bluetooth tools and daemons

The Getting started with Linux on CM-FX6 page provides a brief introduction on how to install the run-time Linux image. This article describes package structure and peripheral device options specific to the CM-FX6.

Package contents

version.txt

The contents of the version.txt identifies the package version.

images

  • uImage-cm-fx6 - ready to run Linux kernel image binary for CM-FX6
  • debian-image.tar.bz2 - archive of the Debian root file system with:
    • FreeScale GPU support libraries
    • Enlightment window manager
  • debian-image-bt-support.tar.bz2 - archive of the Debian root file system with Bluez 4.x compatible with CM-FX6 Linux kernel
  • kernel.img - Kernel image required for installation onto the NAND flash or the SSD
  • ramdisk.img - Ramdisk image required for installation onto the NAND flash or the SSD
  • bootscr.img - U-Boot script used for image installation

kernel

  • uImage-3.0.35-cm-fx6-6.2.bin - ready to run Linux kernel version 3.0.35-cm-fx6-6.2 for CM-FX6
  • linux-3.0.35-cm-fx6-6.2.config - Linux kernel 3.0.35-cm-fx6-6.2 configuration file
  • linux-3.0.35-cm-fx6-6.2.patch - patch vs. Linux stable kernel 3.0.35 with support for CM-FX6 peripherals
  • patches - ordered collection of patches, that form the single patch above (linux-3.0.35-cm-fx6-6.2.patch)
  • modules_3.0.35-cm-fx6-6.2.tar.gz - a modules tarball, that matches the ready to run Linux kernel (uImage-3.0.35-cm-fx6-6.2.bin)

utilities

The utilities directory contains miscellaneous utilities useful for development

  • tftpd32.zip - TFTP server for Windows users
  • eeprom-util - CompuLab EEPROM utility for reading information found inside the EEPROM on CompuLab boards
  • bootscr.src - U-Boot script source used for loading kernel and ramdisk images from MMC/SD card
  • debian-image.cfg - configuration file used by ubinize utility for debian-image.ubi generation. For more information about UBIFS images please refer to the Linux Development for ARM modules article.

extra

  • deb_packages - FreeScale *.deb packages used in CM-FX6 Debian root filesystem
    • imx-test_3.0.35-4.0.0_armel.deb - platform specific unit tests for mxc platform
    • can-utils_0.0.2+gitba9b189-1_armel.deb - CAN Bus utilities
  • FreeScale GPU
    • 00-Support
      • firmware-imx_3.0.35-4.0.0_armel.deb - Firmware for imx platform
      • gpu-viv-bin-mx6q_3.0.35-4.0.0_armel.deb - GPU driver and application for mx6q
      • imx-lib_3.0.35-4.0.0_armel.deb - platform specific libraries for imx platform
      • udev-fsl-rules_4.0.0-5_armel.deb - userspace udev rules for imx devices
    • 01-Samples
      • viv_samples.tar.bz2 - FreeScale Vivante GPU demos
Admolition note.png The debian-image-squeeze rootfs has all deb-packages installed.

Using Debian Linux on CM-FX6

Connection and Logging In

Use the following username and password to login:

Account with administrative privileges:

User: root
Password: 111111

In addition to these accounts CM-FX6 allows anonymous FTP access. To login into the Linux system, you may use a serial console (ttymxc3) at 115200 bps, or connect through the network, or use a keyboard and DVI/LCD/HDMI display (tty1, tty2, tty3, tty4).

Networking

To configure networking, edit /etc/network/interfaces, /etc/udev/rules.d/70-persistent-net.rules, /etc/resolv.conf, /etc/hostname and /etc/hosts. For more information about Debian Linux network configuration read Network setup chapter in the Debian Reference.


Consoles

The Linux file system image is designed to suit different kernel versions and configurations. Therefore, during the operating system startup, consoles at several serial ports and DVI/LCD display are enabled. Some of these devices may not be supported, either because of kernel versions incompatibilities, or because the kernel was not configured to support these devices. When the console is enabled for such a device, the following or similar message can appear on active console:

INIT: Id "T0" respawning too fast: disabled for 5 minutes

This is not an error message, it is just a warning that can be eliminated by editing /etc/inittab file.

X Windows system

The CompuLab distribution contains full featured X Windows system with Enlightenment 17 window manager. Before starting X Windows, connect USB mouse and keyboard to the system. You can run X Windows by typing startx.

Enlightenment 17 window manager has a built in configuration set up to work best with phones, tablets and similar devices. To activate the "touchscreen" profile, enter Main->Settings Panel->Settings->Profiles. Select the Touchscreen profile.

To switch back to the standard profile, please see the Known Issues article.

Software Management

The Debian Linux image for CM-FX6 includes all the information required to use Debian package management utilities. You can use apt-get and dpkg out of the box.

HDMI Audio

CM-FX6 provides a digital HDMI audio interface, which is registered as a standard ALSA sound card. If the default CM-FX6 configuration is used, the audio drivers are loaded automatically in the boot process.

Admolition note.png The HDMI audio will work only if the HDMI cable is plugged in.

More information about Linux audio subsystem can be found at ALSA project official website.

Analog Audio

CM-FX6 provides an analog audio interface, which is registered as a standard ALSA sound card. If the default CM-FX6 configuration is used, the audio drivers are loaded automatically in the boot process.

aplay -l shows list of all soundcards and digital audio devices registered on the system. Here is an aplay -l sample output.
**** List of PLAYBACK Hardware Devices ****
card 0: wm8731audio [wm8731-audio], device 0: HiFi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: imxhdmisoc [imx-hdmi-soc], device 0: IMX HDMI TX mxc-hdmi-soc-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The 'card 0' is an analog audio device.

Analog Audio Settings

To enable the Analog audio playback, alsamixer or amixer applications can be used.

  • alsamixer - set the “Output Mixer HiFi Playback Switch” control on with arrow buttons.

or

  • amixer - set the “Output Mixer HiFi Playback Switch” control on using command line interface:
# amixer cset numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch' on
# alsactl store wm8731audio

Analog Audio Playback

In order to play back a sound file make use of the aplay application.

  • aplay -L can be used for listing of all pcm devices.

Here is a sample output of aplay -L command:

# aplay -L
default:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
sysdefault:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
default:CARD=imxhdmisoc
    imx-hdmi-soc, 
    Default Audio Device
sysdefault:CARD=imxhdmisoc
    imx-hdmi-soc, 
    Default Audio Device

The next command can be used for audio play back:

# aplay -D sysdefault:CARD=wm8731audio <wav-file>

The above command makes use of the wm8731 audio codec and passes the audio signal to the audio out (J3 on SB-FX6).

  • aplay -l can be used for list all soundcards and digital audio devices.

Here is a sample output of aplay -l command:

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: wm8731audio [wm8731-audio], device 0: HiFi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: imxspdif [imx-spdif], device 0: IMX SPDIF mxc-spdif-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: imxhdmisoc [imx-hdmi-soc], device 0: IMX HDMI TX mxc-hdmi-soc-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The next command can be used for audio play back using the 'hw:card#,device#' notation:

# aplay -D hw:0,0 <wav-file>

The above command makes use of the wm8731 audio described as the hw:0,0.

Recording Audio

CM-FX6 provides recording audio signal from ether “Line In” or “Mic In” sources.

Make use of arecord application for capturing audio signal. arecord -L shows all devices that can be used for audio capturing.

The below list of devices is shown on a CM-FX6 module:

# arecord -L
default:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
sysdefault:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device

Audio Input Settings

CM-FX6 provides an audio capturing feature from either Mic or Line In input sources. alsamixer or amixer can be used in order to switch between these inputs.

Mic
  • alsamixer
Input Mux => Mic
Mic Boost Volume => 1
  • amixer
# amixer cset numid=11,iface=MIXER,name='Input Mux' 1
# amixer cset numid=5,iface=MIXER,name='Mic Boost Volume' 1
Line In
  • alsamixer
Input Mux => Line In
  • amixer
# amixer cset numid=11,iface=MIXER,name='Input Mux' 0

Sample Audio Recording

As soon as the correct input values have been set, audio signal can be captured. Here is a sample command that shows the arecord usage for capturing audio signal from the selected input line.

# arecord < -D sysdefault:CARD=wm8731audio > -t wav /tmp/out.wav

The below sample commands record audio signal from the selected 'Input Mux' device.

  • Mic Example
# amixer cset numid=11,iface=MIXER,name='Input Mux' 1
# amixer cset numid=5,iface=MIXER,name='Mic Boost Volume' 1
# arecord -t wav /tmp/out.wav
  • Line In Example
# amixer cset numid=11,iface=MIXER,name='Input Mux' 0
# arecord -t wav /tmp/out.wav

Controller–area network (CAN)

CM-FX6 features two CAN bus interfaces. The CAN bus interfaces are implemented with the i.MX6 on chip “Flexible Controller Area Network” (FlexCAN) communication modules. FlexCAN supports the following main features:

  • Compliant with the CAN 2.0B protocol specification
  • Programmable bit rate up to 1 Mb/sec

For information on enabling CAN kernel support, please, see the Linux Kernel for CM-FX6 page.

CAN interface configuration

It is recommended configure the CAN interface, with the iproute2 utilities.

  • To make sure the right ip utility is used, run:
# ip -V
ip utility, iproute2-ss140804
  • Configure the CAN interface bit-rate to 125 Kbits/sec (values of up to 1Mbit/sec are supported):
# ip link set can0 type can bitrate 125000
  • Enable the CAN interface:
# ip link set can0 up
flexcan imx6q-flexcan.0: writing ctrl=0x0e312005
Send/Receive packets

Use cansend and candump utilities to send and receive packets via CAN interface.

  • Send standard CAN frame (on the first device):
# cansend can0 111#1122334455667788
  • Send extended CAN frame (on the first device):
# cansend can0 11111111#1122334455667788
  • Dump all received data frames as well as error frames (on the second device):
# candump any,0:0,#FFFFFFFF
  can0  111  [8] 11 22 33 44 55 66 77 88
  can0  11111111  [8] 11 22 33 44 55 66 77 88

USB On-The-Go (OTG)

CM-FX6 features a high-speed USB 2.0 OTG controller. CM-FX6 OTG port is USB host and USB device (gadget) capable.
In CM-FX6 default kernel configuration, the USB host driver is compiled into the kernel, whereas USB gadget drivers are compiled as modules.
Gadget drivers should be loaded for OTG support.

  • Load a Gadget Driver
# modprobe g_audio    
g_audio gadget: controller 'fsl-usb2-udc' not recognized; trying Linux USB Audio Gadget
g_audio gadget: Hardware params: access 3, format 2, channels 2, rate 48000
g_audio gadget: audio_buf_size 48000, req_buf_size 200, req_count 256
g_audio gadget: Linux USB Audio Gadget, version: Dec 18, 2008
g_audio gadget: g_audio ready
Suspend udc for OTG auto detect
USB Gadget resume begins
fsl_udc_resume, Wait for wakeup thread finishes
dr_controller_run: udc out low power mode
USB Gadget resume ends
fsl-usb2-udc: bind to driver g_audio 

Default CM-FX6 kernel configuration enables g_serial, g_file_storage, g_ether and g_audio gadget drivers. More gadget drivers can be enabled in the kernel configuration.

Testing OTG port

Host mode

Connect USB keyboard to OTG port.

usb 1-1: new low speed USB device number 3 using fsl-ehci
usb 1-1: device v413c p2107 is not supported
input: DELL Dell USB Entry Keyboard as /devices/platform/fsl-ehci.0/usb1/1-1/1-1:1.0/input/input5
generic-usb 0003:413C:2107.0003: input,hidraw1: USB HID v1.10 Keyboard [DELL Dell USB Entry Keyboard] on usb-fsl-ehci.0-1/input0
Gadget mode

Load g_audio gadget driver.

# modprobe g_audio
g_audio gadget: controller 'fsl-usb2-udc' not recognized; trying Linux USB Audio Gadget
g_audio gadget: Hardware params: access 3, format 2, channels 2, rate 48000
g_audio gadget: audio_buf_size 48000, req_buf_size 200, req_count 256
g_audio gadget: Linux USB Audio Gadget, version: Dec 18, 2008
g_audio gadget: g_audio ready

Connect desktop PC to OTG port.

g_audio gadget: high speed config #1: Linux USB Audio Gadget

In case the desktop PC is running Linux, this gadget will show up in the aplay -L list:

hw:CARD=Gadget,DEV=0
    Linux USB Audio Gadget, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Gadget,DEV=0
    Linux USB Audio Gadget, USB Audio
    Hardware device with all software conversions

WiFi

CM-FX6 features 802.11b/g/n wireless connectivity solution, implemented with the AzureWave AW-NH387 Wireless controller module.

WiFi Initialization

  • WiFi requires no user interaction for being configured. The driver gets loaded automatically.

Make sure that the WiFi driver is loaded:

# lsmod | grep mwifiex
mwifiex_sdio           12214  0 
mwifiex               113596  1 mwifiex_sdio

The WiFi driver can be loaded manually:

# modprobe mwifiex_sdio
mwifiex_sdio mmc1:0001:1: WLAN FW already running! Skip FW download
mwifiex_sdio mmc1:0001:1: WLAN FW is active
mwifiex_sdio mmc1:0001:1: info: successfully registered wiphy device
mwifiex_sdio mmc1:0001:1: info: mlan0: Marvell 802.11 Adapter
mwifiex_sdio mmc1:0001:1: driver_version = mwifiex 1.0 (14.57.5.p44) 
  • iwconfig command from wireless-tools package can be used to retrieve detailed information about the WiFi interfaces:
# iwconfig mlan0
mlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
  • Activate the interface:
# ifconfig mlan0 up
  • Sample WiFi scanning:
# iwlist mlan0 scan

The output will show the list of Access Points and Ad-Hoc cells in range. For more information about connecting to wireless networks and tuning WiFi interfaces refer to “wpa_supplicant” and “wireless-tools” man pages.

Bluetooth

CM-FX6 features Bluetooth 3.0 + High Speed (HS) interface. Following sections describe the initialization and simple use cases of the Bluetooth interface.

Host Controller Interface (HCI) Initialization

  • HCI requires no user interaction for being configured. The driver gets loaded automatically unless this option has been disabled by putting a black list rule for this device.

Make sure that the Bluetooth driver is loaded:

# lsmod | grep btmrvl
btmrvl_sdio             9024  0 
btmrvl                 10572  3 btmrvl_sdio

The Bluetooth driver can be loaded manually:

# modprobe btmrvl_sdio
Bluetooth: vendor=0x2df, device=0x911a, class=255, fn=2
  • HCI device configuration utility can be run to retrieve detailed information about the Bluetooth interfaces:
# hciconfig -a
hci0:	Type: BR/EDR  Bus: SDIO
	BD Address: 4C:AA:16:66:C4:E0  ACL MTU: 1021:7  SCO MTU: 120:6
	UP RUNNING PSCAN 
	RX bytes:1136 acl:0 sco:0 events:40 errors:0
	TX bytes:1546 acl:0 sco:0 commands:39 errors:0
	Features: 0xff 0xee 0x8f 0xfe 0x9b 0xff 0x79 0x87
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3 
	Link policy: RSWITCH HOLD SNIFF 
	Link mode: SLAVE ACCEPT 
	Name: 'cm-debian-0'
	Class: 0x4a0100
	Service Classes: Networking, Capturing, Telephony
	Device Class: Computer, Uncategorized
	HCI Version: 2.1 (0x4)  Revision: 0x8300
	LMP Version: 2.1 (0x5)  Subversion: 0x810
	Manufacturer: Marvell Technology Group Ltd. (72)
  • If the HCI device is not running, use the below command to enable the HCI device:
# hciconfig hci0 up

A2DP Headphones

  • Scan for available devices to find out Headphones BT device address:
# hcitool scan
Scanning ...
	00:07:A4:F2:B3:CB	Motorola HT820
  • Add new PCM device by editing /etc/asound.conf:
pcm.btheadphones {
   type plug
   slave {
       pcm {
           type bluetooth
           device 00:07:A4:F2:B3:CB
           profile "auto"
       }
   }
   hint {
       show on
       description "BT Headphones"
   }
}
ctl.btheadphones {
  type bluetooth
}
  • List device names to ensure correct settings in /etc/asound.conf:
# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
btheadphones
    BT Headphones
default:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
sysdefault:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
default:CARD=imxhdmisoc
    imx-hdmi-soc, 
    Default Audio Device
sysdefault:CARD=imxhdmisoc
    imx-hdmi-soc, 
    Default Audio Device
  • Put the headphones in the pairing mode.


Admolition warning.png Debian Sid example root file system has Bluez 5.x support which is compatible with Linux kernel v3.4 and higher.

In order to apply the commands below, please use debian-image-bt-support.tar.bz2 rootfs image with Bluez 4.x support.

  • Launch bluez-simple-agent application and provide device PIN code on request:
# bluez-simple-agent hci0 00:07:A4:F2:B3:CB
RequestPinCode (/org/bluez/1335/hci0/dev_00_07_A4_F2_B3_CB)
Enter PIN Code: 0000
Release
New device (/org/bluez/1335/hci0/dev_00_07_A4_F2_B3_CB)
  • Launch aplay playback tool:
# aplay -D btheadphones sample_audio.wav
Playing WAVE 'sample_audio.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo

Touchscreen

The CM-FX6 Evaluation Kit is equipped with DataImage SCF0403852GGU04 LCD touch panel. See LCD, DVI and HDMI support and Touchscreen support sections for kernel configuration details to enable support for the particular touchscreen. The touchscreen driver is modularized if you use default CM-FX6 configuration and is loaded by udev automatically on Linux boot. If the touchscreen driver is not loaded, the following command will load the touchscreen driver:

  • For TI TSC2046 touch panel:
modprobe ads7846
  • For DataImage SCF0403852GGU04 LCD touch panel (Himax HX8520-C):
modprobe hx8520-c

The X Windows system of CM-FX6 uses tslib X server input driver to get the input from the touchscreen.

Touchscreen calibration

Both supported touchscreen devices can be accessed through symbolic link /dev/input/touchscreen. The symlink is created by udev rules defined in /etc/udev/rules.d/10-touchscreen.rules.

Touchscreen calibration is performed with the xinput_calibrator utility available in package xinput_calibrator. To calibrate the touchscreen:

  • Make sure X Server is running
  • Make sure the touchscreen driver is loaded as described in Touchscreen section
  • Run the xinput_calibrator utility.
DISPLAY=:0 xinput_calibrator
  • Use a stylus to tap the four registration point indicated in red on screen by the program.
  • Follow the instruction at the end of the procedure in order make the calibration permanent.
	Setting calibration data: 0, 4095, 0, 4095
Calibrating EVDEV driver for "ADS7846 Touchscreen" id=8
	current calibration values (from XInput): min_x=0, max_x=4095 and min_y=0, max_y=4095

Doing dynamic recalibration:
	Setting calibration data: 14, 4099, 21, 4087
	--> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
	Identifier	"calibration"
	MatchProduct	"ADS7846 Touchscreen"
	Option	"Calibration"	"14 4099 21 4087"
	Option	"SwapAxes"	"0"
EndSection

MMC/SD

The support for MMC/SD card on CM-FX6 is built into the Linux kernel. To mount a memory card, monitor /proc/partitions to see what partitions were detected on the MMC/SD card. For example, suppose an MMC/SD partition you'd like to mount is mmcblk0p1 then:

if [ ! -d /mnt/mmcblk0p1 ]; then mkdir /mnt/mmcblk0p1; fi
mount /dev/mmcblk0p1 /mnt/mmcblk0p1

Display options

CM-FX6 evaluation platform can be used with either of four display interfaces: LCD or DVI, HDMI and LVDS. Default configuration of Linux kernel and Debian Linux for CM-FX6 uses LCD as primary video output interface. It is possible to use either the DVI or the LCD interface at the same time. HDMI can be used simultaneously with LVDS and either LCD or DVI interfaces.
Linux kernel implementation of the CM-FX6 display subsystem (IPU) is described in LCD, DVI, HDMI and LVDS support section.

In the default Linux configuration for CM-FX6, four main framebuffers are available: /dev/fb0, /dev/fb2, /dev/fb3, and /dev/fb5. The default mapping is:

  • LCD/DVI <---> /dev/fb0
  • HDMI <---> /dev/fb2
  • LVDS0 <---> /dev/fb3
  • LVDS1 <---> /dev/fb5

Starting X Server

X server has an option to use FRAMEBUFFER environment variable in order to redefine the default frame buffer device. This variable can be used in order to make the X Server use a specified frame buffer. Bellow are examples of starting X Server using different frame buffers

  • fb2 -> HDMI
FRAMEBUFFER=/dev/fb2 startx
  • fb3 -> LVDS0
FRAMEBUFFER=/dev/fb3 startx
  • fb5 -> LVDS1
FRAMEBUFFER=/dev/fb5 startx

Setting Desired Frame Buffer Parameters

Changing Frame Buffer Settings via Kernel Video Parameter

In order to set a desired frame buffer resolution, the following kernel command line parameters can be used:

  • For DVI on /dev/fb0:
    video=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32
  • For HDMI on /dev/fb2:
    video=mxcfb2:dev=hdmi,1920x1080M-32@50,if=RGB32
  • For LVDS0 on /dev/fb3:
    video=mxcfb3:dev=ldb,1366x768M-18@60,if=RGB666
  • For LVDS1 on /dev/fb5:
    video=mxcfb5:dev=ldb,1366x768M-18@60,if=RGB666

Changing Frame Buffer Settings via SYSFS

Here is another approach of changing the frame buffer resolution. Each frame buffer has an entry on sysfs:

# ls -al /sys/class/graphics/fb[0-5]
lrwxrwxrwx 1 root root 0 Jan  4 19:46 /sys/class/graphics/fb0 -> ../../devices/platform/mxc_sdc_fb.0/graphics/fb0
lrwxrwxrwx 1 root root 0 Jan  4 19:46 /sys/class/graphics/fb1 -> ../../devices/platform/mxc_sdc_fb.0/graphics/fb1
lrwxrwxrwx 1 root root 0 Jan  4 19:46 /sys/class/graphics/fb2 -> ../../devices/platform/mxc_sdc_fb.1/graphics/fb2
lrwxrwxrwx 1 root root 0 Jan  4 19:46 /sys/class/graphics/fb3 -> ../../devices/platform/mxc_sdc_fb.2/graphics/fb3
lrwxrwxrwx 1 root root 0 Jan  4 19:46 /sys/class/graphics/fb4 -> ../../devices/platform/mxc_sdc_fb.2/graphics/fb4
lrwxrwxrwx 1 root root 0 Jan  4 19:46 /sys/class/graphics/fb5 -> ../../devices/platform/mxc_sdc_fb.3/graphics/fb5
  • 2-nd frame buffer resolution:
# cat /sys/class/graphics/fb2/mode
U:1280x720p-50
  • 2-nd frame buffer supported modes:
# cat /sys/class/graphics/fb2/modes
U:1280x720p-50
S:1280x720p-50
S:720x576p-50
S:1920x1080p-50
S:640x480p-60
S:720x480p-60
S:720x480p-60
S:1280x720p-60
S:1920x1080p-60
U:1920x1080p-60
S:1280x1024p-60
S:1152x864p-75
V:1280x1024p-75
V:1024x768p-75
V:1024x768p-60
V:800x600p-75
V:800x600p-60
V:640x480p-75
V:640x480p-60
U:720x400p-70
D:1920x1080p-60
V:640x480p-60
  • To change mode of the 2-nd frame buffer to "D:1920x1080p-60"
echo "D:1920x1080p-60" > /sys/class/graphics/fb2/mode

DVI/HDMI/LVDS Data Output Format

In order to change the default frame buffer mapping, the following kernel command line parameters can be provided:

  • For DVI on /dev/fb0:
    video=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32
  • For HDMI on /dev/fb0:
    video=mxcfb0:dev=hdmi,1920x1080M-32@50,if=RGB32
  • For LVDS on /dev/fb0:
    video=mxcfb0:dev=ldb,1366x768M-18@60,if=RGB666

GPIO access

Linux provides simple and convenient GPIO access via sysfs interface. A GPIO should be exported using /sys/class/gpio/export. After the GPIO is exported it is possible to change its direction and value using /sys/class/gpio/gpioX/direction and /sys/class/gpio/gpioX/value attributes.

Example

The following example demonstrates how to configure GPIO 140 as output and set value to high:

echo 140 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio140/direction
echo 1 > /sys/class/gpio/gpio140/value
Admolition note.png The above example assumes that the corresponding pin is set to mux mode 5 and the GPIO 140 is not requested in the Linux kernel.

Debian Sid Linux

The purpose of this image is to provide the environment in order to show the FreeScale GPU and camera features.

Connection and Logging In

Use the following username and password to login:

Account with administrative privileges:

User: root
Password: 111111

To login into the Linux system, you may use a serial console (ttymxc3) at 115200 bps, or connect through the network, or use a keyboard and DVI/LCD/HDMI display (tty1, tty2, tty3, tty4, tty5, tty6).

Admolition note.png Serial console (ttymxc3) provides a password less login with the root credentials.

GPU Demos

This is a FreeScale tarball with the FreeScale GPU demos.

  • Unpack viv_samples.tar.bz2 from cm-fx6-linux/extra/FreeScale GPU/01-Samples directory.
  • Make the viv_samples.tar.bz2 content available to the CM-FX6 board. Use either nfs-mount or copy the viv_samples.tar.bz2 content to a media available to CM-FX6 board.
  • On the CM-FX6 Linux console run:
# startx
  • After the X server has started, open a terminal window: Mouse Right Click → Applications → Terminal Emulators → Xterm
  • Mount the storage device or an NFS share with the content of viv_samples.tar.bz2 and enter the viv_samples directory:
# cd /path/to/mount/point/viv_samples/opt/viv_samples/vdk/
  • Run any of the available tests: ./tutorial[1..7]_es20
# ./tutorial1_es20
# ./tutorial2_es20
# ./tutorial3_es20
# ./tutorial4_es20
# ./tutorial5_es20
# ./tutorial6_es20
# ./tutorial7_es20

Press 'ESC' for exit

Camera

Linux provides a variety of streaming tools for the V4L2 compliant devices. We provide two examples such as: imx-test and mplayer.

imx-test

imx-test is a FreeScale package that can be used to show the Camera Serial Interface (CSI) functionality.

  • Unpack imx-test_3.0.35-4.0.0_armel.deb from cm-fx6-linux/extra/deb_packages directory:
# dpkg -x imx-test_3.0.35-4.0.0_armel.deb /path/to/cm-fx6-shared-directory
  • Make the /path/to/cm-fx6-shared-directory content available to the CM-FX6 board. Use either nfs-mount or copy the /path/to/cm-fx6-shared-directory content to a media available to CM-FX6 board.
  • On the CM-FX6 Linux console run:
# startx
  • After the X server has started, open a terminal window: Mouse Right Click → Applications → Terminal Emulators → Xterm
Streaming the camera output to the frame buffer
# /path/to/imx-test_directory/unit_tests/mxc_v4l2_overlay.out -ow 720 -oh 525
Capturing a stills image
# /path/to/imx-test_directory/mxc_v4l2_still.out -f UYVY -w 720 -h 525 -m 1

mplayer

MPlayer application is not a part of the example root file system image. In order to install it run the following command:

apt-get install mplayer
Streaming the camera output
# mplayer tv:// -tv driver=v4l2:device=/dev/video0:outfmt=uyvy:width=720:height=524

See also