NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides

From Texas Instruments Wiki
Jump to: navigation, search

TIBanner.png


Contents

About this manual[edit]

The goal of Porting Guide is to provide valuable information and instructions to people who want to run Android OS on their (new) HW. Information covered here will mainly be useful to port Android GingerBread DevKit 2.1.1 (with kernel 3.1) on AM335x based devices.

NoteNote: Detailed porting information in the different technical areas is dependent on the respective h/w architecture.

WLAN[edit]

Introduction[edit]

This section of guide provides a step by step explanation of what's involved in adding a new WiFi driver and making WiFi work in a custom Android build like Rowboat.

Features Overview[edit]

  • WLAN (802.11 b/g/n)
  • Core IP pre-tested against WiFi specifications.
  • Currently only station mode is supported.


Android WLAN Sub-System Overview[edit]

WLAN Stack.jpg

Diagram explains WLAN event flow from application to h/w with respect to rowboat android source tree.

Application[edit]

  • Settings/Connection Manager:<android-src>/packages/apps/Settings/src/com/android/settings/WirelessSettings.java

Application Framework[edit]

  • WiFi manager:<android-src>/frameworks/base/wifi/java/android/net/wifi
  • JNI Implementation:<android-src>/frameworks/base/core/jni/android_net_wifi_Wifi.cpp

Libraries[edit]

  • libhardware_legacy:<android-src>/hardware/libhardware_legacy/wifi/wifi.c
  • wpa_supplicant (Daemon):<android-src>/external/hostap/wpa_supplicant
  • Higher level network management is done in <android-src>/frameworks/base/core/java/android/net.

Driver Configuration[edit]

In this Devkit release we are using WL12XX Compat wireless SDK. The drivers and firmwares of WL12XX Compat release are at hardware/ti/wlan/WL1271_compat

To enable WLAN support in kernel the following settings need to be enabled:

  • First enable Wireless LAN device driver as shown below:
   Device Drivers  --->
       [*] Network device support  --->
           [*]   Wireless LAN --->
  • Enable WLAN Networking support as shown below:
   [*] Networking support  --->
       -*-   Wireless  --->
           [*]   Wireless extensions sysfs files

This enables the following CONFIG options in kernel and allows WL12xx compat wlan drivers to be built:

   CONFIG_WLAN=y
   CONFIG_WIRELESS_EXT=y
   CONFIG_WEXT_CORE=y
   CONFIG_WEXT_PROC=y
   CONFIG_WEXT_PRIV=y
  • The following additional options need to be enabled in kernel for WLAN to operate
  CONFIG_KEYS=y
  CONFIG_SECURITY=y
  CONFIG_CRYPTO=y
  CONFIG_CRYPTO_ARC4=y
  CONFIG_CRYPTO_ECB=y
  CONFIG_CRYPTO_AES=y
  CONFIG_CRYPTO_MICHAEL_MIC=y
  CONFIG_CRC7=y
  • On AM335x EVM WL1271 SDIO is connected to MMC2 bus. Its relevant initialization and pin-muxing is done at arch/arm/mach-omap2/board-am335xevm.c. Do take care of this initialization and pin-muxing if using any other MMC bus e.g. MMC3.

Android WiFi HAL Configuration[edit]

  • Enable building of wpa_supplicant 0.8.x in your BoardConfig.mk (e.g. device/ti/am335xevm/BoardConfig.mk)

This is by simply adding following options in BoardConfig.mk:

  BOARD_WLAN_DEVICE             := wl12xx_mac80211
  BOARD_SOFTAP_DEVICE           := wl12xx_mac80211
  WPA_SUPPLICANT_VERSION        := VER_0_8_X
  BOARD_WPA_SUPPLICANT_DRIVER   := NL80211
  WIFI_DRIVER_MODULE_PATH       := "/system/etc/wifi/wl12xx_sdio.ko"
  WIFI_DRIVER_MODULE_NAME       := "wl12xx_sdio"

This will set WPA_BUILD_SUPPLICANT to true in external/hostap/wpa_supplicant/Android.mk enabling building of wpa_supplicant 0.8 with NL80211. At run time wl12xx_sdio will get loaded from WIFI_DRIVER_MODULE_PATH. We don't need any external WIFI_FIRMWARE_LOADER because our driver module wl12xx_sdio is capable of loading the firmware by itself.

  • Next we need to provide a proper wpa_supplicant.conf for our device. That we will keep in /data/misc/wifi.
  • Set the correct permissions and paths created from init.rc
   # give system access to wpa_supplicant.conf for backup and restore
   mkdir /system/etc/wifi 0770 system wifi
   chmod 0770 /system/etc/wifi
   chmod 0660 /system/etc/wifi/wpa_supplicant.conf
   chown system wifi /system/etc/wifi/wpa_supplicant.conf
   mkdir /data/misc/wifi 0770 system wifi
   mkdir /data/misc/wifi/sockets 0770 system wifi
   chmod 0770 /data/misc/wifi
   chmod 0660 /data/misc/wifi/wpa_supplicant.conf
   chown wifi wifi /data/misc/wifi
   chown wifi wifi /data/misc/wifi/wpa_supplicant.conf

Important We use System user(uid: 1000) to initiate wpa_supplicant service that way are able to enable WiFi over Android NFS rootfs. Here is the detailed discussion on that WiFi does not work when booting from an NFS file system

  • Set the wifi interface name
  setprop wifi.interface wlan0:0
  • Start wpa_supplicant and dhcpcd from init.rc.
   # wpa_supplicant and dhcp daemon
   service wpa_supplicant /system/bin/wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd -qq
       socket wpa_wlan0:0 dgram 660 wifi wifi
       group system wifi inet
       disabled
   service dhcpcd /system/bin/dhcpcd  -ABKL wlan0:0
       disabled
       oneshot

Note: AOSP 2.3.4 requires using dhcpcd_<ifname> for dhcpc service, but currently this does not work correctly for wlan0:0 interface. This patch is reverted in TI-Android-Gingerbread-2.3.4-DevKit-2.1.1 sources and the service name is changed to dhcpcd.

Bluetooth[edit]

Introduction[edit]

This section describes how to enable Bluetooth support on Android for wl1271 chipset.

Features Overview[edit]

  • Bluetooth 2.1
  • OPP, A2DP, AVRCP profiles are supported.


Android BT Sub-System Overview[edit]

BT Stack.jpg


Enable Bluetooth with the following setting in BoardConfig.mk (e.g. device/ti/am335xevm/BoardConfig.mk)

   # Bluetooth
   BOARD_HAVE_BLUETOOTH := true

