December 13, 2008 Archives

2008-12-13

Using HSPA and GPS on my X200s

Since some days I replaced my old Thinkpad T40p mobile workstation with a new Thinkpad X200s. Higher performance, smaller form-factor, lighter, I'm happy with it. :)

One feature that I wanted to have in my new notebook was a built-in 3G data card. What I got was the Ericsson F3507g. It does not only have HSPA, with 7,2 MBit down and 2,0MBit up, but also a GPS reciever on the same MiniPCIe card.

The control of the GPS is done via AT commands. For this the card offer three serial channels. Once you enabled GPS on one it will only act as NMEA channel after this. Given you have three channels the logical way was to have one for the HSPA data transfers, one for the GPS and the last one as control channel.

The basic commands for configuration and enabling the GPS can be found here. Sadly there seem to be no public documentation from Ericson on the proprietary AT commands for the GPS. Ericson, can you please offer a description or even better a datasheet for the chip it?

Anyone else can help out with more informations on this card? I'm interested in all kind of details about configuration options for the GPS.

For now I'm using the following script to handle the gps and hspa enable and disable. Not nice but working. FSO support is on the way and will get finished when I find a spare cycle for it.

#!/bin/sh

# We have /dev/ttyACM{0,1,2}
# 0 is used from wvdial for the HSPA connection
NMEADEVICE=/dev/ttyACM1
CONTROLDEVICE=/dev/ttyACM2

## Check we have appropriate permissions
if [ `whoami` != "root" ]; then
    echo Run this script as root
    exit 0
fi

init_modem() {
    echo -n "Powering up WWAN device .."
    echo 1 > /sys/devices/platform/thinkpad_acpi/wwan_enable
    while [ ! -c $CONTROLDEVICE ]; do sleep 0.5; echo -n "."; done
    echo " OK"

    echo -n "Initialising WWAN modem ..."
    /usr/sbin/chat -v "" "AT+CFUN=1" "+PACSP0" "AT" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"
}

exit_modem() {
    echo -n "Shutting down WWAN modem ..."
    /usr/sbin/chat -v "" "AT+CFUN=4" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"

    ## Disable the WWAN hardware, save power
    echo -n "Powering down WWAN device .."
    echo 0 > /sys/devices/platform/thinkpad_acpi/wwan_enable
    while [ -c $CONTROLDEVICE ]; do sleep 0.5; echo -n "."; done
    echo " OK"
}

start_hspa() {
    echo "Starting PPP -- hit Ctrl+C when finished"
    /usr/bin/wvdial 3G
    #/usr/bin/wvdial Vodafone
}

start_gps() {
    # Enable NMEA, every 3 seconds, enable DGPS
    echo -n "Configure GPS ..."
    /usr/sbin/chat -v "" "AT*E2GPSCTL=1,3,1" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"

    echo "Starting GPS -- hit Ctrl+C when finished"

    # Fire up NMEA stream
    #/usr/sbin/chat -v "" "AT*E2GPSNPD" "FOOBAR" > $CONTROLDEVICE < $CONTROLDEVICE
    echo -en 'AT*E2GPSNPD\r\n' > $NMEADEVICE

    /etc/init.d/gpsd stop
    /etc/init.d/gpsd start
}

stop_gps() {
    echo -n "Shutting down GPS..."
    /usr/sbin/chat -v "" "AT*E2GPSCTL=0,3,1" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"
}

case "$1" in
    hspa)
        init_modem
        start_hspa
        exit_modem
        ;;
    gps)
        init_modem
        start_gps
        # A bit hacky to wait for a ^C
        sleep 7d
        stop_gps
        exit_modem
        ;;
    both)
        init_modem
        start_gps
        start_hspa
        stop_gps
        exit_modem
        ;;
    *)
        echo "Use hspa, gps or both as param" >&2
        exit 1
        ;;
esac

exit 0

Posted by Stefan Schmidt | Permanent Link | Categories: Thinkpad X200s, linux