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);
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
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
if(i%0x100==0):
print "%04x" % i;
-
+if(sys.argv[1]=="testleds"):
+ client.testleds();
#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
#define MONITOR_WRITEBUF 0xC1
#define MONITOR_SIZEBUF 0xC2
+#define MONITOR_LEDTEST 0xD0
+
extern app_t const monitor_app;
#endif // MONITOR_H
#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
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;
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
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
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
+++ /dev/null
-/*! \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
--- /dev/null
+/*! \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
#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