This enables bluez external/bluez HAL layer, which is used to connect with Android Frameworks (frameworks/base/core/jni/android_bluetooth_*.cpp, frameworks/base/core/java/android/bluetooth/*.java and SystemServer via DBUS .

Driver Configuration[edit]

  • WL12xx BT is interfaced to UART1. UART1 initialization and BT module on/off using rfkill is implemented at arch/arm/mach-omap2/board-am335xevm.c
  • Bluetooth support is enabled in the kernel as shown below:
   [*] Networking support  ---> 
       <*>   Bluetooth subsystem support  --->
           [*]   L2CAP protocol support
           <*>   RFCOMM protocol support
           <*>   RFCOMM protocol support
           <*>   BNEP protocol support
           [*]     Multicast filter support
           [*]     Protocol filter support 
           <*>   HIDP protocol support 
                 Bluetooth device drivers  --->
                   <*> HCI UART driver
                   [*]   UART (H4) protocol support 
                   [*]   HCILL protocol support
       <*>   RF switch subsystem support

This enables the following CONFIG options:

CONFIG_BT=y
CONFIG_BT_L2CAP=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_LL=y
CONFIG_RFKILL=y
  • The following kernel configs are required for Bluetooth AVRCP support:
CONFIG_INPUT_MISC=y
CONFIG_INPUT_UINPUT=y

You can check this as follows:

   Device Drivers  --->
       Input device support  --->
           [*]   Miscellaneous devices  --->
                   <*>   User level driver support

Android BT HAL Configuration[edit]

  • Set the correct permissions and paths created from init.rc
   #Owners, Modes for Bluetooth
   #console changed to ttyO* from ttyS* since 2.6.37 kernel.
   chmod 0660 /dev/ttyO1
   chown bluetooth bluetooth /dev/ttyO1
   chmod 0660 sys/class/rfkill/rfkill0/state
   chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
   write /sys/class/rfkill/rfkill0/state 0
  • The following services are registered in init.rc for Bluetooth operation:
  • dbus-daemon: (deal connections between hcid and system server)
   service dbus /system/bin/dbus-daemon --system --nofork
   socket dbus stream 660 bluetooth bluetooth
   user bluetooth
   group bluetooth net_bt_admin
  • bluetoothd: create hcid (Bluetooth Host Controller Interface Daemon) service, but disabled at first
   service bluetoothd /system/bin/bluetoothd -n
   socket bluetooth stream 660 bluetooth bluetooth
   socket dbus_bluetooth stream 660 bluetooth bluetooth
   group bluetooth net_bt_admin misc
   disabled
  • hciattach - Project external/bluetooth/bluez is patched to enable TI-WL1271 chipset specific hciattach tool. This service attaches the BT UART HCI interface to the bluetooth stack at 3000000 baud rate. It is also responsible for loading the BT firmware on WL1271.
   service hciattach /system/bin/hciattach -n /dev/ttyO1 texas 3000000
   user root
   group bluetooth net_bt_admin misc
   disabled
   oneshot
  • opush - BT Object Push Profile
   service opush /system/bin/sdptool add --channel=12 OPUSH
   user bluetooth
   group bluetooth net_bt_admin
   disabled
   oneshot

Adding bluetooth profile[edit]

Kindly refer the following wiki guide: Android-Adding Bluetooth Profile

Audio[edit]

Introduction[edit]

AM335x EVM uses AIC31 for audio analog inputs and outputs. It is connected to the main processor through the TDM / I2S interface and used to transmit and receive audio data. The AIC31 audio codec is connected via Multi-Channel Audio Serial Port (McASP) interface, a communication peripheral, to the main processor.

McASP provides a full-duplex direct serial interface between the main processor (AM335x) and other devices in the system such as the AIC31 codec. It provides a direct interface to industry standard codecs, analog interface chips (AICs) and other serially connected A/D and D/A devices:

  • Inter-IC Sound (I2S) compliant devices
  • Pulse Code Modulation (PCM) devices
  • Time Division Multiplexed (TDM) bus devices.

The AIC31 audio module is controlled by internal registers that can be accessed by the high speed I2C control interface.

This user manual section defines and describes the user level and platform level interfaces of the ALSA SoC Audio driver.

Features Overview[edit]

The features supported by ALSA SoC Audio driver are:

  • Supports AIC31 audio codec (on AM335x EVM only) in ALSA SoC framework.
  • Multiple sample rates support (8 KHz, 16 KHz, 22.05 KHz, 32 KHz, 44.1 KHz, 48 KHz etc) for both capture and playback.
  • Supports audio in stereo mode.
  • Supports simultaneous playback and record (full-duplex mode).
  • Start, stop, pause and resume feature.
  • Supports mixer interface for audio codecs.
  • Supports MMAP mode for both playback and capture.
  • McASP is configured as slave and AIC31 Codec is configured as master.

Important

Please note that enabling any line-in inputs necessitates connecting an audio playback source's output; connecting a (non-preamplified) microphone input (like the one from a head-set jack) might not work.

Android Audio Sub-System Overview[edit]

Audio Stack.jpg


  • To use ALSA framework as HAL we need to build Rowboat with following options in BoardConfig.mk:
BOARD_USES_ALSA_AUDIO := true
BUILD_WITH_ALSA_UTILS := true
  • Generic ALSA as AudioFlinger Interface(libaudio.so) is implemented at hardware/alsa_sound.
  • Audio device specific settings and controls(alsa.omap3.so) are implemented at hardware/ti/omap3/modules/alsa.
  • ALSA library(libasound.so) is implemented at external/alsa-libs.
  • ALSA core utils(alsa_aplay, alsa_amixer) are implemented at external/alsa-utils.


Driver Configuration[edit]

To enable/disable audio support, start the Linux Kernel Configuration tool:

$ make ARCH=arm menuconfig
  • Select Device Drivers from the main menu.
   ...
   ...
   Power management options --->
   [*] Networking support --->
   Device Drivers --->
   File systems --->
   Kernel hacking --->
   ...
   ...
  • Select Sound card support as shown here:
   ...
   ...
   Multimedia devices --->
   Graphics support --->
   <*> Sound card support --->
   [*] HID Devices --->
   [*] USB support --->
   ...
   ...
  • Select Advanced Linux Sound Architecture as shown here:
   --- Sound card support
   <*> Advanced Linux Sound Architecture --->
   < > Open Sound System (DEPRECATED) --->
  • Select ALSA for SoC audio support as shown here:
   ...
   ...
   [*] ARM sound devices  --->
   [*] SPI sound devices  --->
   [*] USB sound devices  --->
   <*> ALSA for SoC audio support --->
  • Select SoC Audio for the AM33XX chip as shown here:
   --- ALSA for SoC audio support
   <*> SoC Audio for the AM33XX chip
   <*> SoC Audio support for AM335X EVM
   < > SoC Audio for the Texas Instruments OMAP chips
   < > Build all ASoC CODEC drivers
  • Enabling "SoC Audio support for AM335X EVM" option (as selected above) will enable McASP support and TLV320AIC3X codec.


See also: AM335x Audio Driver's Guide

Android Audio HAL Configuration[edit]

Before diving into Android ALSA hardware layer, we have to verify whether ALSA driver is properly working or not. We will use ALSA utilities(alsa_aplay, alsa_arecord, and alsa_amixer) which got build along with Rowboat and is a part of external/alsa-utils package.

  • alsa_amixer is used to set ALSA controls & settings.
  • alsa_arecord and alsa_aplay are used for record and playback purpose respectively.


By default alsa_arecord doesn't exist. It is a soft link to alsa_aplay. So to create the link run the following command from Android prompt.

# ln -s /system/bin/alsa_aplay /system/bin/alsa_arecord


Important (for AM335x EVM ONLY)

  • AM335x ASoC driver default configuration is sufficient for audio capture and playback.
  • Software loopback command to test capture-playback. Following command will record in "CD" format and play the recorded data.
# alsa_arecord -f cd | alsa_aplay

The --help option provides a comprehensive list of command-line options for ALSA utilities.

The above procedure should get your Audio Capture and Playback working from command line. If it is then we are all set to make the corresponding changes in Android HAL layer and that will be all.

Hardware specific ALSA configurations will go here to hardware/ti/omap3/modules/alsa/alsa_module.cpp file.

Select and configure hardware devices

  • List down all the Audio devices available on target/AM335x.
# alsa_aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: EVM [AM335X EVM], device 0: AIC3X tlv320aic3x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
  • We got that default out device is hw 0:0
  • Define: deviceName() to return correct out device on query. See the implementation for details.
  • In alsa_handle_t _defaults[] goes the ALSA handle settings:
.....
    {
        module      : 0,
        devices     : OMAP3_OUT_DEFAULT,
        curDev      : 0,
        curMode     : 0,
        handle      : 0,
        format      : SND_PCM_FORMAT_S16_LE, // AudioSystem::PCM_16_BIT
        channels    : 2,
        sampleRate  : DEFAULT_SAMPLE_RATE,
        latency     : 200000, // Desired Delay in usec
        bufferSize  : DEFAULT_SAMPLE_RATE / 11, // Desired Number of samples
        mmap        :0,
        modPrivate  : (void *)&setDefaultControls,
    },
.....
  • In setDefaultControls() we set the ALSA controls. It is similar to setting the ALSA Switch and Volume controls using alsa_amixer .
  • Additional default setting is not required in ALSA HAL as default ALSA ASoC driver configuration is sufficient for capture and playback.


Important
Please note that enabling any line-in inputs necessitates connecting an audio playback source's output ; connecting a (non-preamplified) microphone input (like the one from a head-set jack) might not work.


Display[edit]

Introduction[edit]

This section of the porting guide describes the display system with respect to AM335x EVM. Display Sub-System hardware integrates one graphics pipeline (for digital interface). Digital interface is used for LCD out.

TFC_S9700RTWV35TR_01B LCD Panel is used on AM335x EVM. Porting explanation for TFC_S9700RTWV35TR_01B LCD Panel is given in this section

Features Overview[edit]

  • Supports LCD display interface at WVGA resolution (800*480)
  • Supports rotation - 0, 90, 180 and 270 degrees on LCD

Android Display Subsystem Overview[edit]

The block diagram below shows the display subsystem in GingerBread android. Android display system is based on a Client/Server Architecture.
Server side: Surface Flinger is a service coded in C++

  • Manages access to display subsystem
  • Seamlessly composites 2D and 3D graphic layers from multiple applications

Client side: Applications can draw on surfaces using two paths:

  • Use widgets/View/Canvas provided by the JAVA APIs and managed by C++ external SKIA library
  • Access OpenGL through JNI to directly create 3D surfaces

Surface Flinger Provides system-wide surface “composer”, handling all surface rendering to frame buffer device. Uses OPENGL and hardware accelerator for composing surfaces. Surfaces passed as buffers via binder IPC calls.

Display_system_overview.jpg

























Driver Configuration[edit]

Frame Buffer Driver[edit]

  • Select "Device Drivers" from the main menu.
   ...
   ...
    Power management options  --->
[*] Networking support  --->
    Device Drivers  --->
    File systems  --->
    Kernel hacking  --->
    ...
    ...
  • Select "Graphics support" from the menu.
    ...
    ...
[*] Voltage and Current Regulator Support  --->
<*> Multimedia support  --->
    Graphics support  --->
<*> Sound card support  --->
[*] HID Devices  --->
    ...
    ...
  • Select "Support for frame buffer devices" from the menu.
    ...
    ...
<M> Lowlevel video output switch controls
<*> Support for frame buffer devices  --->
< > Virtual Frame Buffer support (ONLY FOR TESTING!)
    ...
    ...
  • Select "DA8xx/OMAP-L1xx Framebuffer support" from the menu.
  • Configure default DMA size to the required/expected size of buffer, the default is 4MB.
   ...
    ...
< > Displaylink USB Framebuffer support
<*> DA8xx/OMAP-L1xx Framebuffer support  --->
(4)   Consistent DMA memory size (MB)
< > Virtual Frame Buffer support (ONLY FOR TESTING)  --->
    ...
    ...

Modification in Board File and LCD driver[edit]

TFC_S9700RTWV35TR_01B LCD panel LCD timing need to be configure in drivers/video/da8xx-fb.c.

  • LCD interface related pin mux state and set as per requirement. It may required to check default pin muxing setup in u-boot as well.
  • Implement lcdc_init() and link to display driver. Where DSS module will use it in runtime. e.g. @arch/arm/mach-omap2/board-am335xevm.c
 static const struct display_panel disp_panel = {
        WVGA,
        32,
        32,
        COLOR_ACTIVE,
};

static struct lcd_ctrl_config lcd_cfg = {
        &disp_panel,
        .ac_bias                = 255,
        .ac_bias_intrpt         = 0,
        .dma_burst_sz           = 16,
        .bpp                    = 32,
        .fdd                    = 0x80,
        .tft_alt_mode           = 0,
        .stn_565_mode           = 0,
        .mono_8bit_mode         = 0,
        .invert_line_clock      = 1,
        .invert_frm_clock       = 1,
        .sync_edge              = 0,
        .sync_ctrl              = 1,
        .raster_order           = 0,
};

struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = {
        .manu_name              = "ThreeFive",
        .controller_data        = &lcd_cfg,
        .type                   = "TFC_S9700RTWV35TR_01B",
}; 
  • LCD timing need to set as per datasheet information. e.g. @drivers/video/da8xx-fb.c
 static struct da8xx_panel known_lcd_panels[] = {
        ...
        ...
        /* ThreeFive S9700RTWV35TR */
        [2] = {
                .name = "TFC_S9700RTWV35TR_01B",
                .width = 800,
                .height = 480,
                .hfp = 39,
                .hbp = 39,
                .hsw = 47,
                .vfp = 13,
                .vbp = 29,
                .vsw = 2,
                .pxl_clk = 30000000,
                .invert_pxl_clk = 0,
        },
     };


