Flashboard-Android-DevKit Guide

From Texas Instruments Wiki
Jump to: navigation, search

What is Flashboard

Flashboard is a development board, equipped with ARM Cortex A8 processor, SGX graphics processor, sensors, and Wireless connectivity.

This platform is well suited as a development platform for mid-end android solutions.

http://www.theflashboard.com/

Flashboard2.JPG




Flashboard Features


Feature
Processor
DM3730 1GHz
Display
5” and 7” TFT LCD with Touch screen
Memory
512MB NAND, 256MB mDDR
Wi-Fi
Integrated WLAN 802.11 b/g/n
Bluetooth
BT2.1 with EDR
Video output
HDMI interface
USB
High speed 2.0 OTG
Audio
Stereo audio with auxiliary LINE IN and LINE OUT
Storage
SD\MMC card on SD\MMC interface
Camera
Beagleboard Xm Camera interface
Sensors
Gyrometer and accelerometer on I2C
Wireless communication
NFC enabled
Wireless sensor network
Onboard ZigBee RF transceiver

Android on Flashboard

Objective of this wiki page

This wiki page has mainly two objectives

  1. Quickly evaluate Android using pre-built images
  2. Start develop using sources

Installation and Usage

This section explains how to prepare a micro-sd card for booting android on the Flashboard. The details on booting the Flashboard and evaluating Android is also explained.

Getting Prebuilt Images

Flashboard Prebuilt SD card image from TI Flashboard Android DevKit uploaded at TI FTP


Preparation of SD card

Connect a Micro SD card (Atleast 2GB size and Class 4) via a USB card reader on an Ubuntu Machine
From a terminal, type the below commands,

$ tar -jxvf TI_Android_GingerBread_2_3_4_Devkit_Flashboard.tar.bz2
$ cd TI_Android_GingerBread_2_3_4_Devkit_Flashboard
$ sudo ./mkmmc-android.sh /dev/sd<device> 

The above step prepares the SD Card with three partitions.

  1. boot - Boot Images (Boot Loaders, Boot Script and Kernel)
  2. rootfs - Filesystem (Android GingerBread 2.3.4)
  3. data - Media Clips (Audio, Video and Images)

Now this card can be used to boot the Flashboard

Hardware setup

Connect MiniB USB Cable, Ethernet Cable and 5V DC Power to the Flashboard and have it powered. Windows or Linux Host can be used to connect and evaluate Flashboard. We prefer to use Ubuntu > 10.04 as the host to connect to Flashboard.

Getting serial console

Serial console is provided via serial cable connection between the Flashboard and the Host. To establish a connection the serial port settings should be 115200 baud rate, 8 data bits, 1 stop bit, and parity none

Verifying Serial Connection

Once you finish setting up serial console, you can test the connection via the below steps

  • Connect the power cable to the board
  • If your serial connection is proper, you can see the sequnce '60' getting popped up on the serial console.

Powering on to Android Terminal

Put the Micro SD card to the slot on the Flashboard. Press the reset button again. See X-loader and Uboot loading. Allow the boot loader to run the boot script to run.Kernel boots up and Android shell is activated. Wait till Android init to start the zygote thread.
See the below message appearing on the shell.

