Android on iMx51EVK with 3G modem

You can find the original article here http://sites.google.com/site/fslnovi/imx-demos/imx51-babbage-demos/android-on-bbg25

Android Installation  

1. Install JDK

Install JDK 5 from here :
http://java.sun.com/javase/downloads/index_jdk5.jsp

NOTE : JDK 6 is not compatible. JDK 5 is essential

Installation notes for JDK 5 are here:
http://java.sun.com/j2se/1.5.0/install-linux.html
Download the .bin file into /usr/java and install

2. Setup other packages for Android based on instructions here :
http://source.android.com/source/download.html

3. Edit ~/.profile and add the following commands :

export ARCH=arm
export CROSS_COMPILE=/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
export JAVA_HOME=/usr/java/jdk1.5.0_22
export ANDROID_JAVA_HOME=$JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH

4. gcc-4.3 and g++4.3 must be installed to compile the SDK.

However, gcc and g++ installed using sudo apt-get install will pull in gcc4.4 and g++4.4
This will not lead to issues in compilation.

Follow all the steps in User guide.

Errors during build : https://sites.google.com/site/fslnovi/imx-demos/imx51-babbage-demos/android-on-bbg25/android-error

Hardware for USB Modem

Huawei E180
Bought from : http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=220459919467
Reference manual : http://www.meteor.ie/rubylith/files/mbb/Meteor%20Mobile%20Broadband%20Trial%20Quick%20start%20guide.pdf

SIM Card
Tmobile 3G with voice and data plan

How to get Log messages ?

Connect 3G module with SIM inserted and then bootup to Android shell:
$ dmesg
$ ls /dev/ttyUSB*
$ logcat -b radio &
$ logcat pppd:* *:S &

* E180 is identified by kernel as two USB serial ports:
# ls /dev/ttyUSB*
/dev/ttyUSB0
/dev/ttyUSB1

But our default configuration for RIL daemon is to listen on ttyUSB3. So change /init.rc as below:
service ril-daemon .... -d /dev/ttyUSB3 -u /dev/ttyUSB0
->
service ril-daemon --- -d /dev/ttyUSB1 -u /dev/ttyUSB0

init.rc is in the root partition of Android root filesystem. After you build Android, it's under ~/myAndroid/out/target/product/imx51_BBG/

How to change init.rc and integrate into rootfs ?
On host machine
$ cd ~/myAndroid
$ rm out/target/imx51_BBG/ramdisk.img
$ CHANGE out/target/imx51_BBG/root/init.rc per your needs
$ make
ramdisk.img will be re-generated
or if you don't want to make whole Android, you can:
$
out/host/linux-x86/bin/mkbootfs out/target/product/imx51_BBG/root | out/host/linux-x86/bin/minigzip > out/target/product/imx51_BBG/ramdisk.img

If you only have ramdisk.img but don't have corresponding "root/" directory, you can get it by:
$ gunzip ramdisk.img
$ mkdir root
$ cd root
$ sudo cpio -i --make-directories < ../ramdisk.img
$ ls
Now you have your "root/". You can change anything (e.g. init.rc) and the re-create the ramdisk.img with method above.

How to detect that you are connected to the network ?

The entire log is attached. But the following sections indicate connection was successful. 

D/GSM     ( 2057): [GsmDataConnectionTracker] setState: INITING
D/AT      ( 1955): AT< OK
D/AT      ( 1955): AT> AT+CGQREQ=1
D/AT      ( 1955): AT< OK
D/AT      ( 1955): AT> AT+CGQMIN=1
D/AT      ( 1955): AT< OK
D/AT      ( 1955): AT> AT+CGEREP=1,0
D/AT      ( 1955): AT< OK
D/AT      ( 1955): AT> AT+CGACT=0,1
D/AT      ( 1955): AT< OK
D/AT      ( 1955): AT> ATD*99***1#
D/AT      ( 1955): AT< CONNECT 236800
D/RIL     ( 1955): PPPd started

The other obvious check would be to check if we get an IP address. 

Sometimes, if you are booting from SD, the excetution mode of "/etc/init.gprs-pppd" is not set which will cause it to fail while bringing up PPP.
To fix this, you need to change the mode in system partition on the SD card after connecting it to the linux host. 

$ chmod 777 /etc/init.gprs-pppd

Radio Interface Layer Sites
----------------------------
a. http://www.netmite.com/android/mydroid/development/pdk/docs/telephony.html
b. http://i-miss-erin.blogspot.com/2009/11/radio-layer-interface-in-android.html 

Android Developers Site
-----------------------
a. http://developer.android.com/guide/index.html
  1. #1 by Tom Howsam on March 4, 2011 - 4:23 pm

    Hello,

    My company is currently working with an Imx51 EVK. We are trying to get a 3G usb modem connected. Found this article and going to follow it, if we get stuck would you be interested in helping in a freelance capacity?

    Many thanks

    Tom

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: