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

From Compulab Mediawiki
Jump to: navigation, search
(kernel)
(Frame Buffer Tunning Using Kernel Arguments)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Overview ==
 
== 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 Wheezy.
+
The example run-time Linux filesystem image for the CompuLab CM-FX6 System-on-Module / Computer-on-Module is based on Debian GNU/Linux Stretch.
 
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 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 Wheezy Linux image includes more than 400 software packages. Among them:
+
The default Debian Stretch Linux image includes more than 400 software packages. Among them:
  
 
* Core system
 
* Core system
Line 10: Line 10:
 
* Fluxbox desktop manager
 
* Fluxbox desktop manager
 
* SSH server and client
 
* SSH server and client
* ALSA configuration and usage utilities  
+
* PulseAudio configuration and usage utilities  
 
* CAN Bus utilities
 
* CAN Bus utilities
* Bluetooth tools and daemons
+
* Bluez5 Bluetooth tools and daemons
 +
* iw/wpasupplicant wireless tools
  
 
The [[CM-FX6: Linux: Getting started|Getting started with Linux on CM-FX6]] page provides a brief introduction on how to install the run-time Linux image.
 
The [[CM-FX6: Linux: Getting started|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.
 
This article describes package structure and peripheral device options specific to the CM-FX6.
  
== Package contents ==
 
  
=== version.txt ===
 
The contents of the {{filename|version.txt}} identifies the package version.
 
 
=== images ===
 
* {{filename|uImage-cm-fx6}} - ready to run Linux kernel image binary for CM-FX6
 
* {{filename|debian-image.tar.bz2}} - archive of the Debian Wheezy root file system with:
 
* {{filename|kernel.img}} - Kernel image required for installation onto the NAND flash or the SSD
 
* {{filename|ramdisk.img}} - Ramdisk image required for installation onto the NAND flash or the SSD
 
* {{filename|bootscr.img}} - U-Boot script used for image installation
 
 
=== kernel ===
 
* {{filename|uImage-3.0.35-cm-fx6-6.4.bin}} - ready to run Linux kernel version 3.0.35-cm-fx6-6.4 for CM-FX6
 
* {{filename|linux-3.0.35-cm-fx6-6.4.config}} - Linux kernel 3.0.35-cm-fx6-6.4 configuration file
 
* {{filename|linux-3.0.35-cm-fx6-6.4.patch}} - patch vs. [http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=839cf7a236278ae358ff12141a168c0982fa0cd9 Linux stable kernel 3.0.35] with support for CM-FX6 peripherals
 
* {{filename|patches}} - ordered collection of patches, that form the single patch above ({{filename|linux-3.0.35-cm-fx6-6.4.patch}})
 
* {{filename|modules_3.0.35-cm-fx6-6.4.tar.gz}} - a modules tarball, that matches the ready to run Linux kernel ({{filename|uImage-3.0.35-cm-fx6-6.4.bin}})
 
 
=== utilities ===
 
The {{filename|utilities}} directory contains miscellaneous utilities useful for development
 
* {{filename|tftpd32.zip}} - TFTP server for Windows users
 
* {{filename|eeprom-util}} - CompuLab EEPROM utility for reading information found inside the EEPROM on CompuLab boards
 
* {{filename|bootscr.src}} - U-Boot script source used for loading kernel and ramdisk images from MMC/SD card
 
* {{filename|debian-image.cfg}} - configuration file used by {{filename|ubinize}} utility for {{filename|debian-image.ubi}} generation. For more information about UBIFS images please refer to the [[Linux_Development_for_ARM_modules#UBIFS_images|Linux Development for ARM modules]] article.
 
 
=== extra ===
 
* deb_packages - FreeScale *.deb packages used in CM-FX6 Debian root filesystem
 
** firmware-cm-fx6_3.0.35-4.0.0_armel.deb - firmware for CM-FX6 platform
 
** 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
 
*** 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
 
* FreeScale VPU - FreeScale plugins, codecs in deb-package format and the {{filename|.install}} installation script.
 
  
 
== Using Debian Linux on CM-FX6 ==
 
== Using Debian Linux on CM-FX6 ==
  
 
=== Connection and Logging In ===
 
=== Connection and Logging In ===
Use the following username and password to login:
+
Use the following username to login:
  
 
Account with administrative privileges:
 
Account with administrative privileges:
 
<pre>
 
<pre>
 
User: root
 
User: root
Password: 111111
 
 
</pre>
 
</pre>
  
 
To login into the Linux system, you may use a serial console (ttymxc3) at 115200 bps, or connect through the network (ssh), or use a keyboard and DVI/LCD/HDMI display (tty1, tty2, tty3, tty4).
 
To login into the Linux system, you may use a serial console (ttymxc3) at 115200 bps, or connect through the network (ssh), or use a keyboard and DVI/LCD/HDMI display (tty1, tty2, tty3, tty4).
 +
 +
==== root password ====
 +
This Debian rootfs comes w/out default root password.<br>
 +
The root password has to be set at the very 1-st login:
 +
 +
<pre>
 +
Debian GNU/Linux stretch/sid imx6-sid ttymxc3
 +
 +
imx6-sid login: root
 +
You are required to change your password immediately (root enforced)
 +
Enter new UNIX password:
 +
</pre>
  
 
=== Networking ===
 
=== Networking ===
 +
SBC-FX6 allows using two network interfaces:
 +
* FEC
 +
This is an internal iMX6 SoC NIC (accessible in U-Boot).
 +
A network interface assigned for this device gets named '''eth0'''.
 +
* i211
 +
This is an external NIC resides on SB-FX6. In order to make it work, the SB-FX6 P31 jumper must be open.
 +
A network interface assigned for this device gets named '''enp1s0'''.<br>
 +
A udev rule can be used for renaming this device into a convenient '''ethX''' name. Here is a rule:
 +
cat << eof >> /etc/udev/rules.d/70-persistent-net.rules
 +
# PCI device 0x8086:0x0x1539 (i211)
 +
SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1539", KERNEL=="eth*", NAME="eth1"
 +
eof
 +
Applying the rule w/out a reboot:
 +
udevadm control --reload
 +
modprobe igb -r
 +
modprobe igb
 
To configure networking, edit {{filename|/etc/network/interfaces}}, {{filename|/etc/udev/rules.d/70-persistent-net.rules}}, {{filename|/etc/resolv.conf}}, {{filename|/etc/hostname}} and {{filename|/etc/hosts}}.
 
To configure networking, edit {{filename|/etc/network/interfaces}}, {{filename|/etc/udev/rules.d/70-persistent-net.rules}}, {{filename|/etc/resolv.conf}}, {{filename|/etc/hostname}} and {{filename|/etc/hosts}}.
 
For more information about Debian Linux network configuration read:
 
For more information about Debian Linux network configuration read:
Line 96: Line 86:
  
 
=== Consoles ===
 
=== 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:  
+
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. '''systemd''' is able to configure most of them.
<pre>
+
Detail information can be found here:
INIT: Id "T0" respawning too fast: disabled for 5 minutes
+
* Systemd getty generator [http://www.freedesktop.org/software/systemd/man/systemd-getty-generator.html systemd-getty-generator]
</pre>
+
* Gettys on Serial Consoles [http://0pointer.de/blog/projects/serial-console.html serial-console]
This is not an error message, it is just a warning that can be eliminated by editing {{filename|/etc/inittab}} file.
 
  
 
=== X Windows system ===
 
=== X Windows system ===
Line 108: Line 97:
  
 
=== Software Management ===
 
=== Software Management ===
 
 
The Debian Linux image for CM-FX6 includes all the information required to use Debian package management utilities.
 
The Debian Linux image for CM-FX6 includes all the information required to use Debian package management utilities.
 
You can use [http://linux.die.net/man/8/apt-get apt-get] and [http://www.wlug.org.nz/dpkg(8) dpkg] out of the box.
 
You can use [http://linux.die.net/man/8/apt-get apt-get] and [http://www.wlug.org.nz/dpkg(8) dpkg] out of the box.
  
=== HDMI Audio ===
+
=== Audio Outputs ===
CM-FX6 provides a digital HDMI audio interface, which is registered as a standard ALSA sound card.
+
CM-FX6 provides free different audio interfaces. These interfaces registered as standard ALSA sound cards. If the default CM-FX6 configuration is used, all audio drivers are loaded automatically in the boot process.
If the default CM-FX6 configuration is used, the audio drivers are loaded automatically in the boot process.
 
{{Note|The HDMI audio will work only if the HDMI cable is plugged in.}}
 
 
 
 
More information about Linux audio subsystem can be found at [http://www.alsa-project.org ALSA project official website].
 
More information about Linux audio subsystem can be found at [http://www.alsa-project.org 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.
 
 
<dl>
 
<dl>
 
'''''aplay -l''''' shows list of all soundcards and digital audio devices registered on the system. Here is an '''''aplay -l''''' sample output.
 
'''''aplay -l''''' shows list of all soundcards and digital audio devices registered on the system. Here is an '''''aplay -l''''' sample output.
Line 126: Line 108:
 
<pre>
 
<pre>
 
**** List of PLAYBACK Hardware Devices ****
 
**** List of PLAYBACK Hardware Devices ****
card 0: wm8731audio [wm8731-audio], device 0: HiFi wm8731-hifi-0 []
+
card 0: cmfx6 [cm-fx6], device 0: 202c000.ssi-wm8731-hifi wm8731-hifi-0 []
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
card 1: imxhdmisoc [imx-hdmi-soc], device 0: IMX HDMI TX mxc-hdmi-soc-0 []
+
card 1: imxhdmisoc [imx-hdmi-soc], device 0: i.MX HDMI Audio Tx hdmi-hifi-0 []
 +
  Subdevices: 1/1
 +
  Subdevice #0: subdevice #0
 +
card 2: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
 
</pre>
 
</pre>
  
The 'card 0' is an analog audio device.
+
==== Default Audio Device ====
 +
The default audio interface in this Linux dsistribution is ''cm-fx6''.
  
==== Analog Audio Settings ====
+
==== Analog Audio ====
To enable the Analog audio playback, {{cmd|alsamixer}} or {{cmd|amixer}} applications can be used.
+
The CM-FX6 analog audio functionality is implemented by interfacing the Wolfson wm8731 audio
* {{cmd|alsamixer}} - set the “''Output Mixer HiFi Playback Switch''” control on with arrow buttons.
+
codec with i.MX6 AUDMUX port 4. The interface controls:
or
+
<pre>
* {{cmd|amixer}} - set the “''Output Mixer HiFi Playback Switch''” control on using command line interface:
+
# amixer controls
 +
numid=2,iface=MIXER,name='Master Playback ZC Switch'
 +
numid=1,iface=MIXER,name='Master Playback Volume'
 +
numid=4,iface=MIXER,name='Line Capture Switch'
 +
numid=5,iface=MIXER,name='Mic Boost Volume'
 +
numid=6,iface=MIXER,name='Mic Capture Switch'
 +
numid=8,iface=MIXER,name='ADC High Pass Filter Switch'
 +
numid=3,iface=MIXER,name='Capture Volume'
 +
numid=10,iface=MIXER,name='Playback Deemphasis Switch'
 +
numid=11,iface=MIXER,name='Input Mux'
 +
numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch'
 +
numid=12,iface=MIXER,name='Output Mixer Line Bypass Switch'
 +
numid=13,iface=MIXER,name='Output Mixer Mic Sidetone Switch'
 +
numid=7,iface=MIXER,name='Sidetone Playback Volume'
 +
numid=9,iface=MIXER,name='Store DC Offset Switch'
 +
</pre>
 +
* Analog Audio Settings.
 +
wm8731 codec has a controll named as “''Output Mixer HiFi Playback Switch''”.
 +
This controll has two values: 0/1 - On/Off. The default value is '0'.
 +
Turn it on in order to unmute the analog output. Issue this command:
 
<pre>
 
<pre>
 
# amixer cset numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch' on
 
# amixer cset numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch' on
# alsactl store wm8731audio
+
</pre>
 +
Save the card state in order to make these settings permanent.
 +
<pre>
 +
# alsactl store cm-fx6
 +
</pre>
 +
* Playback using wm8731 output:
 +
<pre>
 +
# aplay -D hw:0,0 <wav-file>
 
</pre>
 
</pre>
  
==== Analog Audio Playback ====
+
==== HDMI ====
In order to play back a sound file make use of the {{cmd|aplay}} application.
+
{{Note|The HDMI audio will work only if the HDMI cable is plugged in.}}
<dl>
+
The interface controls:
* {{cmd|aplay -L}} can be used for listing of all pcm devices.
+
<pre>
</dl>
+
# amixer -c 1 controls
Here is a sample output of {{cmd|aplay -L}} command:
+
numid=1,iface=MIXER,name='IEC958 Playback Default'
 +
numid=2,iface=MIXER,name='HDMI Support Channels'
 +
numid=4,iface=MIXER,name='HDMI Support Formats'
 +
numid=3,iface=MIXER,name='HDMI Support Rates'
 +
</pre>
 +
Playback using HDMI output:
 
<pre>
 
<pre>
# aplay -L
+
# aplay -D hw:1,0 <wav-file>
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
 
 
</pre>
 
</pre>
  
The next command can be used for audio play back:
+
==== SPDIF ====
 +
The Sony/Philips Digital Interface (SPDIF) module is a stereo that allows the processor transmit digital audio over it using the IEC60958 standard, consumer format. i.MX 6Dual/6Quad provides one SPDIF transmitter with one output and one SPDIF receiver with one input.
 +
* SB-FX6 P40 is SPDIF OUT
 +
* SB-FX6 P47 is SPDIF IN
 +
{{Note|The SPDIF audio will work only if the SPDIF cable is plugged in.}}
 +
The interface controls:
 
<pre>
 
<pre>
# aplay -D sysdefault:CARD=wm8731audio <wav-file>
+
# amixer -c 2 controls
 +
numid=1,iface=MIXER,name='IEC958 Playback Default'
 +
numid=2,iface=PCM,name='IEC958 Capture Default'
 +
numid=4,iface=PCM,name='IEC958 Q-subcode Capture Default'
 +
numid=3,iface=PCM,name='IEC958 Subcode Capture Default'
 +
numid=7,iface=PCM,name='IEC958 USyncMode CDText'
 +
numid=5,iface=PCM,name='IEC958 V-Bit Errors'
 +
numid=6,iface=PCM,name='RX Sample Rate'
 +
</pre>
 +
Playback using SPDIF output:
 +
<pre>
 +
# aplay -D hw:2,0 <wav-file>
 
</pre>
 
</pre>
The above command makes use of the wm8731 audio codec and passes the audio signal to the audio out (J3 on SB-FX6).
 
  
<dl>
+
==== Sound Capture Devices ====
* {{cmd|aplay -l}} can be used for list all soundcards and digital audio devices.
+
{{cmd|arecord -l}} shows all devices that can be used for audio capturing.
</dl>
 
Here is a sample output of {{cmd|aplay -l}} command:
 
 
<pre>
 
<pre>
# aplay -l
+
# arecord -l
**** List of PLAYBACK Hardware Devices ****
+
**** List of CAPTURE Hardware Devices ****
card 0: wm8731audio [wm8731-audio], device 0: HiFi wm8731-hifi-0 []
+
card 0: cmfx6 [cm-fx6], device 0: 202c000.ssi-wm8731-hifi wm8731-hifi-0 []
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
card 1: imxspdif [imx-spdif], device 0: IMX SPDIF mxc-spdif-0 []
+
card 2: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-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
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
 
</pre>
 
</pre>
  
The next command can be used for audio play back using the 'hw:card#,device#' notation:
+
==== Analog Audio Recording ====
<pre>
+
Wolfsom wm8731 provides an audio capturing feature from either ''Mic In'' or ''Line In'' input sources.
# aplay -D hw:0,0 <wav-file>
+
{{cmd|alsamixer}} or {{cmd|amixer}} can be used in order to switch between these inputs.
</pre>
+
* Set bitrate options:
 
 
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.
 
<dl>
 
Make use of {{cmd|arecord}} application for capturing audio signal. {{cmd|arecord -L}} shows all devices that can be used for audio capturing.
 
</dl>
 
The below list of devices is shown on a CM-FX6 module:
 
 
<pre>
 
<pre>
# arecord -L
+
# export RATE_OPT="--rate=32000"
default:CARD=wm8731audio
 
    wm8731-audio,
 
    Default Audio Device
 
sysdefault:CARD=wm8731audio
 
    wm8731-audio,
 
    Default Audio Device
 
 
</pre>
 
</pre>
 
+
* Line In recording:
==== Audio Input Settings ====
 
CM-FX6 provides an audio capturing feature from either ''Mic'' or ''Line In'' input sources.
 
{{cmd|alsamixer}} or {{cmd|amixer}} can be used in order to switch between these inputs.
 
===== Mic =====
 
* {{cmd|alsamixer}}
 
:: Input Mux => Mic
 
:: Mic Boost Volume => 1
 
* {{cmd|amixer}}
 
 
<pre>
 
<pre>
# amixer cset numid=11,iface=MIXER,name='Input Mux' 1
+
# : Line In recording
# amixer cset numid=5,iface=MIXER,name='Mic Boost Volume' 1
 
 
</pre>
 
</pre>
 
===== Line In =====
 
* {{cmd|alsamixer}}
 
:: Input Mux => Line In
 
* {{cmd|amixer}}
 
 
<pre>
 
<pre>
# amixer cset numid=11,iface=MIXER,name='Input Mux' 0
+
amixer cset numid=3 31
 +
amixer cset numid=4 1
 +
amixer cset numid=6 0
 +
amixer cset numid=11 0
 +
: Filters
 +
amixer cset numid=8 1
 +
amixer cset numid=10 1
 +
: Line Output ByPass On
 +
amixer cset numid=12 1
 +
: Mic Output ByPass Off
 +
amixer cset numid=13 0
 +
: Recording
 +
arecord -f cd -t wav --duration=30 ${RATE_OPT} /tmp/file.vaw
 
</pre>
 
</pre>
 
+
* Mic In recording:
==== 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 {{cmd|arecord}} usage for capturing audio signal from the selected input line.
 
 
<pre>
 
<pre>
# arecord < -D sysdefault:CARD=wm8731audio > -t wav /tmp/out.wav
+
# : Mic In recording
 
</pre>
 
</pre>
The below sample commands record audio signal from the selected 'Input Mux' device.
 
* Mic Example
 
 
<pre>
 
<pre>
# amixer cset numid=11,iface=MIXER,name='Input Mux' 1
+
amixer cset numid=3 31
# amixer cset numid=5,iface=MIXER,name='Mic Boost Volume' 1
+
amixer cset numid=4 0
# arecord -t wav /tmp/out.wav
+
amixer cset numid=6 1
 +
amixer cset numid=11 1
 +
: Filters
 +
amixer cset numid=8 1
 +
amixer cset numid=10 1
 +
: Line Output ByPass Off
 +
amixer cset numid=12 0
 +
: Mic Output ByPass On
 +
amixer cset numid=13 1
 +
: Recording
 +
arecord -f cd -t wav --duration=30 ${RATE_OPT} /tmp/file.vaw
 
</pre>
 
</pre>
* Line In Example
+
* Playback a recorded file:
 
<pre>
 
<pre>
# amixer cset numid=11,iface=MIXER,name='Input Mux' 0
+
# aplay -vv /tmp/file.wav
# arecord -t wav /tmp/out.wav
 
 
</pre>
 
</pre>
  
Line 308: Line 310:
 
In CM-FX6 default kernel configuration, the USB host driver is compiled into the kernel, whereas USB gadget drivers are compiled as modules.<br>
 
In CM-FX6 default kernel configuration, the USB host driver is compiled into the kernel, whereas USB gadget drivers are compiled as modules.<br>
 
Gadget drivers should be loaded for OTG support.
 
Gadget drivers should be loaded for OTG support.
* Load a Gadget Driver
+
<br>
<pre>
+
Default CM-FX6 kernel configuration enables {{filename|g_serial}}, {{filename|g_file_storage}}, {{filename|g_ether}} and {{filename|g_audio}} gadget drivers. Additional gadget drivers can be enabled in the kernel configuration.
# 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
 
</pre>
 
 
 
Default CM-FX6 kernel configuration enables {{filename|g_serial}}, {{filename|g_file_storage}}, {{filename|g_ether}} and {{filename|g_audio}} gadget drivers.
 
More gadget drivers can be enabled in the kernel configuration.
 
  
 
==== Testing OTG port ====
 
==== Testing OTG port ====
 
 
===== Host mode =====
 
===== Host mode =====
Connect USB keyboard to OTG port.
+
Connect a USB keyboard to the OTG port P48 using a UsbOTGAdapter.
 +
Make sure that the device was recognized by the system. Evaluate ''lsusb'' and ''dmesg'' outputs.
 
<pre>
 
<pre>
usb 1-1: new low speed USB device number 3 using fsl-ehci
+
# lsusb
usb 1-1: device v413c p2107 is not supported
+
Bus 002 Device 002: ID 413c:2106 Dell Computer Corp. Dell QuietKey Keyboard
input: DELL Dell USB Entry Keyboard as /devices/platform/fsl-ehci.0/usb1/1-1/1-1:1.0/input/input5
+
# dmesg
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
+
ci_hdrc ci_hdrc.0: EHCI Host Controller
 +
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 2
 +
ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
 +
hub 2-0:1.0: USB hub found
 +
hub 2-0:1.0: 1 port detected
 +
usb 2-1: new low-speed USB device number 2 using ci_hdrc
 +
input: Dell Dell QuietKey Keyboard as /devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/usb2/2-1/2-1:1.0/0003:413C:2106.0004/input/input4
 +
hid-generic 0003:413C:2106.0004: input: USB HID v1.10 Keyboard [Dell Dell QuietKey Keyboard] on usb-ci_hdrc.0-1/input0
 
</pre>
 
</pre>
  
 
===== Gadget mode =====
 
===== Gadget mode =====
Load g_audio gadget driver.
+
* g_audio
 
<pre>
 
<pre>
 
# modprobe g_audio
 
# 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: 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: Feb 2, 2012
g_audio gadget: Linux USB Audio Gadget, version: Dec 18, 2008
 
 
g_audio gadget: g_audio ready
 
g_audio gadget: g_audio ready
 
</pre>
 
</pre>
Connect desktop PC to OTG port.
+
Connect a desktop PC to the OTG port.
 
<pre>
 
<pre>
 
g_audio gadget: high speed config #1: Linux USB Audio Gadget
 
g_audio gadget: high speed config #1: Linux USB Audio Gadget
 
</pre>
 
</pre>
In case the desktop PC is running Linux, this gadget will show up in the {{cmd|aplay -L}} list:
+
In case the desktop PC is running Linux, this gadget will show up in the {{cmd|aplay -l}} and {{cmd|lsusb}:
 +
<pre>
 +
# : Desktop PC shell
 +
# aplay -l | awk '/Gadget/,0'
 +
card 3: Gadget [Linux USB Audio Gadget], device 0: USB Audio [USB Audio]
 +
  Subdevices: 1/1
 +
  Subdevice #0: subdevice #0
 +
# lsusb  | awk '/Gadget/'
 +
Bus 001 Device 111: ID 1d6b:0101 Linux Foundation Audio Gadget
 +
</pre>
 +
* Playback using the USB Gabget:
 +
The sound goes to the SB-FX6 J3 audio out.
 
<pre>
 
<pre>
hw:CARD=Gadget,DEV=0
+
# aplay -D hw:3,0 <wav-file>
    Linux USB Audio Gadget, USB Audio
+
</pre>
    Direct hardware device without any conversions
+
* g_mass_storage
plughw:CARD=Gadget,DEV=0
+
<pre>
     Linux USB Audio Gadget, USB Audio
+
# modprobe g_mass_storage file=/dev/sdb
    Hardware device with all software conversions
+
Mass Storage Function, version: 2009/09/11
 +
LUN: removable file: (no medium)
 +
LUN: file: /dev/sdb
 +
Number of LUNs=1
 +
g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
 +
g_mass_storage gadget: userspace failed to provide iSerialNumber
 +
g_mass_storage gadget: g_mass_storage ready
 +
g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
 +
</pre>
 +
Connect desktop PC to OTG port.<br>
 +
In case the desktop PC is running Linux, this gadget will show up in the {{cmd|lsusb}} list:
 +
<pre>
 +
# lsusb
 +
...
 +
Bus 001 Device 117: ID 0525:a4a5 Netchip Technology, Inc. Pocketbook Pro 903
 +
...
 +
</pre>
 +
The new device information shows up in the system log.
 +
<pre>
 +
# dmesg
 +
[93333.477394] usb 1-1.2.4: new high-speed USB device number 119 using ehci-pci
 +
[93333.587166] usb 1-1.2.4: New USB device found, idVendor=0525, idProduct=a4a5
 +
[93333.587172] usb 1-1.2.4: New USB device strings: Mfr=3, Product=4, SerialNumber=0
 +
[93333.587175] usb 1-1.2.4: Product: Mass Storage Gadget
 +
[93333.587177] usb 1-1.2.4: Manufacturer: Linux 4.1.15-cm-fx6-8.0 with 2184000.usb
 +
[93333.595095] usb-storage 1-1.2.4:1.0: USB Mass Storage device detected
 +
[93333.595371] usb-storage 1-1.2.4:1.0: Quirks match for vid 0525 pid a4a5: 10000
 +
[93333.595505] scsi host74: usb-storage 1-1.2.4:1.0
 +
[93334.594259] scsi 74:0:0:0: Direct-Access     Linux   File-Stor Gadget 0401 PQ: 0 ANSI: 2
 +
[93334.594924] sd 74:0:0:0: Attached scsi generic sg8 type 0
 +
[93334.596081] sd 74:0:0:0: [sdi] 7813120 512-byte logical blocks: (4.00 GB/3.73 GiB)
 +
[93334.697138] sd 74:0:0:0: [sdi] Write Protect is off
 +
[93334.697146] sd 74:0:0:0: [sdi] Mode Sense: 0f 00 00 00
 +
[93334.807116] sd 74:0:0:0: [sdi] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 +
</pre>
 +
* g_ether
 +
<pre>
 +
# modprobe g_ether
 +
using random self ethernet address
 +
using random host ethernet address
 +
usb0: HOST MAC 9a:6b:67:42:a2:07
 +
usb0: MAC a2:3f:2a:96:aa:18
 +
using random self ethernet address
 +
using random host ethernet address
 +
g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
 +
g_ether gadget: g_ether ready
 +
g_ether gadget: high-speed config #1: CDC Ethernet (ECM)
 +
</pre>
 +
In case the desktop PC is running Linux, this gadget will show up in the {{cmd|lsusb}} list:
 +
<pre>
 +
# lsusb
 +
...
 +
Bus 001 Device 120: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
 +
...
 +
</pre>
 +
A new network interface turns out in the ((cmd|ifconfig -a}} list:
 +
<pre>
 +
usb0      Link encap:Ethernet  HWaddr 8a:d5:23:f0:e4:d5 
 +
          BROADCAST MULTICAST  MTU:1500  Metric:1
 +
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
 +
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:1000
 +
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 +
</pre>
 +
* g_serial
 +
<pre>
 +
# modprobe g_serial
 +
g_serial gadget: Gadget Serial v2.4
 +
g_serial gadget: g_serial ready
 +
g_serial gadget: high-speed config #2: CDC ACM config
 +
</pre>
 +
In case the desktop PC is running Linux, this gadget will show up in the {{cmd|lsusb}} list:
 +
<pre>
 +
# lsusb
 +
...
 +
Bus 001 Device 122: ID 0525:a4a7 Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode)
 +
...
 +
</pre>
 +
The new device information shows up in the system log.
 +
<pre>
 +
# dmesg
 +
[93774.027732] usb 1-1.2.4: new high-speed USB device number 122 using ehci-pci
 +
[93774.137513] usb 1-1.2.4: New USB device found, idVendor=0525, idProduct=a4a7
 +
[93774.137519] usb 1-1.2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
 +
[93774.137522] usb 1-1.2.4: Product: Gadget Serial v2.4
 +
[93774.137524] usb 1-1.2.4: Manufacturer: Linux 4.1.15-cm-fx6-8.0 with 2184000.usb
 +
[93774.201770] cdc_acm 1-1.2.4:2.0: ttyACM0: USB ACM device
 +
[93774.202155] usbcore: registered new interface driver cdc_acm
 +
[93774.202158] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
 
</pre>
 
</pre>
  
Line 401: Line 491:
 
The output will show the list of Access Points and Ad-Hoc cells in range.
 
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.
 
For more information about connecting to wireless networks and tuning WiFi interfaces refer to “wpa_supplicant” and “wireless-tools” man pages.
 +
 +
==== wpa_supplicant ====
 +
* Configuration sample
 +
{{cmd|wpa_supplicant}} requires a configuration file to be created in order to get connected to a scanned wireless network.<br>
 +
Make use of the example bellow and put the network name and the password into the "ssid/psk" fields.
 +
 +
<pre>
 +
# cat << eof > /etc/wpa_supplicant.conf
 +
ctrl_interface=/var/run/wpa_supplicant
 +
 +
network={
 +
ssid="wireless_network_name"
 +
key_mgmt=WPA-PSK
 +
psk="wireless_network_password"
 +
}
 +
eof
 +
</pre>
 +
* Sample run
 +
<pre>
 +
# ifconfig mlan0 up
 +
# wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i mlan0
 +
# dhclient mlan0
 +
</pre>
  
 
=== Bluetooth ===
 
=== Bluetooth ===
Line 446: Line 559:
 
</pre>
 
</pre>
  
==== A2DP Headphones ====
+
==== Bluez5 & PulseAudio ====
 
+
Debian is using BlueZ 5 and PluseAudio 5, which are fairly new.<br>
* Scan for available devices to find out Headphones BT device address:
+
BlueZ 5 dropped support for alsa, so the solution for now is to use PulseAudio.<br>
 +
PulseAudio 5 only supports the A2DP profile and not HSP/HFP. <br>
 +
* Software to install {{filename|'''pulseaudio'''}}, {{filename|'''pulseaudio-module-bluetooth'''}}
 +
{{Note|{{filename|'''debian-image.tar.bz2'''}} has all these packages pre-installed.}}
 
<pre>
 
<pre>
# hcitool scan
+
# apt-get install --no-install-recommends pulseaudio pulseaudio-module-bluetooth
Scanning ...
 
00:07:A4:F2:B3:CB Motorola HT820
 
 
</pre>
 
</pre>
 +
:* Create a systemd service for running pulseaudio as the pulse user.
 +
<pre>
 +
# cat << eof > /etc/systemd/system/pulseaudio.service
 +
[Unit]
 +
Description=Pulse Audio
 +
 +
[Service]
 +
Type=simple
 +
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm
 +
 +
[Install]
 +
WantedBy=multi-user.target
 +
eof
  
* Add new PCM device by editing {{filename|/etc/asound.conf}}:
+
# chown pulse:pulse /etc/systemd/system/pulseaudio.service
 +
</pre>
  
 +
:* Create a dbus configuration file for running pulseaudio. Give the pulse user permission to use Bluetooth.
 
<pre>
 
<pre>
pcm.btheadphones {
+
# cat << eof > /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
  type plug
+
<busconfig>
  slave {
+
 
      pcm {
+
  <policy user="pulse">
          type bluetooth
+
    <allow send_destination="org.bluez"/>
          device 00:07:A4:F2:B3:CB
+
  </policy>
          profile "auto"
+
 
      }
+
</busconfig>
  }
+
eof
  hint {
+
 
      show on
+
# chmod 0666 /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
      description "BT Headphones"
 
  }
 
}
 
ctl.btheadphones {
 
  type bluetooth
 
}
 
 
</pre>
 
</pre>
 +
:* Paste the following lines to the end of /etc/pulse/system.pa:
 +
<pre>
 +
# cat << eof >> /etc/pulse/system.pa
 +
### Automatically load driver modules for Bluetooth hardware
 +
.ifexists module-bluetooth-policy.so
 +
load-module module-bluetooth-policy
 +
.endif
  
* List device names to ensure correct settings in {{filename|/etc/asound.conf}}:
+
.ifexists module-bluetooth-discover.so
 +
load-module module-bluetooth-discover
 +
.endif
 +
eof
 +
</pre>
 +
:* Create {{filename|/var/run/pulse/.config/pulse}} directory. Change its ownership.
 +
<pre>
 +
# mkdir -p /var/run/pulse/.config/pulse
 +
# chown -R pulse:pulse /var/run/pulse
 +
</pre>
 +
:* Make the root belong to the pulse-access,audio groups
 +
<pre>
 +
# usermod -a -G pulse-access,audio root
 +
</pre>
 +
:* Start PulseAudio service
 
<pre>
 
<pre>
# aplay -L
+
# systemctl daemon-reload
null
+
# systemctl start pulseaudio.service
    Discard all samples (playback) or generate zero samples (capture)
+
</pre>
btheadphones
+
:* Make sure that the service is active, running and reports on no errors.
    BT Headphones
+
<pre>
default:CARD=wm8731audio
+
# systemctl status pulseaudio.service
    wm8731-audio,
+
  Loaded: loaded (/etc/systemd/system/pulseaudio.service; disabled)
    Default Audio Device
+
  Active: active (running) since Mon 2015-07-20 12:00:13 UTC; 1min 34s ago
sysdefault:CARD=wm8731audio
+
Main PID: 805 (pulseaudio)
    wm8731-audio,
+
  CGroup: /system.slice/pulseaudio.service
    Default Audio Device
+
          └─805 /usr/bin/pulseaudio --system --disallow-exit --disable-shm
default:CARD=imxhdmisoc
 
    imx-hdmi-soc,
 
    Default Audio Device
 
sysdefault:CARD=imxhdmisoc
 
    imx-hdmi-soc,
 
    Default Audio Device
 
 
</pre>
 
</pre>
  
* Put the headphones in the pairing mode.
+
==== Bluez5 pairing ====
* Launch {{cmd|bluez-simple-agent}} application and provide device PIN code on request:
+
PulseAudio 5.x supports A2DP per default.<br>
 +
Make sure the following packages are installed:
 +
pulseaudio pulseaudio-module-bluetooth pulseaudio-utils, bluez, bluez-tools.
 +
{{Note|Without {{filename|'''pulseaudio-module-bluetooth'''}} you won't be able to connect after the next pairing and you won't get any usable error messages.}}
 +
 
 +
* Start the Bluetooth system:
 
<pre>
 
<pre>
# bluez-simple-agent hci0 00:07:A4:F2:B3:CB
+
# systemctl start bluetooth
RequestPinCode (/org/bluez/1335/hci0/dev_00_07_A4_F2_B3_CB)
+
</pre>
Enter PIN Code: 0000
+
Now we can use the {{filename|'''bluetoothctl'''}} command line utility to pair and connect. Run
Release
+
<pre>
New device (/org/bluez/1335/hci0/dev_00_07_A4_F2_B3_CB)
+
# bluetoothctl
 +
</pre>
 +
to be greeted by its internal command prompt.Then enter:
 +
<pre>
 +
# power on
 +
# agent on
 +
# default-agent
 +
# scan on
 +
</pre>
 +
Now make sure that your headset is in pairing mode. It should be discovered shortly. For example,
 +
<pre>
 +
[NEW] Device 00:07:A4:F2:B3:CB Motorola HT820
 +
</pre>
 +
shows a device that calls itself "Motorola HT820" and has MAC address 00:07:A4:F2:B3:CB.
 +
We will now use that MAC address to initiate the pairing:
 +
<pre>
 +
# pair 00:07:A4:F2:B3:CB
 +
</pre>
 +
After pairing, you also need to explicitly connect the device (every time?):
 +
<pre>
 +
# connect 00:07:A4:F2:B3:CB
 +
</pre>
 +
If everything works correctly, you now have a separate output device in PulseAudio.<br>
 +
You can now disable scanning again and exit the program:
 +
<pre>
 +
# scan off
 +
# exit
 
</pre>
 
</pre>
  
* Launch {{cmd|aplay}} playback tool:
+
==== Playback using PulseAudio ====
 +
{{Note|Next examples assume that the device mac address is '''00_07_A4_F2_B3_CB'''}}
 +
* Show the PulseAudio device
 
<pre>
 
<pre>
# aplay -D btheadphones sample_audio.wav
+
# pactl list cards  | awk '/00_07_A4_F2_B3_CB/' RS=""
Playing WAVE 'sample_audio.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
+
Card #2
 +
Name: bluez_card.00_07_A4_F2_B3_CB
 +
Driver: module-bluez5-device.c
 +
Owner Module: 16
 +
Properties:
 +
device.description = "Motorola HT820"
 +
device.string = "00:07:A4:F2:B3:CB"
 +
device.api = "bluez"
 +
device.class = "sound"
 +
device.bus = "bluetooth"
 +
device.form_factor = "headset"
 +
bluez.path = "/org/bluez/hci0/dev_00_07_A4_F2_B3_CB"
 +
bluez.class = "0x240404"
 +
bluez.alias = "Motorola HT820"
 +
device.icon_name = "audio-headset-bluetooth"
 +
device.intended_roles = "phone"
 +
Profiles:
 +
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
 +
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
 +
Active Profile: a2dp_sink
 +
Ports:
 +
headset-output: Headset (priority: 0, latency offset: 0 usec)
 +
Part of profile(s): a2dp_sink
 +
headset-input: Headset (priority: 0, latency offset: 0 usec, not available)
 +
 
 
</pre>
 
</pre>
 +
:* Switch the active card profile to a2dp_sink
 +
<pre>
 +
# pactl set-card-profile 2 a2dp_sink
 +
</pre>
 +
:* Show the PulseAudio sink
 +
<pre>
 +
# pactl list sinks | awk '/00_07_A4_F2_B3_CB/' RS=""
 +
Sink #2
 +
State: SUSPENDED
 +
Name: bluez_sink.00_07_A4_F2_B3_CB
 +
Description: Motorola HT820
 +
Driver: module-bluez5-device.c
 +
Sample Specification: s16le 2ch 44100Hz
 +
Channel Map: front-left,front-right
 +
Owner Module: 16
 +
Mute: no
 +
Volume: front-left: 65536 / 100% / 0.00 dB,  front-right: 65536 / 100% / 0.00 dB
 +
        balance 0.00
 +
Base Volume: 65536 / 100% / 0.00 dB
 +
Monitor Source: bluez_sink.00_07_A4_F2_B3_CB.monitor
 +
Latency: 0 usec, configured 0 usec
 +
Flags: HARDWARE DECIBEL_VOLUME LATENCY
 +
Properties:
 +
bluetooth.protocol = "a2dp_sink"
 +
device.description = "Motorola HT820"
 +
device.string = "00:07:A4:F2:B3:CB"
 +
device.api = "bluez"
 +
device.class = "sound"
 +
device.bus = "bluetooth"
 +
device.form_factor = "headset"
 +
bluez.path = "/org/bluez/hci0/dev_00_07_A4_F2_B3_CB"
 +
bluez.class = "0x240404"
 +
bluez.alias = "Motorola HT820"
 +
device.icon_name = "audio-headset-bluetooth"
 +
device.intended_roles = "phone"
 +
Ports:
 +
headset-output: Headset (priority: 0)
 +
Active Port: headset-output
 +
Formats:
 +
pcm
 +
</pre>
 +
:* Play sound using {{filename|paplay}}. Example:
 +
<pre>
 +
# paplay -d bluez_sink.00_07_A4_F2_B3_CB /mnt/media/vegas.wav
 +
</pre>
 +
==== PulseAudio Helpful Links ====
 +
* [https://wiki.archlinux.org/index.php/Bluetooth_headset Bluetooth headset]
 +
* [https://bbs.archlinux.org/viewtopic.php?id=166678&p=2 Bluetooth audio paired but not connect?]
  
 
=== Touchscreen ===
 
=== Touchscreen ===
Line 522: Line 765:
 
<pre>
 
<pre>
 
modprobe ads7846
 
modprobe ads7846
</pre>
 
* For DataImage SCF0403852GGU04 LCD touch panel (Himax HX8520-C):
 
<pre>
 
modprobe hx8520-c
 
 
</pre>
 
</pre>
  
The X Windows system of CM-FX6 uses tslib X server input driver to get the input from the touchscreen.
+
The X Windows system of CM-FX6 uses ''evdev'' X server input driver to get the input from the touchscreen.
  
 
==== Touchscreen calibration ====
 
==== Touchscreen calibration ====
Both supported touchscreen devices can be accessed through symbolic link {{filename|/dev/input/touchscreen}}.
+
All supported touchscreen devices can be calibrated using {{cmd|xinput_calibrator}} utility.
The symlink is created by {{filename|udev}} rules defined in {{filename|/etc/udev/rules.d/10-touchscreen.rules}}.<br>
 
Calibration utilities require proper setting of the {{parameter|TSLIB_TSDEVICE}} system variable (pointing to the touchscreen device special file).
 
This is done automatically by the {{filename|/etc/profile.d/tslib.sh}} script.
 
  
Touchscreen calibration is performed with the {{cmd|ts_calibrate}} utility available in package {{filename|libts-bin}}.
 
 
To calibrate the touchscreen:
 
To calibrate the touchscreen:
* Make sure X Server is running
+
* Create an empty calibration file:
* Make sure the touchscreen driver is loaded as described in [[#Touchscreen|Touchscreen]] section
+
<pre>
* Run the {{cmd|ts_calibrate}} utility. For proper calibration you are required to touch the touchscreen corners and center in the following order: top-left, top-right, bottom-right, bottom-left, center. The calibration results are saved to file {{filename|/etc/pointercal}}.
+
# cat << eof > /etc/X11/xorg.conf.d/99-calibration.conf
* Use the {{cmd|ts_test}} utility to test the calibration results.
+
Section "InputClass"
 +
Identifier "calibration"
 +
MatchProduct "ADS7846 Touchscreen"
 +
Driver "evdev"
 +
EndSection
 +
eof
 +
</pre>
 +
* Run X Server by issuing {{cmd|startx &}} command
 +
* Make sure the touchscreen driver is loaded as described in [[CM-FX6_Linux_Debian_Stretch#Touchscreen|Touchscreen]] section
 +
* Set the {{parameter|DISPLAY}} environment variable:
 +
<pre># export DISPLAY=:0</pre>
 +
* Run {{cmd|xinput_calibrator}} utility. For proper calibration you are required to touch the touchscreen corners and center in the following order: top-left, top-right, bottom-right, bottom-left, center.
 +
* Add '''Option''' fields into the {{filename|'''/usr/share/X11/xorg.conf.d/99-calibration.conf'''}}:
 +
<pre>
 +
# xinput_calibrator
 +
Setting calibration data: 0, 4095, 0, 4095
 +
Calibrating EVDEV driver for "ADS7846 Touchscreen" id=6
 +
        current calibration values (from XInput): min_x=0, max_x=4095 and min_y=0, max_y=4095
 +
 
 +
Doing dynamic recalibration:
 +
        Setting calibration data: 165, 3864, 3789, 268
 +
        --> 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" "129 3968 3750 161"
 +
Option "SwapAxes" "0"
 +
Driver "evdev"
 +
EndSection
 +
</pre>
  
 
=== MMC/SD ===
 
=== MMC/SD ===
Line 548: Line 813:
 
For example, suppose an MMC/SD partition you'd like to mount is ''mmcblk0p1'' then:
 
For example, suppose an MMC/SD partition you'd like to mount is ''mmcblk0p1'' then:
 
<pre>
 
<pre>
if [ ! -d /mnt/mmcblk0p1 ]; then mkdir /mnt/mmcblk0p1; fi
+
# [ ! -d /mnt/mmcblk0p1 ] && mkdir /mnt/mmcblk0p1
mount /dev/mmcblk0p1 /mnt/mmcblk0p1
+
# mount /dev/mmcblk0p1 /mnt/mmcblk0p1
 
</pre>
 
</pre>
  
Line 556: Line 821:
 
Default configuration of Linux kernel and Debian Linux for CM-FX6 uses LCD as primary video output interface.
 
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, DSI or the LCD interface at the same time. HDMI can be used simultaneously with LVDS and either LCD or DVI interfaces.<br>
 
It is possible to use either the DVI, DSI or the LCD interface at the same time. HDMI can be used simultaneously with LVDS and either LCD or DVI interfaces.<br>
Linux kernel implementation of the CM-FX6 display subsystem (IPU) is described in [[CM-FX6: Linux: Kernel#LCD, DSI, DVI, HDMI and LVDS support|LCD, DSI, DVI, HDMI and LVDS support]] section.
+
Linux kernel implementation of the CM-FX6 display subsystem (IPU) is described in [[CM-FX6: Linux: Kernel#LCD, DSI, DVI, HDMI and LVDS support|LCD, DSI, DVI, HDMI and LVDS support]] section. In the default Linux configuration for CM-FX6, four main framebuffers are available: {{filename|/dev/fb0}}, {{filename|/dev/fb2}}, {{filename|/dev/fb3}}, and {{filename|/dev/fb5}}.
  
In the default Linux configuration for CM-FX6, four main framebuffers are available: {{filename|/dev/fb0}}, {{filename|/dev/fb2}}, {{filename|/dev/fb3}}, and {{filename|/dev/fb5}}.
+
==== Frame Buffer Mapping Using DTB ====
The default mapping is:
+
* Quad configuration with the {{filename|'''imx6q-sbc-fx6.dtb'''}} blob.
* LCD/DSI/DVI <---> {{filename|/dev/fb0}}
+
::* LCD/DVI <---> {{filename|/dev/fb0}}
* HDMI       <---> {{filename|/dev/fb2}}
+
::* HDMI   <---> {{filename|/dev/fb2}}
* LVDS0       <---> {{filename|/dev/fb3}}
+
::* LVDS0   <---> {{filename|/dev/fb3}}
* LVDS1       <---> {{filename|/dev/fb5}}
+
::* LVDS1   <---> {{filename|/dev/fb5}}
  
=== Starting X Server ===
+
* Quad configuration with the {{filename|'''imx6q-sbc-fx6-hdmi.dtb'''}} blob.
X server has an option to use FRAMEBUFFER environment variable in order to redefine the default frame buffer device.
+
::* HDMI    <---> {{filename|/dev/fb0}}
This variable can be used in order to make the X Server use a specified frame buffer.
+
::* LCD/DVI <---> {{filename|/dev/fb2}}
Bellow are examples of starting X Server using different frame buffers
+
::* LVDS0  <---> {{filename|/dev/fb3}}
* fb2 -> HDMI
+
::* LVDS1  <---> {{filename|/dev/fb5}}
<pre>
+
 
FRAMEBUFFER=/dev/fb2 startx
+
* Quad configuration with the {{filename|'''imx6q-sbc-fx6-mipi.dtb'''}} blob.
</pre>
+
::* MIPI    <---> {{filename|/dev/fb0}}
* fb3 -> LVDS0
+
::* HDMI    <---> {{filename|/dev/fb2}}
<pre>
+
::* LVDS0  <---> {{filename|/dev/fb3}}
FRAMEBUFFER=/dev/fb3 startx
+
::* LVDS1   <---> {{filename|/dev/fb5}}
</pre>
 
* fb5 -> LVDS1
 
<pre>
 
FRAMEBUFFER=/dev/fb5 startx
 
</pre>
 
  
=== Setting Desired Frame Buffer Parameters ===
+
==== Frame Buffer Tunning Using Kernel Arguments ====
==== 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:
 
In order to set a desired frame buffer resolution, the following kernel command line parameters can be used:
* For DVI on {{filename|/dev/fb0}}:<pre>video=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32</pre>
+
* For LCD on {{filename|/dev/fb0}}:<pre>video=mxcfb0:dev=lcd,800x480M-32@50,if=RGB32</pre>
 
* For HDMI on {{filename|/dev/fb2}}:<pre>video=mxcfb2:dev=hdmi,1920x1080M-32@50,if=RGB32</pre>
 
* For HDMI on {{filename|/dev/fb2}}:<pre>video=mxcfb2:dev=hdmi,1920x1080M-32@50,if=RGB32</pre>
 
* For LVDS0 on {{filename|/dev/fb3}}:<pre>video=mxcfb3:dev=ldb,1366x768M-18@60,if=RGB666</pre>
 
* For LVDS0 on {{filename|/dev/fb3}}:<pre>video=mxcfb3:dev=ldb,1366x768M-18@60,if=RGB666</pre>
 
* For LVDS1 on {{filename|/dev/fb5}}:<pre>video=mxcfb5:dev=ldb,1366x768M-18@60,if=RGB666</pre>
 
* For LVDS1 on {{filename|/dev/fb5}}:<pre>video=mxcfb5:dev=ldb,1366x768M-18@60,if=RGB666</pre>
 +
==== Configuring mxcfb0 only ====
 +
* HDMI on {{filename|mxcfb0}}:<pre>video=mxcfb0:dev=hdmi,1920x1080M-32@50,bpp=32,if=RGB32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off</pre>
 +
* LDB on {{filename|mxcfb0}}:<pre>video=mxcfb0:dev=ldb,1368x768M-18@60,bpp=16,if=RGB666 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off</pre>
  
==== Changing Frame Buffer Settings via SYSFS ====
+
=== Starting X Server ===
Here is another approach of changing the frame buffer resolution. Each frame buffer has an entry on sysfs:
+
Start X server on a default frame buffer:
 
<pre>
 
<pre>
# ls -al /sys/class/graphics/fb[0-5]
+
# startx&
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
 
 
</pre>
 
</pre>
 
+
==== Use Another Frame Buffer ====
* 2-nd frame buffer resolution:
+
* Edit the {{filename|xorg.conf}} conf file and set a desire frame buffer:
 
<pre>
 
<pre>
# cat /sys/class/graphics/fb2/mode
+
Section "Device"
U:1280x720p-50
+
    Identifier  "i.MX Accelerated Framebuffer Device"
</pre>
+
    Driver      "vivante"
 +
    Option      "fbdev"    "/dev/fb2"
 +
    Option      "vivante_fbdev" "/dev/fb2"
 +
    Option      "HWcursor"  "false"
 +
EndSection
  
* 2-nd frame buffer supported modes:
+
Section "ServerFlags"
<pre>
+
    Option "BlankTime"  "0"
# cat /sys/class/graphics/fb2/modes
+
    Option "StandbyTime"  "0"
U:1280x720p-50
+
    Option "SuspendTime"  "0"
S:1280x720p-50
+
    Option "OffTime"  "0"
S:720x576p-50
+
EndSection
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
 
 
</pre>
 
</pre>
 
+
* Alternative method of using '''FRAMEBUFFER''' environment variable:
* To change mode of the 2-nd frame buffer to "D:1920x1080p-60"
+
{{Note|This approach works w/out the xorg configuration file.<br> The {{filename|/etc/X11/xorg.conf}} has to be removed first.}}
 
<pre>
 
<pre>
echo "D:1920x1080p-60" > /sys/class/graphics/fb2/mode
+
# FRAMEBUFFER=/dev/fb2 startx
 
</pre>
 
</pre>
 
=== 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 {{filename|/dev/fb0}}:<pre>video=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32</pre>
 
* For HDMI on {{filename|/dev/fb0}}:<pre>video=mxcfb0:dev=hdmi,1920x1080M-32@50,if=RGB32</pre>
 
* For LVDS on {{filename|/dev/fb0}}:<pre>video=mxcfb0:dev=ldb,1366x768M-18@60,if=RGB666</pre>
 
  
 
=== GPIO access ===
 
=== GPIO access ===
Line 654: Line 888:
 
The following example demonstrates how to configure GPIO 140 as output and set value to high:
 
The following example demonstrates how to configure GPIO 140 as output and set value to high:
 
<pre>
 
<pre>
echo 140 > /sys/class/gpio/export
+
# echo 140 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio140/direction
+
# echo out > /sys/class/gpio/gpio140/direction
echo 1 > /sys/class/gpio/gpio140/value
+
# echo 1 > /sys/class/gpio/gpio140/value
 
</pre>
 
</pre>
 
{{Note|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.}}
 
{{Note|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.}}
Line 662: Line 896:
 
== Multi Media Support  ==
 
== Multi Media Support  ==
  
=== VPU plugins and codecs ===
+
In order to provide the FreeScale Multi Media Support some packages has to be installed onto a Debian Stretch clean system.
==== Install ====
+
The {{filename|'''package/extra/fsl-support'''}} contains all packages that required for it.
* Make the {{filename|extra/FreeScale VPU/}} content available to the CM-FX6 board. Use either nfs-mount or copy the {{filename|extra/FreeScale VPU/}} content to a media available to CM-FX6 board.
+
 
* On the CM-FX6 Linux console run:
+
{{Note|The CompuLab Debian Stretch release have all these packages installed}}
<pre>
 
# cd "/path/to/mount/point/extra/FreeScale VPU"
 
# ./.install
 
</pre>
 
{{Note|These packages provide hardware acceleration support for: MPEG-2 MP/HP, VC-1 SP/MP/AP, MPEG-4 SP/ASP, H.263 V2, H.264 BP/MP/HP, DivX v3,4,5, MJPEG Baseline, On2 VP8.}}
 
  
 
==== Video Playback  ====
 
==== Video Playback  ====
Make use of either {{filename|gplay}} or {{filename|gst-launch}} in order to playback media files.
+
===== Frame Buffer Mode =====
* gplay
+
* gst-play
<pre>
 
# gplay sample.avi
 
</pre>
 
* gst-launch
 
 
<pre>
 
<pre>
# gst-launch-0.10 filesrc location=sample.avi typefind=true ! aiurdemux name=demux demux. ! queue max-size-buffers=0 max-size-time=0 ! vpudec ! \
+
# gst-play /media/ElephantsDream-DivXPlusHD.mkv
                  mfw_v4lsink demux. ! queue max-size-buffers=0 max-size-time=0 ! beepdec ! audioconvert ! 'audio/x-raw-int, channels=2' ! alsasink
 
 
</pre>
 
</pre>
 
+
===== X11 =====
=== GPU Demos ===
+
Start X and set DISPLAY:
This is a FreeScale tarball with the FreeScale GPU demos.
 
* Unpack {{filename|viv_samples.tar.bz2}} from {{filename|cm-fx6-linux/extra/FreeScale GPU/01-Samples}} directory.
 
* Make the {{filename|viv_samples.tar.bz2}} content available to the CM-FX6 board. Use either nfs-mount or copy the {{filename|viv_samples.tar.bz2}} content to a media available to CM-FX6 board.
 
* Mount the storage device or an NFS share with the content of {{filename|viv_samples.tar.bz2}} and enter the viv_samples directory:
 
 
<pre>
 
<pre>
# cd /path/to/mount/point/viv_samples/opt/viv_samples/vdk/
+
# startx &
 +
# export DISPLAY=:0
 
</pre>
 
</pre>
* Run any of the available tests: ./tutorial[1..7]_es20
+
Make use either:
 +
* gst-play
 
<pre>
 
<pre>
# ./tutorial1_es20
+
# gst-play /media/ElephantsDream-DivXPlusHD.mkv
# ./tutorial2_es20
 
# ./tutorial3_es20
 
# ./tutorial4_es20
 
# ./tutorial5_es20
 
# ./tutorial6_es20
 
# ./tutorial7_es20
 
 
</pre>
 
</pre>
Press 'ESC' for exit
+
* google-chrome [--kiosk] [URL]
 
 
=== 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 ====
 
{{parameter|imx-test}} is a FreeScale package that can be used to show the Camera Serial Interface (CSI) functionality.<br>
 
* Unpack {{filename|imx-test_3.0.35-4.0.0_armel.deb}} from {{filename|cm-fx6-linux/extra/deb_packages}} directory:
 
 
<pre>
 
<pre>
# dpkg -x imx-test_3.0.35-4.0.0_armel.deb /path/to/cm-fx6-shared-directory
+
# : Browse a local ''/media'' directory
 +
# google-chrome --kiosk /media
 
</pre>
 
</pre>
* Make the {{filename|/path/to/cm-fx6-shared-directory}} content available to the CM-FX6 board. Use either nfs-mount or copy the {{filename|/path/to/cm-fx6-shared-directory}} content to a media available to CM-FX6 board.
 
* On the CM-FX6 Linux console run:
 
 
<pre>
 
<pre>
# startx
+
# : Browse a remote ''http://192.168.11.170/media'' directory
 +
# google-chrome --kiosk http://192.168.11.170/media
 
</pre>
 
</pre>
* After the X server has started, open a terminal window: Mouse Right Click → Applications → Terminal Emulators → Xterm
+
==== Camera Support  ====
 
+
{{Note|
 +
*ov5640 camera works with SB-FX6 Rev 1.2 only
 +
*In this article we assume that an ov5640 camera is connected to the SB-FX6 P66 connector
 +
}}
 +
Linux provides a variety of streaming tools for the V4L2 compliant devices.
 +
We provide some gst-streamer examples that operate on your camera and capture images.
 
===== Streaming the camera output to the frame buffer =====
 
===== Streaming the camera output to the frame buffer =====
<pre>
+
gst-launch-1.0  imxv4l2videosrc ! imxg2dvideosink
# /path/to/imx-test_directory/unit_tests/mxc_v4l2_overlay.out -ow 720 -oh 525
 
</pre>
 
  
===== Capturing a stills image =====
+
===== Streaming the camera output to a file =====
<pre>
+
* Camera output -> mpeg4 codec -> matroska container
# /path/to/imx-test_directory/mxc_v4l2_still.out -f UYVY -w 720 -h 525 -m 1
+
gst-launch-1.0 -v imxv4l2videosrc device=/dev/video0 ! videoconvert ! queue ! imxvpuenc_mpeg4 ! matroskamux ! filesink location=test.mkv
</pre>
+
* Camera output -> H-264 codec -> avi container
 
+
gst-launch-1.0 imxv4l2videosrc device=/dev/video0 ! videoconvert ! queue ! imxvpuenc_h264 ! avimux ! filesink location=test.avi
=== mplayer ===
 
 
 
MPlayer application is not a part of the example root file system image. In order to install it run the following command:
 
  
 +
=== GPU Demos ===
 
<pre>
 
<pre>
apt-get install mplayer
+
# cd /opt/viv_samples/vdk/
 
</pre>
 
</pre>
 
+
* Run any of the available tests: ./tutorial[1..7]_es20
==== Streaming the camera output ====
 
 
<pre>
 
<pre>
# mplayer tv:// -tv driver=v4l2:device=/dev/video0:outfmt=uyvy:width=720:height=524
+
# ./tutorial1_es20
 
</pre>
 
</pre>
 +
Press 'ESC' for exit
  
 
== See also ==
 
== See also ==
  
* [[CM-FX6: Linux: Getting started]]
+
* [[CM-FX6: Linux: Automatic Installation]]
 +
* [[CM-FX6: Linux: Getting started|CM-FX6: Linux: Manual Linux installation]]
 
* [[CM-FX6: Linux: Kernel]]
 
* [[CM-FX6: Linux: Kernel]]
 
* [[Linux: Development for ARM modules]]
 
* [[Linux: Development for ARM modules]]

Latest revision as of 09:06, 5 February 2017

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 Stretch. 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 Stretch Linux image includes more than 400 software packages. Among them:

  • Core system
  • Debian package management system
  • X11 Windowing System
  • Fluxbox desktop manager
  • SSH server and client
  • PulseAudio configuration and usage utilities
  • CAN Bus utilities
  • Bluez5 Bluetooth tools and daemons
  • iw/wpasupplicant wireless tools

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.


Using Debian Linux on CM-FX6

Connection and Logging In

Use the following username to login:

Account with administrative privileges:

User: root

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

root password

This Debian rootfs comes w/out default root password.
The root password has to be set at the very 1-st login:

Debian GNU/Linux stretch/sid imx6-sid ttymxc3

imx6-sid login: root
You are required to change your password immediately (root enforced)
Enter new UNIX password:

Networking

SBC-FX6 allows using two network interfaces:

  • FEC

This is an internal iMX6 SoC NIC (accessible in U-Boot). A network interface assigned for this device gets named eth0.

  • i211

This is an external NIC resides on SB-FX6. In order to make it work, the SB-FX6 P31 jumper must be open. A network interface assigned for this device gets named enp1s0.
A udev rule can be used for renaming this device into a convenient ethX name. Here is a rule:

cat << eof >> /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x8086:0x0x1539 (i211)
SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1539", KERNEL=="eth*", NAME="eth1"
eof

Applying the rule w/out a reboot:

udevadm control --reload
modprobe igb -r
modprobe igb

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:

The majority of network setup can be done via the interfaces configuration file at /etc/network/interfaces.

Admolition note.png auto line is required for interfaces that have to be brought up at boot time.
  • Using DHCP to automatically configure the interface
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
  • Configuring the interface manually
auto eth0
    iface eth0 inet static
        address 192.168.1.170
        netmask 255.255.0.0
        gateway 192.0.0.1

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. systemd is able to configure most of them. Detail information can be found here:

X Windows system

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

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.

Audio Outputs

CM-FX6 provides free different audio interfaces. These interfaces registered as standard ALSA sound cards. If the default CM-FX6 configuration is used, all audio drivers are loaded automatically in the boot process. More information about Linux audio subsystem can be found at ALSA project official website.

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: cmfx6 [cm-fx6], device 0: 202c000.ssi-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: imxhdmisoc [imx-hdmi-soc], device 0: i.MX HDMI Audio Tx hdmi-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Default Audio Device

The default audio interface in this Linux dsistribution is cm-fx6.

Analog Audio

The CM-FX6 analog audio functionality is implemented by interfacing the Wolfson wm8731 audio codec with i.MX6 AUDMUX port 4. The interface controls:

# amixer controls
numid=2,iface=MIXER,name='Master Playback ZC Switch'
numid=1,iface=MIXER,name='Master Playback Volume'
numid=4,iface=MIXER,name='Line Capture Switch'
numid=5,iface=MIXER,name='Mic Boost Volume'
numid=6,iface=MIXER,name='Mic Capture Switch'
numid=8,iface=MIXER,name='ADC High Pass Filter Switch'
numid=3,iface=MIXER,name='Capture Volume'
numid=10,iface=MIXER,name='Playback Deemphasis Switch'
numid=11,iface=MIXER,name='Input Mux'
numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch'
numid=12,iface=MIXER,name='Output Mixer Line Bypass Switch'
numid=13,iface=MIXER,name='Output Mixer Mic Sidetone Switch'
numid=7,iface=MIXER,name='Sidetone Playback Volume'
numid=9,iface=MIXER,name='Store DC Offset Switch'
  • Analog Audio Settings.

wm8731 codec has a controll named as “Output Mixer HiFi Playback Switch”. This controll has two values: 0/1 - On/Off. The default value is '0'. Turn it on in order to unmute the analog output. Issue this command:

# amixer cset numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch' on

Save the card state in order to make these settings permanent.

# alsactl store cm-fx6
  • Playback using wm8731 output:
# aplay -D hw:0,0 <wav-file>

HDMI

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

The interface controls:

# amixer -c 1 controls
numid=1,iface=MIXER,name='IEC958 Playback Default'
numid=2,iface=MIXER,name='HDMI Support Channels'
numid=4,iface=MIXER,name='HDMI Support Formats'
numid=3,iface=MIXER,name='HDMI Support Rates'

Playback using HDMI output:

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

SPDIF

The Sony/Philips Digital Interface (SPDIF) module is a stereo that allows the processor transmit digital audio over it using the IEC60958 standard, consumer format. i.MX 6Dual/6Quad provides one SPDIF transmitter with one output and one SPDIF receiver with one input.

  • SB-FX6 P40 is SPDIF OUT
  • SB-FX6 P47 is SPDIF IN
Admolition note.png The SPDIF audio will work only if the SPDIF cable is plugged in.

The interface controls:

# amixer -c 2 controls
numid=1,iface=MIXER,name='IEC958 Playback Default'
numid=2,iface=PCM,name='IEC958 Capture Default'
numid=4,iface=PCM,name='IEC958 Q-subcode Capture Default'
numid=3,iface=PCM,name='IEC958 Subcode Capture Default'
numid=7,iface=PCM,name='IEC958 USyncMode CDText'
numid=5,iface=PCM,name='IEC958 V-Bit Errors'
numid=6,iface=PCM,name='RX Sample Rate'

Playback using SPDIF output:

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

Sound Capture Devices

arecord -l shows all devices that can be used for audio capturing.

# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: cmfx6 [cm-fx6], device 0: 202c000.ssi-wm8731-hifi wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Analog Audio Recording

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

  • Set bitrate options:
# export RATE_OPT="--rate=32000"
  • Line In recording:
# : Line In recording
amixer cset numid=3 31
amixer cset numid=4 1
amixer cset numid=6 0
amixer cset numid=11 0
: Filters
amixer cset numid=8 1
amixer cset numid=10 1
: Line Output ByPass On
amixer cset numid=12 1
: Mic Output ByPass Off
amixer cset numid=13 0
: Recording
arecord -f cd -t wav --duration=30 ${RATE_OPT} /tmp/file.vaw
  • Mic In recording:
# : Mic In recording
amixer cset numid=3 31
amixer cset numid=4 0
amixer cset numid=6 1
amixer cset numid=11 1
: Filters
amixer cset numid=8 1
amixer cset numid=10 1
: Line Output ByPass Off
amixer cset numid=12 0
: Mic Output ByPass On
amixer cset numid=13 1
: Recording
arecord -f cd -t wav --duration=30 ${RATE_OPT} /tmp/file.vaw
  • Playback a recorded file:
# aplay -vv /tmp/file.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.
Default CM-FX6 kernel configuration enables g_serial, g_file_storage, g_ether and g_audio gadget drivers. Additional gadget drivers can be enabled in the kernel configuration.

Testing OTG port

Host mode

Connect a USB keyboard to the OTG port P48 using a UsbOTGAdapter. Make sure that the device was recognized by the system. Evaluate lsusb and dmesg outputs.

# lsusb
Bus 002 Device 002: ID 413c:2106 Dell Computer Corp. Dell QuietKey Keyboard
# dmesg
ci_hdrc ci_hdrc.0: EHCI Host Controller
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 2
ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usb 2-1: new low-speed USB device number 2 using ci_hdrc
input: Dell Dell QuietKey Keyboard as /devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/usb2/2-1/2-1:1.0/0003:413C:2106.0004/input/input4
hid-generic 0003:413C:2106.0004: input: USB HID v1.10 Keyboard [Dell Dell QuietKey Keyboard] on usb-ci_hdrc.0-1/input0
Gadget mode
  • g_audio
# modprobe g_audio
g_audio gadget: Hardware params: access 3, format 2, channels 2, rate 48000
g_audio gadget: Linux USB Audio Gadget, version: Feb 2, 2012
g_audio gadget: g_audio ready

Connect a desktop PC to the 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 and lsusb}:

# : Desktop PC shell
# aplay -l | awk '/Gadget/,0'
card 3: Gadget [Linux USB Audio Gadget], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
# lsusb  | awk '/Gadget/'
Bus 001 Device 111: ID 1d6b:0101 Linux Foundation Audio Gadget
  • Playback using the USB Gabget:

The sound goes to the SB-FX6 J3 audio out.

# aplay -D hw:3,0 <wav-file>
  • g_mass_storage
# modprobe g_mass_storage file=/dev/sdb
	Mass Storage Function, version: 2009/09/11
	LUN: removable file: (no medium)
	LUN: file: /dev/sdb
	Number of LUNs=1
	g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
	g_mass_storage gadget: userspace failed to provide iSerialNumber
	g_mass_storage gadget: g_mass_storage ready
	g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

Connect desktop PC to OTG port.
In case the desktop PC is running Linux, this gadget will show up in the lsusb list:

# lsusb
...
Bus 001 Device 117: ID 0525:a4a5 Netchip Technology, Inc. Pocketbook Pro 903
...

The new device information shows up in the system log.

# dmesg
[93333.477394] usb 1-1.2.4: new high-speed USB device number 119 using ehci-pci
[93333.587166] usb 1-1.2.4: New USB device found, idVendor=0525, idProduct=a4a5
[93333.587172] usb 1-1.2.4: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[93333.587175] usb 1-1.2.4: Product: Mass Storage Gadget
[93333.587177] usb 1-1.2.4: Manufacturer: Linux 4.1.15-cm-fx6-8.0 with 2184000.usb
[93333.595095] usb-storage 1-1.2.4:1.0: USB Mass Storage device detected
[93333.595371] usb-storage 1-1.2.4:1.0: Quirks match for vid 0525 pid a4a5: 10000
[93333.595505] scsi host74: usb-storage 1-1.2.4:1.0
[93334.594259] scsi 74:0:0:0: Direct-Access     Linux    File-Stor Gadget 0401 PQ: 0 ANSI: 2
[93334.594924] sd 74:0:0:0: Attached scsi generic sg8 type 0
[93334.596081] sd 74:0:0:0: [sdi] 7813120 512-byte logical blocks: (4.00 GB/3.73 GiB)
[93334.697138] sd 74:0:0:0: [sdi] Write Protect is off
[93334.697146] sd 74:0:0:0: [sdi] Mode Sense: 0f 00 00 00
[93334.807116] sd 74:0:0:0: [sdi] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
  • g_ether
# modprobe g_ether
	using random self ethernet address
	using random host ethernet address
	usb0: HOST MAC 9a:6b:67:42:a2:07
	usb0: MAC a2:3f:2a:96:aa:18
	using random self ethernet address
	using random host ethernet address
	g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
	g_ether gadget: g_ether ready
	g_ether gadget: high-speed config #1: CDC Ethernet (ECM)

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

# lsusb
...
Bus 001 Device 120: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
...

A new network interface turns out in the ((cmd list:

usb0      Link encap:Ethernet  HWaddr 8a:d5:23:f0:e4:d5  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  • g_serial
# modprobe g_serial
	g_serial gadget: Gadget Serial v2.4
	g_serial gadget: g_serial ready
	g_serial gadget: high-speed config #2: CDC ACM config

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

# lsusb
...
Bus 001 Device 122: ID 0525:a4a7 Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode)
...

The new device information shows up in the system log.

# dmesg
[93774.027732] usb 1-1.2.4: new high-speed USB device number 122 using ehci-pci
[93774.137513] usb 1-1.2.4: New USB device found, idVendor=0525, idProduct=a4a7
[93774.137519] usb 1-1.2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[93774.137522] usb 1-1.2.4: Product: Gadget Serial v2.4
[93774.137524] usb 1-1.2.4: Manufacturer: Linux 4.1.15-cm-fx6-8.0 with 2184000.usb
[93774.201770] cdc_acm 1-1.2.4:2.0: ttyACM0: USB ACM device
[93774.202155] usbcore: registered new interface driver cdc_acm
[93774.202158] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

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.

wpa_supplicant

  • Configuration sample

wpa_supplicant requires a configuration file to be created in order to get connected to a scanned wireless network.
Make use of the example bellow and put the network name and the password into the "ssid/psk" fields.

# cat << eof > /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant

network={
	ssid="wireless_network_name"
	key_mgmt=WPA-PSK
	psk="wireless_network_password"
}
eof
  • Sample run
# ifconfig mlan0 up
# wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i mlan0
# dhclient mlan0

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

Bluez5 & PulseAudio

Debian is using BlueZ 5 and PluseAudio 5, which are fairly new.
BlueZ 5 dropped support for alsa, so the solution for now is to use PulseAudio.
PulseAudio 5 only supports the A2DP profile and not HSP/HFP.

  • Software to install pulseaudio, pulseaudio-module-bluetooth
Admolition note.png debian-image.tar.bz2 has all these packages pre-installed.
# apt-get install --no-install-recommends pulseaudio pulseaudio-module-bluetooth
  • Create a systemd service for running pulseaudio as the pulse user.
# cat << eof > /etc/systemd/system/pulseaudio.service
[Unit]
Description=Pulse Audio

[Service]
Type=simple
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm

[Install]
WantedBy=multi-user.target
eof

# chown pulse:pulse /etc/systemd/system/pulseaudio.service
  • Create a dbus configuration file for running pulseaudio. Give the pulse user permission to use Bluetooth.
# cat << eof > /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
<busconfig>

  <policy user="pulse">
    <allow send_destination="org.bluez"/>
  </policy>

</busconfig>
eof

# chmod 0666 /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
  • Paste the following lines to the end of /etc/pulse/system.pa:
# cat << eof >> /etc/pulse/system.pa
### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
eof
  • Create /var/run/pulse/.config/pulse directory. Change its ownership.
# mkdir -p /var/run/pulse/.config/pulse
# chown -R pulse:pulse /var/run/pulse
  • Make the root belong to the pulse-access,audio groups
# usermod -a -G pulse-access,audio root
  • Start PulseAudio service
# systemctl daemon-reload
# systemctl start pulseaudio.service
  • Make sure that the service is active, running and reports on no errors.
# systemctl status pulseaudio.service
   Loaded: loaded (/etc/systemd/system/pulseaudio.service; disabled)
   Active: active (running) since Mon 2015-07-20 12:00:13 UTC; 1min 34s ago
 Main PID: 805 (pulseaudio)
   CGroup: /system.slice/pulseaudio.service
           └─805 /usr/bin/pulseaudio --system --disallow-exit --disable-shm

Bluez5 pairing

PulseAudio 5.x supports A2DP per default.
Make sure the following packages are installed: pulseaudio pulseaudio-module-bluetooth pulseaudio-utils, bluez, bluez-tools.

Admolition note.png Without pulseaudio-module-bluetooth you won't be able to connect after the next pairing and you won't get any usable error messages.
  • Start the Bluetooth system:
# systemctl start bluetooth

Now we can use the bluetoothctl command line utility to pair and connect. Run

# bluetoothctl

to be greeted by its internal command prompt.Then enter:

# power on
# agent on
# default-agent
# scan on

Now make sure that your headset is in pairing mode. It should be discovered shortly. For example,

[NEW] Device 00:07:A4:F2:B3:CB Motorola HT820

shows a device that calls itself "Motorola HT820" and has MAC address 00:07:A4:F2:B3:CB. We will now use that MAC address to initiate the pairing:

# pair 00:07:A4:F2:B3:CB

After pairing, you also need to explicitly connect the device (every time?):

# connect 00:07:A4:F2:B3:CB

If everything works correctly, you now have a separate output device in PulseAudio.
You can now disable scanning again and exit the program:

# scan off
# exit

Playback using PulseAudio

Admolition note.png Next examples assume that the device mac address is 00_07_A4_F2_B3_CB
  • Show the PulseAudio device
# pactl list cards  | awk '/00_07_A4_F2_B3_CB/' RS=""
Card #2
	Name: bluez_card.00_07_A4_F2_B3_CB
	Driver: module-bluez5-device.c
	Owner Module: 16
	Properties:
		device.description = "Motorola HT820"
		device.string = "00:07:A4:F2:B3:CB"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_00_07_A4_F2_B3_CB"
		bluez.class = "0x240404"
		bluez.alias = "Motorola HT820"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Profiles:
		a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: a2dp_sink
	Ports:
		headset-output: Headset (priority: 0, latency offset: 0 usec)
			Part of profile(s): a2dp_sink
		headset-input: Headset (priority: 0, latency offset: 0 usec, not available)

  • Switch the active card profile to a2dp_sink
# pactl set-card-profile 2 a2dp_sink
  • Show the PulseAudio sink
# pactl list sinks | awk '/00_07_A4_F2_B3_CB/' RS=""
Sink #2
	State: SUSPENDED
	Name: bluez_sink.00_07_A4_F2_B3_CB
	Description: Motorola HT820
	Driver: module-bluez5-device.c
	Sample Specification: s16le 2ch 44100Hz
	Channel Map: front-left,front-right
	Owner Module: 16
	Mute: no
	Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	Base Volume: 65536 / 100% / 0.00 dB
	Monitor Source: bluez_sink.00_07_A4_F2_B3_CB.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE DECIBEL_VOLUME LATENCY 
	Properties:
		bluetooth.protocol = "a2dp_sink"
		device.description = "Motorola HT820"
		device.string = "00:07:A4:F2:B3:CB"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_00_07_A4_F2_B3_CB"
		bluez.class = "0x240404"
		bluez.alias = "Motorola HT820"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Ports:
		headset-output: Headset (priority: 0)
	Active Port: headset-output
	Formats:
		pcm
  • Play sound using paplay. Example:
# paplay -d bluez_sink.00_07_A4_F2_B3_CB /mnt/media/vegas.wav

PulseAudio Helpful Links

Touchscreen

See Touchscreen controllers 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

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

Touchscreen calibration

All supported touchscreen devices can be calibrated using xinput_calibrator utility.

To calibrate the touchscreen:

  • Create an empty calibration file:
# cat << eof > /etc/X11/xorg.conf.d/99-calibration.conf
Section "InputClass"
	Identifier	"calibration"
	MatchProduct	"ADS7846 Touchscreen"
	Driver "evdev"
EndSection
eof
  • Run X Server by issuing startx & command
  • Make sure the touchscreen driver is loaded as described in Touchscreen section
  • Set the DISPLAY environment variable:
# export DISPLAY=:0
  • Run xinput_calibrator utility. For proper calibration you are required to touch the touchscreen corners and center in the following order: top-left, top-right, bottom-right, bottom-left, center.
  • Add Option fields into the /usr/share/X11/xorg.conf.d/99-calibration.conf:
# xinput_calibrator
Setting calibration data: 0, 4095, 0, 4095
Calibrating EVDEV driver for "ADS7846 Touchscreen" id=6
        current calibration values (from XInput): min_x=0, max_x=4095 and min_y=0, max_y=4095

Doing dynamic recalibration:
        Setting calibration data: 165, 3864, 3789, 268
        --> 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"	"129 3968 3750 161"
	Option	"SwapAxes"	"0"
	Driver "evdev"
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:

# [ ! -d /mnt/mmcblk0p1 ] && mkdir /mnt/mmcblk0p1
# mount /dev/mmcblk0p1 /mnt/mmcblk0p1

Display options

CM-FX6 evaluation platform can be used with either of five display interfaces: LCD, DSI, 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, DSI 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, DSI, 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.

Frame Buffer Mapping Using DTB

  • Quad configuration with the imx6q-sbc-fx6.dtb blob.
  • LCD/DVI <---> /dev/fb0
  • HDMI <---> /dev/fb2
  • LVDS0 <---> /dev/fb3
  • LVDS1 <---> /dev/fb5
  • Quad configuration with the imx6q-sbc-fx6-hdmi.dtb blob.
  • HDMI <---> /dev/fb0
  • LCD/DVI <---> /dev/fb2
  • LVDS0 <---> /dev/fb3
  • LVDS1 <---> /dev/fb5
  • Quad configuration with the imx6q-sbc-fx6-mipi.dtb blob.
  • MIPI <---> /dev/fb0
  • HDMI <---> /dev/fb2
  • LVDS0 <---> /dev/fb3
  • LVDS1 <---> /dev/fb5

Frame Buffer Tunning Using Kernel Arguments

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

  • For LCD on /dev/fb0:
    video=mxcfb0:dev=lcd,800x480M-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

Configuring mxcfb0 only

  • HDMI on mxcfb0:
    video=mxcfb0:dev=hdmi,1920x1080M-32@50,bpp=32,if=RGB32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off
  • LDB on mxcfb0:
    video=mxcfb0:dev=ldb,1368x768M-18@60,bpp=16,if=RGB666 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off

Starting X Server

Start X server on a default frame buffer:

# startx&

Use Another Frame Buffer

  • Edit the xorg.conf conf file and set a desire frame buffer:
Section "Device"
    Identifier  "i.MX Accelerated Framebuffer Device"
    Driver      "vivante"
    Option      "fbdev"     "/dev/fb2"
    Option      "vivante_fbdev" "/dev/fb2"
    Option      "HWcursor"  "false"
EndSection

Section "ServerFlags"
    Option "BlankTime"  "0"
    Option "StandbyTime"  "0"
    Option "SuspendTime"  "0"
    Option "OffTime"  "0"
EndSection
  • Alternative method of using FRAMEBUFFER environment variable:
Admolition note.png This approach works w/out the xorg configuration file.
The /etc/X11/xorg.conf has to be removed first.
# FRAMEBUFFER=/dev/fb2 startx

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.

Multi Media Support

In order to provide the FreeScale Multi Media Support some packages has to be installed onto a Debian Stretch clean system. The package/extra/fsl-support contains all packages that required for it.


Admolition note.png The CompuLab Debian Stretch release have all these packages installed

Video Playback

Frame Buffer Mode
  • gst-play
# gst-play /media/ElephantsDream-DivXPlusHD.mkv
X11

Start X and set DISPLAY:

# startx &
# export DISPLAY=:0

Make use either:

  • gst-play
# gst-play /media/ElephantsDream-DivXPlusHD.mkv
  • google-chrome [--kiosk] [URL]
# : Browse a local ''/media'' directory
# google-chrome --kiosk /media
# : Browse a remote ''http://192.168.11.170/media'' directory
# google-chrome --kiosk http://192.168.11.170/media

Camera Support

Admolition note.png
  • ov5640 camera works with SB-FX6 Rev 1.2 only
  • In this article we assume that an ov5640 camera is connected to the SB-FX6 P66 connector

Linux provides a variety of streaming tools for the V4L2 compliant devices. We provide some gst-streamer examples that operate on your camera and capture images.

Streaming the camera output to the frame buffer
gst-launch-1.0  imxv4l2videosrc ! imxg2dvideosink
Streaming the camera output to a file
  • Camera output -> mpeg4 codec -> matroska container
gst-launch-1.0 -v imxv4l2videosrc device=/dev/video0 ! videoconvert ! queue ! imxvpuenc_mpeg4 ! matroskamux ! filesink location=test.mkv
  • Camera output -> H-264 codec -> avi container
gst-launch-1.0 imxv4l2videosrc device=/dev/video0 ! videoconvert ! queue ! imxvpuenc_h264 ! avimux ! filesink location=test.avi

GPU Demos

# cd /opt/viv_samples/vdk/
  • Run any of the available tests: ./tutorial[1..7]_es20
# ./tutorial1_es20

Press 'ESC' for exit

See also