Difference between revisions of "CM-T335: Android"

From Compulab Mediawiki
Jump to: navigation, search
(Testing WiFi from command line)
(kernel)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
The Android Demo filesystem image for CM-T335 is based on [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/TI_Android_JB_4_1_2_DevKit_4_0_1/index_FDS.html  Android Jelly Bean 4.1.2] distribution for TI's Sitara(TM) AM335x ARM Cortex(TM) A8 Processors.  
+
The Android Demo filesystem image for the CompuLab CM-T335 System-on-Module / Computer-on-Module is based on [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/TI_Android_JB_4_1_2_DevKit_4_0_1/index_FDS.html  Android Jelly Bean 4.1.2] distribution for TI's Sitara(TM) AM335x ARM Cortex(TM) A8 Processors.  
 
The [http://compulab.co.il/products/computer-on-modules/cm-t335/#devres CompuLab Android Demo package for CM-T335] includes ready to run Demo Android filesystem image and [[CM-T335: Android: Kernel|Linux kernel]] based on 3.2.0 version.
 
The [http://compulab.co.il/products/computer-on-modules/cm-t335/#devres CompuLab Android Demo package for CM-T335] includes ready to run Demo Android filesystem image and [[CM-T335: Android: Kernel|Linux kernel]] based on 3.2.0 version.
  
Line 39: Line 39:
  
 
== kernel ==
 
== kernel ==
* {{filename|uImage-3.2.0-cm-t335-3.bin}} - ready to run Linux kernel 3.2.0-cm-t335-2 for CM-T335 can be used with either Android or Linux root filesystem
+
* {{filename|uImage-3.2.0-cm-t335-3.1.bin}} - ready to run Linux kernel 3.2.0-cm-t335-3.1 for CM-T335 can be used with either Android or Linux root filesystem
* {{filename|linux-3.2.0-cm-t335-3.config}} - Linux kernel 3.2.0-cm-t335-2 configuration file
+
* {{filename|linux-3.2.0-cm-t335-3.1.config}} - Linux kernel 3.2.0-cm-t335-3.1 configuration file
* {{filename|linux-3.2.0-cm-t335-3.patch}} - patch vs. [http://gitorious.org/rowboat/kernel/commit/996686459db1181a5deaf5d493681ecb5bf43ad7 rowboat-jb-am335x-4.1.2] tag with support for CM-T335 peripherals
+
* {{filename|linux-3.2.0-cm-t335-3.1.patch}} - patch vs. [http://gitorious.org/rowboat/kernel/commit/996686459db1181a5deaf5d493681ecb5bf43ad7 rowboat-jb-am335x-4.1.2] tag with support for CM-T335 peripherals
* {{filename|patches}} - ordered collection of patches, that form the single patch above ({{filename|linux-3.2.0-cm-t335-3.patch}})
+
* {{filename|patches}} - ordered collection of patches, that form the single patch above ({{filename|linux-3.2.0-cm-t335-3.1.patch}})
  
 
== utilities ==
 
== utilities ==

Latest revision as of 11:39, 13 July 2015

Introduction

The Android Demo filesystem image for the CompuLab CM-T335 System-on-Module / Computer-on-Module is based on Android Jelly Bean 4.1.2 distribution for TI's Sitara(TM) AM335x ARM Cortex(TM) A8 Processors. The CompuLab Android Demo package for CM-T335 includes ready to run Demo Android filesystem image and Linux kernel based on 3.2.0 version.

The Android Demo image for CM-T335 includes following software components:

  • Android Jelly Bean 4.1.2 release from Google
  • Android Linux Kernel v3.2.0
  • SGX OpenGL ES Driver & Libraries DDK v1.10
  • Built-in Applications and Demos
    • Browser, Calculator, Clock, Contacts, Music, Search, File Manager, etc.
  • Peripherals drivers
    • MMC/SD, UART, Ethernet, etc.
    • USB OTG and USB Host

The Getting started with Android on CM-T335 page provides a brief introduction on how to install and boot the Android Demo image. This article describes package structure and peripheral device options specific to the CM-T335.

Package contents

version.txt

The contents of the version.txt identifies the package version.

images

  • uImage-cm-t335 - ready to run Linux kernel image binary for CM-T335
  • Android-image-cm-t335.tar.bz2 - Android root file system image archive
  • kernel.img - Kernel image required for installation onto the NAND flash
  • ramdisk.img - Ramdisk image required for installation onto the NAND flash
  • bootscr.img - U-Boot script used for image installation

development

The development directory contains a collection of patches with support for CM-T335. The directory structure preserves the original TI Android JB 4.1.2 source tree structure. It contains patches for several Android sub-projects including Linux kernel.

  • build - contains a collection of patches that determine build specification for CM-T335
  • device/compulab/cm_t335 - contains a collection of patches that introduce CM-T335 support
  • hardware/ti/omap3 - patches for CM-T335 audio
  • hardware/ti/wlan - patches for CM-T335 WLAN
  • kernel - contains a collection of patches for Linux kernel with support for CM-T335 peripherals

kernel

  • uImage-3.2.0-cm-t335-3.1.bin - ready to run Linux kernel 3.2.0-cm-t335-3.1 for CM-T335 can be used with either Android or Linux root filesystem
  • linux-3.2.0-cm-t335-3.1.config - Linux kernel 3.2.0-cm-t335-3.1 configuration file
  • linux-3.2.0-cm-t335-3.1.patch - patch vs. rowboat-jb-am335x-4.1.2 tag with support for CM-T335 peripherals
  • patches - ordered collection of patches, that form the single patch above (linux-3.2.0-cm-t335-3.1.patch)

utilities

The utilities directory contains miscellaneous utilities useful for development

  • adb - prebuilt adb binary for Linux host
  • busybox - prebuilt busybox binary v1.19.4
  • eeprom-util - CompuLab EEPROM utility for reading information found inside the EEPROM on CompuLab boards

Using Android on CM-T335

Touchscreen

Introduction

The touchscreen is the primary input device for CM-T335 Android Demo Image. Features supported by Touchscreen in Android are:

  • Single touch input
  • Single click
  • Single long click
  • Uni-direction motion touch

Touchscreen calibration

The platform data for TSC driver for CM-T335 contains the following fields to provide calibration data (kernel/arc/arm/mach-omap2/board-cm-t335.c):

static struct tsc_data cm_t335_ts_data  = {
...
	.x = {
		.min = 0xB0,
		.max = 0xF50,
		.inverted = 1,
	},
	.y = {
		.min = 0x120,
		.max = 0xEB8,
		.inverted = 1,
	},
...
};

Where X-axis is from left to right and Y-axis from top to bottom, and min and max values are the actual touch data obtained at the extreme corners of the LCD screen. You can obtain the raw value returned by the touchscreen at the corners using the getevent utility in Android. Use the values for ABS_X and ABS_Y to determine the position:

root@android:/ # getevent -tl /dev/input/event0
[    1824.651800] EV_ABS       ABS_X                0000035a
[    1824.651819] EV_ABS       ABS_Y                00000411
[    1824.651822] EV_ABS       ABS_PRESSURE         00000013
[    1824.651828] EV_KEY       BTN_TOUCH            DOWN
[    1824.651831] EV_SYN       SYN_REPORT           00000000
...

Testing touchscreen calibration accuracy

  • Run android on the board
  • Select Menu ---> Dev Tools ---> Pointer Location utility
  • Touch and draw on the screen and observe that the expected points are getting marked on the LCD screen.
  • If drawing on LCD is not proper then driver should to be fine tuned by the means of the TSC platform data.

Audio

Introduction

CM-T335 uses the TLV320AIC23B (TI) audio codec for analog audio input and output. The audio module is interfaced to the main processor through the TDM / I2S interface and used to transmit and receive audio data. The audio codec is connected via Multi-Channel Audio Serial Port (McASP) interface.

Android Audio HAL Configuration

Android uses the kernel ALSA framework for audio input/output.

The tinyalsa utilities are used for audio playback, capture and configuration. These can be used to test the audio functionality and configuration at kernel-level.

The ALSA HAL is named audio.primary.cm_t335.so.

Testing audio from command line

Use the tinyalsa utilities to test audio input/output from shell.

  • The tinymix is a mixer utility used for showing and configuring sound settings.
root@android:/ # tinymix
Number of controls: 12
ctl     type    num     name                                     value
0       INT     2       Digital Playback Volume                  112 112
1       BOOL    1       Digital Playback Switch                  On
2       BOOL    2       Line Input Switch                        Off Off
3       INT     2       Line Input Volume                        23 23
4       BOOL    1       Mic Input Switch                         On
5       BOOL    1       Mic Booster Switch                       Off
6       INT     1       Sidetone Volume                          3
7       ENUM    1       Playback De-emphasis                     44.1Khz
8       BOOL    1       Output Mixer Line Bypass Switch          Off
9       BOOL    1       Output Mixer Mic Sidetone Switch         Off
10      BOOL    1       Output Mixer Playback Switch             On
11      ENUM    1       Capture Source                           Line
  • To play a simple audio file use the tinyplay media player:
root@android:/ # tinyplay <media-file-name>.wav -n 16
  • To record a simple audio file use the tinycap utility:
root@android:/ # tinycap <capture-file-name>.wav -n 16

USB Gadget

Introduction

There are two options for USB configuration available for the CM-T335:

  • with single USB OTG port (U1 option)
  • with four USB host ports (U4 option)

The CM-T335 Android Demo image supports both USB host and USB device ports in single binary image. USB host can be used to connect Keyboard/Mouse, Mass storage device, etc. The USB device port is used for connecting to a PC workstation.

Android USB Gadget Configuration

The Android USB gadget driver is configured via the sysfs entries. The sysfs settings depend on the features required to be enabled. By default only the adb and mtp mode is configured. The adb mode is configured by default. Please refer to the device/compulab/cm_t335/init.cm-t335.rc for more details.

Android Mass Storage USB Gadgets

To enable Android Mass Storage USB Gadgets follow the instruction below:

  • Set the Android Gadget to the Mass Storage mode:
root@android:/ # echo 0 > /sys/class/android_usb/android0/enable
root@android:/ # echo mass_storage > /sys/class/android_usb/android0/functions
root@android:/ # echo 1 > /sys/class/android_usb/android0/enable
  • Make sure the external storage device you want to use (SD/MMC card partition) is plugged/installed into the CM-T335 and has a proper partition:
root@android:/ # ls -l /dev/block/
...
brw------- root     root     179,   0 2010-11-01 22:08 mmcblk0
brw------- root     root     179,   1 2010-11-01 22:08 mmcblk0p1
brw------- root     root     179,   2 2010-11-01 22:08 mmcblk0p2
...
root@android:/ # cat /proc/partitions
major minor  #blocks  name

  31        0       2048 mtdblock0
  31        1       1024 mtdblock1
  31        2       1024 mtdblock2
  31        3       1024 mtdblock3
  31        4       4096 mtdblock4
  31        5       6144 mtdblock5
  31        6     508928 mtdblock6
 179        0    7830528 mmcblk0
 179        1     120456 mmcblk0p1
 179        2    7709048 mmcblk0p2
  • Make sure the partition you're going to share is not mounted. Otherwise unmount it.
  • Share the partition:
root@android:/ # echo /dev/block/mmcblk0p1 > /sys/class/android_usb/f_mass_storage/lun/file
  • Finally, connect the CM-T335 to your host via USB OTG port.

ADB over USB

Please refer to the Android: ADB setup article for more information about the ADB over USB.

WiFi

Introduction

The CM-T335 uses the TI WL1271 device. The CM-T335 Android Demo package uses WL12XX Compat wireless SDK instead of the device driver integrated into the Linux kernel. The WL12XX Compat SDK includes the WL1271 device driver as well as the device firmware.

Android WiFi HAL Configuration

  • The TI version of wpa_supplicant 0.8.x is enabled in device/compulab/cm_t335/BoardConfig.mk:
BOARD_WPA_SUPPLICANT_DRIVER      := NL80211
BOARD_HOSTAPD_DRIVER             := NL80211
BOARD_WLAN_DEVICE                := wl12xx_mac80211
BOARD_SOFTAP_DEVICE              := wl12xx_mac80211
WPA_SUPPLICANT_VERSION           := VER_0_8_X_TI
WIFI_DRIVER_MODULE_PATH          := "/system/lib/modules/wl12xx_spi.ko"
WIFI_DRIVER_MODULE_NAME          := "wl12xx_spi"

This enables building the wpa_supplicant 0.8.x with NL80211. Additionally, it specifies the wl12xx_spi as the WiFi driver that is loaded at run time.

  • The WiFi interface name wlan0 is set in the device/compulab/cm_t335/device.mk:
PRODUCT_PROPERTY_OVERRIDES += \
        wifi.interface=wlan0
  • Finally, the wpa_supplicant and the dhcpcd daemons are started in the CM-T335 init file. Please refer to the device/compulab/cm_t335/init.compulabcm-t335.rc for more details.

Testing WiFi from command line

  • Check the WiFi modules are loaded:
root@android:/ # lsmod                                                         
wl12xx 192431 0 - Live 0x00000000 (O)
mac80211 348940 1 wl12xx, Live 0x00000000 (O)
cfg80211 182789 2 wl12xx,mac80211, Live 0x00000000 (O)
compat 1666 0 - Live 0x00000000 (O)
...
  • Load the WL12XX SPI driver module:
root@android:/ # insmod /system/lib/modules/wl12xx_spi.ko
[  384.983917] wl12xx: loaded
  • Turn the WiFi module up:
root@android:/ # netcfg wlan0 up
[  679.577941] wl12xx: state: 0
[  680.062042] wl12xx: firmware booted (Rev 6.3.10.0.132)
[  680.082092] ADDRCONF(NETDEV_UP): wlan0: link is not ready
The above messages mean that the interface is up and the firmware is downloaded to the WiFi module.
  • Turn the WiFi module down and unload the driver module prior to trying WiFi configuration via Android user interface:
root@android:/ # netcfg wlan0 down
[ 1131.165161] wl12xx: down
root@android:/ # rmmod wl12xx_sdio

Bluetooth

Introduction

The CM-T335 uses the Bluetooth module on the TI WL1271 device. The appropriate firmware for the Bluetooth module is supplied with the Android Demo package.
Following features are supported in this release:

  • Bluetooth 2.1
  • OPP, A2DP, AVRCP, HID profiles are supported
  • HSP, HFP profiles are NOT supported

Android Bluetooth HAL Configuration

  • The Bluetooth is enabled in device/compulab/cm_t335/BoardConfig.mk:
BOARD_HAVE_BLUETOOTH := true

This enables bluez HAL layer, which is used to connect Android Bluetooth Framework and SystemServer via DBUS.

  • The following services are registered in init.rc for Bluetooth operation:
    • dbus-daemon: connects between hcid and system server
    • bluetoothd: create hcid (Bluetooth Host Controller Interface Daemon) service
    • uim-sysfs: userspace module for TI-ST kernel driver. This service attaches the BT UART HCI interface to the bluetooth stack. It is also responsible for loading the BT firmware on WL1271.

See also