CM-T54: Linux: Debian

From Compulab Mediawiki
Jump to: navigation, search

Overview

The example run-time Linux filesystem image for the CompuLab CM-T54 System-on-Module / Computer-on-Module is based on Debian GNU/Linux Wheezy. The CompuLab Linux package for CM-T54 includes ready to run root filesystem demo archive, Linux kernel configuration and source code patches.

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

  • Core system
  • Debian package management system
  • X11 Windowing System
  • Fluxbox desktop manager
  • Iceweasel browser
  • Samba connectivity suite
  • SSH server and client
  • ALSA configuration and usage utilities
  • Bluetooth tools and daemons

The CM-T54: Linux: Getting started page provides a brief introduction on how to install the run-time Linux image.

Using Debian Linux on CM-T54

Connection and Logging In

Use the following username and password to login:

Account with administrative privileges:

cm-debian login: root
Password: 111111

Regular user account:

cm-debian login: user	
Password: 111111

To login into the Linux system, you may use a serial console (ttyO3) at 115200 bps, or connect through the network, or use a keyboard and HDMI display.

Display options

CM-T54 evaluation platform has four video output interfaces: LCD, DVI, LVDS and HDMI. All of them are enabled by default. Current version of Xorg driver of CM-T54 example root file system supports mirror video output mode only. It causes last registered video output device (LVDS) resolution to be propagated to other devices.

In order to force a specific video output device to be selected as a primary device the U-Boot environment variables should be adjusted:

  • HDMI/DVI output enabled (LCD/LVDS disabled)
CM-T54 # setenv mmcloadfdt 'load mmc ${mmcdev} ${fdtaddr} ${fdtfile}; run fdt_adjust_video;'
CM-T54 # setenv fdt_adjust_video 'fdt addr ${fdtaddr}; run fdt_disable_lvds; run fdt_disable_lcd'
CM-T54 # setenv fdt_disable_lvds 'fdt set /ocp/dss/encoder@58004000 status "disabled"; fdt rm /ocp/i2c@48070000/sn65dsi83@2c; fdt rm /aliases display3;'
CM-T54 # setenv fdt_disable_lcd 'fdt rm /display; fdt rm /ocp/dss/port/endpoint@1; fdt rm /aliases display2;'
CM-T54 # saveenv
  • LCD output enabled (LVDS disabled)
CM-T54 # setenv mmcloadfdt 'load mmc ${mmcdev} ${fdtaddr} ${fdtfile}; run fdt_adjust_video;'
CM-T54 # setenv fdt_adjust_video 'fdt addr ${fdtaddr}; run fdt_disable_lvds'
CM-T54 # setenv fdt_disable_lvds 'fdt set /ocp/dss/encoder@58004000 status "disabled"; fdt rm /ocp/i2c@48070000/sn65dsi83@2c; fdt rm /aliases display3;'
CM-T54 # saveenv
  • Default settings
CM-T54 # setenv mmcloadfdt 'load mmc ${mmcdev} ${fdtaddr} ${fdtfile};'
CM-T54 # saveenv

Networking

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

X Windows system

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.

Fluxbox window manager

CM-T54 Debian Linux features installed Fluxbox package - a lightweight window manager for the X Windowing System.

  • Fluxbox provides configurable window decorations, a root menu to launch applications and a toolbar that shows the current workspace name, a set of application names and the current time. There is also a workspace menu which allows you to add or remove workspaces. The slit can be used to dock small applications, e.g. most of the bbtools can use slit.
  • Fluxbox can iconify windows to the toolbar, in addition to adding the window to the Icons submenu of the workspace menu.

Visit Fluxbox Wiki and Official home page for more details.

Software Management

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

HDMI Audio

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

Since the HDMI audio card is the default one in the Linux for CM-T54, the following command can be used for audio play back:

root@cm-debian:~# aplay <wav-file>

Analog Audio

CM-T54 provides the analog audio interface, which is registered as a standard ALSA sound card. If the default CM-T54 configuration is used, the audio drivers are loaded automatically in the boot process.
aplay -l shows list of all soundcards and digital audio devices registered on the system. Here is a sample aplay -l output.

root@cm-debian:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: OMAP4HDMI [OMAP4HDMI], device 0: HDMI hdmi-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: wm8731audio [wm8731-audio], device 0: WM8731 PCM wm8731-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The 'card 1' is the analog audio device.

Analog Audio Settings

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

  • alsamixer - set the “Output Mixer HiFi” control on.

or

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

Analog Audio Playback

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

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

Here is a sample output of aplay -L command:

root@cm-debian:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=OMAP4HDMI
    OMAP4HDMI, 
    Default Audio Device
sysdefault:CARD=OMAP4HDMI
    OMAP4HDMI, 
    Default Audio Device
default:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
sysdefault:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device

The next command can be used for audio play back:

root@cm-debian:~# aplay -D sysdefault:CARD=wm8731audio <wav-file>

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

Recording Audio

CM-T54 provides recording audio signal from either “Line In” or “Mic In” sources. The arecord application can be used for capturing audio signal. arecord -L shows all devices that can be used for audio capturing.
The below list of devices is shown on a CM-T54 module:

root@cm-debian:~# arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
sysdefault:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device

Audio Input Settings

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

Mic
  • Using alsamixer
Set Input Mux playback control to Mic state
Set Mic Boost playback control to the highest state
Set Mic capture control to CAPTURE state
  • Using amixer
root@cm-debian:~# amixer -c 1 cset numid=11,iface=MIXER,name='Input Mux' 1
root@cm-debian:~# amixer -c 1 cset numid=5,iface=MIXER,name='Mic Boost Volume' 1
root@cm-debian:~# amixer -c 1 cset numid=6,iface=MIXER,name='Mic Capture Switch' 1
Line In
  • Using alsamixer
Set Input Mux playback control to Line In state
Set Line capture control to CAPTURE state
  • Using amixer
root@cm-debian:~# amixer -c 1 cset numid=11,iface=MIXER,name='Input Mux' 0
root@cm-debian:~# amixer -c 1 cset numid=4,iface=MIXER,name='Line Capture Switch' 1

Sample Audio Recording

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

root@cm-debian:~# arecord -D sysdefault:CARD=wm8731audio -f cd -t wav /tmp/out.wav

Touchscreen

CM-T54 Evaluation Kit is equipped with Startek KD050C LCD 800x480 LCD touch panel. The touchscreen driver is modularized if you use default CM-T54 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:

modprobe ads7846

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

Touchscreen calibration

A touchscreen device can be calibrated using xinput_calibrator utility.

To calibrate the touchscreen:

  • 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.
  • Create a file /usr/share/X11/xorg.conf.d/99-calibration.conf and paste there a snippet with the calibration results:
root@cm-debian:~# 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: 289, 3781, 3887, 227
	--> 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"	"289 3781 3887 227"
	Option	"SwapAxes"	"0"
EndSection

MMC/SD

The support for MMC/SD card on CM-T54 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. For example, suppose MMC/SD partition you'd like to mount is mmcblk0p1 then:

mkdir -p /mnt/mmcblk0p1 && mount /dev/mmcblk0p1 /mnt/mmcblk0p1


USB3.0 On-The-Go (OTG)

CM-T54 has USB DWC3 (XHCI) based controller. It features SuperSpeed (SS) USB 3.0 Dual-Role-Device (DRD) subsystem with integrated SS (USB3.0) PHY and HS/FS (USB2.0) PHY.

CM-T54 OTG port is USB host and USB device (gadget) capable. OTG Gadget drivers are compiled as modules with default CM-T54 kernel configuration.

Current Linux kernel support of DWC3 features does not allow dynamic role (host/device) switching in runtime. By default, device role is assigned to CM-T54 USB3.0 OTG port.

Host mode can be enabled by adjusting U-Boot environment variable:

CM-T54 # setenv mmcloadfdt 'load mmc ${mmcdev} ${fdtaddr} ${fdtfile}; fdt addr ${fdtaddr}; fdt set /ocp/omap_dwc3/dwc3/ dr_mode host;'
CM-T54 # saveenv
  • To enable the default device mode modify U-Boot environment variable:
CM-T54 # setenv mmcloadfdt 'load mmc ${mmcdev} ${fdtaddr} ${fdtfile};'
CM-T54 # saveenv

Testing OTG device (gadget) mode

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

  • Connect USB3.0 OTG micro B-cable (ID pin Float) to P16 USB OTG port of SB-T54 baseboard (not included in CM-T54 eval kit).
  • Connect other side Standard-A connector to Linux Host PC USB3.0 port.
Emulate a serial link
  • Load gadget driver on CM-T54 eval board:
root@cm-debian:~# modprobe g_serial
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready
g_serial gadget: super-speed config #2: CDC ACM config
  • Ensure the connection is established on the Host PC:
lifshitz@dlifshitz:~$ dmesg
...
[161033.952421] usb 4-1: new SuperSpeed USB device number 9 using xhci_hcd
[161033.981896] cdc_acm 4-1:2.0: This device cannot do calls on its own. It is not a modem.
[161033.981986] cdc_acm 4-1:2.0: ttyACM0: USB ACM device
  • Receive data on CM-T54 eval board:
root@cm-debian:~#  cat /dev/ttyGS0
  • Send data from Host PC:
lifshitz@dlifshitz:~$ echo "Test message" > /dev/ttyACM0