See also: AM335x LCD Controller Driver's Guide

MMC[edit]

Introduction[edit]

TI AM335x has an multimedia card high-speed/secure data/secure digital I/O (MMC/SD/SDIO) host controller, which provides an interface between microprocessor and either MMC, SD memory cards, or SDIO cards. The current version of the user guide talks about the MMC/SD controller. The MMC driver is implemented on top of host controller as a HS-MMC controller driver and supports MMC, SD, SD High Speed and SDHC cards. The salient features of the aforementioned HS-MMC host controller are:

  • Full compliance with MMC/SD command/response sets as defined in the Specification.
  • Supports 1-bit or 4-bit transfer mode specifications for SD and SDIO cards
  • Supports 1-bit, 4-bit, or 8-bit transfer mode specifications for MMC cards
  • Built-in 1024-byte buffer for read or write
  • 32-bit-wide access bus to maximize bus throughput
  • Single interrupt line for multiple interrupt source events
  • Two slave DMA channels (1 for TX, 1 for RX)
  • Designed for low power and Programmable clock generation


Features Overview[edit]

The MMC/SD/SDIO driver supports following features

  • The driver is built in-kernel (part of vmlinux).
  • MMC cards including High Speed cards.
  • SD cards including SD High Speed and SDHC cards
  • Uses block bounce buffer to aggregate scattered blocks


