From dd49731422f391ad8cfbc1910b9b5285f36f43bc Mon Sep 17 00:00:00 2001 From: rmspeers Date: Tue, 24 Jul 2012 02:33:56 +0000 Subject: [PATCH] Moved board definition from apimote to apimote1 for versioning support. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1204 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFET.py | 10 +++++++- client/goodfet.monitor | 4 ++- firmware/config.mk | 4 +-- firmware/include/monitor.h | 2 ++ firmware/include/platform.h | 2 +- firmware/lib/msp430.c | 26 +++++++++++++++++++- firmware/platforms/README.txt | 2 +- firmware/platforms/{apimote.h => apimote1.h} | 0 firmware/platforms/telosb.h | 20 +++++++++++++++ 9 files changed, 63 insertions(+), 7 deletions(-) rename firmware/platforms/{apimote.h => apimote1.h} (100%) mode change 100644 => 100755 diff --git a/client/GoodFET.py b/client/GoodFET.py index e0d575d..6fd0f29 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -205,7 +205,7 @@ class GoodFET: self.telosBReset(); elif (os.environ.get("board")=='zolertiaz1' or os.environ.get("board")=='z1'): self.bslResetZ1(); - elif (os.environ.get("board")=='apimote'): + elif (os.environ.get("board")=='apimote1'): #Explicitly set RTS and DTR to halt board. self.serialport.setRTS(1); self.serialport.setDTR(1); @@ -670,6 +670,14 @@ class GoodFET: print "Clocked at %s" % self.monitorclocking(); return 1; + def testleds(self): + print "Flashing LEDs" + self.writecmd(self.MONITORAPP,0xD0,0,""); + try: + print "Flashed %d LED." % ord(self.data) + except: + print "Unable to process response:", self.data + def monitor_list_apps(self, full=False): self.monitor_info() old_value = self.besilent diff --git a/client/goodfet.monitor b/client/goodfet.monitor index 67ec3fb..b530a4b 100755 --- a/client/goodfet.monitor +++ b/client/goodfet.monitor @@ -19,6 +19,7 @@ if(len(sys.argv)==1): print "%s call 0x$start" % sys.argv[0]; print "%s exec '0x35 0x00 0x..'" % sys.argv[0]; print "%s listapps [full]" % sys.argv[0] + print "%s testleds" % sys.argv[0] sys.exit(); #Initialize FET and set baud rate @@ -125,4 +126,5 @@ if(sys.argv[1]=="verify"): if(i%0x100==0): print "%04x" % i; - +if(sys.argv[1]=="testleds"): + client.testleds(); diff --git a/firmware/config.mk b/firmware/config.mk index 76c118f..a59ab27 100644 --- a/firmware/config.mk +++ b/firmware/config.mk @@ -5,9 +5,9 @@ #Unset by default, but can be explicitly set later. config=undef -ifneq (,$(findstring $(board),apimote)) +ifneq (,$(findstring $(board),apimote1)) mcu ?= msp430f2618 -platform := apimote +platform := apimote1 config := monitor spi ccspi MSP430BSL?=goodfet.bsl --speed=38400 --swap-reset-test CFLAGS += -Duseuart1 diff --git a/firmware/include/monitor.h b/firmware/include/monitor.h index d38dae9..019ae59 100644 --- a/firmware/include/monitor.h +++ b/firmware/include/monitor.h @@ -29,6 +29,8 @@ #define MONITOR_WRITEBUF 0xC1 #define MONITOR_SIZEBUF 0xC2 +#define MONITOR_LEDTEST 0xD0 + extern app_t const monitor_app; #endif // MONITOR_H diff --git a/firmware/include/platform.h b/firmware/include/platform.h index dfc4681..2614ecc 100644 --- a/firmware/include/platform.h +++ b/firmware/include/platform.h @@ -33,7 +33,7 @@ void led_toggle(); #include "config.h" #ifdef useuart1 -//TelosB uses second serial port. +//TelosB and the ApiMote use the second serial port. #define serial_tx serial1_tx #define serial_rx serial1_rx #define setbaud setbaud1 diff --git a/firmware/lib/msp430.c b/firmware/lib/msp430.c index 19bca37..0f30e33 100644 --- a/firmware/lib/msp430.c +++ b/firmware/lib/msp430.c @@ -16,8 +16,15 @@ void led_init() { PLEDDIR |= PLEDPIN; + #ifdef PLED2OUT + PLED2DIR |= PLED2PIN; + #endif + #ifdef PLED3OUT + PLED3DIR |= PLED3PIN; + #endif } +//TODO define differently if needed for telos/apimote void led_on() { PLEDOUT |= PLEDPIN; @@ -31,6 +38,24 @@ void led_toggle() PLEDOUT ^= PLEDPIN; } +//LED2 and LED3 are only used by the telosb and apimote for now +void led2_on() +{ + PLED2OUT &= ~PLED2PIN; +} +void led2_off() +{ + PLED2OUT |= PLED2PIN; +} +void led3_on() +{ + PLED3OUT &= ~PLED3PIN; +} +void led3_off() +{ + PLED3OUT |= PLED3PIN; +} + //! Initialize MSP430 registers and all that jazz. void msp430_init(){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer @@ -39,7 +64,6 @@ void msp430_init(){ led_init(); led_off(); - /* P5.0 out and low; this is chosen for the PIC app (in which P5.0 is !MCLR) to ensure that an attached PIC chip, if present, is immediately driven to reset state. A brief explanation of why this diff --git a/firmware/platforms/README.txt b/firmware/platforms/README.txt index 8d075a1..da63e90 100644 --- a/firmware/platforms/README.txt +++ b/firmware/platforms/README.txt @@ -1,7 +1,7 @@ goodfet.h GoodFET hardware and neighborly clones. telosb.h MSP430F1612-based Telos B and its clones. z1.h Zolertia Z1, an MSP430F2617 mote. - +apimote.h Api-Mote (802.15.4/ZigBee enabled GoodFET) (board rev 1) TODO: TRF7960 Dev Board diff --git a/firmware/platforms/apimote.h b/firmware/platforms/apimote1.h old mode 100644 new mode 100755 similarity index 100% rename from firmware/platforms/apimote.h rename to firmware/platforms/apimote1.h diff --git a/firmware/platforms/telosb.h b/firmware/platforms/telosb.h index 8fb2857..56595ab 100644 --- a/firmware/platforms/telosb.h +++ b/firmware/platforms/telosb.h @@ -31,6 +31,26 @@ #define SPIIN P3IN #define SPIREN P3REN +/* INITPLATFORM PX.7 PX.6 PX.5 PX.4 PX.3 PX.2 PX.1 PX.0 + HUM HUM HUM RGIO1 RGIO0 PDVCC UART1TX PKT_INT + P1DIR = 0xe0 11100000 Out Out Out In In In In In + P1OUT = 0x00 Out?? + UsrInt GIO3 NC 1Wire GIO2 UART1RX GIO1 GIO0 + P2DIR = 0x7b 01111011 In Out Out Out Out In Out Out + P2OUT = 0x10 00010000 Hi + U1RX U1TX U0RX U0TX RSCLK R_SO R_SI NC + P3DIR = 0xf1 11110001 Out Out Out Out In In In Out + P3OUT = 0x00 + FHold RRST RVREFEN F_CS NC R_CS R_SFD NC + P4DIR = 0xfd 11111101 Out Out Out Out Out Out In Out + P4OUT = 0xfd 11111101 Hi Hi Hi Hi Hi Hi Lo Hi + SVSoutLED3 LED2 LED1 NC NC NC NC + P5DIR = 0xff 11111111 Out Out Out Out Out Out Out Out + P5OUT = 0xff 11111111 Hi Hi Hi Hi Hi Hi Hi Hi + SVSin DAC0 ADC5 ADC4 ADC3 ADC2 ADC1 ADC0 + P6DIR = 0xff 11111111 Out Out Out Out Out Out Out Out + P6OUT = 0x00 +*/ /* For the radio to be used: 4.6 (!RST) must be low -- 2.20.1