CM-T3730: Linux: Debian

From Compulab Mediawiki
Jump to: navigation, search

Overview

The example run-time Linux filesystem image for CM-T3730 is based on Debian GNU/Linux Wheezy. The CompuLab Linux package for CM-T3730 includes ready to run NAND flash image, Linux kernel configuration and source code patches, and an archive of the root filesystem, used to create the image.

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

  • Core system
  • Debian package management system
  • X11 Windowing System
  • Fluxbox desktop manager
  • Netsurf web browser
  • Samba connectivity suite
  • SSH server and client
  • ALSA configuration and usage utilities
  • Bluetooth tools and daemons
  • The Graphics SDK 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

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 Debian Linux on CM-T3730

Connection and Logging In

Use the following username and password to login:

Account with administrative privileges:

User: root
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 DVI/LCD display (tty1, tty2, tty3).

Networking

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

Consoles

Linux file system image is designed to suit different kernel versions and configurations. Therefore, during the operating system startup, consoles at several serial ports and DVI display are enabled. Some of these devices may not be supported, either because of kernel versions incompatibilities, or because the kernel was not configured to support these devices. When the console is enabled for such a device, the following or similar message can appear on active console:

INIT: Id "T0" respawning too fast: disabled for 5 minutes

This is not an error message, it is just a warning that can be eliminated by editing /etc/inittab file.

X Windows system

CompuLab distribution contains full featured X Windows system with Fluxbox window manager. Before starting X Windows, connect USB mouse and keyboard to the system. You can run X Windows by typing startx.

Fluxbox window manager

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

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

Visit Fluxbox Wiki and Official home page for more details.

Software Management

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

Touchscreen

CM-T3730 Evaluation Kit can be equipped with either of the following LCD touch panels: Toppoly TDO35S or DataImage SCF0403852GGU04. See Select LCD model section to enable support for the particular touchscreen. The touchscreen driver is modularized if you use default CM-T3730 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:

  • For Toppoly TDO35S LCD touch panel:
modprobe ads7846
  • For DataImage SCF0403852GGU04 LCD touch panel:
modprobe hx8520-c

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

Touchscreen calibration

All supported touchscreen devices can be calibrated using xinput_calibrator utility.

To calibrate the touchscreen:

  • Run X Server by issuing startx command
  • Make sure the touchscreen driver is loaded as described in Touchscreen section
  • Set the DISPLAY environment variable:
     export DISPLAY=:0
  • Run xinput_calibrator utility. For proper calibration you are required to touch the touchscreen corners and center in the following order: top-left, top-right, bottom-right, bottom-left, center.
  • Create a file /usr/share/X11/xorg.conf.d/99-calibration.conf and paste there a snippet with the calibration results:
root@cm-debian:~# xinput_calibrator 
	Setting calibration data: 0, 4095, 0, 4095
Calibrating EVDEV driver for "ADS7846 Touchscreen" id=6
	current calibration values (from XInput): min_x=0, max_x=4095 and min_y=0, max_y=4095

Doing dynamic recalibration:
	Setting calibration data: 289, 3781, 3887, 227
	--> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
	Identifier	"calibration"
	MatchProduct	"ADS7846 Touchscreen"
	Option	"Calibration"	"289 3781 3887 227"
	Option	"SwapAxes"	"0"
EndSection

MMC/SD

The support for MMC/SD card on CM-T3730 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

WL12xx calibration tool

Calibration of TI WL12xx wireless device is needed for generation of specific radio configuration parameters and saving into the NVS file. The NVS file is then used by the wl12xx driver.

The CM-T3730 Linux package contains the statically compiled calibrator utility from ti-utils support package for WL12xx. For more details please read OMAP Wireless Connectivity Calibration Proccess NLCP article.

Example of reading WLAN MAC address stored in NVS file:

root@cm-debian:~# ./calibrator get nvs_mac /lib/firmware/ti-connectivity/wl1271-nvs.bin
MAC addr from NVS: 00:00:00:00:00:00
Admolition note.png If the NVS file contains MAC of all zeroes, the MAC address is initialized from the chip fuse. It is recommended to not change it.

USB On-The-Go (OTG)

CM-T3730 features an Inventra Highspeed Dual Role USB On-The-Go (OTG) 2.0 controller. CM-T3730 OTG port is USB host and USB device (gadget) capable. OTG Gadget drivers are compiled as modules with default CM-T3730 kernel configuration. A Gadget driver should be loaded for OTG support:

root@cm-debian:~# modprobe g_serial
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready
musb-hdrc musb-hdrc: MUSB HDRC host driver
musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 2
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: MUSB HDRC host driver
usb usb2: Manufacturer: Linux 3.0.87-cm-t3730 musb-hcd
usb usb2: SerialNumber: musb-hdrc
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected

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

Testing OTG port

  • Host mode. Connect USB keyboard to OTG port.
usb 2-1: new low speed USB device number 9 using musb-hdrc
usb 2-1: device v413c p2107 is not supported
usb 2-1: New USB device found, idVendor=413c, idProduct=2107
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1: Product: Dell USB Entry Keyboard
usb 2-1: Manufacturer: Dell
input: Dell Dell USB Entry Keyboard as /devices/platform/omap/musb-omap2430/musb-hdrc/usb2/2-1/2-1:1.0/input/input7
generic-usb 0003:413C:2107.0004: input: USB HID v1.10 Keyboard [Dell Dell USB Entry Keyboard] on usb-musb-hdrc-1/input0
  • Gadget mode. Connect desktop PC to OTG port.
