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

From Compulab Mediawiki
Jump to: navigation, search
(New page: == Overview == The example run-time Linux filesystem image for CM-FX6 is based on Debian GNU/Linux Sid. The CompuLab Linux package for CM-FX6 includes ready to run NAND flash image, Linux ...)
 
(Frame Buffer Tunning Using Kernel Arguments)
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
The example run-time Linux filesystem image for CM-FX6 is based on Debian GNU/Linux Sid.
+
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 Sid 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
 
* Debian package management system
 
* Debian package management system
 
* X11 Windowing System
 
* X11 Windowing System
* Enlightenment desktop manager
+
* Fluxbox desktop manager
* Netsurf web browser
+
* SSH server and client
* Samba connectivity suite
+
* PulseAudio configuration and usage utilities  
* SSH and FTP server and client
 
* ALSA 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.ubi}} - ready to run Debian Linux UBI image for installation onto the NAND flash
 
* {{filename|debian-image.tar.bz2}} - archive of the Debian root file system
 
* {{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-1.bin}} - ready to run Linux kernel version 3.0.35-cm-fx6-1 for CM-FX6
 
* {{filename|linux-3.0.35-cm-fx6-1.config}} - Linux kernel 3.0.35-cm-fx6-1 configuration file
 
* {{filename|linux-3.0.35-cm-fx6-1.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-1.patch}})
 
 
=== 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.
 
  
  
Line 49: Line 23:
  
 
=== Connection and Logging In ===
 
=== Connection and Logging In ===
Use the following usernames and passwords 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>
  
Regular user account:
+
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>
 
<pre>
User: user
+
Debian GNU/Linux stretch/sid imx6-sid ttymxc3
Password: 111111
+
 
 +
imx6-sid login: root
 +
You are required to change your password immediately (root enforced)
 +
Enter new UNIX password:
 
</pre>
 
</pre>
  
In addition to these accounts CM-FX6 allows anonymous FTP access.
+
=== Networking ===
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).
+
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}}.
 +
For more information about Debian Linux network configuration read:
 +
