--- /dev/null
+#!/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
+else
+ echo "Can't find ao-load! Aborting."
+ 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
+else
+ echo "Can't find ao-rawload! Aborting."
+ exit 1
+fi
+
+echo "TeleBT v0.1 Turn-On and Calibration Program"
+echo "Copyright 2011 by Bdale Garbee. Released under GPL v2"
+echo
+echo "Expectations:"
+echo "\tTeleBT v0.1 powered from USB"
+echo "\t\twith TeleDonle (on /dev/ttyACM0) cabled to debug header"
+echo "\t\twith coax from SMA to frequency counter"
+echo
+echo -n "TeleBT serial number: "
+read SERIAL
+
+echo $RAWLOAD
+
+$RAWLOAD -D 100 -r ao_led_blink.ihx
+echo "LEDs should be blinking"
+sleep 5
+
+$RAWLOAD -D 100 -r ao_radio_xmit.ihx
+echo -n "Generating RF carrier. Please enter measured frequency: "
+read FREQ
+
+CAL_VALUE=`nickle -e "floor(434.55 / $FREQ * 1186611 + 0.5)"`
+
+echo "Programming flash with cal value " $CAL_VALUE
+$AOLOAD -D 100 --cal $CAL_VALUE /usr/share/altos/telebt-v0.1*.ihx $SERIAL
+
+echo "Serial number "$SERIAL" programmed with RF cal value "$CAL_VALUE
+echo "Unplug and replug USB, cu to the board, confirm freq and record power"
-altos (0.9.1) unstable; urgency=low
+altos (0.9.1.telemini.1) unstable; urgency=low
[ Keith Packard ]
* ao-load: fix usage message to note that '=' is required for options
[ Bdale Garbee ]
* tie bringup scripts to Bdale's bench TeleDongle
- -- Bdale Garbee <bdale@gag.com> Fri, 18 Feb 2011 23:55:58 -0700
+ -- Bdale Garbee <bdale@gag.com> Fri, 01 Apr 2011 20:02:12 -0600
altos (0.9) unstable; urgency=low
telemetrum-v1.1 telemetrum-v1.0 \
teledongle-v0.2 teledongle-v0.1 \
telemini-v0.1 telenano-v0.1 \
- telebt-v0.0 \
+ telebt-v0.0 telebt-v0.1 \
telemetrum-v0.1-sky telemetrum-v0.1-sirf \
tidongle test
$(TNANO_MAIN_SRC)
#
-# Sources for TeleDongle
+# Sources for TeleBluetooth
#
TBT_MAIN_SRC = \
$(DBG_SRC) \
$(TBT_MAIN_SRC)
+TBT_V_0_1_SRC = \
+ $(TBT_BASE_SRC) \
+ $(SPI_DRIVER_SRC) \
+ $(M25_DRIVER_SRC) \
+ $(BEEP_DRIVER_SRC) \
+ ao_log_telem.c
+
#
# TI Dongle sources
#
/* ao_btm.c */
-/* Shared by USB, so the USB code calls this function */
+/* If bt_link is on P2, this interrupt is shared by USB, so the USB
+ * code calls this function. Otherwise, it's a regular ISR.
+ */
+
void
-ao_btm_isr(void);
+ao_btm_isr(void)
+#if BT_LINK_ON_P1
+ __interrupt 15
+#endif
+ ;
+
void
ao_btm_init(void);
*/
ao_delay(AO_SEC_TO_TICKS(3));
+#if HAS_BEEP
+ ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
+#endif
+
/*
* The first time we connect, the BTM-180 comes up at 19200 baud.
* After that, it will remember and come up at 57600 baud. So, see
__xdata struct ao_task ao_btm_task;
+#if BT_LINK_ON_P2
+#define BT_PICTL_ICON PICTL_P2ICON
+#define BT_PIFG P2IFG
+#define BT_PDIR P2DIR
+#define BT_PINP P2INP
+#define BT_IEN2_PIE IEN2_P2IE
+#endif
+#if BT_LINK_ON_P1
+#define BT_PICTL_ICON PICTL_P1ICON
+#define BT_PIFG P1IFG
+#define BT_PDIR P1DIR
+#define BT_PINP P1INP
+#define BT_IEN2_PIE IEN2_P1IE
+#endif
+
void
ao_btm_check_link() __critical
{
- if (P2_1) {
+ /* Check the pin and configure the interrupt detector to wait for the
+ * pin to flip the other way
+ */
+ if (BT_LINK_PIN) {
ao_btm_connected = 0;
- PICTL |= PICTL_P2ICON;
+ PICTL |= BT_PICTL_ICON;
} else {
ao_btm_connected = 1;
- PICTL &= ~PICTL_P2ICON;
+ PICTL &= ~BT_PICTL_ICON;
}
}
void
ao_btm_isr(void)
+#if BT_LINK_ON_P1
+ __interrupt 15
+#endif
{
- if (P2IFG & (1 << 1)) {
+#if BT_LINK_ON_P1
+ P1IF = 0;
+#endif
+ if (BT_PIFG & (1 << BT_LINK_PIN_INDEX)) {
ao_btm_check_link();
ao_wakeup(&ao_btm_connected);
}
- P2IFG = 0;
+ BT_PIFG = 0;
}
void
ao_serial_init();
ao_serial_set_speed(AO_SERIAL_SPEED_19200);
+#if BT_LINK_ON_P1
+ /*
+ * Configure ser reset line
+ */
+
+ P1_6 = 0;
+ P1DIR |= (1 << 6);
+#endif
+
/*
* Configure link status line
*/
- /* Set P2_1 to input, pull-down */
- P2DIR &= ~(1 << 1);
- P2INP |= P2INP_MDP2_1_TRISTATE;
+ /* Set pin to input */
+ BT_PDIR &= ~(1 << BT_LINK_PIN_INDEX);
+
+ /* Set pin to tri-state */
+ BT_PINP |= (1 << BT_LINK_PIN_INDEX);
- /* Enable P2 interrupts */
- IEN2 |= IEN2_P2IE;
+ /* Enable interrupts */
+ IEN2 |= BT_IEN2_PIE;
+
+ /* Check current pin state */
ao_btm_check_link();
+
+#if BT_LINK_ON_P2
+ /* Eable the pin interrupt */
PICTL |= PICTL_P2IEN;
+#endif
+#if BT_LINK_ON_P1
+ /* Enable pin interrupt */
+ P1IEN |= (1 << BT_LINK_PIN_INDEX);
+#endif
ao_add_task(&ao_btm_task, ao_btm, "bt");
}
--- /dev/null
+/*
+ * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+void
+ao_log_write_erase(uint8_t pos)
+{
+ (void) pos;
+}
+
+uint8_t
+ao_log_present(void)
+{
+ return 0;
+}
#define SPI_CS_ON_P1 1
#define SPI_CS_ON_P0 0
#define HAS_IGNITE 0
+ #define BT_LINK_ON_P2 1
+ #define BT_LINK_ON_P1 0
+ #define BT_LINK_PIN_INDEX 7
+ #define BT_LINK_PIN P2_1
+#endif
+
+#if defined(TELEBT_V_0_1)
+ #define HAS_FLIGHT 0
+ #define HAS_USB 1
+ #define HAS_BEEP 1
+ #define HAS_SERIAL_1 1
+ #define HAS_SERIAL_1_ALT_1 1
+ #define HAS_SERIAL_1_ALT_2 0
+ #define HAS_SERIAL_1_HW_FLOW 1
+ #define USE_SERIAL_STDIN 1
+ #define HAS_ADC 0
+ #define HAS_DBG 1
+ #define HAS_EEPROM 1
+ #define USE_INTERNAL_FLASH 0
+ #define HAS_BTM 1
+ #define DBG_ON_P1 1
+ #define DBG_ON_P0 0
+ #define IGNITE_ON_P2 0
+ #define IGNITE_ON_P0 0
+ #define PACKET_HAS_MASTER 1
+ #define PACKET_HAS_SLAVE 0
+ #define AO_LED_RED 1
+ #define AO_LED_GREEN 2
+ #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN)
+ #define SPI_CS_ON_P1 1
+ #define SPI_CS_ON_P0 0
+ #define M25_CS_MASK 0x04 /* CS0 is P1_2 */
+ #define M25_MAX_CHIPS 1
+ #define HAS_ACCEL 0
+ #define HAS_IGNITE 0
+ #define BT_LINK_ON_P2 0
+ #define BT_LINK_ON_P1 1
+ #define BT_LINK_PIN_INDEX 7
+ #define BT_LINK_PIN P1_7
#endif
#if DBG_ON_P1
void
ao_serial_init(void)
{
+#if HAS_SERIAL_1_ALT_1
+ /* Set up the USART pin assignment */
+ PERCFG = (PERCFG & ~PERCFG_U1CFG_ALT_MASK) | PERCFG_U1CFG_ALT_1;
+
+ P2DIR = (P2DIR & ~P2DIR_PRIP0_MASK) | P2DIR_PRIP0_USART1_USART0;
+
+ /* Make the USART pins be controlled by the USART */
+ P0SEL |= (1 << 5) | (1 << 4);
+#if HAS_SERIAL_1_HW_FLOW
+ P0SEL |= (1 << 3) | (1 << 2);
+#endif
+#else
/* Set up the USART pin assignment */
PERCFG = (PERCFG & ~PERCFG_U1CFG_ALT_MASK) | PERCFG_U1CFG_ALT_2;
/* Make the USART pins be controlled by the USART */
P1SEL |= (1 << 6) | (1 << 7);
+ P1SEL |= (1 << 5) | (1 << 4);
+#endif
/* UART mode with receiver enabled */
U1CSR = (UxCSR_MODE_UART | UxCSR_RE);
/* Reasonable serial parameters */
U1UCR = (UxUCR_FLUSH |
+#if HAS_SERIAL_1_HW_FLOW
+ UxUCR_FLOW_ENABLE |
+#else
UxUCR_FLOW_DISABLE |
+#endif
UxUCR_D9_EVEN_PARITY |
UxUCR_BIT9_8_BITS |
UxUCR_PARITY_DISABLE |
ao_led_init(LEDS_AVAILABLE);
ao_led_on(AO_LED_RED);
ao_timer_init();
+#if HAS_BEEP
+ ao_beep_init();
+#endif
ao_cmd_init();
+#if HAS_EEPROM
+ ao_spi_init();
+ ao_storage_init();
+#endif
ao_usb_init();
ao_monitor_init(AO_LED_GREEN, TRUE);
ao_rssi_init(AO_LED_RED);
ao_usb_isr(void) __interrupt 6
{
USBIF = 0;
- IRCON2 &= ~IRCON2_USBIF;
ao_usb_iif |= USBIIF;
if (ao_usb_iif & 1)
ao_wakeup(&ao_usb_task);
if (USBCIF & USBCIF_RSTIF)
ao_usb_set_interrupts();
#if HAS_BTM
+#if BT_LINK_ON_P2
ao_btm_isr();
#endif
+#endif
}
struct ao_usb_setup {
sfr at 0xFE P1DIR;
sfr at 0xFF P2DIR;
+#define P2DIR_PRIP0_USART0_USART1 (0 << 6)
+#define P2DIR_PRIP0_USART1_USART0 (1 << 6)
+#define P2DIR_PRIP0_TIMER1_01_USART1 (2 << 6)
+#define P2DIR_PRIP0_TIMER1_2_USART0 (3 << 6)
+#define P2DIR_PRIP0_MASK (3 << 6)
+
sfr at 0x8F P0INP;
/* Select between tri-state and pull up/down
--- /dev/null
+telebt-*
+ao_product.h
--- /dev/null
+--directory=..
--- /dev/null
+include ../Makefile.proto
--- /dev/null
+PROG = telebt-v0.1-$(VERSION).ihx
+
+SRC = \
+ $(TBT_V_0_1_SRC)
+
+PRODUCT=TeleBT-v0.1
+PRODUCT_DEF=-DTELEBT_V_0_1
+IDPRODUCT=0x000e