Driver Configuration[edit]

The default kernel configuration enables support for MMC/SD(built-in to kernel). The selection of MMC/SD/SDIO driver can be modified as follows:

  • start Linux Kernel Configuration tool.
$ make menuconfig  ARCH=arm
  • Select Device Drivers from the main menu.
...
...
Kernel Features  --->
Boot options  --->
CPU Power Management  --->
Floating point emulation  --->
Userspace binary formats  --->
Power management options  --->
[*] Networking support  --->
Device Drivers  --->
...
...
  • Select MMC/SD/SDIO card support from the menu.
...
...
[*] USB support  --->
<*> MMC/SD/SDIO card support  --->
< > Sony MemoryStick card support (EXPERIMENTAL)  --->
...
...
  • Select OMAP HS MMC driver
...
[ ] MMC debugging
[ ] Assume MMC/SD cards are non-removable (DANGEROUS) 
     *** MMC/SD/SDIO Card Drivers ***
<*> MMC block device driver
[*]  Use bounce buffer for simple hosts
...
<*>   TI OMAP High Speed Multimedia Card Interface support 
...

See also: AM335x MMC/SD Driver's Guide

Android MMC HAL or Vold Configuration[edit]

Android system uses vold as the mount daemon, which detects, mounts and monitors the status of sdcard. The mount daemon needs a configuration file to tell it what the sdcard device is. Since Android 2.2 (froyo), it ships with a new implementation of vold (aka vold2). The configuration is changed to /etc/vold.fstab and its format is also changed. See system/core/rootdir/etc/vold.fstab in the Android source tree for the detailed explanations of the format.

However, a fixed vold.fstab can only support block device with fixed name.

# cat /etc/vold.fstab
dev_mount sdcard /mnt/sdcard 3 /devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0
dev_mount usb /mnt/usb2 auto /devices/platform/omap/ti81xx-usbss/musb-hdrc.1/usb2

Depending on the interface used these values can change. Best way is to probe sysfs directories to find the fixed name. For MMC the entry will be of the form:

 /sys/devices/platform/omap/omap_hsmmc.X/mmc_host/mmcY

Touchscreen[edit]

Introduction[edit]

The touch controller is TSCADC with ADC interface (in AM335x EVM). This is resistive touch screen controllers.

Features Overview[edit]

The features supported by Touchscreen in Android are:

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

Driver Configuration[edit]

Add touchscreen driver support[edit]

  • Start the Linux Kernel Configuration tool:
    $ make ARCH=arm menuconfig
  • Select Device Drivers from the main menu.
   ...
   Power management options --->
   [*] Networking support --->
   Device Drivers --->
   File systems --->
   Kernel hacking --->
   ...
  • Select Input device support form the next menu:
   ...
   [ ] ISDN support  --->
   < > Telephony support  --->
   Input device support  --->
   Character devices  --->
   -*- I2C support  --->
   ...
  • Select Touchscreens from the next menu:
   ...
   [ ]   Joysticks/Gamepads  --->
   [ ]   Tablets  --->
   [*]   Touchscreens  --->
   [*]   Miscellaneous devices  --->
   Hardware I/O ports  --->
   ...
  • Select TI Touchscreen Interface from the next menu:
   ...
   --- Touchscreens
   < >   Touchwin serial touchscreen
   <*>   TI Touchscreen Interface
   < >   USB Touchscreen Driver
   ...
  • Add the ADC touch controller configuration values in board file (e.g. board-am335xevm.c).
static struct resource tsc_resources[]  = {
        [0] = {
                .start  = AM33XX_TSC_BASE,
                .end    = AM33XX_TSC_BASE + SZ_8K - 1,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
                .start  = AM33XX_IRQ_ADC_GEN,
                .end    = AM33XX_IRQ_ADC_GEN,
                .flags  = IORESOURCE_IRQ,
        },
};

static struct tsc_data am335x_touchscreen_data  = {
        .wires  = 4,
        .x_max = 0x0fff,
        .y_max = 0x0fff,
};

static struct platform_device tsc_device = {
        .name   = "tsc",
        .id     = -1,
        .dev    = {
                        .platform_data  = &am335x_touchscreen_data,
        },
        .num_resources  = ARRAY_SIZE(tsc_resources),
        .resource       = tsc_resources,
};

See also: AM335x Touchscreen Driver's Guide

