Difference between revisions of "CL-SOM-AM57x: Linux: Debian"
(→Using Debian Linux on CM-T54) |
(→Analog Audio Playback) |
||
(5 intermediate revisions by 2 users not shown) | |||
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: | + | The [[CL-SOM-AM57x: Linux: Automatic Installation|Automatic Installation]] page provides a brief introduction on how to install the run-time Linux image. |
== Using Debian Linux on CL-SOM-AM57x == | == Using Debian Linux on CL-SOM-AM57x == | ||
=== Connection and Logging In === | === Connection and Logging In === | ||
− | Use the following username | + | Use the following username to login: |
− | |||
<pre> | <pre> | ||
− | + | User: root | |
− | |||
</pre> | </pre> | ||
− | + | 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. | |
+ | |||
+ | ==== root password ==== | ||
+ | This Debian rootfs comes without default root password.<br> | ||
+ | The root password has to be set at the very first login: | ||
+ | |||
<pre> | <pre> | ||
− | cl- | + | Debian GNU/Linux stretch/sid cl-rootfs ttyS2 |
− | + | ||
+ | cl-rootfs login: root | ||
+ | You are required to change your password immediately (root enforced) | ||
+ | Enter new UNIX password: | ||
</pre> | </pre> | ||
− | + | === Wayland/Weston === | |
+ | Wayland is a protocol that specifies the communication between a display server (called Wayland compositor) and its clients, as well as a reference implementation of the protocol. | ||
+ | The Wayland project includes a demo Wayland compositor, called Weston. It's fast, small, and runs on embedded and mobile devices. | ||
+ | |||
+ | During start-up | ||
+ | * The Weston starts with the current active display (HDMI by default - connector J4). | ||
+ | * The Texas Instrument Matrix Weston clients is lunched. | ||
− | === | + | ==== Running Weston clients ==== |
− | |||
− | |||
− | |||
− | + | After launching Weston, the user should be able to use the keyboard and the mouse for various controls. | |
− | + | There is a terminal icon, located in the left hand corner of the Weston desktop window. | |
+ | Clicking terminal icons should launch the weston-terminal on the Weston Desktop. | ||
− | + | There are several other applications that are included in the example file system. | |
− | + | To invoke these applications, the user should launch the weston-terminal and then invoke the client apps as described below from within the terminal window: | |
− | + | <pre> | |
+ | root@cl-rootfs:~# /etc/init.d/matrix-gui-2.0 start | ||
+ | root@cl-rootfs:~# /usr/bin/weston-calibrator | ||
+ | root@cl-rootfs:~# /usr/bin/weston-clickdot | ||
+ | root@cl-rootfs:~# /usr/bin/weston-cliptest | ||
+ | root@cl-rootfs:~# /usr/bin/weston-dnd | ||
+ | root@cl-rootfs:~# /usr/bin/weston-editor | ||
+ | root@cl-rootfs:~# /usr/bin/weston-eventdemo | ||
+ | root@cl-rootfs:~# /usr/bin/weston-flower | ||
+ | root@cl-rootfs:~# /usr/bin/weston-fullscreen | ||
+ | root@cl-rootfs:~# /usr/bin/weston-info | ||
+ | root@cl-rootfs:~# /usr/bin/weston-multi-resource | ||
+ | root@cl-rootfs:~# /usr/bin/weston-presentation-shm | ||
+ | root@cl-rootfs:~# /usr/bin/weston-resizor | ||
+ | root@cl-rootfs:~# /usr/bin/weston-scaler | ||
+ | root@cl-rootfs:~# /usr/bin/weston-simple-damage | ||
+ | root@cl-rootfs:~# /usr/bin/weston-simple-egl | ||
+ | root@cl-rootfs:~# /usr/bin/weston-simple-shm | ||
+ | root@cl-rootfs:~# /usr/bin/weston-simple-touch | ||
+ | root@cl-rootfs:~# /usr/bin/weston-smoke | ||
+ | root@cl-rootfs:~# /usr/bin/weston-stacking | ||
+ | root@cl-rootfs:~# /usr/bin/weston-subsurfaces | ||
+ | root@cl-rootfs:~# /usr/bin/weston-transformed | ||
+ | </pre> | ||
=== Software Management === | === Software Management === | ||
Line 58: | Line 87: | ||
CL-SOM-AM57x evaluation platform has four video output interfaces: HDMI, LCD, DVI, and LVDS. | 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. | 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 {{filename|udev}} automatically on Linux boot. | ||
+ | If the touchscreen driver is not loaded, the following command will load the touchscreen driver: | ||
+ | |||
+ | <pre> | ||
+ | modprobe ads7846 | ||
+ | </pre> | ||
+ | |||
+ | ==== Touchscreen calibration ==== | ||
+ | A touchscreen device can be calibrated using {{cmd|weston-calibrator}} utility. | ||
+ | {{Note| [[CL-SOM-AM57x:_Linux:_Manual_Installation:_destination:_eMMC#Select_video_output|LCD display]] should be selected for touchscreen calibration}} | ||
+ | |||
+ | To calibrate the touchscreen: | ||
+ | * Launch Weston: | ||
+ | <blockquote><pre> | ||
+ | /etc/init.d/weston start | ||
+ | </pre></blockquote> | ||
+ | * Make sure the touchscreen driver is loaded | ||
+ | * Start the Weston calibrator: | ||
+ | <blockquote><pre> | ||
+ | /usr/bin/weston-calibrator | ||
+ | </pre></blockquote> | ||
+ | * For proper calibration you are required to follow the calibrator and touch at the '+' locations. | ||
+ | * The calibration file will be created at the following path: | ||
+ | <blockquote><pre> | ||
+ | /etc/udev/rules.d/ws-calibrate.rules | ||
+ | </pre></blockquote> | ||
+ | |||
+ | === Analog Audio === | ||
+ | CL-SOM-AM57x provides an analog audio interface, which is registered as a standard ALSA sound card. | ||
+ | Use {{cmd|aplay -l}} to list all soundcards and digital audio devices registered on the system: | ||
+ | <pre> | ||
+ | root@cl-rootfs:~# aplay -l | ||
+ | **** List of PLAYBACK Hardware Devices **** | ||
+ | card 0: clsomamx57xx [cl-som-amx57xx], device 0: davinci-mcasp.0-wm8731-hifi wm8731-hifi-0 [] | ||
+ | Subdevices: 1/1 | ||
+ | Subdevice #0: subdevice #0 | ||
+ | card 1: H58040000encode [HDMI 58040000.encoder], device 0: HDMI 58040000.encoder snd-soc-dummy-dai-0 [] | ||
+ | Subdevices: 1/1 | ||
+ | Subdevice #0: subdevice #0 | ||
+ | </pre> | ||
+ | |||
+ | ==== Analog Audio Settings ==== | ||
+ | To enable the Analog audio playback, {{cmd|alsamixer}} or {{cmd|amixer}} applications can be used. | ||
+ | * {{cmd|alsamixer}} - set the “''Output Mixer''” control on. | ||
+ | or | ||
+ | * {{cmd|amixer}} - set the “''Output Mixer HiFi Playback Switch''” control on using command line interface: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# amixer cset numid=13 1 | ||
+ | numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch' | ||
+ | ; type=BOOLEAN,access=rw------,values=1 | ||
+ | : values=on | ||
+ | </pre></blockquote> | ||
+ | To set maximum playback volume, {{cmd|alsamixer}} or {{cmd|amixer}} applications can be used. | ||
+ | * {{cmd|alsamixer}} - set the “''Master''” control to 100. | ||
+ | or | ||
+ | * {{cmd|amixer}} - set the “''Master Playback Volume''” control to 127 by using command line interface: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# amixer cset numid=1 127 127 | ||
+ | numid=1,iface=MIXER,name='Master Playback Volume' | ||
+ | ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0 | ||
+ | : values=127,127 | ||
+ | | dBscale-min=-121.00dB,step=1.00dB,mute=1 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ==== Analog Audio Playback ==== | ||
+ | In order to play back a sound file make use of the {{cmd|aplay}} application. | ||
+ | <dl> | ||
+ | * {{cmd|aplay -L}} can be used for listing of all pcm devices. | ||
+ | </dl> | ||
+ | :Here is a sample output of {{cmd|aplay -L}} command: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# aplay -L | ||
+ | null | ||
+ | Discard all samples (playback) or generate zero samples (capture) | ||
+ | default:CARD=clsomamx57xx | ||
+ | cl-som-amx57xx, | ||
+ | Default Audio Device | ||
+ | sysdefault:CARD=clsomamx57xx | ||
+ | cl-som-amx57xx, | ||
+ | Default Audio Device | ||
+ | dmix:CARD=clsomamx57xx,DEV=0 | ||
+ | cl-som-amx57xx, | ||
+ | Direct sample mixing device | ||
+ | dsnoop:CARD=clsomamx57xx,DEV=0 | ||
+ | cl-som-amx57xx, | ||
+ | Direct sample snooping device | ||
+ | hw:CARD=clsomamx57xx,DEV=0 | ||
+ | cl-som-amx57xx, | ||
+ | Direct hardware device without any conversions | ||
+ | plughw:CARD=clsomamx57xx,DEV=0 | ||
+ | cl-som-amx57xx, | ||
+ | Hardware device with all software conversions | ||
+ | default:CARD=H58040000encode | ||
+ | HDMI 58040000.encoder, | ||
+ | Default Audio Device | ||
+ | sysdefault:CARD=H58040000encode | ||
+ | HDMI 58040000.encoder, | ||
+ | Default Audio Device | ||
+ | dmix:CARD=H58040000encode,DEV=0 | ||
+ | HDMI 58040000.encoder, | ||
+ | Direct sample mixing device | ||
+ | dsnoop:CARD=H58040000encode,DEV=0 | ||
+ | HDMI 58040000.encoder, | ||
+ | Direct sample snooping device | ||
+ | hw:CARD=H58040000encode,DEV=0 | ||
+ | HDMI 58040000.encoder, | ||
+ | Direct hardware device without any conversions | ||
+ | plughw:CARD=H58040000encode,DEV=0 | ||
+ | HDMI 58040000.encoder, | ||
+ | Hardware device with all software conversions | ||
+ | </pre></blockquote> | ||
+ | |||
+ | :The next command can be used for audio playback: | ||
+ | <blockquote><pre> | ||
+ | root@cm-debian:~# aplay <wav-file> | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ==== Audio Input Settings ==== | ||
+ | CL-SOM-AM57x provides an audio capturing feature from either ''Mic'' or ''Line In'' input sources. | ||
+ | {{cmd|alsamixer}} or {{cmd|amixer}} can be used in order to switch between these inputs. | ||
+ | ===== Mic ===== | ||
+ | * {{cmd|alsamixer}} | ||
+ | :: Line Input => 100 | ||
+ | :: Line => off | ||
+ | :: Mic => on | ||
+ | * {{cmd|amixer}} | ||
+ | <blockquote><pre> | ||
+ | amixer cset numid=3 31 | ||
+ | amixer cset numid=4 0 | ||
+ | amixer cset numid=6 1 | ||
+ | amixer cset numid=11 1 | ||
+ | amixer cset numid=14 1 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ===== Line In ===== | ||
+ | * {{cmd|alsamixer}} | ||
+ | :: Line Input => 100 | ||
+ | :: Line => on | ||
+ | :: Mic => off | ||
+ | * {{cmd|amixer}} | ||
+ | <blockquote><pre> | ||
+ | amixer cset numid=3 31 | ||
+ | amixer cset numid=4 1 | ||
+ | amixer cset numid=6 0 | ||
+ | amixer cset numid=11 0 | ||
+ | amixer cset numid=14 0 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ==== Sample Audio Recording ==== | ||
+ | As soon as the correct input values have been set, audio signal can be captured. | ||
+ | Here is a sample command that shows the {{cmd|arecord}} usage for capturing audio signal from the selected input line. | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# arecord -f dat -t wav /tmp/out.wav | ||
+ | </pre></blockquote> | ||
+ | |||
+ | === 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 ==== | ||
+ | |||
+ | * Attach the ttyO9 serial port to the HCI Bluetooth subsystem: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# echo "enabled" > /sys/bus/platform/devices/reg-userspace-consumer.0/state | ||
+ | root@cl-rootfs:~# hciattach -s 115200 /dev/ttyS9 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 | ||
+ | [ 359.147143] Bluetooth: Core ver 2.21 | ||
+ | [ 359.151930] NET: Registered protocol family 31 | ||
+ | [ 359.156626] Bluetooth: HCI device and connection manager initialized | ||
+ | [ 359.163317] Bluetooth: HCI socket layer initialized | ||
+ | [ 359.168224] Bluetooth: L2CAP socket layer initialized | ||
+ | [ 359.173380] Bluetooth: SCO socket layer initialized | ||
+ | [ 359.181770] Bluetooth: HCI UART driver ver 2.3 | ||
+ | [ 359.186391] Bluetooth: HCI UART protocol H4 registered | ||
+ | [ 359.191884] Bluetooth: HCI UART protocol BCSP registered | ||
+ | [ 359.197221] Bluetooth: HCI UART protocol LL registered | ||
+ | [ 359.202470] Bluetooth: HCI UART protocol Three-wire (H5) registered | ||
+ | [ 359.325453] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 | ||
+ | [ 359.330844] Bluetooth: BNEP filters: protocol multicast | ||
+ | [ 359.336103] Bluetooth: BNEP socket layer initialized | ||
+ | Device setup complete | ||
+ | </pre></blockquote> | ||
+ | |||
+ | * Run HCI device configuration utility to retrieve detailed information about the Bluetooth device: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# hciconfig -a | ||
+ | ci0: Type: Primary Bus: UART | ||
+ | BD Address: 20:C3:8F:88:8C:3C ACL MTU: 1021:6 SCO MTU: 180:4 | ||
+ | UP RUNNING | ||
+ | RX bytes:725 acl:0 sco:0 events:46 errors:0 | ||
+ | TX bytes:2764 acl:0 sco:0 commands:46 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-rootfs' | ||
+ | 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></blockquote> | ||
+ | |||
+ | * If the HCI device is not running, use the below command to enable the HCI device: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# hciconfig hci0 up | ||
+ | </pre></blockquote> | ||
+ | * HCI Inquire remote devices. | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# hcitool scan | ||
+ | Scanning ... | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ==== 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'''}} | ||
+ | {{Note|{{filename|rootfs.tar.bz2}} has all these packages pre-installed. Continue to the [[#Start PulseAudio | Start PulseAudio]] section if you use this root filesystem.}} | ||
+ | ===== Install and configure PulseAudio ===== | ||
+ | The included example user space (root file system) includes PulseAudio packages. | ||
+ | Use the following to install the packages on alternative user space: | ||
+ | <pre> | ||
+ | root@cl-rootfs:~# apt-get update | ||
+ | root@cl-rootfs:~# apt-get install pulseaudio pulseaudio-module-bluetooth bluez | ||
+ | </pre> | ||
+ | * Create a systemd service for running pulseaudio as the pulse user. | ||
+ | Included in the example user space: {{filename| /etc/systemd/system/pulseaudio.service}} | ||
+ | |||
+ | * Create a dbus configuration file for running pulseaudio. Give the pulse user permission to use Bluetooth. | ||
+ | Included in the example user space: {{filename| /etc/dbus-1/system.d/pulseaudio-bluetooth.conf}} | ||
+ | |||
+ | * Update PulseAudio startup script to automatically load driver modules for Bluetooth hardware. | ||
+ | Included in the example user space, at the end of {{filename| /etc/pulse/system.pa}} | ||
+ | |||
+ | * Create configuration directory and fix the ownership. | ||
+ | Included in the example user space: {{filename|/var/run/pulse/.config/pulse}} | ||
+ | {{Note| Additional information can be found at archlinux [https://wiki.archlinux.org/index.php/PulseAudio/Configuration PulseAudio/Configuration]}} | ||
+ | |||
+ | ===== Start PulseAudio ===== | ||
+ | * Start PulseAudio service | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# systemctl daemon-reload | ||
+ | root@cl-rootfs:~# systemctl start pulseaudio.service | ||
+ | </pre></blockquote> | ||
+ | * Make sure that the service is active, running and reports no error | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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></blockquote> | ||
+ | |||
+ | ===== Bluez5 pairing ===== | ||
+ | PulseAudio 5.x supports A2DP by default. Make sure the following packages are installed: | ||
+ | {{filename|pulseaudio}}, {{filename|pulseaudio-module-bluetooth}}, {{filename|pulseaudio-utils}}, {{filename|bluez}}, {{filename|bluez-tools}}. | ||
+ | |||
+ | * Start the Bluetooth system: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# systemctl start bluetooth | ||
+ | </pre></blockquote> | ||
+ | Now we can use the {{cmd|bluetoothctl}} command line utility to pair and connect. Run | ||
+ | <pre> | ||
+ | root@cl-rootfs:~# 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 {{parameter|00_07_A4_F2_B3_CB}}}} | ||
+ | * Show the PulseAudio device | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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></blockquote> | ||
+ | |||
+ | * Make sure the active card profile is a2dp_sink. Otherwise switch to it: | ||
+ | <blockquote><pre> | ||
+ | # pactl set-card-profile 1 a2dp_sink | ||
+ | </pre></blockquote> | ||
+ | |||
+ | * Show the PulseAudio sink | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# pactl list sinks | awk '/00_07_A4_F2_B3_CB/' RS="" | ||
+ | Sink #1 | ||
+ | State: SUSPENDED | ||
+ | Name: bluez_sink.00_07_A4_F2_B3_CB.a2dp_sink | ||
+ | Description: Motorola HT820 | ||
+ | Driver: module-bluez5-device.c | ||
+ | Sample Specification: s16le 2ch 44100Hz | ||
+ | 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.a2dp_sink.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></blockquote> | ||
+ | |||
+ | * Play sound using {{filename|paplay}}. Example: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# paplay -d bluez_sink.00_07_A4_F2_B3_CB.a2dp_sink /path/to/<audio-file.wav> | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ==== 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@cl-rootfs:~# apt-get update | ||
+ | root@cl-rootfs:~# 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: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# hcitool scan | ||
+ | Scanning ... | ||
+ | 00:15:2A:20:63:94 Nokia 6230i | ||
+ | </pre></blockquote> | ||
+ | |||
+ | * Ensure the phone supports Obex FTP service: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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></blockquote> | ||
+ | |||
+ | * Follow the section "Bluez5 pairing" to pair the CL-SOM-AM57x module with the phone. | ||
+ | * List phone's root folder: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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></blockquote> | ||
+ | |||
+ | * Transfer a file from CL-SOM-AM57x to the phone: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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></blockquote> | ||
+ | |||
+ | * Retrieve a file from the phone to CL-SOM-AM57x: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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></blockquote> | ||
+ | |||
+ | === 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: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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 | ||
+ | </pre></blockquote> | ||
+ | * {{cmd|iwconfig}} command from {{filename|wireless-tools}} package can be used to retrieve detailed information about the WiFi interfaces: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | * WLAN interface activating: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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) | ||
+ | </pre></blockquote> | ||
+ | * Sample WiFi scanning: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# iwlist wlan0 scan | ||
+ | </pre></blockquote> | ||
+ | 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> | ||
+ | :Create the configuration file example bellow in {{filename|/etc/wpa_supplicant.conf}} and put the network name and the password into the "ssid/psk" fields. | ||
+ | <blockquote><pre> | ||
+ | ctrl_interface=/var/run/wpa_supplicant | ||
+ | |||
+ | network={ | ||
+ | ssid="wireless_network_name" | ||
+ | key_mgmt=WPA-PSK | ||
+ | psk="wireless_network_password" | ||
+ | } | ||
+ | </pre></blockquote> | ||
+ | * Sample run | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# ifconfig wlan0 up | ||
+ | root@cl-rootfs:~# wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i wlan0 | ||
+ | root@cl-rootfs:~# dhclient wlan0 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | === 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: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# modprobe can-raw | ||
+ | can: controller area network core (rev 20120528 abi 9) | ||
+ | NET: Registered protocol family 29 | ||
+ | can: raw protocol (rev 20120528) | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ===== 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: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# ip -V | ||
+ | ip utility, iproute2-ss140804 | ||
+ | </pre></blockquote> | ||
+ | * Configure the CAN interface bit-rate to 125 Kbits/sec (values of up to 1Mbit/sec are supported): | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# ip link set can0 type can bitrate 125000 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | * Enable the CAN interface: | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | ===== 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): | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# cansend can0 111#1122334455667788 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | * Send extended CAN frame (on the first device): | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# cansend can0 11111111#1122334455667788 | ||
+ | </pre></blockquote> | ||
+ | |||
+ | * Dump all received data frames as well as error frames (on the second device): | ||
+ | <blockquote><pre> | ||
+ | root@cl-rootfs:~# 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></blockquote> | ||
=== MMC/SD === | === MMC/SD === | ||
Line 75: | Line 686: | ||
=== RTC === | === RTC === | ||
− | To | + | To set the date and write it into the RTC do the following: |
<pre> | <pre> | ||
− | root@ | + | root@cl-rootfs:~# date -s "31 JUL 2015 10:00:00" |
− | + | Fri Jul 31 10:00:00 UTC 2015 | |
+ | root@cl-rootfs:~# /sbin/hwclock --systohc | ||
+ | root@cl-rootfs:~# hwclock -w | ||
</pre> | </pre> | ||
− | To | + | To access the RTC time and date run: |
<pre> | <pre> | ||
− | root@ | + | root@cl-rootfs:~# hwclock |
− | Fri Jul | + | Fri 31 Jul 2015 10:00:24 AM UTC -0.083102 seconds |
− | |||
− | |||
− | |||
</pre> | </pre> | ||
== See also == | == See also == | ||
− | + | * [[CL-SOM-AM57x: Linux: Automatic Installation]] | |
− | * [[CL-SOM-AM57x: Linux: | + | * [[CL-SOM-AM57x: Linux: Manual Installation]] |
* [[CL-SOM-AM57x: Linux: Kernel]] | * [[CL-SOM-AM57x: Linux: Kernel]] | ||
* [[Linux: Development for ARM modules]] | * [[Linux: Development for ARM modules]] | ||
* [[Linux: Debian: Minimal ARM filesystem]] | * [[Linux: Debian: Minimal ARM filesystem]] | ||
* [http://www.debian.org/doc/manuals/reference/index.en.html Debian Reference]. | * [http://www.debian.org/doc/manuals/reference/index.en.html Debian Reference]. | ||
+ | |||
[[Category:Linux|Debian]] | [[Category:Linux|Debian]] | ||
[[Category:CL-SOM-AM57x|Linux: Debian]] | [[Category:CL-SOM-AM57x|Linux: Debian]] |
Latest revision as of 15:01, 7 June 2017
Contents
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 to login:
User: root
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.
root password
This Debian rootfs comes without default root password.
The root password has to be set at the very first login:
Debian GNU/Linux stretch/sid cl-rootfs ttyS2 cl-rootfs login: root You are required to change your password immediately (root enforced) Enter new UNIX password:
Wayland/Weston
Wayland is a protocol that specifies the communication between a display server (called Wayland compositor) and its clients, as well as a reference implementation of the protocol. The Wayland project includes a demo Wayland compositor, called Weston. It's fast, small, and runs on embedded and mobile devices.
During start-up
- The Weston starts with the current active display (HDMI by default - connector J4).
- The Texas Instrument Matrix Weston clients is lunched.
Running Weston clients
After launching Weston, the user should be able to use the keyboard and the mouse for various controls.
There is a terminal icon, located in the left hand corner of the Weston desktop window. Clicking terminal icons should launch the weston-terminal on the Weston Desktop.
There are several other applications that are included in the example file system. To invoke these applications, the user should launch the weston-terminal and then invoke the client apps as described below from within the terminal window:
root@cl-rootfs:~# /etc/init.d/matrix-gui-2.0 start root@cl-rootfs:~# /usr/bin/weston-calibrator root@cl-rootfs:~# /usr/bin/weston-clickdot root@cl-rootfs:~# /usr/bin/weston-cliptest root@cl-rootfs:~# /usr/bin/weston-dnd root@cl-rootfs:~# /usr/bin/weston-editor root@cl-rootfs:~# /usr/bin/weston-eventdemo root@cl-rootfs:~# /usr/bin/weston-flower root@cl-rootfs:~# /usr/bin/weston-fullscreen root@cl-rootfs:~# /usr/bin/weston-info root@cl-rootfs:~# /usr/bin/weston-multi-resource root@cl-rootfs:~# /usr/bin/weston-presentation-shm root@cl-rootfs:~# /usr/bin/weston-resizor root@cl-rootfs:~# /usr/bin/weston-scaler root@cl-rootfs:~# /usr/bin/weston-simple-damage root@cl-rootfs:~# /usr/bin/weston-simple-egl root@cl-rootfs:~# /usr/bin/weston-simple-shm root@cl-rootfs:~# /usr/bin/weston-simple-touch root@cl-rootfs:~# /usr/bin/weston-smoke root@cl-rootfs:~# /usr/bin/weston-stacking root@cl-rootfs:~# /usr/bin/weston-subsurfaces root@cl-rootfs:~# /usr/bin/weston-transformed
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 weston-calibrator utility.
LCD display should be selected for touchscreen calibration |
To calibrate the touchscreen:
- Launch Weston:
/etc/init.d/weston start
- Make sure the touchscreen driver is loaded
- Start the Weston calibrator:
/usr/bin/weston-calibrator
- For proper calibration you are required to follow the calibrator and touch at the '+' locations.
- The calibration file will be created at the following path:
/etc/udev/rules.d/ws-calibrate.rules
Analog Audio
CL-SOM-AM57x provides an analog audio interface, which is registered as a standard ALSA sound card. Use aplay -l to list all soundcards and digital audio devices registered on the system:
root@cl-rootfs:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: clsomamx57xx [cl-som-amx57xx], device 0: davinci-mcasp.0-wm8731-hifi wm8731-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: H58040000encode [HDMI 58040000.encoder], device 0: HDMI 58040000.encoder snd-soc-dummy-dai-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
Analog Audio Settings
To enable the Analog audio playback, alsamixer or amixer applications can be used.
- alsamixer - set the “Output Mixer” control on.
or
- amixer - set the “Output Mixer HiFi Playback Switch” control on using command line interface:
root@cl-rootfs:~# amixer cset numid=13 1 numid=14,iface=MIXER,name='Output Mixer HiFi Playback Switch' ; type=BOOLEAN,access=rw------,values=1 : values=on
To set maximum playback volume, alsamixer or amixer applications can be used.
- alsamixer - set the “Master” control to 100.
or
- amixer - set the “Master Playback Volume” control to 127 by using command line interface:
root@cl-rootfs:~# amixer cset numid=1 127 127 numid=1,iface=MIXER,name='Master Playback Volume' ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0 : values=127,127 | dBscale-min=-121.00dB,step=1.00dB,mute=1
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@cl-rootfs:~# aplay -L null Discard all samples (playback) or generate zero samples (capture) default:CARD=clsomamx57xx cl-som-amx57xx, Default Audio Device sysdefault:CARD=clsomamx57xx cl-som-amx57xx, Default Audio Device dmix:CARD=clsomamx57xx,DEV=0 cl-som-amx57xx, Direct sample mixing device dsnoop:CARD=clsomamx57xx,DEV=0 cl-som-amx57xx, Direct sample snooping device hw:CARD=clsomamx57xx,DEV=0 cl-som-amx57xx, Direct hardware device without any conversions plughw:CARD=clsomamx57xx,DEV=0 cl-som-amx57xx, Hardware device with all software conversions default:CARD=H58040000encode HDMI 58040000.encoder, Default Audio Device sysdefault:CARD=H58040000encode HDMI 58040000.encoder, Default Audio Device dmix:CARD=H58040000encode,DEV=0 HDMI 58040000.encoder, Direct sample mixing device dsnoop:CARD=H58040000encode,DEV=0 HDMI 58040000.encoder, Direct sample snooping device hw:CARD=H58040000encode,DEV=0 HDMI 58040000.encoder, Direct hardware device without any conversions plughw:CARD=H58040000encode,DEV=0 HDMI 58040000.encoder, Hardware device with all software conversions
- The next command can be used for audio playback:
root@cm-debian:~# aplay <wav-file>
Audio Input Settings
CL-SOM-AM57x 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
- alsamixer
- Line Input => 100
- Line => off
- Mic => on
- amixer
amixer cset numid=3 31 amixer cset numid=4 0 amixer cset numid=6 1 amixer cset numid=11 1 amixer cset numid=14 1
Line In
- alsamixer
- Line Input => 100
- Line => on
- Mic => off
- amixer
amixer cset numid=3 31 amixer cset numid=4 1 amixer cset numid=6 0 amixer cset numid=11 0 amixer cset numid=14 0
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@cl-rootfs:~# arecord -f dat -t wav /tmp/out.wav
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
- Attach the ttyO9 serial port to the HCI Bluetooth subsystem:
root@cl-rootfs:~# echo "enabled" > /sys/bus/platform/devices/reg-userspace-consumer.0/state root@cl-rootfs:~# hciattach -s 115200 /dev/ttyS9 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 [ 359.147143] Bluetooth: Core ver 2.21 [ 359.151930] NET: Registered protocol family 31 [ 359.156626] Bluetooth: HCI device and connection manager initialized [ 359.163317] Bluetooth: HCI socket layer initialized [ 359.168224] Bluetooth: L2CAP socket layer initialized [ 359.173380] Bluetooth: SCO socket layer initialized [ 359.181770] Bluetooth: HCI UART driver ver 2.3 [ 359.186391] Bluetooth: HCI UART protocol H4 registered [ 359.191884] Bluetooth: HCI UART protocol BCSP registered [ 359.197221] Bluetooth: HCI UART protocol LL registered [ 359.202470] Bluetooth: HCI UART protocol Three-wire (H5) registered [ 359.325453] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 359.330844] Bluetooth: BNEP filters: protocol multicast [ 359.336103] Bluetooth: BNEP socket layer initialized Device setup complete
- Run HCI device configuration utility to retrieve detailed information about the Bluetooth device:
root@cl-rootfs:~# hciconfig -a ci0: Type: Primary Bus: UART BD Address: 20:C3:8F:88:8C:3C ACL MTU: 1021:6 SCO MTU: 180:4 UP RUNNING RX bytes:725 acl:0 sco:0 events:46 errors:0 TX bytes:2764 acl:0 sco:0 commands:46 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-rootfs' 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@cl-rootfs:~# hciconfig hci0 up
- HCI Inquire remote devices.
root@cl-rootfs:~# 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
rootfs.tar.bz2 has all these packages pre-installed. Continue to the Start PulseAudio section if you use this root filesystem. |
Install and configure PulseAudio
The included example user space (root file system) includes PulseAudio packages. Use the following to install the packages on alternative user space:
root@cl-rootfs:~# apt-get update root@cl-rootfs:~# apt-get install pulseaudio pulseaudio-module-bluetooth bluez
- Create a systemd service for running pulseaudio as the pulse user.
Included in the example user space: /etc/systemd/system/pulseaudio.service
- Create a dbus configuration file for running pulseaudio. Give the pulse user permission to use Bluetooth.
Included in the example user space: /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
- Update PulseAudio startup script to automatically load driver modules for Bluetooth hardware.
Included in the example user space, at the end of /etc/pulse/system.pa
- Create configuration directory and fix the ownership.
Included in the example user space: /var/run/pulse/.config/pulse
Additional information can be found at archlinux PulseAudio/Configuration |
Start PulseAudio
- Start PulseAudio service
root@cl-rootfs:~# systemctl daemon-reload root@cl-rootfs:~# systemctl start pulseaudio.service
- Make sure that the service is active, running and reports no error
root@cl-rootfs:~# 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@cl-rootfs:~# systemctl start bluetooth
Now we can use the bluetoothctl command line utility to pair and connect. Run
root@cl-rootfs:~# 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@cl-rootfs:~# 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@cl-rootfs:~# pactl list sinks | awk '/00_07_A4_F2_B3_CB/' RS="" Sink #1 State: SUSPENDED Name: bluez_sink.00_07_A4_F2_B3_CB.a2dp_sink Description: Motorola HT820 Driver: module-bluez5-device.c Sample Specification: s16le 2ch 44100Hz 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.a2dp_sink.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@cl-rootfs:~# paplay -d bluez_sink.00_07_A4_F2_B3_CB.a2dp_sink /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@cl-rootfs:~# apt-get update root@cl-rootfs:~# 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-rootfs:~# hcitool scan Scanning ... 00:15:2A:20:63:94 Nokia 6230i
- Ensure the phone supports Obex FTP service:
root@cl-rootfs:~# 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-rootfs:~# 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-rootfs:~# 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-rootfs:~# 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-rootfs:~# 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-rootfs:~# 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-rootfs:~# 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-rootfs:~# 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.
- Create the configuration file example bellow in /etc/wpa_supplicant.conf and put the network name and the password into the "ssid/psk" fields.
ctrl_interface=/var/run/wpa_supplicant network={ ssid="wireless_network_name" key_mgmt=WPA-PSK psk="wireless_network_password" }
- Sample run
root@cl-rootfs:~# ifconfig wlan0 up root@cl-rootfs:~# wpa_supplicant -B -Dwext -c /etc/wpa_supplicant.conf -i wlan0 root@cl-rootfs:~# 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-rootfs:~# 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-rootfs:~# 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-rootfs:~# ip link set can0 type can bitrate 125000
- Enable the CAN interface:
root@cl-rootfs:~# 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-rootfs:~# cansend can0 111#1122334455667788
- Send extended CAN frame (on the first device):
root@cl-rootfs:~# cansend can0 11111111#1122334455667788
- Dump all received data frames as well as error frames (on the second device):
root@cl-rootfs:~# 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-rootfs:~# date -s "31 JUL 2015 10:00:00" Fri Jul 31 10:00:00 UTC 2015 root@cl-rootfs:~# /sbin/hwclock --systohc root@cl-rootfs:~# hwclock -w
To access the RTC time and date run:
root@cl-rootfs:~# hwclock Fri 31 Jul 2015 10:00:24 AM UTC -0.083102 seconds