CM-T3730: Android

From Compulab Mediawiki
Jump to: navigation, search

Introduction

The Android Demo filesystem image for CM-T3730 is based on Rowboat Android 4.1.2 Jelly Bean support for TI's AM37x platform. The CompuLab Android Demo package for CM-T3730 includes ready to run Demo Android filesystem image and Linux kernel based on 2.6.37 version.

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

  • Android Jelly Bean 4.1.2 release from Google
  • Android Linux Kernel v2.6.37
  • 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, Matrix Keypad, LCD, Touchscreen, etc.
    • USB (Host and Gadget), Audio out/in, WLAN, Bluetooth

The Getting started with Android on CM-T3730 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-T3730.

Package contents

version.txt

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

images

  • uImage-cm-t3730.bin - ready to run Linux kernel image binary for CM-T3730
  • Android-image-cm-t3730.tar.bz2 - Android root file system archive

development

The development directory contains a collection of patches with support for CM-T3730. The directory structure preserves the Rowboat Android 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-T3730
  • device/compulab/cm_t3730 - contains a collection of patches that introduce CM-T3730 support
  • hardware - contains hardware specific patches
    • devmem2 - provides devmem2 utility
    • ti - TI platform specific patches
      • omap3 - patches for CM-T3730 audio
      • sgx - patches for Graphics SDK
  • kernel - contains a collection of patches for Linux kernel with support for CM-T3730 peripherals

kernel

  • uImage-2.6.37-cm-t3730-3.bin - ready to run Linux kernel 2.6.37-cm-t3730-3 for CM-T3730 can be used with either Android or Linux root filesystem
  • linux-2.6.37-cm-t3730-3.config - Linux kernel 2.6.37-cm-t3730-3 configuration file
  • linux-2.6.37-cm-t3730-3.patch - patch vs. rowboat-jb-am37x-4.1.2 tag with support for CM-T3730 peripherals
  • patches - ordered collection of patches, that form the single patch above (linux-2.6.37-cm-t3730-3.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-T3730

Audio

Introduction

CM-T3730 uses the audio module of the TPS65930 PMIC 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 Buffered Serial Port (McBSP) 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_t3730.so. It uses the file mixer_paths.xml to configure the audio driver. This file contains the ALSA mixer settings for the various audio paths supported by the driver.

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: 70
ctl     type    num     name                                     value
0       ENUM    1       Codec Operation Mode                     Option 2 (voice/audio)
1       INT     2       DAC1 Digital Fine Playback Volume        63 63
2       INT     2       DAC2 Digital Fine Playback Volume        63 63
3       INT     2       DAC1 Digital Coarse Playback Volume      0 0
4       INT     2       DAC2 Digital Coarse Playback Volume      0 0
5       INT     2       DAC1 Analog Playback Volume              12 12
6       INT     2       DAC2 Analog Playback Volume              12 12
7       BOOL    2       DAC1 Analog Playback Switch              On On
...
69      BOOL    1       Right1 Analog Loopback Switch            Off
  • To play a simple audio file use the tinyplay media player:
root@android:/ # tinyplay <media-file-name>.wav
  • To record a simple audio file use the tinycap utility:
root@android:/ # tinycap <capture-file-name>.wav

Keypad

The matrix keypad is supplied with the CM-T3730 Evaluation Kit. Connect the keypad to the SB-T35 base-board (connector P10) via 20-pin flat cable supplied with the evaluation kit.

Android Keypad Configuration

The default Android keypad configuration is determined by the Android Key layout file /system/usr/keylayout/TWL4030_Keypad.kl. This file is responsible for mapping Linux key and axis codes to Android key and axis codes and specifying associated policy flags. The TWL4030_Keypad.kl for CM-T3730 looks as follows:

# CM-T3730 TWL4030 KEYPAD keylayout
key 30    BACK               WAKE_DROPPED
key 48    HOME               WAKE
key 46    MENU               WAKE_DROPPED
key 32    SEARCH             WAKE
key 28    POWER              WAKE

USB Gadget

Introduction

The CM-T3730 Android Demo image supports both USB host and USB device ports. USB host can be used to connect Keyboard/Mouse, Mass storage device, etc. The USB device port is used for adb and USB accessory gadgets.

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_t3730/init.compulabcm-t3730.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 (e.g. USB stick, SD/MMC card) is plugged/installed into the CM-T3730 and has a proper partition:
root@android:/ # ls -l /dev/block/
...
brw------- root     root     179,   0 2013-05-07 09:37 mmcblk0
brw------- root     root     179,   1 2013-05-07 09:37 mmcblk0p1
brw------- root     root     179,   2 2013-05-07 09:37 mmcblk0p2
brw------- root     root     179,   3 2013-05-07 09:37 mmcblk0p3
...
brw------- root     root       8,   0 2013-05-07 09:37 sda
brw------- root     root       8,   1 2013-05-07 09:37 sda1
...
root@android:/ # cat /proc/partitions
major minor  #blocks  name

 179        0    7842816 mmcblk0
 179        1     120456 mmcblk0p1
 179        2    5669520 mmcblk0p2
 179        3    2051815 mmcblk0p3
   8        0    1970239 sda
   8        1    1969215 sda1
  • Make sure the partition you're going to share is not mounted. Otherwise unmount it.
  • Share the partition:
root@android:/ # echo /dev/block/mmcblk0p3 > /sys/class/android_usb/f_mass_storage/lun/file
  • Finally, connect the CM-T3730 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-T3730 uses the TI WL1271 device. The CM-T3730 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_t3730/BoardConfig.mk:
BOARD_WPA_SUPPLICANT_DRIVER      := NL80211
WPA_SUPPLICANT_VERSION           := VER_0_8_X_TI
BOARD_HOSTAPD_DRIVER             := NL80211
BOARD_WLAN_DEVICE                := wl12xx_mac80211
BOARD_SOFTAP_DEVICE              := wl12xx_mac80211
WIFI_DRIVER_MODULE_PATH          := "/system/lib/modules/wl12xx_sdio.ko"
WIFI_DRIVER_MODULE_NAME          := "wl12xx_sdio"

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

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

Testing WiFi from command line

  • Check the WiFi modules are loaded:
root@android:/ # lsmod
wl12xx 198125 0 - Live 0xbf0f6000
mac80211 341334 1 wl12xx, Live 0xbf083000
cfg80211 158648 2 wl12xx,mac80211, Live 0xbf04b000
compat 7163 2 wl12xx,mac80211, Live 0xbf042000
...
  • Load the WL12XX SDIO driver module:
root@android:/ # insmod /system/lib/modules/wl12xx_sdio.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-T3730 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_t3730/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