Table of Contents

MTKBabel

MTKBabel is hosted on Sourceforge!

MTKBabel is a Perl program to operate the i-Blue 747 GPS data logger. It should work also with other GPS devices based on the MediaTek MTK chipset. Starting with version 0.7 it offers also support for the Holux M-241 data logger. It is free software released under the GPL license.

The main capabilities are:

The progam is written in Perl, and it was tested on Linux via USB connection. One goal is easy portability to C and small RAM footprint.

Run mtkbabel -h for a brief help screen:

Usage: mtkbabel [options]
Options:
    -a                       Read all the log memory (overlapped data)
    -b filename.bin          Don't read data from a GPS device, but rather read
                             a previously saved .bin file. Ignore -f option
    -c                       Create a GPX file with tracks and waypoints
    -d debug_level           Debug level: 0..7
    -E                       Erase data log memory
    -f filename              Base name for saved files (.bin and .gpx)
    -h                       Print this message and exit
    -i                       Ignore some error conditions, try to extract data
    -l {on|off}              Turn logging ON/OFF
    -m {stop|overlap}        Set STOP/OVERLAP recording method on memory full
    -o log_format            Enable or disable log fields (FIELD1,-FIELD2,...),
                             available fields:
                             UTC,VALID,LATITUDE,LONGITUDE,HEIGHT,SPEED,HEADING,DSTA,DAGE,PDOP,HDOP,VDOP
                             NSAT,SID,ELEVATION,AZIMUTH,SNR,RCR,MILLISECOND,DISTANCE
    -p port                  Communication port, default: /dev/ttyUSB0
    -R                       Recover from disabled log: erase data and reset
                             recording criteria
    -r time:distance:speed   Set logging criteria (zero to disable):
                             every 0.10-9999999.90 seconds, every 0.10-9999999.90
                             meters, over 0.10-9999999.90 km/h
    -s speed                 Serial port speed, default 115200 baud
    -t                       Create a GPX file with tracks
    -v                       Print MTKBabel version and exit
    -w                       Create a GPX file with waypoints
    -x                       Force reading Holux format

Example:
    Download traks and waypoints from GPS device, creating the
    following files: gpsdata.bin, gpsdata_trk.gpx and gpsdata_wpt.gpx.

    mtkbabel -s 115200 -f gpsdata -t -w

In this example you will set serial speed to 115200 baut, STOP logging, download gpsdata.bin, gpsdata_trk.gpx and gpsdata_wpt.gpx files:

mtkbabel -s 115200 -l off -f gpsdata -t -w

If you encounter some problems, please run the program with the -d 7 option and write me a mail with the output. You will find my address in the program itself.

Weeks Rollover Bug

It turned out that several GPS based on the MTK chipset are affected by a Weeks Rollover Bug. You discover that your device is affected by the bug because the GPX files you save from it, will have a timestamp badly in the past.

Actually I have two i-Blue 747 GPS data loggers. The older one is a Model ID 001B, which has already manifested the problem: today is 2019-10-10, but GPX points logged have a timestamp of 2000-02-24. If you do the math, you can find that there is a difference of exactly 1024 weeks. This means that the device internally stores timestamps using a weeks counter of only 10 bits. So exactly 1024 weeks after its EPOCH (the begin of the time it can handle), the timestamps rolls-back of that amount of time.

The other logger of mine is a Model ID 001D, which instead is still recording correct timestamps today. I suspect that the weeks counter is nevertheless 10 bits, and just the hard-coded EPOCH is more recent. So the bug is just to come in the near future.

Credits

I wish to thank all the people behind the BT747 project: everything I made is derived from their work.

Thanks to Uwe Hermann, mtkbabel entered Debian Testing. Now I can install the program just with apt-get install mtkbabel. Thanks Uwe! :-)

The program is now hosted on Sourceforge, where you can find the the SVN, a bug tracker and the latest stable version 0.8, get it at https://sourceforge.net/projects/mtkbabel.

GPS data logger i-Blue 747

i-Blue 747 GPS It is a very nice piece of hardware; it can works as a GPS receiver for your palm or notebook, or as a standalone data logger.

The USB connection can be used for both receiving navigation data (NMEA strings) and for device control (retrieving log data, erasing memory, setting the log properties, etc.). The bluetooth connection is used instead only to receive the navigation data.

Loggin is always active when the switch is in the LOG position. If you disable logging using the software command, logging is enabled again when the device is turned off/on. With the switch in the NAV position, logging is enabled only when the bluetooth connection is active.

Features:

Holux M-241 GPS logger

Holux M-241 :-) MTKBabel 0.7 has some support for the Holux M-241. The device is based on the MTK chip, but unfortunately the binary log data is not the one described on the Mediatek datasheets.

