projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Generate LED icons on the fly. Include SVG versions.
[fw/altos]
/
ao-bringup
/
turnon_teledongle
diff --git
a/ao-bringup/turnon_teledongle
b/ao-bringup/turnon_teledongle
index 058e72cec590936c7073bae6755cf17c5fb27e5f..983f1010340004b69b1c7e0a74f2d5e61118a5e6 100755
(executable)
--- a/
ao-bringup/turnon_teledongle
+++ b/
ao-bringup/turnon_teledongle
@@
-1,58
+1,106
@@
#!/bin/sh
#!/bin/sh
-if [ -x ../ao-tools/ao-
load/ao-load
]; then
- AOLOAD=../ao-tools/ao-load/ao-load
-elif [ -x /usr/bin/ao-
load
]; then
- AOLOAD=/usr/bin/ao-load
+if [ -x ../ao-tools/ao-
flash/ao-flash-lpc
]; then
+ FLASH_LPC=../ao-tools/ao-flash/ao-flash-lpc
+elif [ -x /usr/bin/ao-
flash-lpc
]; then
+ FLASH_LPC=/usr/bin/ao-flash-lpc
else
else
- echo "Can't find ao-
load
! Aborting."
+ echo "Can't find ao-
flash-lpc
! Aborting."
exit 1
fi
exit 1
fi
-if [ -x ../ao-tools/ao-rawload/ao-rawload ]; then
- RAWLOAD=../ao-tools/ao-rawload/ao-rawload
-elif [ -x /usr/bin/ao-rawload ]; then
- RAWLOAD=/usr/bin/ao-rawload
+if [ -x /usr/bin/ao-usbload ]; then
+ USBLOAD=/usr/bin/ao-usbload
else
else
- echo "Can't find ao-
raw
load! Aborting."
+ echo "Can't find ao-
usb
load! Aborting."
exit 1
fi
exit 1
fi
-echo "TeleDongle v0.2 Turn-On and Calibration Program"
-echo "Copyright 2010 by Bdale Garbee. Released under GPL v2"
+PRODUCT=teledongle
+PRODUCT_NAME=TeleDongle
+VERSION=3.0
+
+echo "$PRODUCT_NAME v$VERSION Turn-On and Calibration Program"
+echo "Copyright © 2015 by Bdale Garbee. Released under GPL v2"
echo
echo "Expectations:"
echo
echo "Expectations:"
-echo "\t
TeleDongle v0.2
powered from USB"
-echo "\t\twith
TIdongle (on /dev/ttyACM0)
cabled to debug header"
-echo "\t\twith coax from
SMA
to frequency counter"
+echo "\t
$PRODUCT_NAME v$VERSION
powered from USB"
+echo "\t\twith
ST-Link-V2
cabled to debug header"
+echo "\t\twith coax from
UHF
to frequency counter"
echo
echo
-echo -n "TeleDongle serial number: "
-read SERIAL
-
-echo $RAWLOAD
-case $USER in
- bdale)
- programmer=100
+case $# in
+ 1)
+ SERIAL="$1"
+ echo "$PRODUCT-$VERSION serial number: $SERIAL"
;;
;;
- keithp)
- programmer=186
+ 0)
+ echo -n "$PRODUCT-$VERSION serial number: "
+ read SERIAL
+ ;;
+ *)
+ echo "Usage: $0 <serial-number>" 1>&2
+ exit 1;
;;
esac
;;
esac
-$RAWLOAD -D $programmer -r ao_led_blink.ihx
-echo "LEDs should be blinking"
+BINARIES=$HOME/altusmetrumllc/Binaries
+
+LOADER="$BINARIES/loaders/$PRODUCT-v$VERSION-"*.elf
+ALTOS="$BINARIES/$PRODUCT-v$VERSION"*.elf
+
+$FLASH_LPC $LOADER || exit 1
+
+sleep 2
+
+$USBLOAD --serial=$SERIAL $ALTOS || exit 1
+
sleep 5
sleep 5
-$RAWLOAD -D $programmer -r ao_radio_xmit.ihx
-echo -n "Generating RF carrier. Please enter measured frequency: "
-read FREQ
+dev=`ao-list | awk '/TeleDongle-v'"$VERSION"'/ { print $3; exit(0); }'`
+
+case "$dev" in
+/dev/tty*)
+ echo "TeleDongle found on $dev"
+ ;;
+*)
+ echo 'No TeleDongle-v'"$VERSION"' found'
+ exit 1
+ ;;
+esac
+
+echo 'E 0' > $dev
-CAL
_VALUE=`nickle -e "floor(434.55 / $FREQ * 1186611 + 0.5)"`
+CAL
FILE=cal-$SERIAL.txt
-echo "Programming flash with cal value " $CAL_VALUE
-$AOLOAD -D $programmer --cal $CAL_VALUE /usr/share/altos/teledongle-v0.2*.ihx $SERIAL
+../ao-tools/ao-cal-freq/ao-cal-freq --verbose --nosave --output=$CALFILE --tty=$dev
+
+case $? in
+ 0)
+ ;;
+ *)
+ echo "Frequency calibration failed"
+ exit 1
+ ;;
+esac
+
+CAL_VALUE=`cat $CALFILE`
+
+case "$CAL_VALUE" in
+ [1-9]*)
+ ;;
+ *)
+ echo "Invalid calibration value: $CAL_VALUE"
+ exit 1
+ ;;
+esac
-echo "Serial number "$SERIAL" programmed with RF cal value "$CAL_VALUE
echo $SERIAL","$CAL_VALUE >> cal_values
echo $SERIAL","$CAL_VALUE >> cal_values
-echo "Unplug and replug USB, cu to the board, confirm freq and record power"
+
+echo "Reflashing with calibration: $CAL_VALUE"
+
+$USBLOAD --cal=$CAL_VALUE --tty=$dev $ALTOS || exit 1
+
+echo "$PRODUCT_NAME-v$VERSION $SERIAL is ready to ship"
+
+exit $?