Moved board definition from apimote to apimote1 for versioning support.
authorrmspeers <rmspeers@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 24 Jul 2012 02:33:56 +0000 (02:33 +0000)
committerrmspeers <rmspeers@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 24 Jul 2012 02:33:56 +0000 (02:33 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1204 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFET.py
client/goodfet.monitor
firmware/config.mk
firmware/include/monitor.h
firmware/include/platform.h
firmware/lib/msp430.c
firmware/platforms/README.txt
firmware/platforms/apimote.h [deleted file]
firmware/platforms/apimote1.h [new file with mode: 0755]
firmware/platforms/telosb.h

index e0d575d..6fd0f29 100755 (executable)
@@ -205,7 +205,7 @@ class GoodFET:
                     self.telosBReset();
                 elif (os.environ.get("board")=='zolertiaz1' or  os.environ.get("board")=='z1'):
                     self.bslResetZ1();
                     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);
                     #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;
 
         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
     def monitor_list_apps(self, full=False): 
         self.monitor_info()
         old_value = self.besilent
index 67ec3fb..b530a4b 100755 (executable)
@@ -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 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
     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(i%0x100==0):
                 print "%04x" % i;
 
-
+if(sys.argv[1]=="testleds"):
+    client.testleds();
index 76c118f..a59ab27 100644 (file)
@@ -5,9 +5,9 @@
 #Unset by default, but can be explicitly set later.
 config=undef
 
 #Unset by default, but can be explicitly set later.
 config=undef
 
-ifneq (,$(findstring $(board),apimote))
+ifneq (,$(findstring $(board),apimote1))
 mcu ?= msp430f2618
 mcu ?= msp430f2618
-platform := apimote
+platform := apimote1
 config := monitor spi ccspi
 MSP430BSL?=goodfet.bsl --speed=38400 --swap-reset-test
 CFLAGS += -Duseuart1
 config := monitor spi ccspi
 MSP430BSL?=goodfet.bsl --speed=38400 --swap-reset-test
 CFLAGS += -Duseuart1
index d38dae9..019ae59 100644 (file)
@@ -29,6 +29,8 @@
 #define MONITOR_WRITEBUF 0xC1
 #define MONITOR_SIZEBUF 0xC2
 
 #define MONITOR_WRITEBUF 0xC1
 #define MONITOR_SIZEBUF 0xC2
 
+#define MONITOR_LEDTEST 0xD0
+
 extern app_t const monitor_app;
 
 #endif // MONITOR_H
 extern app_t const monitor_app;
 
 #endif // MONITOR_H
index dfc4681..2614ecc 100644 (file)
@@ -33,7 +33,7 @@ void led_toggle();
 #include "config.h"
 
 #ifdef useuart1
 #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
 #define serial_tx serial1_tx
 #define serial_rx serial1_rx
 #define setbaud setbaud1
