CM-T3730: Linux: Angstrom

From Compulab Mediawiki
Revision as of 08:27, 18 February 2014 by Grinberg (talk | contribs) (Introduction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

The example run-time Linux filesystem image for CM-T3730 is based on Angstrom Linux 2012. The CompuLab Linux package for CM-T3730 includes ready to run Angstrom Linux filesystem image, Linux kernel and source code patches.

The default Angstrom Linux image includes more than 1000 software packages. Among them:

  • Core system
  • X11 Windowing System
  • Enlightenment v0.16 desktop manager
  • Midory web browser
  • Totem and MPlayer media players
  • GStreamer with multiple plugins
  • The Graphics SDK version 4.05.00.03 including the Linux graphics (SGX) drivers and ready to run SGX functionality demos
  • The Digital Video SDK (DVSDK) version 4.03.00.06 including Linux kernel modules, multimedia and DSP packages and ready to run DSP functionality demos

The CM-T3730: Linux: Getting started page provides a brief introduction on how to install the run-time Linux image.
The CM-T3730: Linux: Package contents article describes Linux package structure specific to CM-T3730.

Using Angstrom Linux on CM-T3730

Display options

CM-T3730 evaluation platform has four video output interfaces: LCD, DVI, LVDS and TV-out. Default configuration of Angstrom Linux for CM-T3730 uses DVI as primary video output. It is possible to switch between the DVI and LCD interfaces on the fly. TV-out can be used simultaneously with LCD or DVI interface.
Linux implementation of the OMAP3 display subsystem is described in detail in Documentation/arm/OMAP/DSS file in the Linux kernel source tree.

Display resolutions

  • The Toppoly LCD supplied with CM-T3730 evaluation kit supports 480x640 resolution with 18 bits per color
  • The DataImage LCD supplied with CM-T3730 evaluation kit supports 480x800 resolution with 18 bits per color
  • DVI output can be configured for standard resolutions using kernel command line parameter omapfb.mode:
    1024x768 - omapfb.mode=dvi:1024x768-24@60
    800x600 - omapfb.mode=dvi:800x600-24@60
    640x480 - omapfb.mode=dvi:640x480-24@60
  • TV-out supports PAL and NTSC standards

Examples

Switch from LCD to DVI

mgr0=/sys/devices/platform/omapdss/manager0
lcd=/sys/devices/platform/omapdss/display0
dvi=/sys/devices/platform/omapdss/display1
fb0=/sys/class/graphics/fb0

w=`cat $dvi/timings | cut -d "," -f 2 | cut -d "/" -f 1`
h=`cat $dvi/timings | cut -d "," -f 3 | cut -d "/" -f 1`

echo "0" > $lcd/enabled
echo "" > $mgr0/display
fbset -fb /dev/fb0 -xres $w -yres $h -vxres $w -vyres $h
# at this point you have to switch the dvi/lcd dip-switch from the omap board
echo "dvi" > $mgr0/display
echo "1" > $dvi/enabled

Clone GFX overlay to LCD and TV

ovl0=/sys/devices/platform/omapdss/overlay0
ovl1=/sys/devices/platform/omapdss/overlay1
tv=/sys/devices/platform/omapdss/display2
fb0=/sys/class/graphics/fb0
fb1=/sys/class/graphics/fb1

w=`cat $tv/timings | cut -d "," -f 2 | cut -d "/" -f 1`
h=`cat $tv/timings | cut -d "," -f 3 | cut -d "/" -f 1`

echo "0" > $ovl0/enabled
echo "0" > $ovl1/enabled

echo "" > $fb1/overlays
echo "0,1" > $fb0/overlays

echo "$w,$h" > $ovl1/output_size
echo "tv" > $ovl1/manager

echo "1" > $ovl0/enabled
echo "1" > $ovl1/enabled

echo "1" > $tv/enabled

Switch TV-out from PAL to NTSC

tv=/sys/devices/platform/omapdss/display2
echo "0" $tv/enabled
echo "ntsc" $tv/timings
echo "1" $tv/enabled

Touchscreen

CM-T3730 Evaluation Kit can be equipped with either of the following LCD touch panels: Toppoly TDO35S or DataImage SCF0403. See Select LCD model to enable support for the particular LCD touch panel. The X Windows system of CM-T3730 uses tslib X server input driver to get the input from the touchscreen.

Touchscreen calibration

Touchscreen calibration can be performed with ts_calibrate utility available in package libts-bin. To calibrate the touchscreen:

  • Run ts_calibrate utility. For proper calibration you are required to touch the touchscreen corners and center in the following order: top-left, top-right, bottom-right, bottom-left, center. The calibration results are saved to file /etc/pointercal.

GPIO access

Linux provides simple and convenient GPIO access via sysfs interface. A GPIO should be exported using /sys/class/gpio/export. After the GPIO is exported it is possible to change its direction and value using /sys/class/gpio/gpioX/direction and /sys/class/gpio/gpioX/value attributes.

Example

The following example demonstrates how to configure GPIO 140 as output and produce a 1usec pulse:

echo 140 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio140/direction
echo 0 > /sys/class/gpio/gpio140/value
echo 1 > /sys/class/gpio/gpio140/value
usleep 1
echo 0 > /sys/class/gpio/gpio140/value

Bluetooth

The CM-T3730 features Bluetooth 4.0 interface. The CM-T3730 Linux package contains pre-build Bluetooth support package based on the TI WL1271 SDK version 3.00.01.06-WL6.1.6.0.3. The following sections demonstrate the Bluetooth device initialization procedure and simple use cases. The CM-T3730 Linux package also provides several scripts for Bluetooth functionality demonstration. The scripts are installed under the /opt/WL1271_demo_01/bluetooth_scripts location.

Configure Bluetooth support package

  • Run the installation and configuration script before first use of the Bluetooth:
root@cm-t3730:~# cd /opt/WL1271_demo_01/
root@cm-t3730:/opt/WL1271_demo_01# ./install.sh
  • Reboot the CM-T3730.

Setup Bluetooth Environment

  • Setup environment variables before using the Bluetooth support package:
root@cm-t3730:~# export EXE_PATH=/usr/local/wl1271/wl1271_bluetooth
root@cm-t3730:~# export PATH=$EXE_PATH/bin:$EXE_PATH/sbin:$PATH
  • Start the Dbus deamon:
root@cm-t3730:~# rm -f $EXE_PATH/var/run/dbus/pid
root@cm-t3730:~# dbus-daemon --system &
  • Start the Bluetooth deamon:
root@cm-t3730:~# bluetoothd -n &
  • Attach the ttyO1 serial port to the HCI Bluetooth subsystem:
root@cm-t3730:~# hciattach -s 115200 /dev/ttyO1 texas 3000000 &
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/TIInit_7.6.15.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Bluetooth: HCI UART driver ver 2.2
Bluetooth: HCI H4 protocol initialized
Bluetooth: HCI BCSP protocol initialized
Bluetooth: HCILL protocol initialized
bluetoothd[1559]: HCI dev 0 registered
bluetoothd[1559]: HCI dev 0 up
bluetoothd[1559]: Starting security manager 0
bluetoothd[1559]: Adapter /org/bluez/1559/hci0 has been enabled
Device setup complete
bluetoothd[1559]: Failed to access HAL
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
  • Recognize the Bluetooth adapter:
root@cm-t3730:~# export BT_ADAPTER=`dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter | tail -n 1 | sed 's/^.*"\(.*\)".*$/\1/'`
  • Start the BlueZ D-Bus Agent:
root@cm-t3730:~# agent --path /org/bluez/agent 0000 &

A2DP Headphones

  • Scan for available devices to find out Headphones BT device address:
root@cm-t3730:~# hcitool scan --refresh
Scanning ...
	00:07:A4:F2:B3:CB	Motorola HT820
  • Recognize the headphones address 00:07:A4:F2:B3:CB
  • Add new PCM device by editing /etc/asound.conf:
pcm.btheadphones {
   type plug
   slave {
       pcm {
           type bluetooth
           device 00:07:A4:F2:B3:CB
           profile "auto"
       }
   }
   hint {
       show on
       description "BT Headphones"
   }
}
ctl.btheadphones {
  type bluetooth
}
  • List device names to ensure correct settings in /etc/asound.conf:
root@cm-t3730:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
btheadphones
    BT Headphones
default:CARD=overo
    overo, 
    Default Audio Device
  • Put the headphones in the pairing mode and pair devices:
root@cm-debian:~# dbus-send --system --print-reply --dest=org.bluez  $BT_ADAPTER org.bluez.Adapter.RemoveDevice \
> objpath:$BT_ADAPTER/dev_00_07_A4_F2_B3_CB
root@cm-debian:~# dbus-send --system --print-reply --dest=org.bluez $BT_ADAPTER org.bluez.Adapter.CreatePairedDevice \
> string:00:07:A4:F2:B3:CB objpath:/org/bluez/agent string:DisplayYesNo
Pincode request for device /org/bluez/1559/hci0/dev_00_07_A4_F2_B3_CB
bluetoothd[1559]: pin_code_request (sba=1C:45:93:3B:EF:98, dba=00:07:A4:F2:B3:CB)
bluetoothd[1559]: link_key_notify (sba=1C:45:93:3B:EF:98, dba=00:07:A4:F2:B3:CB, type=0)
bluetoothd[1559]: link_key_request (sba=1C:45:93:3B:EF:98, dba=00:07:A4:F2:B3:CB)
method return sender=:1.0 -> dest=:1.3 reply_serial=2
   object path "/org/bluez/1559/hci0/dev_00_07_A4_F2_B3_CB"
sudo cp	-r /path/to/cm-t3730-linux/extra/WL1271_Linux_SDK_3_00_01_06/extra_files/gallery /path/to/cm-t3730/rootfs/opt/WL1271_demo_01/
  • Lunch aplay playback tool:
root@cm-t3730:~# aplay -D btheadphones /opt/WL1271_demo_01/gallery/Pop.wav
bluetoothd[1559]: link_key_request (sba=1C:45:93:3B:EF:98, dba=00:07:A4:F2:B3:CB)
Playing WAVE '/opt/WL1271_demo_01/gallery/Pop.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Authorizing request for /org/bluez/1559/hci0/dev_00_07_A4_F2_B3_CB
bluetoothd[1559]: link_key_request (sba=1C:45:93:3B:EF:98, dba=00:07:A4:F2:B3:CB)

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. CM-T3730 Linux example root file system contains file transfer utility for devices that use the OBEX protocol. Following examples demonstrate OBEX usage on CM-T3730 with mobile phone device.

  • Enable Bluetooth on a phone. On CM-T3730, scan for available Bluetooth devices to find out phone's BT address:

root@cm-t3730:~# hcitool scan --refresh

Scanning ...
        5C:B5:24:3D:13:65       J20i
  • Recognize the phone address 5C:B5:24:3D:13:65
  • Ensure the phone supports Obex FTP service:
root@cm-t3730:~# sdptool search FTP
Inquiring ...
Searching for FTP on 5C:B5:24:3D:13:65 ...
Service Name: OBEX File Transfer
Service RecHandle: 0x2008008
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 7
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX File Transfer" (0x1106)
    Version: 0x0100
  • Pair the devices:
root@cm-t3730:~# dbus-send --system --print-reply --dest=org.bluez  $BT_ADAPTER org.bluez.Adapter.RemoveDevice \
> objpath:$BT_ADAPTER/dev_5C_B5_24_3D_13_65
root@cm-t3730:~# dbus-send --system --print-reply --dest=org.bluez $BT_ADAPTER org.bluez.Adapter.CreatePairedDevice \
> string:5C:B5:24:3D:13:65 objpath:/org/bluez/agent string:DisplayYesNo
bluetoothd[1559]: link_key_request (sba=1C:45:93:3B:EF:98, dba=5C:B5:24:3D:13:65)
bluetoothd[1559]: io_capa_request (sba=1C:45:93:3B:EF:98, dba=5C:B5:24:3D:13:65)
bluetoothd[1559]: io_capa_response (sba=1C:45:93:3B:EF:98, dba=5C:B5:24:3D:13:65)
Confirmation request of 391382 for device /org/bluez/1559/hci0/dev_5C_B5_24_3D_13_65
bluetoothd[1559]: link_key_notify (sba=1C:45:93:3B:EF:98, dba=5C:B5:24:3D:13:65, type=5)
bluetoothd[1559]: probe failed with driver input-headset for device /org/bluez/1559/hci0/dev_5C_B5_24_3D_13_65
method return sender=:1.0 -> dest=:1.4 reply_serial=2
   object path "/org/bluez/1559/hci0/dev_5C_B5_24_3D_13_65"
  • Transfer a file from the CM-T3730 to the phone:
root@cm-t3730:~# obexftp -b 5C:B5:24:3D:13:65 -B 7 -p /opt/WL1271_demo_01/gallery/Document.jpg
Connecting...bluetoothd[1559]: link_key_request (sba=1C:45:93:3B:EF:98, dba=5C:B5:24:3D:13:65)
\done
Tried to connect for 598ms
Sending "/opt/WL1271_demo_01/gallery/Document.jpg"...|done
Disconnecting../done

Angstrom Linux package management

Angstrom Linux for CM-T3730 includes opkg package manager. It can be run from terminal command line.

Digital Video SDK

Overview

The Digital Video SDK (DVSDK) version 4.03.00.06 provides multiple resourses for evaluation and application development for the TI DM3730 platform. Current CM-T3730 Linux package contains the following pre-built DVSDK components: Multimedia Package, DSP Package, and several demo applications for functionality demonstration and validation.

Multimedia Package includes:

  • Multimedia Framework Product (MFP)
    • Codec Engine Framework
    • Framework Components
    • Linux Utils (CMEM)
    • XDAIS (eXpress DSP Algorithm Interoperability Standard)
  • Davinci Multimedia Application Interface (DMAI)
  • DSP Optimized codecs
    • Encoders: H.264, MPEG-4, JPEG, G711
    • Decoders: H.264, MPEG-4, MPEG-2, AAC. JPEG, G711
  • DSP accelerated Gstreamer TI plugin

DSP Package includes:

  • C6000 code generation tool chain
  • DSP/BIOS Real Time Operating System
  • DSPLink Inter Processor Communication
  • C6Accel - easy access to DSP accelerated function libraries
  • C6Run - tool to easily run C code on the DSP

The DVSDK was built outside of OpenEmbedded framework and intensively tested with Linux kernel version 3.0.38. For custom Linux kernel build, the DVSDK must be re-built to avoid compatibility issues. This section describes how to configure Linux kernel at boot time and run DVSDK demos. For detailed DVSDK build instruction please refer to the CM-T3730: Linux: Building images page.

Kernel parameters

The framebuffer plains 1 and 2 must be enabled in the kernel command line for the GStreamer-TI package will work correctly:

vram=18M omapfb.vram=0:6M,1:6M,2:6M

Additionally, DSP kernel modules require a memory "window" in the kernel memory to allocate a heap buffer of 73MB at 0x83700000. This memory must not be used by any other module or process, so the following parameters must be added to the kernel command line:

mem=55M@0x80000000 mem=128M@0x88000000
Admolition note.png We do not recommend using DVSDK on CM-T3730 devices with less then 256MB of RAM.

Running Demos

Current CM-T3730 Linux package contains pre-built and ready to run DVSDK functionality demo programs. For additional information about the DVSDK demos please refer to the DVSDK Software Developers Guide.

DSPLink Examples

The DSPLink includes several sample application examples. Use the following example to run the demo applications on CM-T3730:

root@cm-t3730:~# cd /usr/share/ti/ti-dsplink-examples/
root@cm-t3730:/usr/share/ti/ti-dsplink-examples# ./ti-dsplink-examples-run.sh

C6Accel Apps

The C6Accel package includes a small test application for benchmarking all the DSP kernel APIs for fixed point and floating point calculations. To run the application, run the following commands on CM-T3730:

root@cm-t3730:~# cd /usr/share/ti/c6accel-apps/
root@cm-t3730:~# ./c6accel_app

DMAI Apps

The Davinci Multimedia Application Interface (DMAI) includes small sample applications (and also source code). Before running a DMAI sample application, copy sample media files found in the CM-T3730 Linux package to the device rootfs under the /usr/share/ti location:

sudo cp	-r /path/to/cm-t3730-linux/extra/dvsdk_04_03_00_06/extra_files/data /path/to/cm-t3730/rootfs/usr/share/ti/

To run a DMAI sample application, make sure the current directory on CM-T3730 is ti-dmai-apps:

root@cm-t3730:~# cd /usr/share/ti/ti-dmai-apps/
Decode Examples

To decode an H.264 BP encoded video to a YUV file execute:

root@cm-t3730:/usr/share/ti/ti-dmai-apps# ./video_decode_io2_dm3730.x470MV -c h264dec \
 -i /usr/share/ti/data/videos/davincieffect_480p30.264 -o h264_test_output.yuv

To decode a JPEG encoded image to a YUV file execute:

root@cm-t3730:/usr/share/ti/ti-dmai-apps# ./image_decode_io1_dm3730.x470MV -c jpegdec \
 -i /usr/share/ti/data/images/remi003_422i.jpg -o jpeg_test_output.yuv

To decode an AAC encoded audio:

root@cm-t3730:/usr/share/ti/ti-dmai-apps# ./audio_decode_io1_dm3730.x470MV -c aachedec \
 -i /usr/share/ti/data/sounds/davincieffect_lc.aac -o aac_test_output.pcm
Encode Examples

To encode 100 frames of resolution 720x480 from a YUV file to an H.264 BP encoded file execute:

root@cm-t3730:/usr/share/ti/ti-dmai-apps# ./video_encode_io1_dm3730.x470MV -c h264enc \
 -i h264_test_output.yuv -o output.264 -r 720x480 -n 100

To encode a YUV file to a JPEG encoded file execute:

root@cm-t3730:/usr/share/ti/ti-dmai-apps# ./image_encode_io1_dm3730.x470MV -c jpegenc -e encode \
 -i jpeg_test_output.yuv -o Output.jpeg -r 720x576 --iColorSpace 3 --oColorSpace 1

Graphics SDK

The CM-T3730 Linux package contains pre-built and ready to run SGX functionality demo programs. The SGX configuration script must be run on CM-T3730 before first use:

root@cm-t3730:~# /etc/init.d/omap-demo
  • The SGX kernel modules must be loaded prior running the demos:
root@cm-t3730:~# /etc/init.d/rc.pvr start

Running Graphics SDK OpenGL ES1.x Demos

To run OpenGL ES1.x demos, perform the following:

root@cm-t3730:~# cd /opt/gfxsdkdemos/ogles
root@cm-t3730:/opt/gfxsdkdemos/ogles# ./OGLESSkybox

This will execute the OGLESSkybox demo. Press ‘q’ on the CM-T3730 console to stop the demo execution. Similarly, any other OpenGL ES1.x demo can be executed.

For more information and command line options of the OpenGL ES1.x demos, please refer to the SDK user guide: Graphics_SDK_4_05_00_03/GFX_Linux_SDK/OGLES/SDKPackage/OpenGL ES SDK.User Guide.1.20f.External.pdf.

Running Graphics SDK OpenGL ES2.0 Demos

To run OpenGL ES2.x demos, perform the following:

root@cm-t3730:~# cd /opt/gfxsdkdemos/ogles2
root@cm-t3730:/opt/gfxsdkdemos/ogle2s# ./OGLES2Coverflow

This will execute the OGLES2Coverflow demo. Press ‘q’ on the CM-T3730 console to stop the demo execution. Similarly, any other OpenGL ES2.0 demo can be executed.

For more information and command line options on the OpenGL ES2.0 demos, please refer to the SDK user guide: Graphics_SDK_4_05_00_03/GFX_Linux_SDK/OGLES2/SDKPackage/OpenGL ES 2.x SDK.User Guide.1.20f.External.pdf.

See also