Difference between revisions of "CL-SOM-AM57x: Linux: Debian"
(→See also) |
|||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
− | The example run-time Linux filesystem image for the CompuLab CL-SOM-AM57x System-on-Module / Computer-on-Module is based on Debian | + | The example run-time Linux filesystem image for the CompuLab CL-SOM-AM57x System-on-Module / Computer-on-Module is based on Debian GNU/Linux stretch/sid (armhf). |
− | The default Debian | + | The default Debian sid Linux image includes many software packages. Among them: |
* Core system | * Core system | ||
Line 8: | Line 8: | ||
* X11 Windowing System | * X11 Windowing System | ||
* Fluxbox desktop manager | * Fluxbox desktop manager | ||
− | |||
− | |||
− | |||
* SSH server and client | * SSH server and client | ||
* ALSA configuration and usage utilities | * ALSA configuration and usage utilities | ||
− | |||
The [[CL-SOM-AM57x: Linux: Automatic Installation|Automatic Installation]] page provides a brief introduction on how to install the run-time Linux image. | The [[CL-SOM-AM57x: Linux: Automatic Installation|Automatic Installation]] page provides a brief introduction on how to install the run-time Linux image. | ||
Line 73: | Line 69: | ||
To calibrate the touchscreen: | To calibrate the touchscreen: | ||
+ | * Update the primary video output to the calibrated display type. | ||
* Run X Server by issuing {{cmd|startx}} command | * Run X Server by issuing {{cmd|startx}} command | ||
* Make sure the touchscreen driver is loaded | * Make sure the touchscreen driver is loaded | ||
Line 79: | Line 76: | ||
* Create a file {{filename|/usr/share/X11/xorg.conf.d/99-calibration.conf}} and paste there a snippet with the calibration results: | * Create a file {{filename|/usr/share/X11/xorg.conf.d/99-calibration.conf}} and paste there a snippet with the calibration results: | ||
<pre> | <pre> | ||
− | root@ | + | root@cl-debian-armhf:~# xinput_calibrator |
Setting calibration data: 0, 4095, 0, 4095 | Setting calibration data: 0, 4095, 0, 4095 | ||
Calibrating EVDEV driver for "ADS7846 Touchscreen" id=6 | Calibrating EVDEV driver for "ADS7846 Touchscreen" id=6 | ||
Line 94: | Line 91: | ||
Option "SwapAxes" "0" | Option "SwapAxes" "0" | ||
EndSection | EndSection | ||
+ | </pre> | ||
+ | |||
+ | === Bluetooth === | ||
+ | |||
+ | CL-SOM-AM57x features Bluetooth 4.1 BLE interface. Following sections describe the initialization and simple use cases of Bluetooth device. | ||
+ | |||
+ | ==== Host Controller Interface (HCI) Initialization ==== | ||
+ | |||
+ | * For TI SDK kernel v4.1.13, create a symbolic link to the bluetooth UART: | ||
+ | <pre> | ||
+ | root@debian-armhf:~# ln -sf /dev/ttyS9 /dev/ttyO9 | ||
+ | </pre> | ||
+ | |||
+ | * Attach the ttyO9 serial port to the HCI Bluetooth subsystem: | ||
+ | <pre> | ||
+ | root@debian-armhf:~# echo "enabled" > /sys/bus/platform/devices/reg-userspace-consumer.0/state | ||
+ | root@debian-armhf:~# hciattach -s 115200 /dev/ttyO9 texas 3000000 | ||
+ | Found a Texas Instruments' chip! | ||
+ | Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts | ||
+ | Loaded BTS script version 1 | ||
+ | texas: changing baud rate to 3000000, flow control to 1 | ||
+ | [ 89.019183] Bluetooth: Core ver 2.21 | ||
+ | [ 89.023025] NET: Registered protocol family 31 | ||
+ | [ 89.027726] Bluetooth: HCI device and connection manager initialized | ||
+ | [ 89.034581] Bluetooth: HCI socket layer initialized | ||
+ | [ 89.039779] Bluetooth: L2CAP socket layer initialized | ||
+ | [ 89.045296] Bluetooth: SCO socket layer initialized | ||
+ | [ 89.055192] Bluetooth: HCI UART driver ver 2.3 | ||
+ | [ 89.059914] Bluetooth: HCI UART protocol H4 registered | ||
+ | [ 89.065306] Bluetooth: HCI UART protocol LL registered | ||
+ | [ 89.308172] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 | ||
+ | [ 89.313747] Bluetooth: BNEP filters: protocol multicast | ||
+ | [ 89.319275] Bluetooth: BNEP socket layer initialized | ||
+ | Device setup complete | ||
+ | </pre> | ||
+ | |||
+ | * Run HCI device configuration utility to retrieve detailed information about the Bluetooth device: | ||
+ | <pre> | ||
+ | root@debian-armhf:~# hciconfig -a | ||
+ | hci0: Type: BR/EDR Bus: UART | ||
+ | BD Address: 54:4A:16:13:0D:42 ACL MTU: 1021:6 SCO MTU: 180:4 | ||
+ | UP RUNNING PSCAN | ||
+ | RX bytes:704 acl:0 sco:0 events:43 errors:0 | ||
+ | TX bytes:1782 acl:0 sco:0 commands:43 errors:0 | ||
+ | Features: 0xff 0xfe 0x2d 0xfe 0xdb 0xff 0x7b 0x87 | ||
+ | Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 | ||
+ | Link policy: RSWITCH HOLD SNIFF | ||
+ | Link mode: SLAVE ACCEPT | ||
+ | Name: 'cl-som-am57x-sid' | ||
+ | Class: 0x000000 | ||
+ | Service Classes: Unspecified | ||
+ | Device Class: Miscellaneous, | ||
+ | HCI Version: 4.1 (0x7) Revision: 0x0 | ||
+ | LMP Version: 4.1 (0x7) Subversion: 0xac08 | ||
+ | Manufacturer: Texas Instruments Inc. (13) | ||
+ | </pre> | ||
+ | |||
+ | * If the HCI device is not running, use the below command to enable the HCI device: | ||
+ | <pre> | ||
+ | root@debian-armhf:~# hciconfig hci0 up | ||
+ | </pre> | ||
+ | * HCI Inquire remote devices. | ||
+ | <pre> | ||
+ | root@debian-armhf:~# hcitool scan | ||
+ | Scanning ... | ||
+ | </pre> | ||
+ | |||
+ | ==== Bluez5 & PulseAudio ==== | ||
+ | Debian stretch/sid is using BlueZ 5 and PluseAudio 5. | ||
+ | BlueZ 5 dropped support for alsa, and uses PulseAudio.<br> | ||
+ | PulseAudio 5 only supports the A2DP profile and not HSP/HFP. <br> | ||
+ | * Software to install {{filename|'''pulseaudio'''}}, {{filename|'''pulseaudio-module-bluetooth'''}} | ||
+ | ===== Install and configure PulseAudio ===== | ||
+ | <pre> | ||
+ | root@debian-armhf:~# apt-get update | ||
+ | root@debian-armhf:~# apt-get install pulseaudio pulseaudio-module-bluetooth | ||
+ | </pre> | ||
+ | * Create a systemd service for running pulseaudio as the pulse user. | ||
+ | <pre> | ||
+ | root@debian-armhf:~# 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 | ||
+ | |||
+ | root@debian-armhf:~# 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> | ||
+ | root@debian-armhf:~# cat << eof > /etc/dbus-1/system.d/pulseaudio-bluetooth.conf | ||
+ | <busconfig> | ||
+ | |||
+ | <policy user="pulse"> | ||
+ | <allow send_destination="org.bluez"/> | ||
+ | </policy> | ||
+ | |||
+ | </busconfig> | ||
+ | eof | ||
+ | |||
+ | root@debian-armhf:~# chmod 0666 /etc/dbus-1/system.d/pulseaudio-bluetooth.conf | ||
+ | </pre> | ||
+ | * Paste the following lines to the end of /etc/pulse/system.pa: | ||
+ | <pre> | ||
+ | root@debian-armhf:~# 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 | ||
+ | </pre> | ||
+ | * Create {{filename|/var/run/pulse/.config/pulse}} directory and fix the ownership. | ||
+ | <pre> | ||
+ | root@debian-armhf:~# mkdir -p /var/run/pulse/.config/pulse | ||
+ | root@debian-armhf:~# chown -R pulse:pulse /var/run/pulse | ||
+ | </pre> | ||
+ | * Add root to the pulse-access,audio groups | ||
+ | <pre> | ||
+ | root@debian-armhf:~# usermod -a -G pulse-access,audio root | ||
+ | </pre> | ||
+ | |||
+ | ===== Start PulseAudio ===== | ||
+ | * Start PulseAudio service | ||
+ | <pre> | ||
+ | root@debian-armhf:~# systemctl daemon-reload | ||
+ | root@debian-armhf:~# systemctl start pulseaudio.service | ||
+ | </pre> | ||
+ | * Make sure that the service is active, running and reports on no error. | ||
+ | <pre> | ||
+ | root@debian-armhf:~# 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 by default. Make sure the following packages are installed: | ||
+ | pulseaudio pulseaudio-module-bluetooth pulseaudio-utils, bluez, bluez-tools. | ||
+ | |||
+ | * Start the Bluetooth system: | ||
+ | <pre> | ||
+ | root@debian-armhf:~# systemctl start bluetooth | ||
+ | </pre> | ||
+ | Now we can use the {{filename|'''bluetoothctl'''}} command line utility to pair and connect. Run | ||
+ | <pre> | ||
+ | root@debian-armhf:~# bluetoothctl | ||
+ | [bluetooth]# | ||
+ | </pre> | ||
+ | to be greeted by its internal command prompt.Then enter: | ||
+ | <pre> | ||
+ | [bluetooth]# power on | ||
+ | [bluetooth]# agent on | ||
+ | [bluetooth]# default-agent | ||
+ | [bluetooth]# scan on | ||
+ | </pre> | ||
+ | Make sure that an A2DP device 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. | ||
+ | Use the MAC address to initiate the pairing: | ||
+ | <pre> | ||
+ | [bluetooth]# pair 00:07:A4:F2:B3:CB | ||
+ | </pre> | ||
+ | After pairing, connect the device: | ||
+ | <pre> | ||
+ | [bluetooth]# connect 00:07:A4:F2:B3:CB | ||
+ | </pre> | ||
+ | After the successful connection, the new output device will be created in PulseAudio.<br> | ||
+ | Scanning can be disabled now: | ||
+ | <pre> | ||
+ | [bluetooth]# scan off | ||
+ | </pre> | ||
+ | Exit the program: | ||
+ | <pre> | ||
+ | [bluetooth]# exit | ||
+ | </pre> | ||
+ | |||
+ | ===== Playback using PulseAudio ===== | ||
+ | {{Note|Next examples assume that the device mac address is '''00_07_A4_F2_B3_CB'''}} | ||
+ | * Show the PulseAudio device | ||
+ | <pre> | ||
+ | root@debian-armhf:~# 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: 13 | ||
+ | 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: | ||
+ | headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no) | ||
+ | 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): headset_head_unit, a2dp_sink | ||
+ | headset-input: Headset (priority: 0, latency offset: 0 usec, not available) | ||
+ | Part of profile(s): headset_head_unit | ||
+ | </pre> | ||
+ | :* Make sure the active card profile is a2dp_sink. Otherwise switch to it: | ||
+ | <pre> | ||
+ | # pactl set-card-profile 1 a2dp_sink | ||
+ | </pre> | ||
+ | :* Show the PulseAudio sink | ||
+ | <pre> | ||
+ | root@debian-armhf:~# pactl list sinks | awk '/00_07_A4_F2_B3_CB/' RS="" | ||
+ | Sink #1 | ||
+ | State: SUSPENDED | ||
+ | Name: bluez_sink.00_07_A4_F2_B3_CB | ||
+ | Description: Motorola HT820 | ||
+ | Driver: module-bluez5-device.c | ||
+ | Sample Specification: s16le 2ch 48000Hz | ||
+ | Channel Map: front-left,front-right | ||
+ | Owner Module: 13 | ||
+ | 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> | ||
+ | root@debian-armhf:~# paplay -d bluez_sink.00_07_A4_F2_B3_CB /path/to/<audio-file.wav> | ||
+ | </pre> | ||
+ | |||
+ | ==== Obex FTP service ==== | ||
+ | |||
+ | The OBject EXchange protocol (OBEX) can be used to exchange all kind of objects like files, pictures, calendar entries (vCal) and business cards (vCard) over bluetooth, IrDA, USB and serial cable links.<br> | ||
+ | Use the following command to install file transfer utility for devices that use the OBEX protocol: | ||
+ | <pre> | ||
+ | root@debian-armhf:~# apt-get update | ||
+ | root@debian-armhf:~# apt-get install obexftp | ||
+ | </pre> | ||
+ | |||
+ | Following examples demonstrate its usage with mobile phone device. | ||
+ | |||
+ | * Enable bluetooth on the phone. On CL-SOM-AM57x, scan for available devices to find out phone's BT address: | ||
+ | <pre> | ||
+ | root@cl-debian-armhf:~# hcitool scan | ||
+ | Scanning ... | ||
+ | 00:15:2A:20:63:94 Nokia 6230i | ||
+ | </pre> | ||
+ | |||
+ | * Ensure the phone supports Obex FTP service: | ||
+ | <pre> | ||
+ | root@cl-debian-armhf:~# sdptool search FTP | ||
+ | Inquiring ... | ||
+ | Searching for FTP on 00:15:2A:20:63:94 ... | ||
+ | Service Name: OBEX File Transfer | ||
+ | Service RecHandle: 0x100de | ||
+ | Service Class ID List: | ||
+ | "OBEX File Transfer" (0x1106) | ||
+ | Protocol Descriptor List: | ||
+ | "L2CAP" (0x0100) | ||
+ | "RFCOMM" (0x0003) | ||
+ | Channel: 10 | ||
+ | "OBEX" (0x0008) | ||
+ | Language Base Attr List: | ||
+ | code_ISO639: 0x656e | ||
+ | encoding: 0x6a | ||
+ | base_offset: 0x100 | ||
+ | Profile Descriptor List: | ||
+ | "OBEX File Transfer" (0x1106) | ||
+ | Version: 0x0100 | ||
+ | </pre> | ||
+ | |||
+ | * Follow the section "Bluez5 pairing" to pair the CL-SOM-AM57x module with the phone. | ||
+ | * List phone's root folder: | ||
+ | <pre> | ||
+ | root@cl-debian-armhf:~# obexftp -b 00:15:2A:20:63:94 --list | ||
+ | Browsing 00:15:2A:20:63:94 ... | ||
+ | Connecting..\done | ||
+ | Tried to connect for 579ms | ||
+ | Receiving "(null)".../<?xml version="1.0"?> | ||
+ | <!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd" | ||
+ | [ <!ATTLIST folder mem-type CDATA #IMPLIED> ]> | ||
+ | <folder-listing version="1.0"> | ||
+ | <folder name="EXTENTSION" user-perm="RW" mem-type="MMC"/> | ||
+ | <folder name="Images" created="19800101T000000" user-perm="R" mem-type="DEV"/> | ||
+ | <folder name="Video clips" created="19800101T000000" user-perm="R" mem-type="DEV"/> | ||
+ | <folder name="Music files" created="19800101T000000" user-perm="R" mem-type="DEV"/> | ||
+ | <folder name="Themes" created="19800101T000000" user-perm="RW" mem-type="DEV"/> | ||
+ | <folder name="Graphics" created="19800101T000000" user-perm="R" mem-type="DEV"/> | ||
+ | <folder name="Tones" created="19800101T000000" user-perm="R" mem-type="DEV"/> | ||
+ | <folder name="Recordings" created="19800101T000000" user-perm="R" mem-type="DEV"/> | ||
+ | </folder-listing> | ||
+ | done | ||
+ | Disconnecting..-done | ||
+ | </pre> | ||
+ | |||
+ | * Transfer a file from CL-SOM-AM57x to the phone: | ||
+ | <pre> | ||
+ | root@cl-debian-armhf:~# obexftp -b 00:15:2A:20:63:94 --put test_file.txt | ||
+ | Browsing 00:15:2A:20:63:94 ... | ||
+ | Connecting..\done | ||
+ | Tried to connect for 380ms | ||
+ | Sending "test_file.txt"...|done | ||
+ | Disconnecting../done | ||
+ | </pre> | ||
+ | |||
+ | * Retrieve a file from the phone to CL-SOM-AM57x: | ||
+ | <pre> | ||
+ | root@cl-debian-armhf:~# obexftp -b 00:15:2A:20:63:94 --get test_file.txt | ||
+ | Browsing 00:15:2A:20:63:94 ... | ||
+ | Connecting..\done | ||
+ | Tried to connect for 267ms | ||
+ | Receiving "test_file.txt".../done | ||
+ | Disconnecting..-done | ||
</pre> | </pre> | ||
Line 100: | Line 448: | ||
==== WiFi Initialization ==== | ==== WiFi Initialization ==== | ||
− | + | * The driver gets loaded automatically. Make sure that the WiFi driver is loaded: | |
− | |||
<pre> | <pre> | ||
root@cl-debian-armhf:~# lsmod | grep wl | root@cl-debian-armhf:~# lsmod | grep wl | ||
Line 120: | Line 467: | ||
</pre> | </pre> | ||
− | * | + | * WLAN interface activating: |
<pre> | <pre> | ||
root@cl-debian-armhf:~# ifconfig wlan0 up | root@cl-debian-armhf:~# ifconfig wlan0 up | ||
Line 128: | Line 475: | ||
* Sample WiFi scanning: | * Sample WiFi scanning: | ||
<pre> | <pre> | ||
− | root@ | + | root@cl-debian-armhf:~# iwlist wlan0 scan |
</pre> | </pre> | ||
The output will show the list of Access Points and Ad-Hoc cells in range. | The output will show the list of Access Points and Ad-Hoc cells in range. | ||
For more information about connecting to wireless networks and tuning WiFi interfaces refer to “wpa_supplicant” and “wireless-tools” man pages. | For more information about connecting to wireless networks and tuning WiFi interfaces refer to “wpa_supplicant” and “wireless-tools” man pages. | ||
+ | |||
+ | ==== wpa_supplicant ==== | ||
+ | * Configuration sample | ||
+ | {{cmd|wpa_supplicant}} requires a configuration file to be created in order to get connected to a scanned wireless network.<br> | ||
+ | Make use of the example bellow and put the network name and the password into the "ssid/psk" fields. | ||
+ | |||
+ | <pre> | ||
+ | root@cl-debian-armhf:~# cat << eof > /etc/wpa_supplicant.conf | ||
+ | ctrl_interface=/var/run/wpa_supplicant | ||
+ | |||
+ | network={ | ||
+ | ssid="wireless_network_name" | ||
+ | key_mgmt=WPA-PSK | ||
+ | psk="wireless_network_password" | ||
+ | } | ||
+ | eof | ||
+ | </pre> | ||
+ | * Sample run | ||
+ | <pre> | ||
+ | root@cl-debian-armhf:~# ifconfig wlan0 up | ||
+ | root@cl-debian-armhf:~# wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i wlan0 | ||
+ | root@cl-debian-armhf:~# dhclient wlan0 | ||
+ | </pre> | ||
=== Controller–area network (CAN) === | === Controller–area network (CAN) === | ||
Line 157: | Line 527: | ||
* Configure the CAN interface bit-rate to 125 Kbits/sec (values of up to 1Mbit/sec are supported): | * Configure the CAN interface bit-rate to 125 Kbits/sec (values of up to 1Mbit/sec are supported): | ||
<pre> | <pre> | ||
− | root@ | + | root@cl-debian-armhf:~# ip link set can0 type can bitrate 125000 |
</pre> | </pre> | ||
Line 206: | Line 576: | ||
To set the date and write it into the RTC do the following: | To set the date and write it into the RTC do the following: | ||
<pre> | <pre> | ||
− | root@ | + | root@cl-debian-armhf:~# date -s "31 JUL 2015 10:00:00" |
Fri Jul 31 10:00:00 UTC 2015 | Fri Jul 31 10:00:00 UTC 2015 | ||
− | root@ | + | root@cl-debian-armhf:~# /sbin/hwclock --systohc |
− | root@ | + | root@cl-debian-armhf:~# hwclock -w |
Fri Jul 31 10:00:13 2015 -1.066224 seconds | Fri Jul 31 10:00:13 2015 -1.066224 seconds | ||
</pre> | </pre> | ||
Line 215: | Line 585: | ||
To access the RTC time and date run: | To access the RTC time and date run: | ||
<pre> | <pre> | ||
− | root@ | + | root@cl-debian-armhf:~# hwclock |
Fri 31 Jul 2015 10:00:24 AM UTC -0.083102 seconds | Fri 31 Jul 2015 10:00:24 AM UTC -0.083102 seconds | ||
</pre> | </pre> |
Revision as of 15:37, 20 October 2016
Contents
- 1 Overview
- 2 Using Debian Linux on CL-SOM-AM57x
- 3 See also
Overview
The example run-time Linux filesystem image for the CompuLab CL-SOM-AM57x System-on-Module / Computer-on-Module is based on Debian GNU/Linux stretch/sid (armhf).
The default Debian sid Linux image includes many software packages. Among them:
- Core system
- Debian package management system
- X11 Windowing System
- Fluxbox desktop manager
- SSH server and client
- ALSA configuration and usage utilities
The Automatic Installation page provides a brief introduction on how to install the run-time Linux image.
Using Debian Linux on CL-SOM-AM57x
Connection and Logging In
Use the following username and password to login:
Account with administrative privileges:
cl-debian-armhf login: root Password: 111111
Regular user account:
cl-debian-armhf login: user Password: 111111
To login into the Linux system, you may use a serial console (ttyO2) at 115200 bps, or connect through the network, or use a keyboard and HDMI display.
X Windows system
CompuLab DEMO root filesystem image contains fully featured X server system with Fluxbox window manager. Before starting X server, connect USB mouse and keyboard to the system. You can run X server and Fluxbox window manager by typing startx.
Fluxbox window manager
CL-SOM-AM57x Debian Linux features installed Fluxbox package - a lightweight window manager for the X server 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 CL-SOM-AM57x includes all the information required to use Debian package management utilities. You can use apt-get and dpkg out of the box.
Display options
CL-SOM-AM57x evaluation platform has four video output interfaces: HDMI, LCD, DVI, and LVDS. Default configuration of Debian Linux for CL-SOM-AM57x uses HDMI (SB-SOM-AM57x J4 connector) as primary video output.
Touchscreen
CL-SOM-AM57x Evaluation Kit is equipped with Startek KD050C LCD 800x480 LCD touch panel. The touchscreen driver is modularized if you use default CL-SOM-AM57x 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
Touchscreen calibration
A touchscreen device can be calibrated using xinput_calibrator utility.
To calibrate the touchscreen:
- Update the primary video output to the calibrated display type.
- Run X Server by issuing startx command
- Make sure the touchscreen driver is loaded
- 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@cl-debian-armhf:~# 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
Bluetooth
CL-SOM-AM57x features Bluetooth 4.1 BLE interface. Following sections describe the initialization and simple use cases of Bluetooth device.
Host Controller Interface (HCI) Initialization
- For TI SDK kernel v4.1.13, create a symbolic link to the bluetooth UART:
root@debian-armhf:~# ln -sf /dev/ttyS9 /dev/ttyO9
- Attach the ttyO9 serial port to the HCI Bluetooth subsystem:
root@debian-armhf:~# echo "enabled" > /sys/bus/platform/devices/reg-userspace-consumer.0/state root@debian-armhf:~# hciattach -s 115200 /dev/ttyO9 texas 3000000 Found a Texas Instruments' chip! Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts Loaded BTS script version 1 texas: changing baud rate to 3000000, flow control to 1 [ 89.019183] Bluetooth: Core ver 2.21 [ 89.023025] NET: Registered protocol family 31 [ 89.027726] Bluetooth: HCI device and connection manager initialized [ 89.034581] Bluetooth: HCI socket layer initialized [ 89.039779] Bluetooth: L2CAP socket layer initialized [ 89.045296] Bluetooth: SCO socket layer initialized [ 89.055192] Bluetooth: HCI UART driver ver 2.3 [ 89.059914] Bluetooth: HCI UART protocol H4 registered [ 89.065306] Bluetooth: HCI UART protocol LL registered [ 89.308172] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 89.313747] Bluetooth: BNEP filters: protocol multicast [ 89.319275] Bluetooth: BNEP socket layer initialized Device setup complete
- Run HCI device configuration utility to retrieve detailed information about the Bluetooth device:
root@debian-armhf:~# hciconfig -a hci0: Type: BR/EDR Bus: UART BD Address: 54:4A:16:13:0D:42 ACL MTU: 1021:6 SCO MTU: 180:4 UP RUNNING PSCAN RX bytes:704 acl:0 sco:0 events:43 errors:0 TX bytes:1782 acl:0 sco:0 commands:43 errors:0 Features: 0xff 0xfe 0x2d 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF Link mode: SLAVE ACCEPT Name: 'cl-som-am57x-sid' Class: 0x000000 Service Classes: Unspecified Device Class: Miscellaneous, HCI Version: 4.1 (0x7) Revision: 0x0 LMP Version: 4.1 (0x7) Subversion: 0xac08 Manufacturer: Texas Instruments Inc. (13)
- If the HCI device is not running, use the below command to enable the HCI device:
root@debian-armhf:~# hciconfig hci0 up
- HCI Inquire remote devices.
root@debian-armhf:~# hcitool scan Scanning ...
Bluez5 & PulseAudio
Debian stretch/sid is using BlueZ 5 and PluseAudio 5.
BlueZ 5 dropped support for alsa, and uses PulseAudio.
PulseAudio 5 only supports the A2DP profile and not HSP/HFP.
- Software to install pulseaudio, pulseaudio-module-bluetooth
Install and configure PulseAudio
root@debian-armhf:~# apt-get update root@debian-armhf:~# apt-get install pulseaudio pulseaudio-module-bluetooth
- Create a systemd service for running pulseaudio as the pulse user.
root@debian-armhf:~# 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 root@debian-armhf:~# chown pulse:pulse /etc/systemd/system/pulseaudio.service
- Create a dbus configuration file for running pulseaudio. Give the pulse user permission to use Bluetooth.
root@debian-armhf:~# cat << eof > /etc/dbus-1/system.d/pulseaudio-bluetooth.conf <busconfig> <policy user="pulse"> <allow send_destination="org.bluez"/> </policy> </busconfig> eof root@debian-armhf:~# chmod 0666 /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
- Paste the following lines to the end of /etc/pulse/system.pa:
root@debian-armhf:~# 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 and fix the ownership.
root@debian-armhf:~# mkdir -p /var/run/pulse/.config/pulse root@debian-armhf:~# chown -R pulse:pulse /var/run/pulse
- Add root to the pulse-access,audio groups
root@debian-armhf:~# usermod -a -G pulse-access,audio root
Start PulseAudio
- Start PulseAudio service
root@debian-armhf:~# systemctl daemon-reload root@debian-armhf:~# systemctl start pulseaudio.service
- Make sure that the service is active, running and reports on no error.
root@debian-armhf:~# 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 by default. Make sure the following packages are installed: pulseaudio pulseaudio-module-bluetooth pulseaudio-utils, bluez, bluez-tools.
- Start the Bluetooth system:
root@debian-armhf:~# systemctl start bluetooth
Now we can use the bluetoothctl command line utility to pair and connect. Run
root@debian-armhf:~# bluetoothctl [bluetooth]#
to be greeted by its internal command prompt.Then enter:
[bluetooth]# power on [bluetooth]# agent on [bluetooth]# default-agent [bluetooth]# scan on
Make sure that an A2DP device 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. Use the MAC address to initiate the pairing:
[bluetooth]# pair 00:07:A4:F2:B3:CB
After pairing, connect the device:
[bluetooth]# connect 00:07:A4:F2:B3:CB
After the successful connection, the new output device will be created in PulseAudio.
Scanning can be disabled now:
[bluetooth]# scan off
Exit the program:
[bluetooth]# exit
Playback using PulseAudio
Next examples assume that the device mac address is 00_07_A4_F2_B3_CB |
- Show the PulseAudio device
root@debian-armhf:~# 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: 13 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: headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no) 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): headset_head_unit, a2dp_sink headset-input: Headset (priority: 0, latency offset: 0 usec, not available) Part of profile(s): headset_head_unit
- Make sure the active card profile is a2dp_sink. Otherwise switch to it:
# pactl set-card-profile 1 a2dp_sink
- Show the PulseAudio sink
root@debian-armhf:~# pactl list sinks | awk '/00_07_A4_F2_B3_CB/' RS="" Sink #1 State: SUSPENDED Name: bluez_sink.00_07_A4_F2_B3_CB Description: Motorola HT820 Driver: module-bluez5-device.c Sample Specification: s16le 2ch 48000Hz Channel Map: front-left,front-right Owner Module: 13 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:
root@debian-armhf:~# paplay -d bluez_sink.00_07_A4_F2_B3_CB /path/to/<audio-file.wav>
Obex FTP service
The OBject EXchange protocol (OBEX) can be used to exchange all kind of objects like files, pictures, calendar entries (vCal) and business cards (vCard) over bluetooth, IrDA, USB and serial cable links.
Use the following command to install file transfer utility for devices that use the OBEX protocol:
root@debian-armhf:~# apt-get update root@debian-armhf:~# apt-get install obexftp
Following examples demonstrate its usage with mobile phone device.
- Enable bluetooth on the phone. On CL-SOM-AM57x, scan for available devices to find out phone's BT address:
root@cl-debian-armhf:~# hcitool scan Scanning ... 00:15:2A:20:63:94 Nokia 6230i
- Ensure the phone supports Obex FTP service:
root@cl-debian-armhf:~# sdptool search FTP Inquiring ... Searching for FTP on 00:15:2A:20:63:94 ... Service Name: OBEX File Transfer Service RecHandle: 0x100de Service Class ID List: "OBEX File Transfer" (0x1106) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 10 "OBEX" (0x0008) Language Base Attr List: code_ISO639: 0x656e encoding: 0x6a base_offset: 0x100 Profile Descriptor List: "OBEX File Transfer" (0x1106) Version: 0x0100
- Follow the section "Bluez5 pairing" to pair the CL-SOM-AM57x module with the phone.
- List phone's root folder:
root@cl-debian-armhf:~# obexftp -b 00:15:2A:20:63:94 --list Browsing 00:15:2A:20:63:94 ... Connecting..\done Tried to connect for 579ms Receiving "(null)".../<?xml version="1.0"?> <!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd" [ <!ATTLIST folder mem-type CDATA #IMPLIED> ]> <folder-listing version="1.0"> <folder name="EXTENTSION" user-perm="RW" mem-type="MMC"/> <folder name="Images" created="19800101T000000" user-perm="R" mem-type="DEV"/> <folder name="Video clips" created="19800101T000000" user-perm="R" mem-type="DEV"/> <folder name="Music files" created="19800101T000000" user-perm="R" mem-type="DEV"/> <folder name="Themes" created="19800101T000000" user-perm="RW" mem-type="DEV"/> <folder name="Graphics" created="19800101T000000" user-perm="R" mem-type="DEV"/> <folder name="Tones" created="19800101T000000" user-perm="R" mem-type="DEV"/> <folder name="Recordings" created="19800101T000000" user-perm="R" mem-type="DEV"/> </folder-listing> done Disconnecting..-done
- Transfer a file from CL-SOM-AM57x to the phone:
root@cl-debian-armhf:~# obexftp -b 00:15:2A:20:63:94 --put test_file.txt Browsing 00:15:2A:20:63:94 ... Connecting..\done Tried to connect for 380ms Sending "test_file.txt"...|done Disconnecting../done
- Retrieve a file from the phone to CL-SOM-AM57x:
root@cl-debian-armhf:~# obexftp -b 00:15:2A:20:63:94 --get test_file.txt Browsing 00:15:2A:20:63:94 ... Connecting..\done Tried to connect for 267ms Receiving "test_file.txt".../done Disconnecting..-done
WiFi
CL-SOM-AM57x features 802.11b/g/n wireless connectivity solution, implemented with the TI WiLink 8 WL1801 Wireless controller module.
WiFi Initialization
- The driver gets loaded automatically. Make sure that the WiFi driver is loaded:
root@cl-debian-armhf:~# lsmod | grep wl wl18xx 89863 0 wlcore 183512 1 wl18xx mac80211 606845 2 wl18xx,wlcore cfg80211 491510 3 mac80211,wl18xx,wlcore wlcore_sdio 6495 0
- iwconfig command from wireless-tools package can be used to retrieve detailed information about the WiFi interfaces:
root@cl-debian-armhf:~# iwconfig wlan0 wlan0 IEEE 802.11abgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm Retry short limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:off
- WLAN interface activating:
root@cl-debian-armhf:~# ifconfig wlan0 up [ 180.395059] wlcore: PHY firmware version: Rev 8.2.0.0.232 [ 180.504299] wlcore: firmware booted (Rev 8.9.0.0.48)
- Sample WiFi scanning:
root@cl-debian-armhf:~# iwlist wlan0 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.
root@cl-debian-armhf:~# 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
root@cl-debian-armhf:~# ifconfig wlan0 up root@cl-debian-armhf:~# wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i wlan0 root@cl-debian-armhf:~# dhclient wlan0
Controller–area network (CAN)
The CL-SOM-AM57x features a Dual Controller Area Network (DCAN) Modules integrated into Sitara AM57x SoC. The DCAN implements full CAN protocol version 2.0B. It supports both the base (standard) and the extended frame format as well as a programmable data bit rate with maximum of 1Mbit/s.
Loading CAN modules
If the DCAN driver and/or Raw CAN protocol compiled as module(s), they must be loaded prior to enabling CAN interface.
- Load Raw CAN protocol module:
root@cl-debian-armhf:~# modprobe can-raw can: controller area network core (rev 20120528 abi 9) NET: Registered protocol family 29 can: raw protocol (rev 20120528)
CAN interface configuration
It is recommended configure the CAN interface, with the iproute2 utilities.
- To make sure the right ip utility is used, run:
root@cl-debian-armhf:~# ip -V ip utility, iproute2-ss140804
- Configure the CAN interface bit-rate to 125 Kbits/sec (values of up to 1Mbit/sec are supported):
root@cl-debian-armhf:~# ip link set can0 type can bitrate 125000
- Enable the CAN interface:
root@cl-debian-armhf:~# ip link set can0 up net can0: c_can_hw_raminit_wait_syscon: time out c_can_platform 4ae3c000.can can0: setting BTR=1c09 BRPE=0000
Send/Receive packets
Use cansend and candump utilities to send and receive packets via CAN interface.
- Send standard CAN frame (on the first device):
root@cl-debian-armhf:~# cansend can0 111#1122334455667788
- Send extended CAN frame (on the first device):
root@cl-debian-armhf:~# cansend can0 11111111#1122334455667788
- Dump all received data frames as well as error frames (on the second device):
root@cl-debian-armhf:~# 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
MMC/SD
The support for MMC/SD card on CL-SOM-AM57x 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
USB 3.0 Dual-Role-Device
CL-SOM-AM57x 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. Current Linux kernel support of DWC3 features does not allow dynamic role (host/device) switching in runtime. By default, host role is assigned to CL-SOM-AM57x USB 3.0 port.
RTC
To set the date and write it into the RTC do the following:
root@cl-debian-armhf:~# date -s "31 JUL 2015 10:00:00" Fri Jul 31 10:00:00 UTC 2015 root@cl-debian-armhf:~# /sbin/hwclock --systohc root@cl-debian-armhf:~# hwclock -w Fri Jul 31 10:00:13 2015 -1.066224 seconds
To access the RTC time and date run:
root@cl-debian-armhf:~# hwclock Fri 31 Jul 2015 10:00:24 AM UTC -0.083102 seconds