Apimote patch. I think this works.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 24 Jul 2012 03:12:57 +0000 (03:12 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 24 Jul 2012 03:12:57 +0000 (03:12 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1206 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/apps/radios/ccspi.c
firmware/config.mk
firmware/platforms/apimote.h [new file with mode: 0644]
firmware/platforms/apimote1.h [deleted file]

index 6df0458..54b155c 100644 (file)
@@ -50,12 +50,14 @@ void ccspisetup(){
   DIRSS;
   DIRCE;
 
   DIRSS;
   DIRCE;
 
-  P4OUT|=BIT5; //activate CC2420 voltage regulator
+  //P4OUT|=BIT5; //activate CC2420 voltage regulator
   msdelay(100);
 
   //Reset the CC2420.
   msdelay(100);
 
   //Reset the CC2420.
-  P4OUT&=~BIT6;
-  P4OUT|=BIT6;
+  /*P4OUT&=~BIT6; FIXME Does the new code work on Z1 and Telosb?
+    P4OUT|=BIT6;*/ 
+  CLRCE;
+  SETCE;
 
   //Begin a new transaction.
   CLRSS;
 
   //Begin a new transaction.
   CLRSS;
@@ -362,8 +364,8 @@ void ccspi_handle_fn( uint8_t const app,
         //TODO disable AUTOCRC here again to go back to promiscous mode
 
         //Turn off LED 2 (green) as signal
         //TODO disable AUTOCRC here again to go back to promiscous mode
 
         //Turn off LED 2 (green) as signal
-           PLED2DIR |= PLED2PIN;
-           PLED2OUT |= PLED2PIN;
+       PLED2DIR |= PLED2PIN;
+       PLED2OUT |= PLED2PIN;
     }
     //TODO the firmware stops staying in this mode after a while, and stops jamming... need to find a fix.
 #else
     }
     //TODO the firmware stops staying in this mode after a while, and stops jamming... need to find a fix.
 #else
index a59ab27..76c118f 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),apimote1))
+ifneq (,$(findstring $(board),apimote))
 mcu ?= msp430f2618
 mcu ?= msp430f2618
-platform := apimote1
+platform := apimote
 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
diff --git a/firmware/platforms/apimote.h b/firmware/platforms/apimote.h
new file mode 100644 (file)
index 0000000..63a8a0a
--- /dev/null
@@ -0,0 +1,93 @@
+/*! \file apimote.h\r
+  \author Ryan Speers\r
+  \brief Port descriptions for the Apimote platform.\r
+*/\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
+\r
+#define INITPLATFORM \\r
+  P2DIR |= BIT0+BIT7; \\r
+  P2OUT &= ~BIT7; \\r
+  P2OUT |= BIT0; \\r
+  P3DIR |= BIT0;\r
+\r
+  /*\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
+\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
deleted file mode 100755 (executable)
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