gadget: >high-speed config #2: CDC ACM config

Bluetooth

CM-T3730 features Bluetooth 4.0 interface. Following sections describe the initialization and simple use cases of Bluetooth device.

Host Controller Interface (HCI) Initialization

  • Attach the ttyO1 serial port to the HCI Bluetooth subsystem:
root@cm-debian:~# 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
Device setup complete
  • Run HCI device configuration utility to retrieve detailed information about the Bluetooth device:
root@cm-debian:~# hciconfig -a   
hci0:	Type: BR/EDR  Bus: UART
	BD Address: 78:C5:E5:E5:25:C2  ACL MTU: 1021:4  SCO MTU: 180:4
	UP RUNNING PSCAN 
	RX bytes:856 acl:0 sco:0 events:34 errors:0
	TX bytes:692 acl:0 sco:0 commands:34 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: 'cm-debian-0'
	Class: 0x6e0100
	Service Classes: Networking, Rendering, Capturing, Audio, Telephony
	Device Class: Computer, Uncategorized
	HCI Version: 4.0 (0x6)  Revision: 0x0
	LMP Version: 4.0 (0x6)  Subversion: 0x1f3b
	Manufacturer: Texas Instruments Inc. (13)

A2DP Headphones

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

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 its usage with mobile phone device.

  • Enable bluetooth on the phone. On CM-T3730, scan for available devices to find out phone's BT address:
root@cm-debian:~# hcitool scan
Scanning ...
	00:15:2A:20:63:94	Nokia 6230i
root@cm-debian:~#
  • Ensure the phone supports Obex FTP service:
root@cm-debian:~# 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

root@cm-debian:~# 
  • Pair the device - provide PIN code upon request and confirm permission request on the phone:
root@cm-debian:~# bluez-simple-agent hci0 00:15:2A:20:63:94
RequestPinCode (/org/bluez/1285/hci0/dev_00_15_2A_20_63_94)
Enter PIN Code: 1937
Release
New device (/org/bluez/1285/hci0/dev_00_15_2A_20_63_94)

root@cm-debian:~#


Admolition note.png You can launch bluez-simple-agent with no parameters. The agent is tracking requests to all bluetooth devices and triggers pin code confirmation when needed.
  • List phone's root folder:
root@cm-debian:~# 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
root@cm-debian:~#
  • Transfer a file from CM-T3730 to the phone:
root@cm-debian:~# 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
root@cm-debian:~#
  • Retrieve a file from the phone to CM-T3730:
root@cm-debian:~# 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
root@cm-debian:~#

Display options

CM-T3730 evaluation platform has four video output interfaces: LCD, DVI, LVDS and TV-out. Default configuration of Debian Linux for CM-T3730 uses LCD 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:
echo 0 > /sys/devices/platform/omapdss/display0/enabled
echo "dvi" > /sys/devices/platform/omapdss/manager0/display
fbset -fb /dev/fb0 -xres 1024 -yres 768
echo 1 > /sys/devices/platform/omapdss/display1/enabled
  • Switch from DVI to Toppoly LCD:
echo 0 > /sys/devices/platform/omapdss/display1/enabled
echo "lcd" > /sys/devices/platform/omapdss/manager0/display
fbset -fb /dev/fb0 -xres 480 -yres 640
echo 1 > /sys/devices/platform/omapdss/display0/enabled
  • Switch from DVI to DataImage LCD:
echo 0 > /sys/devices/platform/omapdss/display1/enabled
echo "lcd" > /sys/devices/platform/omapdss/manager0/display
fbset -fb /dev/fb0 -xres 480 -yres 800
echo 1 > /sys/devices/platform/omapdss/display0/enabled

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 set value to high:

echo 140 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio140/direction
echo 1 > /sys/class/gpio/gpio140/value
Admolition note.png The above example assumes that the corresponding pin is set to mux mode 4 and the GPIO 140 is not requested in the Linux kernel.

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

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 in a separate archive. Extract ti_dvsdk_demo.tar.bz2 DVSDK demos:

root@cm-debian:~# cd /usr/share/ti/                 
root@cm-debian:/usr/share/ti# tar -xjpvf <path_to_dvsdsk_demos>/ti_dvsdk_demo.tar.bz2

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-debian:~# cd /usr/share/ti/ti-dsplink-examples/
root@cm-debian:~#/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-debian:~# cd /usr/share/ti/c6accel-apps/
root@cm-debian:~# ./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-debian:/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-debian:/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-debian:/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-debian:/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-debian:/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-debian:~# /etc/init.d/omap-demo
  • The SGX kernel modules must be loaded prior running the demos:
root@cm-debian:~# /etc/init.d/rc.pvr start

Running Graphics SDK OpenGL ES1.x Demos

  • To run OpenGL ES1.x demos, perform the following:
root@cm-debian:~# cd /opt/gfxsdkdemos/ogles
root@cm-debian:/opt/gfxsdkdemos/ogles# ./OGLESEvilSkull

This will execute the OGLESEvilSkull demo. Press ‘q’ on the CM-T3730 console to stop the demo execution.

Running Graphics SDK OpenGL ES2.0 Demos

  • To run OpenGL ES2.x demos, perform the following:
root@cm-debian:~# cd /opt/gfxsdkdemos/ogles2
root@cm-debian:/opt/gfxsdkdemos/ogles2# ./OGLES2FilmTV

This will execute the OGLESFilmTV demo. Press ‘q’ on the CM-T3730 console to stop the demo execution.

See also