index 19bca37..0f30e33 100644 (file)
 void led_init()
 {
        PLEDDIR |= PLEDPIN;
 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;
 void led_on()
 {
        PLEDOUT |= PLEDPIN;
@@ -31,6 +38,24 @@ void led_toggle()
        PLEDOUT ^= PLEDPIN;
 }
 
        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
 //! 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();
 
        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
        /* 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
index 8d075a1..da63e90 100644 (file)
@@ -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.
 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
 
 TODO:
 TRF7960 Dev Board
diff --git a/firmware/platforms/apimote.h b/firmware/platforms/apimote.h
deleted file mode 100644 (file)
index 082947a..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*! \file apimote.h\r
-  \author Ryan Speers\r
-  \brief Port descriptions for the GoodFET platform.\r
-*/\r
-\r
-/* #ifdef __MSPGCC__ */\r
-/* #include <msp430.h> */\r
-/* #else */\r
-/* #include <signal.h> */\r
-/* #include <msp430.h> */\r
-/* #include <iomacros.h> */\r
-/* #endif */\r
-\r
-#ifndef _GNU_ASSEMBLER_\r
-#include <msp430.h>\r
-#endif\r
-\r
-//LED on P5.5 (pin 49) (LED1 red)\r
-#define PLEDOUT P5OUT\r
-#define PLEDDIR P5DIR\r
-#define PLEDPIN BIT5\r
-//LED on P5.6 (pin 50) (LED2 green)\r
-#define PLED2OUT P5OUT\r
-#define PLED2DIR P5DIR\r
-#define PLED2PIN BIT6\r
-//LED on P5.7 (pin 51) (LED3 blue)\r
-#define PLED3OUT P5OUT\r
-#define PLED3DIR P5DIR\r
-#define PLED3PIN BIT7\r
-\r
-//mtx frx p34 \r
-//mrx ftx p35\r
-\r
-//SPI\r
-//TelosB:  29/3.1=RF_SI, 30/3.2=RF_SO, 31/3.3=RF_SCLK\r
-//ApiMote: 29/3.1=RF_SI, 30/3.2=RF_SO, 31/3.3=RF_SCLK\r
-#define SPIOUT P3OUT\r
-#define SPIDIR P3DIR\r
-#define SPIIN  P3IN\r
-#define SPIREN P3REN\r
-\r
-/* For the radio to be used:\r
-   2.7 (!RST) must be low\r
-   2.0 (VREF_EN) must be high (cc2420-41 rf_vreg)\r
-   3.0 (!CS) must be low for the transaction.\r
-*/\r
-\r
-\r
-/* TODO what to do here?.  Hopefully nothing.\r
-#define INITPLATFORM \\r
-  P1DIR = 0xe0;\\r
-  P1OUT = 0x00;\\r
-  P2DIR = 0x7b;\\r
-  P2OUT = 0x10;\\r
-  P3DIR = 0xf1;\\r
-  P3OUT = 0x00;\\r
-  P4DIR = 0xfd;\\r
-  P4OUT = 0xFd;\\r
-  P5DIR = 0xff;\\r
-  P5OUT = 0xff;\\r
-  P6DIR = 0xff;\\r
-  P6OUT = 0x00;\r
-*/\r
-\r
-//RF Control\r
-//TelosB:  Radio CS is 38/P4.2 (to CC2420 pin31)\r
-//ApiMote: Radio CS is 28/P3.0\r
-#define SETSS P3OUT|=BIT0\r
-#define CLRSS P3OUT&=~BIT0\r
-#define DIRSS P3DIR|=BIT0\r
-\r
-//CC2420 Chip Enable\r
-//TelosB:  Radio RESETn is 42/P4.6 (to CC2420 pin21)\r
-//ApiMote: Radio RESETn is 27/P2.7 (to CC2420 pin21)\r
-#define SETCE P2OUT|=BIT7\r
-#define CLRCE P2OUT&=~BIT7\r
-#define DIRCE P2DIR|=BIT7\r
-\r
-//CC2420 signals\r
-#define SFD   (P2IN&BIT6) //TelosB 37/P4.1 -> ApiMote 26/P2.6\r
-#define FIFOP (P2IN&BIT4) //TelosB 12/P1.0 -> ApiMote 24/P2.4 (rf_pkt cc2420-29)\r
-#define FIFO  (P2IN&BIT3) //TelosB 15/P1.3 -> ApiMote 23/P2.3 (rf_gio0 cc2420-30)\r
-\r
-// network byte order converters\r
-#define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \\r
-                                (((uint16_t)(x) & 0x00FF) << 8))\r
-#define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \\r
-                                 (((uint32_t)(x) & 0x00FF0000) >> 8) | \\r
-                                 (((uint32_t)(x) & 0x0000FF00) << 8) | \\r
-                                 (((uint32_t)(x) & 0x000000FF) << 24))\r
-\r
-#define ntohs htons\r
-#define ntohl htonl\r
-\r
diff --git a/firmware/platforms/apimote1.h b/firmware/platforms/apimote1.h
new file mode 100755 (executable)
index 0000000..082947a
--- /dev/null
@@ -0,0 +1,94 @@
+/*! \file apimote.h\r
+  \author Ryan Speers\r
+  \brief Port descriptions for the GoodFET platform.\r
+*/\r
+\r
+/* #ifdef __MSPGCC__ */\r
+/* #include <msp430.h> */\r
+/* #else */\r
+/* #include <signal.h> */\r
+/* #include <msp430.h> */\r
+/* #include <iomacros.h> */\r
+/* #endif */\r
+\r
+#ifndef _GNU_ASSEMBLER_\r
+#include <msp430.h>\r
+#endif\r
+\r
+//LED on P5.5 (pin 49) (LED1 red)\r
+#define PLEDOUT P5OUT\r
+#define PLEDDIR P5DIR\r
+#define PLEDPIN BIT5\r
+//LED on P5.6 (pin 50) (LED2 green)\r
+#define PLED2OUT P5OUT\r
+#define PLED2DIR P5DIR\r
+#define PLED2PIN BIT6\r
+//LED on P5.7 (pin 51) (LED3 blue)\r
+#define PLED3OUT P5OUT\r
+#define PLED3DIR P5DIR\r
+#define PLED3PIN BIT7\r
+\r
+//mtx frx p34 \r
+//mrx ftx p35\r
+\r
+//SPI\r
+//TelosB:  29/3.1=RF_SI, 30/3.2=RF_SO, 31/3.3=RF_SCLK\r
+//ApiMote: 29/3.1=RF_SI, 30/3.2=RF_SO, 31/3.3=RF_SCLK\r
+#define SPIOUT P3OUT\r
+#define SPIDIR P3DIR\r
+#define SPIIN  P3IN\r
+#define SPIREN P3REN\r
+\r
+/* For the radio to be used:\r
+   2.7 (!RST) must be low\r
+   2.0 (VREF_EN) must be high (cc2420-41 rf_vreg)\r
+   3.0 (!CS) must be low for the transaction.\r
+*/\r
+\r
+\r
+/* TODO what to do here?.  Hopefully nothing.\r
+#define INITPLATFORM \\r
+  P1DIR = 0xe0;\\r
+  P1OUT = 0x00;\\r
+  P2DIR = 0x7b;\\r
+  P2OUT = 0x10;\\r
+  P3DIR = 0xf1;\\r
+  P3OUT = 0x00;\\r
+  P4DIR = 0xfd;\\r
+  P4OUT = 0xFd;\\r
+  P5DIR = 0xff;\\r
+  P5OUT = 0xff;\\r
+  P6DIR = 0xff;\\r
+  P6OUT = 0x00;\r
+*/\r
+\r
+//RF Control\r
+//TelosB:  Radio CS is 38/P4.2 (to CC2420 pin31)\r
+//ApiMote: Radio CS is 28/P3.0\r
+#define SETSS P3OUT|=BIT0\r
+#define CLRSS P3OUT&=~BIT0\r
+#define DIRSS P3DIR|=BIT0\r
+\r
+//CC2420 Chip Enable\r
+//TelosB:  Radio RESETn is 42/P4.6 (to CC2420 pin21)\r
+//ApiMote: Radio RESETn is 27/P2.7 (to CC2420 pin21)\r
+#define SETCE P2OUT|=BIT7\r
+#define CLRCE P2OUT&=~BIT7\r
+#define DIRCE P2DIR|=BIT7\r
+\r
+//CC2420 signals\r
+#define SFD   (P2IN&BIT6) //TelosB 37/P4.1 -> ApiMote 26/P2.6\r
+#define FIFOP (P2IN&BIT4) //TelosB 12/P1.0 -> ApiMote 24/P2.4 (rf_pkt cc2420-29)\r
+#define FIFO  (P2IN&BIT3) //TelosB 15/P1.3 -> ApiMote 23/P2.3 (rf_gio0 cc2420-30)\r
+\r
+// network byte order converters\r
+#define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \\r
+                                (((uint16_t)(x) & 0x00FF) << 8))\r
+#define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \\r
+                                 (((uint32_t)(x) & 0x00FF0000) >> 8) | \\r
+                                 (((uint32_t)(x) & 0x0000FF00) << 8) | \\r
+                                 (((uint32_t)(x) & 0x000000FF) << 24))\r
+\r
+#define ntohs htons\r
+#define ntohl htonl\r
+\r
index 8fb2857..56595ab 100644 (file)
 #define SPIIN  P3IN
 #define SPIREN P3REN
 
 #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
 
 /* For the radio to be used:
    4.6 (!RST) must be low