-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Somebody in the thread at some point said:

| and spew once a second whether there is good data or not.  But the GPS
| chip also supports some checksummed binary packets in this UBX protocol
| documented above to control it.  If you place a canned UBX packet in a
| file, you can issue it to the GPS chip like this:

Here is a UBX packet generator in Bash, it sends the checksummed binary
packet to stdout given hex commandline args, eg.  You can then cat it to
the GPS device.

You need to run it on your host PC because it won't work on GTA02 since
it doesn't seem to have bc in there by default (on the rootfs I am using
anyway).

- -Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkh7GdQACgkQOjLpvpq7dMrZPgCaAvj1RMHRDyJSfU/9IvmENGlR
XlYAniOWM16btwweRsDwKjnx9L0jPlK4
=s4IR
-----END PGP SIGNATURE-----
#!/bin/sh
#
# ubx packet generator   v0.1  Andy Green <[EMAIL PROTECTED]>
#
# Usage:
#
# ubxcs b5 62 06 13 04 00 01 00 00 00 > ubx-packet.bin
#
# appends checksum and issues binary packet on stdout
#
# you can subsequently issue the packet to GPS unit like this
#
# cat ubx-packet.bin > /dev/ttySAC1

cs0=0
cs1=0
seen=0

until [ -z "$1" ]
do
  upr=`echo $1 | tr [[:lower:]] [[:upper:]]`
  dec=`echo "ibase=16;obase=A;$upr" | bc`

  if [ $seen -gt 1 ] ; then

   cs0=$(( $cs0 + $dec ))
   cs0="$(( $cs0 & 255 ))"
   cs1=$(( $cs1 + $cs0 ))
   cs1="$(( $cs1 & 255 ))"

  fi

  echo -e -n "\x$upr"

  shift

  seen=$(( $seen + 1 ))

done

echo -e -n "\x`echo "ibase=10;obase=16;$cs0" | bc`\x`echo 
"ibase=10;obase=16;$cs1" | bc`"

Reply via email to