From a9021e12779463f37bfebec8cacd9e8dd7643b69 Mon Sep 17 00:00:00 2001 From: rmspeers Date: Wed, 25 Jul 2012 11:18:37 +0000 Subject: [PATCH] Changed so apimote is refered to as board=apimote1 to support future versioning. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1208 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFET.py | 5 +- firmware/config.mk | 4 +- firmware/platforms/README.txt | 8 +-- firmware/platforms/apimote1.h | 120 ++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 8 deletions(-) create mode 100755 firmware/platforms/apimote1.h diff --git a/client/GoodFET.py b/client/GoodFET.py index e6ca933..23a147f 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); @@ -672,11 +672,12 @@ class GoodFET: def testleds(self): print "Flashing LEDs" - self.writecmd(self.MONITORAPP,0xD0,0,""); + self.writecmd(self.MONITORAPP,0xD0,0,"") try: print "Flashed %d LED." % ord(self.data) except: print "Unable to process response:", self.data + return 1 def monitor_list_apps(self, full=False): self.monitor_info() 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/platforms/README.txt b/firmware/platforms/README.txt index da63e90..0d42841 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) +goodfet.h GoodFET hardware and neighborly clones. +telosb.h MSP430F1612-based Telos B and its clones. +z1.h Zolertia Z1, an MSP430F2617 mote. +apimote1.h Api-Mote (802.15.4/ZigBee enabled GoodFET) (board rev 1) TODO: TRF7960 Dev Board diff --git a/firmware/platforms/apimote1.h b/firmware/platforms/apimote1.h new file mode 100755 index 0000000..ddea8f2 --- /dev/null +++ b/firmware/platforms/apimote1.h @@ -0,0 +1,120 @@ +/*! \file apimote.h + \author Ryan Speers + \brief Port descriptions for the Apimote platform. +*/ + +#ifndef _GNU_ASSEMBLER_ +#include +#endif + +//LED on P5.5 (pin 49) (LED1 red) +#define PLEDOUT P5OUT +#define PLEDDIR P5DIR +#define PLEDPIN BIT5 +//LED on P5.6 (pin 50) (LED2 green) +#define PLED2OUT P5OUT +#define PLED2DIR P5DIR +#define PLED2PIN BIT6 +//LED on P5.7 (pin 51) (LED3 blue) +#define PLED3OUT P5OUT +#define PLED3DIR P5DIR +#define PLED3PIN BIT7 + +//SPI +//TelosB: 29/3.1=RF_SI, 30/3.2=RF_SO, 31/3.3=RF_SCLK +//ApiMote: 29/3.1=RF_SI, 30/3.2=RF_SO, 31/3.3=RF_SCLK +#define SPIOUT P3OUT +#define SPIDIR P3DIR +#define SPIIN P3IN +#define SPIREN P3REN + +/* For the radio to be used: + 2.7 (!RST) must be low + 2.0 (VREF_EN) must be high (cc2420-41 rf_vreg) + 3.0 (!CS) must be low for the transaction. +*/ + +/* INITPLATFORM PX.7 PX.6 PX.5 PX.4 PX.3 PX.2 PX.1 PX.0 + EXP_USR NC EINT5 EINT4 EINT3 EINT2 MTXFRX EINT1 + P1DIR = 0xff 11111111 In In In In In Out In + P1OUT = 0x00 Lo + P1IE = 0xbd 10111101 Int Int Int Int Int Int + P1IE @ 025h (UGpg341) ^BSLTX + + R_RST R_SFD RGIO1 R_PKT RGIO0 MRXFTX G_RST R_VREG + P2DIR = 0x83 10000011 Out In In In In In Out Out + P2OUT = 0x81 10000001 Hi Lo Lo? Hi + ^BSLRX + + MRXFTXMTXFRX G_RX G_TX RSCLK R_SO R_SI RF_CSn + P3DIR = 0x5b 01011011 In Out In Out Out In Out? Out + P3OUT = 0x Lo Lo Lo? Lo? Lo Lo Lo Hi + P3SEL = 0xff 11111111 Pri Pri Pri Pri Pri Pri Pri Pri + P3SEL2= 0x00 + (SEL2=0,SEL=1: Primary Peripheral Func; 1,1: Secondary Peripheral) + + G_TST NC F_CSn FHold R_ANT NC NC NC + P4DIR = 0xff 11111111 Out Out Out Out + P4OUT = 0x30 00110000 Lo? Hi Hi Lo + + LED3 LED2 LED1 NC GSCLK G_SD G_SI G_CSn + P5DIR = 0xfb 11111011 Out Out Out Out In Out Out + P5OUT = 0x80 10000000 Hi Hi Hi Lo? Lo? Lo? + + ADC5 ADC4 ADC3 ADC2 ADC1 NC BADC2 BADC1 + P6DIR = 0xc7 11000111 Out Out In In In Out Out + P6OUT = 0x00 Lo Lo Lo Lo +*/ + +#define INITPLATFORM \ + P2DIR |= BIT0+BIT7; \ + P2OUT &= ~BIT7; \ + P2OUT |= BIT0; \ + P3DIR |= BIT0; + + /* + P1DIR = 0xe0;\ + P1OUT = 0x00;\ + P2DIR = 0x7b;\ + P2OUT = 0x10;\ + P3DIR = 0xf1;\ + P3OUT = 0x00;\ + P4DIR = 0xfd;\ + P4OUT = 0xFd;\ + P5DIR = 0xff;\ + P5OUT = 0xff;\ + P6DIR = 0xff;\ + P6OUT = 0x00; + */ + + +//RF Control +//TelosB: Radio CS is 38/P4.2 (to CC2420 pin31) +//ApiMote: Radio CS is 28/P3.0 +#define SETSS P3OUT|=BIT0 +#define CLRSS P3OUT&=~BIT0 +#define DIRSS P3DIR|=BIT0 + +//CC2420 Chip Enable +//TelosB: Radio RESETn is 42/P4.6 (to CC2420 pin21) +//ApiMote: Radio RESETn is 27/P2.7 (to CC2420 pin21) +#define SETCE P2OUT|=BIT7 +#define CLRCE P2OUT&=~BIT7 +#define DIRCE P2DIR|=BIT7 + +//CC2420 signals +#define SFD (P2IN&BIT6) //TelosB 37/P4.1 -> ApiMote 26/P2.6 +#define FIFOP (P2IN&BIT4) //TelosB 12/P1.0 -> ApiMote 24/P2.4 (rf_pkt cc2420-29) +#define FIFO (P2IN&BIT3) //TelosB 15/P1.3 -> ApiMote 23/P2.3 (rf_gio0 cc2420-30) + +// network byte order converters +#define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \ + (((uint16_t)(x) & 0x00FF) << 8)) +#define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \ + (((uint32_t)(x) & 0x00FF0000) >> 8) | \ + (((uint32_t)(x) & 0x0000FF00) << 8) | \ + (((uint32_t)(x) & 0x000000FF) << 24)) + +#define ntohs htons +#define ntohl htonl + -- 2.20.1