warning: `zygote' uses 32-bit capabilities (legacy support in use) 

Booting the platform

Booting over MMC using boot.scr

   NOTE:

- If the board has bootargs configured already, then the board will not boot for Android automatically, 
- It is suggested to either delete the bootargs or use the following commands on u-boot prompt through UART console. 
   #> mmc init
   #> fatload mmc 0 0x82000000 boot.scr
   #> source 0x82000000

Boot arguments

Boot arguments for Flashboard are as follows

 setenv bootargs 'console=ttyO2,115200n8 androidboot.console=ttyO2 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait rootdelay=1 init=/init ip=off vram=8M omapfb.vram=0:8M'

Android Display through HDMI port

The flashboard is able to display a DVI signal through the HDMI output port, in order to view the output signal a HDMI to DVI cable like the one shown in the picture is required.

HDMI-DVI cable.jpg


To enable the DVI signal in the HDMI output append the following arguments to the bootargs:

mpurate=1000 omap_vout.vid1_static_vrfb_alloc=y omapdss.def_disp=dvi omapfb.mode=dvi:1280x720MR-16 omap_vout.vid1_static_vrfb_alloc=y
For example when booting from MMC/SD with the HDMI output enabled:
setenv bootargs 'console=ttyO2,115200n8 androidboot.console=ttyO2 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait rootdelay=1 init=/init ip=dhcp mpurate=1000 omap_vout.vid1_static_vrfb_alloc=y omapdss.def_disp=dvi omapfb.mode=dvi:1280x720MR-16 omap_vout.vid1_static_vrfb_alloc=y vram="8M" omapfb.vram=0:8M'

ADB Debugging

Android Debug Bridge (adb) is a versatile tool lets you manage the state of the Android-powered device. For more information about what is possible with adb, see Android Debug Bridge page at http://developer.android.com/guide/developing/tools/adb.html. The ADB tool can be used to

  1. Download an application from a host machine, install & run it on the target board.
  2. Start a remote shell in the target instance.
  3. Debug applications running on the device using the debugging tool DDMS ( Dalvik Debug Monitor Server) which runs on top of adb connection.
  4. Copy files to and from the board to host machine

Please visit http://processors.wiki.ti.com/index.php/Android_ADB_Setup for setting up ADB on the Flashboard

Running Android Applications

Keypad mappings

The below table lists the keypad mappings to Android UI functionality

Functionality
Keypad Button
Left
SW5
Right
SW6
Select
SW3
Back / Previous screen
SW4


Android Home Screen

After the first boot, the user will see an unlocked Android home screen. On subsequent boot, a locked screen will be displayed. User needs to unlock the screen via TouchScreen by dragging the lock tab accross the screen. Once the screen is unlocked, the user can navigate to Google Search, Tips, Browser or Application Launcher. Click the Application Launcher to see all pre-built applications. Rb main.JPG

Gallery Application

In Gallery, the user can view the images and play videos.

Rb gallery.JPG

Rowboperf and 3D graphics applications

RowboPERF is comprehensive set of banchmarks and Demos.
Select the rowboperf icon and get into the app directory. For more information on RowboPERF, please check RowboPERF User Guide

Rb rowbo.JPG

Browser Configuration

To browse web pages user should configure the Internet connection as given below.

  # netcfg eth0 up
  # netcfg eth0 dhcp
  # getprop net.eth0.dns1

This prints the dns for the ethernet port, do the following to configure the DNS entries on board.

  # setprop net.dns1 <your_dns_server_ip>

If the platform is behind proxy, then following command should be executed to set the proxy settings

  # setprop net.gprs.http-proxy http://proxyurl:80

Rotation Support

Graphics and Video rotation is managed by software. Use standard android API to rotate screen in portrait or landscape mode. Currently portrait and landscape graphics rotation mode is supported.

Camera Support

Ti Android GingerBread supports camera sensor mt9t111 for Flashboard

3Mpixel camera board.jpeg

Feature supported:

  • Image Capture
  1. Go to application/activity view luncher > open camera
  2. Click on camera capture.By default images will get stored at - /sdcard/DCIM

NOTE:

- Video recording is not supported

Wireless

Flashboard evm revG with the wireless module supports WLAN and Bluetooth on Android. For steps on installing the wireless module see this page.

WLAN

  • Menu->Settings->Wireless & networks->Wi-Fi settings
  • click Wi-Fi and wait for few seconds.
  • On the UI, Green check-mark appears and status shows scanning
  • After scan completes, available APs are listed
  • Connect to desired AP by clicking on its name and enter required details (username/key etc) and click connect
  • The following appears on console
wl1271: loaded
wl1271: initialized
wl1271: firmware booted (Rev 6.1.5.50.69)
cfg80211: Calling CRDA to update world regulatory domain
wl1271: Association completed.
  • when successfully connected, you will see status as connected to APNAME


  • To turn off Wi-Fi, click Wi-Fi in Menu->Settings->Wireless & networks
  • Following message appears on console and the green check mark is not visible on UI
wl1271: down
wl1271: unloaded

Bluetooth

  • Menu->Settings->Wireless & networks->Bluetooth settings
  • Click Bluetooth and wait for few seconds
  • LED LD3 turns ON on the wireless module and the Bluetooth icon appears on taskbar. The following appears on the debug console
Set BT_EN of WL1271
WL1271: Powering on
  • If BT is enabled green check-mark appears and status shows scanning
  • available bt devices are listed

BT scan results

  • click on desired device to pair with
  • popup with pin will appear

PIN for pairing

  • click Pair button to confirm pairing
  • verify that the desired device shows the same pin. click ok. devices paired

NOTE: When pairing with Bluetooth headset, pin may not be displayed. Android attempts to pair automatically with Bluetooth headsets. Pin dialog will be shown only if auto-pairing fails.


  • To turn off Bluetooth, click Bluetooth in Menu->Settings->Wireless & networks
  • LED LD3 turns OFF on the wireless module, Bluetooth icon is not displayed on taskbar and the following messages appear on console:
Set BT_EN of WL1271
WL1271: Powering off

Bluetooth Object Push profile

Using Bluetooth, it is possible to send receive files (pictures, media files etc).

Sending files
  • go to Menu ->Gallery
  • Select a picture to share
  • click Menu (bottom right)
  • click share, select bluetooth from the options

Send picture from Gallery to Bluetooth

  • select paired bt device to send to
  • the bt device will prompt to accept. accept incoming file
  • once download finished. check file
Receiving files
  • on paired device (e.g. phone), select send to bt, click on omap3evm
  • on evm, notification appears about incoming connection (top left)

incoming transfer icon

  • open task bar. click on note

incoming transfer message

  • in popup click accept

Confirm incoming transfer

  • once download complete. check file

Bluetooth A2DP

You can listen to Media audio on Bluetooth A2DP headset.

  • Pair A2DP capable bluetooth headset with device. Android uses the stereo headset icon to denote A2DP headset
  • After pairing succeeds, the status is updated to 'Connected to phone and media audio'.

A2DP headset pairing-Note headset icon

  • Open Music player and play any audio clip
  • Audio will be heard on the Bluetooth headset

Bluetooth AVRCP

You can control Media playback with Media player keys on Bluetooth headset with AVRCP capabilities.

NOTE: The following steps assume Bluetooth A2DP headset with AVRCP.

  • Pair the BT headset
  • The following text appears on the debug serial when the pairing is successfully completed. This confirms that AVRCP feature is registered with android
  input: AVRCP as /devices/virtual/input/input3
  • Open Music Player and go to playlist view. Check that there are multiple clips in the playlist.
  • Press the Play/Pause button on the BT headset - The currently queued clip begins playing on the headset
  • Press the Play/Pause button again on the headset - The currently playing clip is paused
  • Press the Next button on the headset; the next clip in the playlist begins to play on the headset
  • Press the Prev button on the headset; the currently playing clip restarts from the begining

Bluetooth SCO Audio

Android supports the Bluetooth Headset Profile/HandsFree Profile Audio Gateway (HSP/HFP AG). Bluetooth SCO connection is used to play/capture audio in these profiles.

It is possible to record audio from Bluetooth headset over SCO.

  • Pair Bluetooth headset with device
  • After pairing succeeds, the status is updated to 'Connected to phone audio'. If using A2DP headset, the status is 'Connected to media and phone audio'

BT HSP/HFP headset pairing

  • NOTE: If using A2DP headset, you need to disable the A2DP profile before BluetoothSCOApp can be used. To disable A2DP follow the steps below
  • Menu -> Settings -> Wireless & networks -> Bluetooth settings
  • Long tap on the entry for A2DP headset, a menu appears
BT device menu
  • Tap Options
  • Uncheck Media. This stops android from using A2DP profile of the headset
Disable A2DP feature for paired headset
  • To re-enable A2DP, repeat the above steps and check-mark Media
  • Menu -> BluetoothSCOApp. BluetoothSCOApp is a sample app to establish SCO connectivity with a Bluetooth headset
  • Menu -> Sound Recorder
  • Tap record button
  • Speak into the bluetooth headset mic, the VU meter display moves as per the sound. This confirms that audio is being recorded from bluetooth headset
  • Stop recording and save the clip.
  • Turn-off and Turn-on the Headset to come out of SCO mode. (This is a limitation of the current version of BluetoothSCOApp)

The audio is recorded in 3gpp format and can be played back by the Music player.

Bluetooth Audio Recording and Playback using ALSA utils

An alternate method to capture and play audio using SCO using alsa-utils is given below. These steps do not use the Android Mediaplayer framework.

  • Pair Bluetooth headset with device
  • After pairing succeeds, the status is updated to 'Connected to phone audio'. If using A2DP headset, the status is 'Connected to media and phone audio'

BT HSP/HFP headset pairing

  • Tap once so that check mark appears against 'Enable Music via Media Player'

NOTE: If using A2DP headset, you need to disable the A2DP profile before BluetoothSCOApp can be used.

  • Menu -> BluetoothSCOApp. BluetoothSCOApp is a sample app to establish SCO connectivity with a Bluetooth headset
  • Tap once so that check mark appears against 'Enable Music via Media Player'
  • On the serial console type in the following commands:
# ln -s /system/app/alsa_aplay /system/app/alsa_arecord
# alsa_arecord -D hw:0,1 -f S16 test.wav
  • Speak into the Bluetooth Headset mic. This data will be captured and saved in test.wav. Press Ctrl-C to stop the capture session.
  • To play the recorded sound, enter the following command on the console.
# alsa_aplay -D hw:0,1 test.wav

Turn off the HandsFree Headset to stop the SCO session.

NOTE: An active SCO session needs to be established to play/capture audio from Bluetooth Hands-Free.

Known Issues

  • After connection drop WiFi doesn't connect to Acess Point automatically. User need to disconnect and connect again.


Power Management

Below are the features supported in TI-Android-GingerBread

Flashboard

  • Change of LCD backlights based on Wake Locks and Screen Timeouts (DIM,OFF)
  • LCD back light brightness control from Settings Application
  • Suspending the device to Memory.The device can be suspended by allowing the system go to suspend after a screen timeout
  • Prevent Suspend based on Wake Locks
  • System Resume on Key Press 
  • System Resume on Alarm 
  • CPU Dynamic Voltage and Frequency Scaling (ondemand, performance, powersave and userspace governors)
  • CPU Idle States
  • Enabling system for hitting retention during idle
  • Enabling system for hitting OFF
  • Smart Reflex

Power Management is disabled by default in the release, to enable Power Management:

  • Edit file <rowboat-gingerbread root>/device/ti/flashboard/init.rc, and change the line "setprop hw.nopm true" to "setprop hw.nopm false" in the #Power Management Patches section.
  • Edit file <rowboat-gingerbread root>/device/ti/flashboard/TWL4030_Keypad.kl, and change line "key 24 BACK WAKE_DROPPED" to "key 24 BACK WAKE"
  • Compile the Android File System as explained in section To build Android filesystem

Once Power Management has been enabled you can change the Power Management settings with sysfs commands, for example

echo 1 > /debug/pm_debug/sleep_while_idle
echo 0 > /debug/pm_debug/enable_off_mode
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Developing with source code

This section show the steps to obtain the complete source code for the android images(Boot loader, Kernel and Filesystem) and to build the same.

Host (PC) setup requirements

The host development environment for Android is based on Ubuntu, please install Ubuntu version 10.04 or later http://www.ubuntu.com/desktop/get-ubuntu/download. The host installation would need few more Android specific dependencies, these can be installed dynamically over network using below commands.
For Ubuntu on 32-bit machines

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
$ sudo apt-get update
$ sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev minicom tftpd uboot-mkimage expect
$ sudo update-java-alternatives -s java-6-sun


NOTE: Android Gingerbread (2.3.4) needs Java 6 on ubuntu, whereas the previous version FroYo (2.2) was using Java 5.
Getting Source Code

Developers can download the sources from the gitorious.org/rowboat repository.

A tool called 'Repo' helps to fetch the android sources from gitorious.org/rowboat. Repo is a tool that makes it easier to work with Git in the context of Android.
For more information about Repo, see the link http://source.android.com/source/version-control.html.
To install, initialize, and configure Repo, follow these steps:
Make sure you have a bin/ directory in your home directory, and that it is included in your path:

$ mkdir ~/bin
$ PATH=~/bin:$PATH


Download the Repo script and ensure it is executable:

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo


The following commands help developers to clone sources from www.gitorious.org/rowboat repository

$ mkdir $HOME/rowboat-android
$ cd $HOME/rowboat-android
$ repo init -u git://gitorious.org/rowboat/manifest.git -m TI-Android-GingerBread-2.3.4-DevKit-Flashboard.xml
$ repo sync


Building Source Code

Tool chain setup

Setup the tool-chain path to point to arm-eabi- tools in prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin

$ export PATH=$HOME/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH

Compilation procedure

To build MLO
  • Change directory to u-boot
  $ cd x-loader
  • Execute the following commands
  $ make CROSS_COMPILE=arm-eabi- distclean
  $ make CROSS_COMPILE=arm-eabi- flashboard_config
  $ make CROSS_COMPILE=arm-eabi-  
  • This command will generate x-loader.bin
  • Use the signGP tool provided with the pre-compiled Android binaries to sign x-loader.bin. signGP and x-loader.bin must be located in the same folder.
  $ ./signGP
  • This command will generate x-loader.bin.ift that can be renamed to MLO
To build boot loader (u-boot)
  • Change directory to u-boot
  $ cd u-boot
  • Execute the following commands
  $ make CROSS_COMPILE=arm-eabi- distclean
  $ make CROSS_COMPILE=arm-eabi- flashboard_config
  $ make CROSS_COMPILE=arm-eabi- 
  • This command will generate the MLO and the u-boot Image "u-boot.bin"

NOTE: Copy the "mkimage" from "tools" folder to /usr/bin folder on your host machine, this is needed for kernel uImage generation

To build Linux kernel
  • Change directory to kernel
  $ cd kernel

  • Do the following to build kernel sources for Flashboard
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- flashboard_android_defconfig
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage
  • This will generate uImage (kernel image) in kernel/arch/arm/boot folder
To build Android filesystem
  • RowboPERF Integration

This step is needed only if the RowboPERF Application needs to be included in the Android file system.

  • Download the sources from rowboat
  $ git clone -b rowboat-gingerbread git://gitorious.org/rowboat/rowboperf.git 
  $ cd rowboperf

NOTE: Clone RowboPERF sources inside the rowboat-android tree.

  • Have Android SDK in the PATH of the host machine
  • Android filesystem build will take care of the integration of rowboperf applications
  • Build Devkit

To Build the root file system for the Flashboard, from android source top directory, type the following command

  $ make TARGET_PRODUCT=flashboard -j8 OMAPES=5.x

The above command will build Android FS, kernel, SGX drivers. After successful build, the kernel image can be found at kernel/arch/arm/uImage. Android rootfs components (root and system folders) will be located in out/target/product/flashboard. SGX drivers and libraries are installed in Android rootfs components.

Create root filesystem tarball

Prepare the root filesystem as follows:

  $ cd out/target/product/flashboard
  $ mkdir android_rootfs
  $ cp -r root/* android_rootfs
  $ cp -r system android_rootfs
  $ sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2

The rootfs.tar.bz2 is the android filesystem, it can be put on a SD/MMC Card or used our NFS.

To generate SD/MMC card to boot Android

These compiled Images can be copied to a SD / MMC card to boot Android on the Flashboard.

Copy all the images to one folder

  $ mkdir image_folder
  $ cp kernel/arch/arm/boot/uImage image_folder
  $ cp u-boot/u-boot.bin image_folder
  $ cp x-loader/MLO image_folder
  $ cp out/target/product/flashboard/rootfs.tar.bz2 image_folder
  $ cp Media_clips image_folder

NOTE: Get the Media_clips folder from the SD card prebuilt image

  $ cp mkmmc-android.sh image_folder

NOTE: Get the mkmmc-android.sh script from the SD card prebuilt image

Connect an SD card to the Host machine

Invoke the mkmmc-android.sh script to prepare the card for booting

  $ cd image_folder
  $ sudo ./mkmmc-android.sh <sd card mounted dev folder example:/dev/sdc> MLO u-boot.bin uImage boot.scr rootfs.tar.bz2 Media_Clips

Wait for the script to complete.
Safely remove the SD card and put it on the Flashboard for Booting.

References

  1. More about the AM3730/15 device used on the BeagleBone at http://www.ti.com/dsp/docs/dspcontent.tsp?contentId=72866&DCMP=am37x_060710&HQS=Other+OT+am37x.
  2. AM37x Technical Reference Manual at http://www.ti.com/lit/ug/sprugw9n/sprugw9n.pdf
  3. Android Sources for Flashboard is hosted at www.gitorious.org/rowboat with manifest TI-Android-GingerBread-2.3.4-DevKit-Flashboard.xml


Observations

  1. UI is upside down.
  2. The board hangs when a reboot operation (running reboot from the cmd line or pressing the reset button SW1) is triggered.
  3. Power button (SW2) does not work.
  4. Zigbee and NFC are currently not supported in the release.