With a little of reverse engineering it was possibile to operate the Holux. First of all the serial port must be set to 38400 baud instead of 115200. Latitude and longitude are stored as float (4 bytes) numbers instead of double (8 bytes), elevation is stored as 3 bytes number, there is not the separator char between data and checksum.

You can control the device via two buttons and the display; the user interface is rather simple for such a sophisticated device. You can control recording criteria (by time or by distance), erase the log, see your position and speed, measure distances. The display has backlight too. But notice that the firmware does not allow full access to the MTK chip features. For example it is not possible to set a recording criteria based on time or distance. Also the distance criteria can be set only to a list of prefixed values, with the minimum being 50 meters. This is very annoying because it renders the device not well suitable for OpenStreetMap surveying, where 10 meters is by far more desiderable. If you set a different distance via MTKBabel, the device resets to its value whenever it starts recording. Anyway I did not give a try to different firmware versions.

If someone is interested in reverse-engineer the log format, please check this:

An user reported also that with a new firmware version (v1.12) he was unable to set the log format with MTKBabel, since each time the unit is turned off and on the default format is used.

Using the i-Blue 747 with Linux

USB connection

Attaching the device to the USB port - leaving it in the OFF status - the kernel detects it as a serial device:

usb 2-7: new full speed USB device using ohci_hcd and address 3
usb 2-7: configuration #1 chosen from 1 choice
usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for cp2101
cp2101 2-7:1.0: cp2101 converter detected
usb 2-7: reset full speed USB device using ohci_hcd and address 3
usb 2-7: cp2101 converter now attached to ttyUSB0
usbcore: registered new driver cp2101
drivers/usb/serial/cp2101.c: Silicon Labs CP2101/CP2102 RS232 serial adaptor driver v0.07

This is how the device is reported by lsusb:

Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc.

To download the tracklog or to configure the device, you must switch the unit to the LOG position.

You can use my MTKBabel program, the BT747 Java program, or you can use the boundled Windows program with Wine, following this recipe.

Bluetooth connection

I used an USB-bluetooth dongle. Using a Debian Lenny, I installed the packages bluetooth and bluez-utils. Inserting the dongle I got:

# lsusb
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 0000:0000
Bus 003 Device 002: ID 0324:bc06
Bus 003 Device 001: ID 0000:0000
# hciconfig
hci0:   Type: USB
        BD Address: 00:09:DD:50:2B:10 ACL MTU: 384:8 SCO MTU: 64:8
        UP RUNNING PSCAN
        RX bytes:765 acl:0 sco:0 events:28 errors:0
        TX bytes:345 acl:0 sco:0 commands:21 errors:0

Useful commands to control the bluetooth local device are:

# hciconfig hci0 {up|down}
# hcitool dev
Devices:
        hci0    00:09:DD:50:2B:10

Now I tried scanning for devices in near proximity:

# hcitool scan
Scanning ...
        00:0B:0D:87:EB:3A       iBT-GPS
# hcitool inq
Inquiring ...
        00:0B:0D:87:EB:3A       clock offset: 0x6e22    class: 0x001f00

This command is used to connect the bluetooth device as a serial device /dev/rfcomm0:

# rfcomm connect 0 00:0B:0D:87:EB:3A
Connected /dev/rfcomm0 to 00:0B:0D:87:EB:3A on channel 1
Press CTRL-C for hangup

Using udev it should be possible to connect automatically the device and to assign proper permissions.

Problem with Belkin adapter

There is a problem with the Belkin F8T012 Bluetooth adapter, upon insert the kernel (2.6.21) misdetects the device and it loads the pegasus module. Just blacklist the modules inserting this line into /etc/modprobe.d/blacklist:

blacklist pegasus

i-Blue 747 A+ with Linux

It seems that the new model 747 A+ (66 channels, 125000 way points storage space) requires the kernel module cdc_acm provided by Linux Kernel 2.6.29. Once connected the device is detected as /dev/ttyACM0.

Logging

Questo il significato di alcuni campi che possono comparire nel log:

DSTA DGPS Station DGPS Station ID Number.
DAGE DGPS Age Number of seconds since last DGPS update.
RCR Recording method S = speed, T = time, D = distance, B = push button
VALID Position fixed No fix = Not fixed, SPS = Standard Positioning Service, PPS = Precise Positioning Service
NO_FIX The GPS device had no fix.
SPS Standard Positioning Service Accuracy degraded to 100 m via Selective Availability. S.A. was turned OFF on May 1st, 2000. SPS is today accurate as previously was PPS.
DGPS Differential GPS Born to circumvent the Selective Availability, compare known coordinates with GPS fix
PPS Precise Positioning Service Accuracy < 10 m, provided encrypted
RTK Real Time Kinematic Sat system used in RTK mode with fixed integers
FRTK Float Real Time Kinematic Sat system used in RTK mode with floating integers
Estimated Estimated (dead reckoning) mode
Manual input Manual Input mode
Simulator Simulator mode