* [http://www.debian.org/doc/manuals/reference/ch05.en.html Network setup] chapter in the [http://www.debian.org/doc/manuals/reference/index.en.html Debian Reference]
 +
* [https://wiki.debian.org/NetworkConfiguration Network Configuration] chapter in the [https://wiki.debian.org/ Debian Wiki]
  
 +
The majority of network setup can be done via the {{filename|interfaces}} configuration file at {{filename|/etc/network/interfaces}}.
 +
{{Note|'''auto''' line is required for interfaces that have to be brought up at boot time.}}
  
=== Networking ===
+
* Using DHCP to automatically configure the interface
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 [http://www.debian.org/doc/manuals/reference/ch05.en.html Network setup] chapter in the [http://www.debian.org/doc/manuals/reference/index.en.html Debian Reference].
+
<pre>
 +
auto eth0
 +
allow-hotplug eth0
 +
iface eth0 inet dhcp
 +
</pre>
  
 
+
* Configuring the interface manually
=== Consoles ===
 
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:
 
 
<pre>
 
<pre>
INIT: Id "T0" respawning too fast: disabled for 5 minutes
+
auto eth0
 +
    iface eth0 inet static
 +
        address 192.168.1.170
 +
        netmask 255.255.0.0
 +
        gateway 192.0.0.1
 
</pre>
 
</pre>
This is not an error message, it is just a warning that can be eliminated by editing {{filename|/etc/inittab}} file.
 
  
 +
=== 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:
 +
* Systemd getty generator [http://www.freedesktop.org/software/systemd/man/systemd-getty-generator.html systemd-getty-generator]
 +
* Gettys on Serial Consoles [http://0pointer.de/blog/projects/serial-console.html serial-console]
  
 
=== X Windows system ===
 
=== X Windows system ===
CompuLab distribution contains full featured X Windows system with Enlightenment 17 window manager.
+
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.
 
Before starting X Windows, connect USB mouse and keyboard to the system.
 
You can run X Windows by typing '''''startx'''''.
 
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.
+
=== Software Management ===
To activate the "touchscreen" profile, enter '''Main->Settings Panel->Settings->Profiles'''. Select the '''Touchscreen''' profile.
+
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.
 +
 
 +
=== 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 [http://www.alsa-project.org ALSA project official website].
 +
<dl>
 +
'''''aplay -l''''' shows list of all soundcards and digital audio devices registered on the system. Here is an '''''aplay -l''''' sample output.
 +
</dl>
 +
<pre>
 +
**** 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
 +
</pre>
 +
 
 +
==== 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:
 +
<pre>
 +
# 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>
 +
# amixer cset numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch' on
 +
</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>
 +
 
 +
==== HDMI ====
 +
{{Note|The HDMI audio will work only if the HDMI cable is plugged in.}}
 +
The interface controls:
 +
<pre>
 +
# 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'
 +
</pre>
 +
Playback using HDMI output:
 +
<pre>
 +
# aplay -D hw:1,0 <wav-file>
 +
</pre>
 +
 
 +
==== 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>
 +
# 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>
 +
 
 +
==== Sound Capture Devices ====
 +
{{cmd|arecord -l}} shows all devices that can be used for audio capturing.
 +
<pre>
 +
# 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
 +
</pre>
 +
 
 +
==== Analog Audio Recording ====
 +
Wolfsom wm8731 provides an audio capturing feature from either ''Mic In'' or ''Line In'' input sources.
 +
{{cmd|alsamixer}} or {{cmd|amixer}} can be used in order to switch between these inputs.
 +
* Set bitrate options:
 +
<pre>
 +
# export RATE_OPT="--rate=32000"
 +
</pre>
 +
* Line In recording:
 +
<pre>
 +
# : Line In recording
 +
</pre>
 +
<pre>
 +
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>
 +
* Mic In recording:
 +
<pre>
 +
# : Mic In recording
 +
</pre>
 +
<pre>
 +
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
 +
</pre>
 +
* Playback a recorded file:
 +
<pre>
 +
# aplay -vv /tmp/file.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>
 +
 
 +
=== 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.<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.
 +
<br>
 +
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.
 +
 
 +
==== 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.
 +
<pre>
 +
# 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
 +
</pre>
 +
 
 +
===== Gadget mode =====
 +
* g_audio
 +
<pre>
 +
# 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
 +
</pre>
 +
Connect a desktop PC to the OTG port.
 +
<pre>
 +
g_audio gadget: high speed config #1: Linux USB Audio Gadget
 +
</pre>
 +
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>
 +
# aplay -D hw:3,0 <wav-file>
 +
</pre>
 +
* g_mass_storage
 +
<pre>
 +
# 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
 +
</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>
 +
 
 +
=== WiFi ===
 +
CM-FX6 features 802.11b/g/n wireless connectivity solution, implemented with the AzureWave AW-NH387 Wireless controller module.
  
To switch back to the standard profile, please see the [[CM-FX6: Linux: Known Issues|Known Issues]] article.
+
==== WiFi Initialization ====
 +
* WiFi requires no user interaction for being configured. The driver gets loaded automatically.
 +
Make sure that the WiFi driver is loaded:
 +
<pre>
 +
# lsmod | grep mwifiex
 +
mwifiex_sdio          12214  0
 +
mwifiex              113596  1 mwifiex_sdio
 +
</pre>
 +
The WiFi driver can be loaded manually:
 +
<pre>
 +
# 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)
 +
</pre>
 +
* {{cmd|iwconfig}} command from {{cmd|wireless-tools}} package can be used to retrieve detailed information about the WiFi interfaces:
 +
<pre>
 +
# 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
 +
</pre>
 +
* Activate the interface:
 +
<pre>
 +
# ifconfig mlan0 up
 +
</pre>
 +
* Sample WiFi scanning:
 +
<pre>
 +
# iwlist mlan0 scan
 +
</pre>
 +
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
 +
{{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
  
=== Software Management ===
+
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 ===
 +
 
 +
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.<br>
 +
Make sure that the Bluetooth driver is loaded:
 +
<pre>
 +
# lsmod | grep btmrvl
 +
btmrvl_sdio            9024  0
 +
btmrvl                10572  3 btmrvl_sdio
 +
</pre>
 +
The Bluetooth driver can be loaded manually:
 +
<pre>
 +
# modprobe btmrvl_sdio
 +
Bluetooth: vendor=0x2df, device=0x911a, class=255, fn=2
 +
</pre>
 +
 
 +
* HCI device configuration utility can be run to retrieve detailed information about the Bluetooth interfaces:
 +
<pre>
 +
# 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)
 +
</pre>
 +
 
 +
* If the HCI device is not running, use the below command to enable the HCI device:
 +
<pre>
 +
# hciconfig hci0 up
 +
</pre>
 +
 
 +
==== Bluez5 & PulseAudio ====
 +
Debian is using BlueZ 5 and PluseAudio 5, which are fairly new.<br>
 +
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>
 +
# apt-get install --no-install-recommends pulseaudio pulseaudio-module-bluetooth
 +
</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
 +
 
 +
# 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>
 +
# 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
 +
</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
  
Debian Linux image for CM-FX6 includes all the information required to use Debian package management utilities.
+
.ifexists module-bluetooth-discover.so
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.
+
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>
 +
# systemctl daemon-reload
 +
# systemctl start pulseaudio.service
 +
</pre>
 +
:* Make sure that the service is active, running and reports on no errors.
 +
<pre>
 +
# 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
 +
</pre>
  
 +
==== Bluez5 pairing ====
 +
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.}}
  
=== HDMI Audio ===
+
* Start the Bluetooth system:
CM-FX6 provides a digital HDMI audio interface, which is registered as a standard ALSA sound card.
+
<pre>
If the default CM-FX6 configuration is used, the audio drivers are loaded automatically in the boot process.
+
# systemctl start bluetooth
{{Note|The HDMI audio will work only if the HDMI cable is plugged in.}}
+
</pre>
 +
Now we can use the {{filename|'''bluetoothctl'''}} command line utility to pair and connect. Run
 +
<pre>
 +
# 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>
  
More information about Linux audio subsystem can be found at [http://www.alsa-project.org ALSA project official website].
+
==== Playback using PulseAudio ====
 +
{{Note|Next examples assume that the device mac address is '''00_07_A4_F2_B3_CB'''}}
 +
* Show the PulseAudio device
 +
<pre>
 +
# 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)
  
 +
</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 ===
CM-FX6 Evaluation Kit is equipped with DataImage SCF0403852GGU04 LCD touch panel.
+
See [[CM-FX6:_Linux:_Kernel#Touchscreen_controllers_support|Touchscreen controllers support]] sections for kernel configuration details to enable support for the particular touchscreen.
See [[CM-FX6: Linux: Kernel#LCD, DVI and HDMI support|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 {{filename|udev}} automatically on Linux boot.
 
The touchscreen driver is modularized if you use default CM-FX6 configuration and is loaded by {{filename|udev}} automatically on Linux boot.
 
If the touchscreen driver is not loaded, the following command will load the touchscreen driver:
 
If the touchscreen driver is not loaded, the following command will load the touchscreen driver:
Line 113: 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 {{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 can be performed with {{cmd|ts_calibrate}} utility available in package {{filename|libts-bin}}.
 
 
To calibrate the touchscreen:
 
To calibrate the touchscreen:
* Make sure X Server is not running
+
* Create an empty calibration file:
* Make sure the touchscreen driver is loaded as described in [[#Touchscreen|Touchscreen]] section
+
<pre>
* Run {{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 {{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 ===
 
The support for MMC/SD card on CM-FX6 is built into the Linux kernel.
 
The support for MMC/SD card on CM-FX6 is built into the Linux kernel.
To mount the memory card, monitor ''/proc/partitions'' to see what partitions were detected on the MMC/SD card.
+
To mount a memory card, monitor ''/proc/partitions'' to see what partitions were detected on the MMC/SD card.
For example, suppose 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>
  
 +
=== 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.<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. 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 ====
 +
* Quad configuration with the {{filename|'''imx6q-sbc-fx6.dtb'''}} blob.
 +
::* LCD/DVI <---> {{filename|/dev/fb0}}
 +
::* HDMI    <---> {{filename|/dev/fb2}}
 +
::* LVDS0  <---> {{filename|/dev/fb3}}
 +
::* LVDS1  <---> {{filename|/dev/fb5}}
  
=== Display options ===
+
* Quad configuration with the {{filename|'''imx6q-sbc-fx6-hdmi.dtb'''}} blob.
CM-FX6 evaluation platform can be used with at least three display interfaces: LCD, DVI, and HDMI.
+
::* HDMI   <---> {{filename|/dev/fb0}}
Default configuration of Linux kernel and Debian Linux for CM-FX6 uses LCD as primary video output.
+
::* LCD/DVI <---> {{filename|/dev/fb2}}
It is possible to use either the DVI or the LCD interface at the same time. HDMI can be used simultaneously with either LCD or DVI interface.<br>
+
::* LVDS0  <---> {{filename|/dev/fb3}}
Linux implementation of the i.MX6 display subsystem (IPU) is described in [[CM-FX6: Linux: Kernel#LCD, DVI and HDMI support|LCD, DVI and HDMI support]] section.
+
::* LVDS1  <---> {{filename|/dev/fb5}}
  
In the default Linux configuration for CM-FX6, two main framebuffers are available: {{filename|/dev/fb0}} and {{filename|/dev/fb2}}.
+
* Quad configuration with the {{filename|'''imx6q-sbc-fx6-mipi.dtb'''}} blob.
The default mapping is:
+
::* MIPI    <---> {{filename|/dev/fb0}}
* LCD/DVI <---> {{filename|/dev/fb0}}
+
::* HDMI    <---> {{filename|/dev/fb2}}
* HDMI    <---> {{filename|/dev/fb2}}
+
::* LVDS0  <---> {{filename|/dev/fb3}}
 +
::* LVDS1  <---> {{filename|/dev/fb5}}
  
In order to change the mapping, the following kernel command line parameters can be provided:
+
==== Frame Buffer Tunning Using Kernel Arguments ====
* For DVI on {{filename|/dev/fb0}}:<pre>video=mxcfb0:dev=dvi,1280x800-24M@50,if=RGB24</pre>
+
In order to set a desired frame buffer resolution, the following kernel command line parameters can be used:
* For HDMI on {{filename|/dev/fb0}}:<pre>video=mxcfb0:dev=hdmi,1280x720-24M@50,if=RGB24</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 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>
 +
==== 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>
  
 +
=== Starting X Server ===
 +
Start X server on a default frame buffer:
 +
<pre>
 +
# startx&
 +
</pre>
 +
==== Use Another Frame Buffer ====
 +
* Edit the {{filename|xorg.conf}} conf file and set a desire frame buffer:
 +
<pre>
 +
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
 +
</pre>
 +
* Alternative method of using '''FRAMEBUFFER''' environment variable:
 +
{{Note|This approach works w/out the xorg configuration file.<br> The {{filename|/etc/X11/xorg.conf}} has to be removed first.}}
 +
<pre>
 +
# FRAMEBUFFER=/dev/fb2 startx
 +
</pre>
  
 
=== GPIO access ===
 
=== GPIO access ===
Line 168: 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.}}
  
 +
== 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 {{filename|'''package/extra/fsl-support'''}} contains all packages that required for it.
 +
 +
{{Note|The CompuLab Debian Stretch release have all these packages installed}}
 +
 +
==== Video Playback  ====
 +
===== Frame Buffer Mode =====
 +
* gst-play
 +
<pre>
 +
# gst-play /media/ElephantsDream-DivXPlusHD.mkv
 +
</pre>
 +
===== X11 =====
 +
Start X and set DISPLAY:
 +
<pre>
 +
# startx &
 +
# export DISPLAY=:0
 +
</pre>
 +
Make use either:
 +
* gst-play
 +
<pre>
 +
# gst-play /media/ElephantsDream-DivXPlusHD.mkv
 +
</pre>
 +
* google-chrome [--kiosk] [URL]
 +
<pre>
 +
# : Browse a local ''/media'' directory
 +
# google-chrome --kiosk /media
 +
</pre>
 +
<pre>
 +
# : Browse a remote ''http://192.168.11.170/media'' directory
 +
# google-chrome --kiosk http://192.168.11.170/media
 +
</pre>
 +
==== 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 =====
 +
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 ===
 +
<pre>
 +
# cd /opt/viv_samples/vdk/
 +
</pre>
 +
* Run any of the available tests: ./tutorial[1..7]_es20
 +
<pre>
 +
# ./tutorial1_es20
 +
</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