CM-T43: Linux: Debian
- 1 Overview
- 2 Using Debian Linux on CM-T43
- 2.1 Connection and Logging In
- 2.2 Networking
- 2.3 X Windows system
- 2.4 Fluxbox window manager
- 2.5 Software Management
- 2.6 MMC/SD
- 2.7 Display options
- 2.8 USB Dual-Role-Device
- 2.9 Bluetooth
- 2.10 Touchscreen
- 2.11 RTC
- 2.12 CAN bus
- 2.13 GPIO
- 3 See also
The example run-time Linux filesystem image for the CompuLab CM-T43 System-on-Module / Computer-on-Module is based on Debian GNU/Linux Jessie. The CompuLab Linux package for CM-T43 includes ready to run Linux kernel binary, root filesystem demo image archive, Linux kernel configuration and source code patches.
The default Debian Jessie Linux image includes more than 400 software packages. Among them:
- Core system
- Debian package management system
- X11 Windowing System
- Fluxbox desktop manager
- Netsurf browser
- Samba connectivity suite
- SSH server and client
- ALSA configuration and usage utilities
- Bluetooth 5.0 tools and daemons
The CM-T43: Linux: Manual Installation page provides a brief introduction on how to install the run-time Linux image.
Using Debian Linux on CM-T43
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 (ttyO0) at 115200 bps, or connect through the network.
CM-T43 can operate in two modes: dual MAC mode, or as a 3 port ethernet switch. The default mode of operation is dual MAC mode. A user guide for both operation modes can be found in the Linux Core CPSW User's Guide article in the TI wiki. 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.
Switching to 3-port switch mode
To enable 3-port switch mode, the device tree blob must be modified to remove the dual_emac property before Linux boots. This can be done using the following U-Boot commands:
# fdt addr <address fdt was loaded to> # fdt rm /ocp/ethernet@4a100000 dual_emac
X Windows system
CompuLab Debian Jessie Linux demo image 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-T43 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.
The support for MMC/SD card on CM-T43 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
CM-T43 evaluation platform has three video output interfaces: LCD, DVI, and LVDS. Default configuration of Debian Linux for CM-T43 uses LCD as primary video output.
CM-T43 has USB DWC3 based controller. It features USB 2.0 Dual-Role-Device (DRD) subsystem with integrated HS/FS (USB2.0) PHY. CM-T43 DRD port is USB host and USB device (gadget) capable. USB Device Gadget drivers are compiled as modules with default CM-T43 kernel configuration. Current Linux kernel support of DWC3 features does not allow dynamic role (host/device) switching during runtime. By default, host role is assigned to CM-T43 DRD port.
Device mode can be enabled by running the following U-Boot commands before boot:
# fdt addr <address fdt was loaded to> # fdt resize # fdt set /ocp/omap_dwc3@48380000/usb@48390000 dr_mode peripheral
Testing Device (gadget) mode
Default CM-T43 kernel configuration enables g_serial, g_mass_storage, g_ether, g_audio, and g_hid gadget drivers. More gadget drivers can be enabled in the kernel configuration.
- Connect USB OTG micro B-cable (ID pin Float) to P3 USB DRD port of SB-SOM baseboard.
- Connect other side Standard-A connector to Linux Host PC USB Host port.
- Load gadget driver on CM-T43 Eval board:
root@cm-debian:~# modprobe g_serial [ 114.805045] g_serial gadget: Gadget Serial v2.4 [ 114.809968] g_serial gadget: g_serial ready [ 115.306074] g_serial gadget: high-speed config #2: CDC ACM config
- Ensure the connection is established on the Host PC:
user@linux-host:~$ dmesg ... [72415.607738] cdc_acm 2-1.8.2:2.0: ttyACM0: USB ACM device [72415.608446] usbcore: registered new interface driver cdc_acm [72415.608447] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
- Receive data on CM-T43 Eval board:
root@cm-debian:~# cat /dev/ttyGS0
- Send data from Host PC:
user@linux-host:~$ echo "Test message" > /dev/ttyACM0
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 14294 0 btmrvl 9612 1 btmrvl_sdio bluetooth 304454 22 bnep,btmrvl,btmrvl_sdio
- 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 jessie 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
# 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 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
PulseAudio 5.x supports A2DP per default.
Make sure the following packages are installed: pulseaudio pulseaudio-module-bluetooth pulseaudio-utils, bluez, bluez-tools.
|Without pulseaudio-module-bluetooth package it will be impossible to connect after the next pairing and there will be no usable error messages.|
- Start the Bluetooth system:
# systemctl start bluetooth
Now we can use the bluetoothctl command line utility to pair and connect. Run
to be greeted by its internal command prompt. Then enter:
# power on # agent on # default-agent # scan on
Now make sure that the 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, connect to the device explicitly:
# connect 00:07:A4:F2:B3:CB
A new PulseAudio output device is ready.
Disable the scanning and exit the program:
# scan off # exit
Playback using PulseAudio
|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 #1 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: 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 Ports: headset-output: Headset (priority: 0, latency offset: 0 usec) Part of profile(s): a2dp headset-input: Headset (priority: 0, latency offset: 0 usec, not available)
- Switch the active card profile to A2DP
# pactl set-card-profile 1 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
- To transfer files between CM-T43 and a remote device, make sure that the remote device supports ObexFTP transfers by running the ObexFTP daemon on the remote device:
user@linux-host:~$ obexftpd -b
- To send a file from CM-T43 to a target device, run the following command:
root@cm-debian:~# obexftp -b <MAC_address_of_device> -p <filename>
- To download a file from a target device to CM-T43, run the following command:
root@cm-debian:~# obexftp -b <MAC_address_of_device> -g <filename>
CM-T43 Evaluation Kit is equipped with Startek KD050C LCD 800x480 LCD touch panel.
The X Windows system of CM-T43 uses EVDEV X server input driver to get the input from the touchscreen.
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:
- Run xinput_calibrator utility. For proper calibration you are required to touch the touchscreen at the displayed markers.
- Create a file /usr/share/X11/xorg.conf.d/99-calibration.conf and paste there a snippet with the calibration results:
xinput_calibrator Calibrating EVDEV driver for "ti-tsc" 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: 105, 3975, 3763, 174 --> 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 "ti-tsc" Option "Calibration" "105 3975 3763 174" Option "SwapAxes" "0" EndSection
Accessing and setting the RTC
To access the RTC time and date run:
root@cm-debian:~# hwclock Sat Jan 1 00:00:00 2000 -10.011159 seconds
To set the date and write it into the RTC do the following:
root@cm-debian:~# date -s "31 JUL 2015 10:00:00" Fri Jul 31 10:00:00 UTC 2015 root@cm-debian:~# hwclock -w root@cm-debian:~# hwclock Fri Jul 31 10:00:13 2015 -1.066224 seconds
Install can-utils using:
# apt-get install can-utils
CAN interface configuration
- Load the can bus modules:
# modprobe can-raw can: controller area network core (rev 20120528 abi 9) NET: Registered protocol family 29 can: raw protocol (rev 20120528) # modprobe can-bcm can: broadcast manager protocol (rev 20120528 t)
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 c_can_platform 481d0000.can can0: setting BTR=0518 BRPE=0000
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  11 22 33 44 55 66 77 88 can0 11111111  11 22 33 44 55 66 77 88
To use a GPIO:
- Select a pin you wish to use as GPIO by consulting the CM-T43 reference manual. The reference manual contains a list of pins and the possible functions each pin can support, many of which include GPIO signals as one of the possible functions.
- Setup the pinmux so that the GPIO function is selected for the pin you chose in the previous step. This may require you to edit the device tree for CM-T43. Consult the device tree article in the CM-T43 Linux wiki.
- Export the GPIO in Linux sysfs and cd into it
# echo <gpio_num> > /sys/class/gpio/export # cd gpio<gpio_num>
- Select GPIO input/output function:
# echo in > direction
# echo out > direction
- To read GPIO input (or determine what value is being output):
# cat value 0
- To output a value on the GPIO pin:
# echo 1 > value