Test touch driver using getevent[edit]

  • Once ADC Touchscreen driver is up through board file (e.g. board-am335xevm.c) configuration.
  • Test with AndroidFS as events are coming while touching the LCD display. Run on command prompt:
    # getevent
    add device 1: /dev/input/event1
      name:     "ti-tsc-adcc"

    /dev/input/event1: 0003 0000 00000659
    /dev/input/event1: 0003 0001 00000a31
    /dev/input/event1: 0001 014a 00000001
    /dev/input/event1: 0000 0000 00000000
    /dev/input/event1: 0003 0000 00000654
    /dev/input/event1: 0000 0000 00000000
    
  • It confirms that touch inputs and irq based event generation is working fine.

Touch Calibration[edit]

  • Touch inputs (x, y, pressure) need to calibrate based on touch controller used.
  • To define the touch input boundaries, the following macros are used in driver (e.g. drivers/input/touchscreen/ti_tscadc.c)
    • AM335X_XMIN -- Minimum raw x input possible
    • AM335X_XMAX -- Maximum raw x input possible
    • AM335X_YMIN -- Minimux raw y input possible
    • AM335X_YMAX -- Maximum raw y input possible
  • add the log to get print of x, y and pressure values as raw and absolute both in function tscadc_interrupt():
    /* Calibrate absolute value of x and y co-ordinate */
    val_x = ts_dev->x_max -
                ((ts_dev->x_max * (val_x - AM335X_TS_XMIN)) /
                    (AM335X_TS_XMAX - AM335X_TS_XMIN));
    val_y = ts_dev->y_max -
                ((ts_dev->y_max * (val_y - AM335X_TS_YMIN)) /
                    (AM335X_TS_YMAX - AM335X_TS_YMIN));
  • Get the debug log for x, y and pressure at following points on the touchscreen
    • Left Top Most Point
    • Right Top Most Point
    • Left Bottom Down Point
    • Right Bottom Down Point
  • Update the macros based on observation of above input points
    • set AM335X_XMIN value as "minimum x input possible value from the reading of left top most touch"
    • set AM335X_XMAX value as "maximum x input possible value from the reading of right top most touch"
    • set AM335X_YMIN value as "minimux y input possible value from the reading of left top most touch"
    • set AM335X_YMAX value as "maximum y input possible value from the reading of left bottom down touch"

Note: Above four macros need to be fine tune to get the correct absolute value of x and y.

  • For example in ads7846.c:
#ifdef CONFIG_MACH_AM335XEVM
#define AM335X_XMIN           0x0A5
#define AM335X_XMAX           0xFB0
#define AM335X_YMIN           0x0DC
#define AM335X_YMAX           0xF43
#endif

Note: sometimes calculation method return negative values. Then method needs some modification to get positive calculated touch inputs.

Test Touch Calibration in Android[edit]

  • 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 needs to be fine tune the above mentioned macros.

Keypad[edit]

Introduction[edit]

The matrix gpio keypad and Volume gpio keys are in AM335x EVM. Here porting explanation for matrix gpio keypad controller.

Features Overview[edit]

  • 3x2 matrix key layout supported
  • single click input

Driver Configuration[edit]

Add keypad driver support

  • start the Linux Kernel Configuration tool:
    $ make ARCH=arm menuconfig
  • Select Device Drivers from the main menu.
    ...
    Power management options --->
    [*] Networking support --->
    '''Device Drivers --->'''
    File systems --->
    Kernel hacking --->
    ...
  • Select Input device support form the next menu:
    ...
    [ ] ISDN support  --->
    < > Telephony support  --->
    '''Input device support  --->'''
    Character devices  --->
    -*- I2C support  --->
    ...
  • Select Keyboards from the next menu:
    ...
    < >   Reset key
          *** Input Device Drivers ***
    '''[*]   Keyboards  --->'''
    [ ]   Mice  --->
    [ ]   Joysticks/Gamepads  --->
....
  • Select GPIO driven matrix keypad support and GPIO Buttons from the next menu:
    ....
 < >   DECstation/VAXstation LK201/LK401 keyboard
 <*>   GPIO Buttons
 < >   Polled GPIO buttons
 < >   TCA6416/TCA6408A Keypad Support
 <*>   GPIO driven matrix keypad support
 < >   Maxim MAX7359 Key Switch Controller
....

Board-specific Configuration The board-specific configuration includes, specifying the GPIOs, no. of rows and columns, debounce, scan settings etc. The following code snippet shows the configuration for AM335x EVM (arch/arm/mach-omap2/board-am335xevm.c).

static const uint32_t am335x_evm_matrix_keys[] = {
        KEY(0, 0, KEY_MENU),
        KEY(1, 0, KEY_BACK),
        KEY(2, 0, KEY_LEFT),

        KEY(0, 1, KEY_RIGHT),
        KEY(1, 1, KEY_ENTER),
        KEY(2, 1, KEY_DOWN),
};

const struct matrix_keymap_data am335x_evm_keymap_data = {
        .keymap      = am335x_evm_matrix_keys,
        .keymap_size = ARRAY_SIZE(am335x_evm_matrix_keys),
};

static const unsigned int am335x_evm_keypad_row_gpios[] = {
        GPIO_TO_PIN(1, 25), GPIO_TO_PIN(1, 26), GPIO_TO_PIN(1, 27)
};

static const unsigned int am335x_evm_keypad_col_gpios[] = {
        GPIO_TO_PIN(1, 21), GPIO_TO_PIN(1, 22)
};

static struct matrix_keypad_platform_data am335x_evm_keypad_platform_data = {
        .keymap_data       = &am335x_evm_keymap_data,
        .row_gpios         = am335x_evm_keypad_row_gpios,
        .num_row_gpios     = ARRAY_SIZE(am335x_evm_keypad_row_gpios),
        .col_gpios         = am335x_evm_keypad_col_gpios,
        .num_col_gpios     = ARRAY_SIZE(am335x_evm_keypad_col_gpios),
        .active_low        = false,
        .debounce_ms       = 5,
        .col_scan_delay_us = 2,
};

...

static struct gpio_keys_button am335x_evm_volume_gpio_buttons[] = {
        {
                .code                   = KEY_VOLUMEUP,
                .gpio                   = GPIO_TO_PIN(0, 2),
                .active_low             = true,
                .desc                   = "volume-up",
                .type                   = EV_KEY,
                .wakeup                 = 1,
        },
        {
                .code                   = KEY_VOLUMEDOWN,
                .gpio                   = GPIO_TO_PIN(0, 3),
                .active_low             = true,
                .desc                   = "volume-down",
                .type                   = EV_KEY,
                .wakeup                 = 1,
        },
};

static struct gpio_keys_platform_data am335x_evm_volume_gpio_key_info = {
        .buttons        = am335x_evm_volume_gpio_buttons,
        .nbuttons       = ARRAY_SIZE(am335x_evm_volume_gpio_buttons),
};