Testing OTG host mode

  • Plug USB3.0 mass storage device into Standard-A receptacle cable (included in CM-T54 eval kit)
  • Connect other side USB3.0 OTG micro B-connector (ID pin Ground) to P16 USB OTG port of SB-T54 baseboard
root@cm-debian:~# dmesg
...
usb 3-1: new SuperSpeed USB device number 2 using xhci-hcd
usb 3-1: New USB device found, idVendor=8564, idProduct=1000
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-1: Product: Mass Storage Device
usb 3-1: Manufacturer: JetFlash
usb 3-1: SerialNumber: 946414084
usb-storage 3-1:1.0: USB Mass Storage device detected
scsi1 : usb-storage 3-1:1.0
scsi 1:0:0:0: Direct-Access     JetFlash Transcend 8GB    1.00 PQ: 0 ANSI: 5
sd 1:0:0:0: Attached scsi generic sg0 type 0
sd 1:0:0:0: [sda] 15435776 512-byte logical blocks: (7.90 GB/7.36 GiB)
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Mode Sense: 23 00 00 00
sd 1:0:0:0: [sda] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
 sda: unknown partition table
sd 1:0:0:0: [sda] Attached SCSI removable disk

WiFi

CM-T54 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:

root@cm-debian:~# lsmod | grep mwifiex
mwifiex_sdio           16807  0 
mwifiex               166126  1 mwifiex_sdio
  • iwconfig command from wireless-tools package can be used to retrieve detailed information about the WiFi interfaces:
root@cm-debian:~# iwconfig mlan0
mlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   
          Retry short limit:9   RTS thr=2347 B   Fragment thr=2346 B   
          Encryption key:off
          Power Management:off
  • Sample WiFi scanning:
root@cm-debian:~# iwlist mlan0 scan

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

Bluetooth

CM-T54 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:

root@cm-debian:~# lsmod | grep btmrvl
btmrvl_sdio            10928  0 
btmrvl                 10562  1 btmrvl_sdio
bluetooth             256992  17 btmrvl,rfcomm,btmrvl_sdio
  • HCI device configuration utility can be run to retrieve detailed information about the Bluetooth interfaces:
root@cm-debian:~# hciconfig -a
hci1:	Type: BR/EDR  Bus: SDIO
	BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
	DOWN 
	RX bytes:202 acl:0 sco:0 events:6 errors:0
	TX bytes:78 acl:0 sco:0 commands:4 errors:0

hci0:	Type: BR/EDR  Bus: SDIO
	BD Address: D0:E7:82:B5:0C:F6  ACL MTU: 1021:6  SCO MTU: 120:6
	UP RUNNING PSCAN 
	RX bytes:1700 acl:0 sco:0 events:59 errors:0
	TX bytes:1479 acl:0 sco:0 commands:59 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: 0x6e0100
	Service Classes: Networking, Rendering, Capturing, Audio, Telephony
	Device Class: Computer, Uncategorized
	HCI Version: 3.0 (0x5)  Revision: 0x8300
	LMP Version: 3.0 (0x5)  Subversion: 0x4660
	Manufacturer: Marvell Technology Group Ltd. (72)
  • If the HCI device is not running, use the below command to enable the HCI device:
# hciconfig hci0 up

A2DP Headphones

  • Scan for available devices to find out Headphones BT device address:
root@cm-debian:~# hcitool scan
Scanning ...
	00:07:A4:F2:B3:CB	Motorola HT820
  • Add new PCM device by editing /etc/asound.conf:
pcm.btheadphones {
   type plug
   slave {
       pcm {
           type bluetooth
           device 00:07:A4:F2:B3:CB
           profile "auto"
       }
   }
   hint {
       show on
       description "BT Headphones"
   }
}
ctl.btheadphones {
  type bluetooth
}
  • List device names to ensure correct settings in /etc/asound.conf:
root@cm-debian:~#  aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
btheadphones
    BT Headphones
default:CARD=H58040000encode
    HDMI 58040000.encoder, 
    Default Audio Device
sysdefault:CARD=H58040000encode
    HDMI 58040000.encoder, 
    Default Audio Device
default:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
sysdefault:CARD=wm8731audio
    wm8731-audio, 
    Default Audio Device
  • Put the headphones in the pairing mode.
  • Launch bluez-simple-agent application and provide device PIN code on request:
root@cm-debian:~# bluez-simple-agent hci0 00:07:A4:F2:B3:CB
RequestPinCode (/org/bluez/1335/hci0/dev_00_07_A4_F2_B3_CB)
Enter PIN Code: 0000
Release
New device (/org/bluez/1335/hci0/dev_00_07_A4_F2_B3_CB)
  • Launch aplay playback tool:
root@cm-debian:~# aplay -D btheadphones sample_audio.wav
Playing WAVE 'sample_audio.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo


See also