Brief description of how to hook up a Huawei E160 HSDPA USB modem to the
FriedlyARM Mini2440 ARM9 development board without breaking a sweat.
The Linux kernel preinstalled on the board does not have the ppp driver, so the first order of business is to recompile and replace the kernel. Fetch the prepared kernel source package:
linux-2.6.32.2-mini2440_20100113.tgz
Extract and add the following options to the configuration matching your device, say
config_mini2440_t35 for the common 3.5" display model:
CONFIG_PPP=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPPOL2TP=y
Configure and compile the kernel using the GNU Toolchain sgpp compiler:
arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Extract into
/usr/src/mini2440/arm-2008q3 and set up the build environment.
$ PATH=$PATH:/usr/src/mini2440/arm-2008q3/bin
$ CC='arm-none-linux-gnueabi-gcc -march=armv4t -mtune=arm920t'
$ CROSS_COMPILE=arm-none-linux-gnueabi-
$ export CC CROSS_COMPILE
Configure by loading your modified configuration file into menuconfig, then build the lot.
$ make ARCH=arm menuconfig
$ make ARCH=arm -j4
Copy the new
kernel/arch/arm/boot/zImage kernel image to the board. This can be done by writing a raw image over the old one using the
"[k] Download linux kernel" BIOS option. No need to format the NAND or fiddle with u-boot.
Enter your selection: k
USB host is connected. Waiting a download.
Now, Downloading [ADDRESS:30000000h,TOTAL:2562214]
RECEIVED FILE SIZE: 2562214 (500KB/S, 5S)
Downloaded file at 0x30000000, size = 2562204 bytes
Found block size = 0x00280000
Erasing... ... done
Writing... ... done
Written 2562204 bytes
At this point the board should boot just as happily as before, now with a fresh kernel with both
/dev/ppp and
/dev/ttyUSB0 support.
Connect the E160 to the USB hub of the board and check that the kernel says something like:
usb 1-1: New USB device found, idVendor=12d1, idProduct=1003
usb 1-1: Product: HUAWEI Mobile
usb 1-1: Manufacturer: HUAWEI Technology
usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
The preinstalled qtopia does not include any userspace tools for dialing or mangaging ppp connections. Rather than compiling all of wvdialer you can pretend it's 1993 all over and just use pppd + chat compiled from source:
$ wget ftp://ftp.samba.org/pub/ppp/ppp-2.4.5.tar.gz
$ tar xf ppp-2.4.5.tar.gz
$ cd ppp-2.4.5
$ ./configure
$ make
$ file pppd/pppd
pppd/pppd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14
Copy the
pppd and
chat binaries to
/usr/sbin/ on the board, and create the
/etc/ppp/ directory for the configuration and control scripts. Use the defaults from the pppd
scripts/ directory and modify to match your ISP. These work for the finnish Saunalahti operator:
/etc/ppp/ppp-on:
#!/bin/sh
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
route del default 2>/dev/null
exec /usr/sbin/pppd debug lock modem crtscts /dev/ttyUSB0 9600 \
asyncmap 20A0000 escape FF kdebug 0 0.0.0.0:0.0.0.0 \
noauth noipdefault netmask 255.255.255.0 defaultroute connect $DIALER_SCRIPT
/etc/ppp/ppp-on-dialer:
#!/bin/sh
exec chat -v \
TIMEOUT 5 \
ABORT 'BUSY' \
ABORT 'NO ANSWER' \
'' 'ATZ' \
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0' \
'OK' 'AT+CGDCONT=1,"IP","internet.saunalahti"' \
'OK' 'ATDT*99#' \
'CONNECT' ''
Replace
internet.saunalahti and
*99# with whatever your ISP requires, add CPIN to the initialization if needed. Execute
/etc/ppp/ppp-on and check
/var/log/messages for output like this:
Sep 17 16:43:59 pppd[773]: pppd 2.4.5 started by root, uid 0
..
Sep 17 16:44:02 chat[775]: ATDT*99#^M^M
Sep 17 16:44:02 chat[775]: CONNECT
Sep 17 16:44:02 chat[775]: -- got it
..
Sep 17 16:44:02 pppd[773]: Connect: ppp0 <--> /dev/ttyUSB0
For manually testing and debugging the chat script you might want to install a terminal like picocom:
$ wget http://picocom.googlecode.com/files/picocom-1.4.tar.gz
$ tar xf picocom-1.4.tar.gz
$ cd picocom-1.4
$ make
That's it.