Test keypad driver using getevent

  • Once matrix gpio keypad and volume gpio keys driver is up through board file (e.g. board-am335xevm.c) configuration.
  • Test with AndroidFS as events are coming while pressing the keys. Run on command prompt:
    # getevent
    add device 1: /dev/input/event2
            name: "gpio-keys"
    add device 2: /dev/input/event0
            name: "matrix-keypad"

    /dev/input/event0: 0004 0004 00000002
    /dev/input/event0: 0001 009e 00000001
    /dev/input/event0: 0000 0000 00000000
    /dev/input/event0: 0004 0004 00000002
    /dev/input/event0: 0001 009e 00000000
    /dev/input/event0: 0000 0000 00000000
    
  • It confirms that keypad inputs and irq based event generation is working fine.

Android Keypad Configuration[edit]

  • The <matrix keypad driver name>.kl (e.g. QWERTY_Keypad.kl) should be present in root directory of AndroidFS.
  • Check and confirm the key mappings are same as expected.


NAND[edit]

Important Note
This section is not applicable for TI-Android-GingerBread-2.3.4-DevKit-2.1.1 and shall be updated later.


Introduction[edit]

This section of porting guide will describe the NAND layout present on AM335x EVM and how to integrate Fastboot functionality in u-boot. Micron MT29F2G08ABA Nand part (AM335x EVM) is supported.

NAND Layout

The NAND on the EVM has been configured in the following manner.

 +------------+-->0x00000000-> SPL start
 |            |
 |            |-->0x0001FFFF-> SPL end  
 |            |-->0x00020000-> SPL.backup1 start
 |            |
 |            |-->0x0003FFFF-> SPL.backup1 end  
 |            |-->0x00040000-> SPL.backup2 start
 |            |
 |            |-->0x0005FFFF-> SPL.backup2 end  
 |            |-->0x00060000-> SPL.backup3 start
 |            |
 |            |-->0x0007FFFF-> SPL.backup3 end  
 |            |-->0x00080000-> U-Boot start
 |            |
 |            |-->0x0025FFFF-> U-Boot end  
 |            |-->0x00260000-> U-Boot ENV start
 |            |
 |            |
 |            |-->0x0027FFFF-> ENV end
 |            |-->0x00280000-> Linux Kernel start
 |            |
 |            |
 |            |
 |            |
 |            |-->0x0077FFFF-> Linux Kernel end
 |            |-->0x00780000-> Filesystem start
 |            |
 |            |
 |            |
 |            |
 |            |
 |            |
 |            |
 |            |
 +------------+-->0x10000000-> Filesystem end


Features Overview[edit]


Driver Configuration[edit]

  • Start the Kernel configuration tool to enable/disable NAND and UBIFS support:
$ make ARCH=arm menuconfig
  • Enable NAND support from the main menu. Select Device Drivers -> MTD support -> NAND support.
-> Device Drivers
   -> Memory Technology Device (MTD) support (MTD [=y])
      -> NAND Device Support (MTD_NAND [=y])     
  • Enable UBI support. Select Device Drivers -> MTD support -> Enable UBI.
-> Device Drivers
   -> Memory Technology Device (MTD) support (MTD [=y])
      -> Enable UBI - Unsorted block images (MTD_UBI [=y])
  • Enable UBIFS support. Select Filesystems -> Misc filesystems -> UBIFS support.
-> File systems
   -> Miscellaneous filesystems (MISC_FILESYSTEMS [=y])
      -> UBIFS file system support (UBIFS_FS [=y])


Fastboot[edit]

Fastboot flashing utility is for updating the different software components of Android. Here is a guide to re-flash the spl, u-boot, kernel and root-filesystem (UBIFS image). This guide assume that Rowboat has been compiled before trying out these instructions.

Establishing Fastboot connectivity[edit]

  • Connect serial port to host PC via null modem cable.
  • Serial port settings: 115200 8N1, No flow control.
  • Apply power to the board.
  • Press any key in serial port utility during boot and get U-boot command prompt.
  • Run "fastboot" on u-boot command prompt (u-boot will echo "fastboot initialized").
  • Connect USB cable between USB OTG port of the board and host PC.

Setup on Linux host

  • On command prompt, run
   $ export ANDROID_ROOT=<rowboat top level directory>
   $ cd $ANDROID_ROOT/out/host/linux-x86/bin
   $ sudo ./fastboot devices

if a device number is echoed, fastboot is working.

Setup on Windows host

   %SingleBootLoaderInterface% = USB_Install, USB\VID_0451
  • Proceed installing, with the difference that device to be selected is "Android Bootloader Interface" instead of "Android ADB Interface".

Supported Fastboot commands[edit]

   $ export ANDROID_ROOT=<rowboat_top_level_build_directory>
   $ cd $ANDROID_ROOT/out/host/linux-x86/bin
  • List connected devices
   $ sudo ./fastboot devices
  • Boot with new kernel image
   $ sudo ./fastboot boot <image_path>
  • Update images
   $ sudo ./fastboot flash <image_name> <image_path>

Note: Where "image_name" can be spl, uboot, kernel or filesystem.

  • Erasing images or partition.
   $ sudo ./fastboot erase <partition_name> (eg. spl)

Note: Where "partition_name" can be spl, uboot, environment, kernel or filesystem.

  • Display fastboot variable
   $ sudo ./fastboot getvar <variable>
  • Exit fastboot mode in uboot
   $ sudo ./fastboot continue

Fastboot Porting guide[edit]

Fastboot implementation have a generic board independent function driver (cmd_fastboot.c), which will communicate with USB gadget driver, in the present case USB gadget stack is handled by MUSB driver. In the board dependent files, configurations like the available partition name, offset, size, method of nand write etc are defined.

In the Config file:

  • Enable CONFIG_FASTBOOT
  • Enable CONFIG_MUSB_UDC, disable CONFIG_MUSB_HCD (assumption: gadget driver used is MUSB)
  • Enable CONFIG_CMD_FASTBOOT
  • Define CONFIG_FASTBOOT_TRANSFER_BUFFER (location to which fastboot data has to be downloaded)
  • Define CONFIG_FASTBOOT_TRANSFER_BUFFER_SIZE (maximum fastboot data that can be downloaded, make sure it does not overlap bootloader memory)
  • Define FASTBOOT_NAND_BLOCK_SIZE
  • Define FASTBOOT_NAND_OOB_SIZE
  • Define FASTBOOT_PRODUCT_NAME, make sure that string is same as value of TARGET_PRODUCT used for compiling Android
  • Define USB_BCD_VERSION to 0x0200, if HS USB support is required

