altos: mma655x also needs ao_sensor_errors
[fw/altos] / ao-bringup / turnon_telemega
1 #!/bin/sh
2
3 if [ -x ../ao-tools/ao-stmload/ao-stmload ]; then
4         STMLOAD=../ao-tools/ao-stmload/ao-stmload
5 elif [ -x /usr/bin/ao-stmload ]; then
6         STMLOAD=/usr/bin/ao-stmload
7 else
8         echo "Can't find ao-stmload!  Aborting."
9         exit 1
10 fi
11
12 if [ -x ../ao-tools/ao-usbload/ao-usbload ]; then
13         USBLOAD=../ao-tools/ao-usbload/ao-usbload
14 elif [ -x /usr/bin/ao-usbload ]; then
15         USBLOAD=/usr/bin/ao-usbload
16 else
17         echo "Can't find ao-usbload!  Aborting."
18         exit 1
19 fi
20
21 VERSION=1.0
22 #VERSION=0.1
23
24 echo "TeleMega v$VERSION Turn-On and Calibration Program"
25 echo "Copyright 2010 by Bdale Garbee.  Released under GPL v2"
26 echo
27 echo "Expectations:"
28 echo "\tTeleMega v$VERSIOn powered from USB"
29 echo "\t\twith ST-Link-V2 cabled to debug header"
30 echo "\t\twith coax from UHF to frequency counter"
31 echo
32 echo -n "TeleMega-$VERSION serial number: "
33 read SERIAL
34
35 echo $STMLOAD
36
37 $STMLOAD --raw ../src/telemega-v$VERSION/flash-loader/*.elf || exit 1
38
39 sleep 2
40
41 $USBLOAD --serial=$SERIAL ../src/telemega-v$VERSION/*.ihx || exit 1
42
43 sleep 2
44
45 dev=`ao-list | awk '/TeleMega-v'"$VERSION"'/ { print $3; exit(0); }'`
46
47 case "$dev" in
48 /dev/tty*)
49         echo "TeleMega found on $dev"
50         ;;
51 *)
52         echo 'No TeleMega-v'"$VERSION"' found'
53         exit 1
54         ;;
55 esac
56
57 echo 'E 0' > $dev
58
59 SERIAL=$SERIAL ./cal-freq $dev
60
61 ./cal-accel $dev