In the Board file:

  • Add header file - fastboot.h
  • Define "struct fastboot_ptentry" array with entries equal to the number of partitions required
  • Each entry to have name - this is the variable used for flashing, erasing.
  • Each entry to provide NAND start address & length
  • Each entry to specify flags, options as follows,
  • FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC - flash the partition using HW ECC
  • FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_1 - Sets the NANDECC to use Kernel/FS layout for writing
  • FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_2 - Sets the NANDECC to use X-loader/U-boot layout for writing
  • FASTBOOT_PTENTRY_FLAGS_WRITE_SW_ECC - flash the partition using SW ECC
  • FASTBOOT_PTENTRY_FLAGS_WRITE_I - Use write.i for NAND write
  • FASTBOOT_PTENTRY_FLAGS_WRITE_JFFS2 - Use write.jffs2 for NAND write
  • FASTBOOT_PTENTRY_FLAGS_WRITE_ENV - Add this flag to indicate to fastboot driver the partition for storing environmental variable
  • FASTBOOT_PTENTRY_FLAGS_REPEAT_4 - Use this to indicate that partition will be written 4 times
  • Additional flags can be defined to write till 15 times, last 4 bits are reserved for repeat value, Define required value & OR the value in flag
  • Invoke fastboot API, ' fastboot_flash_add_ptn' for each partition so as to inform about the partition details to fastboot driver.

Notes

  • Existing USB gadget supported only FS, this was modified so that HS USB can be handled. Changes were done in USB header files, MUSB files.
  • AM335X was having problems due to the wrapper over MUSB IP. Fix in MUSB UDC; read TI EP interrupt register instead of MUSB register.
  • A fix with respect to the index for EP array has also been done.
  • MUSB EP setup has been modified to be more in line with the USB TRM.
  • Portions of the code that has been ported from OmapZoom is included within the macro FASTBOOT_PORT_OMAPZOOM_NAND_FLASHING.


USB Host and Gadget[edit]

Introduction[edit]

For AM335x the usb0 or usb1 can either act as Host or device mode. On the AM335x EVM, usb0 is set up for device mode and usb1 is set up for host mode operation. We use the Android USB Gadget driver on usb0 to enable the adb feature.

Driver Configuration[edit]

USB support for host and device mode is enabled in the kernel as shown below:

Device Drivers  --->
  [*] USB support  --->
    <*>   Support for Host-side USB
    <*>   Inventra Highspeed Dual Role Controller (TI, ADI, ...)
            *** Platform Glue Layer ***
          ...
    <*>     TI81XX onward
    [*]   Disable DMA (always use PIO)
    <*>   USB Mass Storage support
    ...
    <*>   USB Gadget Support  --->
        <*>   USB Peripheral Controller (Inventra HDRC USB Peripheral (TI, ADI, ...))  --->
        <*>   USB Gadget Drivers (Android Gadget)  --->
        ...
        <M>       Android gadget Zero (DUMMY)

See also: AM335x USB Driver's Guide

Android USB Configuration[edit]

Android USB Gadget Configuration

The Android gadget driver is enabled via the script at /system/bin/usb/rc.usb. For enabling Android gadget features, the following sysfs entries are done after the gadget driver is loaded and running:

echo 0       > /sys/class/android_usb/android0/enable
echo adb,acm > /sys/class/android_usb/android0/functions
echo 2       > /sys/class/android_usb/android0/f_acm/instances
echo 1       > /sys/class/android_usb/android0/enable

The sysfs settings need to be done depending on the features required to be enabled. The above settings enable adb and acm modes in the Android gadget driver.

USB Mass storage[edit]

The USB mass storage device class, otherwise known as USB MSC or UMS, is a protocol that allows file transfers between device and host to which it is connected. Mass storage is very good source of carrying media as well as other data files.

Introduction[edit]

The Android system uses vold as the mount daemon which detects, mounts and monitors the status of external storage.This mount daemon needs a configuration file(vold.fstab) to determine the mount device and location where it should be mounted.
Vold reads /etc/vold.fstab configuration file and mounts the device specified in the file. The basic format of the vold.fstab is

  dev_mount <label> <mount_point> <part> <sysfs_path1...> 
  
  where
  label - Label for the volume
  mount_point - Where the volume will be mounted
  part - Partition # (1 based), or 'auto' for first usable partition.
  <sysfs_path> - List of sysfs paths to source devices

sysfs_path is the full or partial path where kernel exports the udev information about the device currently pluged into system.
See system/core/rootdir/etc/vold.fstab in the Android source tree for the detailed explanations of the format.

Android Configuration for USB mass storage[edit]

In case of AM335xevm, Kernel populates udev entries for the following path for USB.

  /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.1/usb2

The following changes are done to detect connected usb mass storage device and mount/unmount it automatically when plugged/unplugged.

  • An entry is added in vold.fstab for USB storage
  dev_mount sdcard /mnt/sdcard 3 /devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0
  dev_mount usb /mnt/usb2 auto /devices/platform/omap/ti81xx-usbss/musb-hdrc.1/usb2
  • init.rc is updated as follows
# create mountpoints
    mkdir /mnt 0775 root system
    mkdir /mnt/sdcard 0000 system system
    mkdir /mnt/usb2 0000 system system

... 
# Backwards Compat - XXX: Going away in G*
    symlink /mnt/sdcard /sdcard
    symlink /mnt/usb2 /usb2

    mkdir /system
    mkdir /data 0771 system system

Test mass storage in Android[edit]

Connect USB mass storage device to board and check whether it is mounted properly.

  • Use mount command to see the list of mount points. Here is the sample output of mount command.
  # mount
  rootfs / rootfs rw 0 0
  /dev/root / ext3 rw,relatime,errors=continue,barrier=1,data=writeback 0 0
  tmpfs /dev tmpfs rw,relatime,mode=755 0 0
  devpts /dev/pts devpts rw,relatime,mode=600 0 0
  proc /proc proc rw,relatime 0 0
  sysfs /sys sysfs rw,relatime 0 0
  tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
  /dev/block/mmcblk0p3 /part-3 vfat rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
  /dev/block/vold/179:3 /mnt/sdcard vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
  /dev/block/vold/179:3 /mnt/secure/asec vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
  tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
  /dev/block/vold/8:1 /mnt/usb2 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
  /dev/block/vold/8:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
  tmpfs /mnt/usb2/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
  • Run OI File Manager application and see whether usb2 directory is populated with the contents of the USB mass storage device.

Browsing to usb2 directory using OI File Manager

USB 3G Modem[edit]

The USB 3G Modem section describes how to connect USB Modem to the android.

Introduction[edit]

PPP is the protocol used for establishing internet links over dial-up modems, DSL connections, and many other types of point-to-point links. The pppd daemon works together with the kernel PPP driver to establish and maintain a PPP link with another system (called the peer) and to negotiate Internet Protocol (IP) addresses for each end of the link.

Kernel Configuration for USB Modem[edit]

Device Drivers --->

 [*] Network device support  --->
   <*>   PPP (point-to-point protocol) support
     <*>     PPP BSD-Compress compression
     <*>     PPP Deflate compression
     <*>     PPP support for async serial ports
     <*>     PPP support for sync tty ports
 [*] USB support  --->
   <*>   USB Modem (CDC ACM) support
   <*>   USB Serial Converter support  --->
     [*]   USB Generic Serial Driver
     <*>   USB driver for GSM and CDMA modems

File System Changes[edit]

To get the Modem Working, we need usb_modeswitch, usb_modeswicth.conf(configuration file) for the specific modem or Hardware vendor and the airtel.chat(dialer script) for the specific network.

  • Copy the usb_modeswitch (ARM Compiled binary) and usb_modeswitch.conf to the /system/xbin folder. The ARM compiled binary and the sources can be obtained from HERE
  • Copy the airtel.chat(dialer script) to the /system/etc/ppp folder

Below is the description of an example usb_modeswitch.conf file for the Huawei E1731 Modem (Airtel in India)

  Huawei E1731

  EnableLogging=1

  DefaultVendor= 0x12d1
  DefaultProduct=0x1446

  TargetVendor=  0x12d1
  TargetProductList="1001,1406,140b,140c,1412,141b,1436,14ac,1506"

  CheckSuccess=20

  MessageEndpoint= 0x01
  MessageContent="55534243123456780000000000000011062000000100000000000000000000"


The DefaultVendor and DefaultProduct is the ID displayed for CDROM or mass storage, the TargetVendor and TargetProduct is for Modem. Plug the device into linux system and do "dmesg" or "lsusb" to know the IDs.

Example: HUAWEI E1731 Modem Below is the log when plugged to PC

   [6663132.917033] usb 1-4: new high speed USB device number 10 using ehci_hcd
   [6663133.033394] usb 1-4: New USB device found, idVendor=12d1, idProduct=1446
[6663133.033400] usb 1-4: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[6663133.033404] usb 1-4: Product: HUAWEI Mobile
[6663133.033407] usb 1-4: Manufacturer: HUAWEI Technology
[6663133.036040] scsi16 : usb-storage 1-4:1.0
[6663133.036652] scsi17 : usb-storage 1-4:1.1
[6663133.685546] usb 1-4: USB disconnect, device number 10
[6663137.665047] usb 1-4: new high speed USB device number 11 using ehci_hcd
[6663137.781645] usb 1-4: New USB device found, idVendor=12d1, idProduct=1436
[6663137.781651] usb 1-4: New USB device strings: Mfr=4, Product=3, SerialNumber=0
[6663137.781654] usb 1-4: Product: HUAWEI Mobile
[6663137.781657] usb 1-4: Manufacturer: HUAWEI Technology
[6663137.784476] option 1-4:1.0: GSM modem (1-port) converter detected
[6663137.784663] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
[6663137.786425] cdc_ether 1-4:1.1: wwan0: register 'cdc_ether' at usb-0000:00:1d.7-4, Mobile Broadband Network Device, 02:50:f3:00:00:00
[6663137.788066] option 1-4:1.3: GSM modem (1-port) converter detected
[6663137.788268] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB1
[6663137.788509] option 1-4:1.4: GSM modem (1-port) converter detected
[6663137.788646] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB2
[6663137.789203] scsi22 : usb-storage 1-4:1.5
[6663137.789812] scsi23 : usb-storage 1-4:1.6
[6663138.790809] scsi 22:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[6663138.791303] scsi 23:0:0:0: Direct-Access     HUAWEI   SD Storage       2.31 PQ: 0 ANSI: 2
[6663138.807169] sr1: scsi-1 drive
[6663138.808426] sr 22:0:0:0: Attached scsi CD-ROM sr1
[6663138.808593] sr 22:0:0:0: Attached scsi generic sg5 type 5
[6663138.809394] sd 23:0:0:0: Attached scsi generic sg6 type 0
[6663138.812181] sd 23:0:0:0: [sde] Attached SCSI removable disk

Below is the description of an example airtel.chat(dialer script) file for AirTel (INDIA)

TIMEOUT 10
' ' AT
OK ATE1
OK AT+CGDCONT=1,"IP","airtelgprs.com"
OK "ATD*99***1#"
CONNECT ' '

NOTE: the single quotes in the above chat file must be together. ie no space allowed.

This file is network service provider dependent, so modify the airtelgprs.com according to your service provider.

Usage[edit]

Below are the steps to perform once android boots up with the above necessary modifications

  • Disable wireless and ethernet settings
  • Plug the USB Modem
  • Run the following commands
   mount -t usbfs usbfs /proc/bus/usb
   /system/xbin/usb_modeswitch -I -W -c /system/xbin/usb_modeswitch.conf

Mount the usbfs file system to /proc/bus/usb. This is necessary to avoid the “Couldn’t opendir()” error you get otherwise on running usb_modeswitch.
Once Mode Switch Succeeds, modem will be enumerated as /dev/ttyUSB* (* can be 0,1,2).
If you place the usb_modeswitch and usb_modeswitch.conf at other place, change the above command accordingly.

  • Once Modem succeeds in enumeration, run the follwoing command
   /system/bin/pppd /dev/ttyUSB0 115200 persist defaultroute usepeerdns updetach crtscts noauth debug connect "/system/xbin/chat -v -s -f /system/etc/ppp/airtel.chat"
  • From the logcat check what primary and secondary dns server IPs you got, you can kill the logcat after getting the IPs. Set those primary and secondary DNS server IPs for your device with the following commands replacing IP1 and IP2 with whatever IPs you got.
   setprop net.dns1 <IP1>
   setprop net.dns2 <IP2>

You are ready to browse that net after this if everything went well in the previous steps.
Enjoy the 3G fast speed surfing on your device.

Disclaimer[edit]

  • All components explained in this porting guide are validated against TI Android DevKit release 2.1.1 available for download HERE
  • However guide can be taken as reference to port mentioned components on similar architecture.

Technical Support and Product Updates[edit]

For further information or to report any problems, contact http://e2e.ti.com/android or http://support.ti.com.
For community support join http://groups.google.com/group/rowboat
For IRC #rowboat on irc.freenode.net

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 PortingGuides here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity