From 8d07c01085a78aec70f3b11f94bfe252bf35a991 Mon Sep 17 00:00:00 2001 From: Antonio Lignan Date: Wed, 29 Jun 2016 16:30:13 +0200 Subject: [PATCH] boards/remote: added revision A and remote-common folder --- boards/{remote => remote-common}/Makefile | 2 +- .../Makefile.include | 11 +- .../{remote => remote-common}/dist/debug.sh | 0 .../{remote => remote-common}/dist/flash.sh | 0 .../{remote => remote-common}/dist/reset.sh | 0 boards/remote-common/include/board_common.h | 96 ++++++++ boards/remote-common/include/fancy_leds.h | 67 ++++++ boards/remote-common/include/periph_common.h | 92 ++++++++ boards/remote-pa/Makefile | 5 + .../{remote => remote-pa}/Makefile.features | 0 boards/remote-pa/Makefile.include | 7 + boards/{remote => remote-pa}/README.md | 14 +- boards/{remote => remote-pa}/board.c | 6 + boards/{remote => remote-pa}/include/board.h | 32 +-- .../include/periph_conf.h | 64 +----- boards/remote-reva/Makefile | 5 + boards/remote-reva/Makefile.features | 14 ++ boards/remote-reva/Makefile.include | 7 + boards/remote-reva/README.md | 111 +++++++++ boards/remote-reva/board.c | 70 ++++++ boards/remote-reva/include/board.h | 111 +++++++++ boards/remote-reva/include/periph_conf.h | 212 ++++++++++++++++++ 22 files changed, 824 insertions(+), 102 deletions(-) rename boards/{remote => remote-common}/Makefile (60%) rename boards/{remote => remote-common}/Makefile.include (82%) rename boards/{remote => remote-common}/dist/debug.sh (100%) rename boards/{remote => remote-common}/dist/flash.sh (100%) rename boards/{remote => remote-common}/dist/reset.sh (100%) create mode 100644 boards/remote-common/include/board_common.h create mode 100644 boards/remote-common/include/fancy_leds.h create mode 100644 boards/remote-common/include/periph_common.h create mode 100644 boards/remote-pa/Makefile rename boards/{remote => remote-pa}/Makefile.features (100%) create mode 100644 boards/remote-pa/Makefile.include rename boards/{remote => remote-pa}/README.md (89%) rename boards/{remote => remote-pa}/board.c (95%) rename boards/{remote => remote-pa}/include/board.h (73%) rename boards/{remote => remote-pa}/include/periph_conf.h (74%) create mode 100644 boards/remote-reva/Makefile create mode 100644 boards/remote-reva/Makefile.features create mode 100644 boards/remote-reva/Makefile.include create mode 100644 boards/remote-reva/README.md create mode 100644 boards/remote-reva/board.c create mode 100644 boards/remote-reva/include/board.h create mode 100644 boards/remote-reva/include/periph_conf.h diff --git a/boards/remote/Makefile b/boards/remote-common/Makefile similarity index 60% rename from boards/remote/Makefile rename to boards/remote-common/Makefile index f8fcbb53a0..d21fafef89 100644 --- a/boards/remote/Makefile +++ b/boards/remote-common/Makefile @@ -1,3 +1,3 @@ -MODULE = board +MODULE = remote-common include $(RIOTBASE)/Makefile.base diff --git a/boards/remote/Makefile.include b/boards/remote-common/Makefile.include similarity index 82% rename from boards/remote/Makefile.include rename to boards/remote-common/Makefile.include index 452a14daed..49569ea29e 100644 --- a/boards/remote/Makefile.include +++ b/boards/remote-common/Makefile.include @@ -1,10 +1,6 @@ -# define the cpu used by the Re-mote board +# define the cpu used by the RE-mote board export CPU = cc2538 -export CPU_MODEL = cc2538sf53 - -# define the default port depending on the host OS -PORT_LINUX ?= /dev/ttyUSB1 -PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*))) +export CPU_MODEL = cc2538sf53 # define the default flash-tool export PROGRAMMER ?= cc2538-bsl @@ -32,5 +28,8 @@ export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) export RESET_FLAGS = $(BINDIR) export OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb +# include remote-common includes +export INCLUDES += -I$(RIOTBOARD)/remote-common/include + # setup serial terminal include $(RIOTBOARD)/Makefile.include.serial diff --git a/boards/remote/dist/debug.sh b/boards/remote-common/dist/debug.sh similarity index 100% rename from boards/remote/dist/debug.sh rename to boards/remote-common/dist/debug.sh diff --git a/boards/remote/dist/flash.sh b/boards/remote-common/dist/flash.sh similarity index 100% rename from boards/remote/dist/flash.sh rename to boards/remote-common/dist/flash.sh diff --git a/boards/remote/dist/reset.sh b/boards/remote-common/dist/reset.sh similarity index 100% rename from boards/remote/dist/reset.sh rename to boards/remote-common/dist/reset.sh diff --git a/boards/remote-common/include/board_common.h b/boards/remote-common/include/board_common.h new file mode 100644 index 0000000000..c71d8fb728 --- /dev/null +++ b/boards/remote-common/include/board_common.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2015 Zolertia SL + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License v2.1. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @ingroup boards_remote + * @brief Support for the RE-Mote boards + * @{ + * + * @file + * @brief Board specific definitions for the RE-Mote boards + * + * @author Hauke Petersen + * Antonio Lignan + */ + +#ifndef BOARD_COMMON__H +#define BOARD_COMMON__H + +#include "cpu.h" +#include "periph/gpio.h" +#include "periph/spi.h" + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @name Macros for controlling the on-board RGB LEDs + * @{ + */ +#define LED_ALL_OFF LED0_OFF; \ + LED1_OFF; \ + LED2_OFF +/* Output is color white */ +#define LED_ALL_ON LED0_ON; \ + LED1_ON; \ + LED2_ON + +/* Yellow */ +#define LED3_ON LED2_OFF; \ + LED0_ON; \ + LED1_ON +#define LED3_OFF LED1_OFF; \ + LED0_OFF +#define LED3_TOGGLE LED1_TOGGLE; \ + LED0_TOGGLE + +/* Purple */ +#define LED4_ON LED1_OFF; \ + LED2_ON; \ + LED0_ON +#define LED4_OFF LED2_OFF; \ + LED0_OFF +#define LED4_TOGGLE LED2_TOGGLE; \ + LED0_TOGGLE +/** @} */ + +/** + * @name Flash Customer Configuration Area (CCA) parameters + * @{ + */ +#ifndef UPDATE_CCA +#define UPDATE_CCA (1) +#endif +#define CCA_BACKDOOR_ENABLE (1) +#define CCA_BACKDOOR_PORT_A_PIN (3) /**< Select button */ +#define CCA_BACKDOOR_ACTIVE_LEVEL (0) /**< Active low */ +/** @} */ + +/** + * @name xtimer configuration + * @{ + */ +#define XTIMER TIMER_0 +#define XTIMER_CHAN (0) +#define XTIMER_SHIFT (-4) +#define XTIMER_BACKOFF (50) +#define XTIMER_ISR_BACKOFF (40) +/** @} */ + +/** + * @brief Initialize board specific hardware + */ +void board_init(void); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif +#endif /* BOARD_COMMON__H */ +/** @} */ diff --git a/boards/remote-common/include/fancy_leds.h b/boards/remote-common/include/fancy_leds.h new file mode 100644 index 0000000000..d152f8a010 --- /dev/null +++ b/boards/remote-common/include/fancy_leds.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2015 Zolertia SL + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License v2.1. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @ingroup boards_remote + * @brief LED extension + * @{ + * + * @file + * @brief LED extended functions + * + * @author Antonio Lignan + */ + +#ifndef FANCY_LEDS_H_ +#define FANCY_LEDS_H_ + +#include "board_common.h" + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @name Macro to create blinking and rainbows with the LEDs + * @{ + */ +/* Take LED_COLOR as argument, i.e LED0 */ +#define LED_FADE(led) \ + volatile int i; \ + int k, j; \ + LED_FADE_EXPAND(led) + +#define LED_FADE_EXPAND(led) \ + for(k = 0; k < 800; ++k) { \ + j = k > 400 ? 800 - k : k; \ + led##_ON; \ + for(i = 0; i < j; ++i) { \ + asm("nop"); \ + } \ + led##_OFF; \ + for(i = 0; i < 400 - j; ++i) { \ + asm("nop"); \ + } \ + } + +#define LED_RAINBOW() \ + volatile int i; \ + int k,j; \ + LED_FADE_EXPAND(LED3); \ + LED_FADE_EXPAND(LED0); \ + LED_FADE_EXPAND(LED4); \ + LED_FADE_EXPAND(LED2); \ + LED_FADE_EXPAND(LED1); +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif +#endif /* FANCY_LEDS_H_ */ +/** @} */ diff --git a/boards/remote-common/include/periph_common.h b/boards/remote-common/include/periph_common.h new file mode 100644 index 0000000000..811be23abe --- /dev/null +++ b/boards/remote-common/include/periph_common.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2015 Zolertia SL + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License v2.1. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @ingroup boards_remote + * @{ + * + * @file + * @brief Peripheral MCU configuration for the Re-Mote boards + * + * @author Hauke Petersen + * Antonio Lignan + */ + +#ifndef PERIPH_COMMON_H_ +#define PERIPH_COMMON_H_ + +#include "cc2538_gpio.h" +#include "periph_cpu.h" + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @name Clock system configuration + * @{ + */ +#define CLOCK_CORECLOCK (32000000U) /* 32MHz */ +/** @} */ + +/** + * @name Timer configuration + * @{ + */ +#define TIMER_NUMOF (4U) +#define TIMER_0_EN 1 +#define TIMER_1_EN 1 +#define TIMER_2_EN 1 +#define TIMER_3_EN 1 + +#define TIMER_IRQ_PRIO 1 + +/* Timer 0 configuration */ +#define TIMER_0_DEV GPTIMER0 +#define TIMER_0_CHANNELS 1 +#define TIMER_0_MAX_VALUE 0xffffffff +#define TIMER_0_IRQn_1 GPTIMER_0A_IRQn +#define TIMER_0_IRQn_2 GPTIMER_0B_IRQn +#define TIMER_0_ISR_1 isr_timer0_chan0 +#define TIMER_0_ISR_2 isr_timer0_chan1 + +/* Timer 1 configuration */ +#define TIMER_1_DEV GPTIMER1 +#define TIMER_1_CHANNELS 1 +#define TIMER_1_MAX_VALUE 0xffffffff +#define TIMER_1_IRQn_1 GPTIMER_1A_IRQn +#define TIMER_1_IRQn_2 GPTIMER_1B_IRQn +#define TIMER_1_ISR_1 isr_timer1_chan0 +#define TIMER_1_ISR_2 isr_timer1_chan1 + +/* Timer 2 configuration */ +#define TIMER_2_DEV GPTIMER2 +#define TIMER_2_CHANNELS 1 +#define TIMER_2_MAX_VALUE 0xffffffff +#define TIMER_2_IRQn_1 GPTIMER_2A_IRQn +#define TIMER_2_IRQn_2 GPTIMER_2B_IRQn +#define TIMER_2_ISR_1 isr_timer2_chan0 +#define TIMER_2_ISR_2 isr_timer2_chan1 + +/* Timer 3 configuration */ +#define TIMER_3_DEV GPTIMER3 +#define TIMER_3_CHANNELS 1 +#define TIMER_3_MAX_VALUE 0xffffffff +#define TIMER_3_IRQn_1 GPTIMER_3A_IRQn +#define TIMER_3_IRQn_2 GPTIMER_3B_IRQn +#define TIMER_3_ISR_1 isr_timer3_chan0 +#define TIMER_3_ISR_2 isr_timer3_chan1 +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* PERIPH_COMMON_H_ */ +/** @} */ diff --git a/boards/remote-pa/Makefile b/boards/remote-pa/Makefile new file mode 100644 index 0000000000..3e20e72e8c --- /dev/null +++ b/boards/remote-pa/Makefile @@ -0,0 +1,5 @@ +MODULE = board + +DIRS = $(RIOTBOARD)/remote-common + +include $(RIOTBASE)/Makefile.base diff --git a/boards/remote/Makefile.features b/boards/remote-pa/Makefile.features similarity index 100% rename from boards/remote/Makefile.features rename to boards/remote-pa/Makefile.features diff --git a/boards/remote-pa/Makefile.include b/boards/remote-pa/Makefile.include new file mode 100644 index 0000000000..07172fd9c0 --- /dev/null +++ b/boards/remote-pa/Makefile.include @@ -0,0 +1,7 @@ +USEMODULE += remote-common + +# define the default port depending on the host OS +PORT_LINUX ?= /dev/ttyUSB1 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*))) + +include $(RIOTBOARD)/remote-common/Makefile.include diff --git a/boards/remote/README.md b/boards/remote-pa/README.md similarity index 89% rename from boards/remote/README.md rename to boards/remote-pa/README.md index 45df38d075..62018b55be 100644 --- a/boards/remote/README.md +++ b/boards/remote-pa/README.md @@ -1,11 +1,11 @@ -Zolertia Re-Mote platform +Zolertia RE-Mote platform ============================================ -The Re-Mote platform is a IoT Hardware development platform based on TI's CC2538 -system on chip (SoC), featuring an ARM Cortex-M3 with 512KB flash, 32Kb RAM, -double RF interface, and the following goodies: +The RE-Mote platform (prototype A) is a IoT Hardware development platform based +on TI's CC2538 system on chip (SoC), featuring an ARM Cortex-M3 with 512KB +flash, 32Kb RAM, double RF interface, and the following goodies: * ISM 2.4-GHz IEEE 802.15.4 & Zigbee compliant. * ISM 868-, 915-, 920-, 950-MHz ISM/SRD Band. @@ -18,6 +18,9 @@ double RF interface, and the following goodies: * Built-in TMP102 temperature sensor * Small form-factor (as the Z1 mote, half the size of an Arduino) 57x35 mm. +This version was the first RE-Mote prototype, available to select users and beta +testers. A commercially available new model (namely the Revision A) is also +ported to RIOT. Port Features ============= @@ -36,7 +39,6 @@ In terms of hardware support, the following drivers have been implemented: And under work or pending at cc2538 base cpu: * RF 2.4GHz built-in in CC2538 (PR #2198) - * SPI/I2C library * Built-in core temperature and battery sensor. * TMP102 temperature sensor driver. * CC1120 sub-1GHz radio interface. @@ -108,10 +110,8 @@ On Linux: More Reading ============ -1. [Zolertia Re-Mote website][remote-site] 2. [CC2538 System-on-Chip Solution for 2.4-GHz IEEE 802.15.4 and ZigBee applications (SWRU319B)][cc2538] 3. [CC1120 sub-1GHz RF transceiver][cc1120] -[remote-site]: http://www.zolertia.io/products "Zolertia Re-Mote" [cc1120]: http://www.ti.com/cc1120 "CC1120" [cc2538]: http://www.ti.com/product/cc2538 "CC2538" diff --git a/boards/remote/board.c b/boards/remote-pa/board.c similarity index 95% rename from boards/remote/board.c rename to boards/remote-pa/board.c index 010e8b0e66..107d4e7dab 100644 --- a/boards/remote/board.c +++ b/boards/remote-pa/board.c @@ -22,6 +22,7 @@ #include "board.h" #include "cpu.h" +#include "fancy_leds.h" static inline void rf_switch_init(void); @@ -31,10 +32,15 @@ void board_init(void) gpio_init(LED0_PIN, GPIO_OUT); gpio_init(LED1_PIN, GPIO_OUT); gpio_init(LED2_PIN, GPIO_OUT); + /* initialize the CPU */ cpu_init(); + /* initialize the 2.4GHz RF switch */ rf_switch_init(); + + /* Shoot rainbows */ + LED_RAINBOW(); } /** diff --git a/boards/remote/include/board.h b/boards/remote-pa/include/board.h similarity index 73% rename from boards/remote/include/board.h rename to boards/remote-pa/include/board.h index ce258db8fb..c50d41648b 100644 --- a/boards/remote/include/board.h +++ b/boards/remote-pa/include/board.h @@ -10,11 +10,11 @@ /** * @defgroup board_remote Re-Mote * @ingroup boards - * @brief Support for the Re-Mote board + * @brief Support for the Re-Mote board prototype A * @{ * * @file - * @brief Board specific definitions for the Re-Mote board + * @brief Board specific definitions for the Re-Mote board prototype A * * @author Hauke Petersen * Antonio Lignan @@ -25,6 +25,7 @@ #include "cpu.h" #include "periph/gpio.h" +#include "board_common.h" #ifdef __cplusplus extern "C" { @@ -55,17 +56,6 @@ #define LED2_TOGGLE (GPIO_C->DATA ^= LED2_MASK) /** @} */ -/** - * @name Flash Customer Configuration Area (CCA) parameters - * @{ - */ -#ifndef UPDATE_CCA -#define UPDATE_CCA 1 -#endif -#define CCA_BACKDOOR_ENABLE 1 -#define CCA_BACKDOOR_PORT_A_PIN 3 /**< Select button */ -#define CCA_BACKDOOR_ACTIVE_LEVEL 0 /**< Active low */ -/** @} */ /** * @name 2.4GHz RF switch controlled by SW * @{ @@ -77,22 +67,6 @@ #define RF_SWITCH_TOGGLE (RF_SWITCH_PORT->DATA ^= (1 << RF_SWITCH_PIN)) /** @} */ -/** - * @name xtimer configuration - * @{ - */ -#define XTIMER TIMER_0 -#define XTIMER_CHAN (0) -#define XTIMER_SHIFT (-4) -#define XTIMER_BACKOFF (50) -#define XTIMER_ISR_BACKOFF (40) -/** @} */ - -/** - * @brief Initialize board specific hardware, including clock, LEDs and std-IO - */ -void board_init(void); - #ifdef __cplusplus } /* end extern "C" */ #endif diff --git a/boards/remote/include/periph_conf.h b/boards/remote-pa/include/periph_conf.h similarity index 74% rename from boards/remote/include/periph_conf.h rename to boards/remote-pa/include/periph_conf.h index 7323b0ec38..8a5bc20400 100644 --- a/boards/remote/include/periph_conf.h +++ b/boards/remote-pa/include/periph_conf.h @@ -12,7 +12,7 @@ * @{ * * @file - * @brief Peripheral MCU configuration for the Re-Mote board + * @brief Peripheral MCU configuration for the Re-Mote board prototype A * * @author Hauke Petersen * Antonio Lignan @@ -23,67 +23,12 @@ #include "cc2538_gpio.h" #include "periph_cpu.h" +#include "periph_common.h" #ifdef __cplusplus extern "C" { #endif -/** - * @name Clock system configuration - * @{ - */ -#define CLOCK_CORECLOCK (32000000U) /* 32MHz */ -/** @} */ - -/** - * @name Timer configuration - * @{ - */ -#define TIMER_NUMOF (4U) -#define TIMER_0_EN 1 -#define TIMER_1_EN 1 -#define TIMER_2_EN 1 -#define TIMER_3_EN 1 - -#define TIMER_IRQ_PRIO 1 - -/* Timer 0 configuration */ -#define TIMER_0_DEV GPTIMER0 -#define TIMER_0_CHANNELS 1 -#define TIMER_0_MAX_VALUE 0xffffffff -#define TIMER_0_IRQn_1 GPTIMER_0A_IRQn -#define TIMER_0_IRQn_2 GPTIMER_0B_IRQn -#define TIMER_0_ISR_1 isr_timer0_chan0 -#define TIMER_0_ISR_2 isr_timer0_chan1 - -/* Timer 1 configuration */ -#define TIMER_1_DEV GPTIMER1 -#define TIMER_1_CHANNELS 1 -#define TIMER_1_MAX_VALUE 0xffffffff -#define TIMER_1_IRQn_1 GPTIMER_1A_IRQn -#define TIMER_1_IRQn_2 GPTIMER_1B_IRQn -#define TIMER_1_ISR_1 isr_timer1_chan0 -#define TIMER_1_ISR_2 isr_timer1_chan1 - -/* Timer 2 configuration */ -#define TIMER_2_DEV GPTIMER2 -#define TIMER_2_CHANNELS 1 -#define TIMER_2_MAX_VALUE 0xffffffff -#define TIMER_2_IRQn_1 GPTIMER_2A_IRQn -#define TIMER_2_IRQn_2 GPTIMER_2B_IRQn -#define TIMER_2_ISR_1 isr_timer2_chan0 -#define TIMER_2_ISR_2 isr_timer2_chan1 - -/* Timer 3 configuration */ -#define TIMER_3_DEV GPTIMER3 -#define TIMER_3_CHANNELS 1 -#define TIMER_3_MAX_VALUE 0xffffffff -#define TIMER_3_IRQn_1 GPTIMER_3A_IRQn -#define TIMER_3_IRQn_2 GPTIMER_3B_IRQn -#define TIMER_3_ISR_1 isr_timer3_chan0 -#define TIMER_3_ISR_2 isr_timer3_chan1 -/** @} */ - /** * @name UART configuration * @{ @@ -99,6 +44,7 @@ /* UART 0 pin configuration */ #define UART_0_TX_PIN GPIO_PA1 #define UART_0_RX_PIN GPIO_PA0 + /** @} */ /** @@ -118,8 +64,8 @@ static const i2c_conf_t i2c_config[I2C_NUMOF] = { { - .scl_pin = GPIO_PC3, - .sda_pin = GPIO_PC2, + .scl_pin = I2C_0_SCL_PIN, + .sda_pin = I2C_0_SDA_PIN, }, }; /** @} */ diff --git a/boards/remote-reva/Makefile b/boards/remote-reva/Makefile new file mode 100644 index 0000000000..3e20e72e8c --- /dev/null +++ b/boards/remote-reva/Makefile @@ -0,0 +1,5 @@ +MODULE = board + +DIRS = $(RIOTBOARD)/remote-common + +include $(RIOTBASE)/Makefile.base diff --git a/boards/remote-reva/Makefile.features b/boards/remote-reva/Makefile.features new file mode 100644 index 0000000000..819901ddc8 --- /dev/null +++ b/boards/remote-reva/Makefile.features @@ -0,0 +1,14 @@ +# Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_cpuid +FEATURES_PROVIDED += periph_gpio +FEATURES_PROVIDED += periph_hwrng +FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_spi +FEATURES_PROVIDED += periph_timer +FEATURES_PROVIDED += periph_uart + +# Various other features (if any) +FEATURES_PROVIDED += cpp + +# The board MPU family (used for grouping by the CI system) +FEATURES_MCU_GROUP = cortex_m3_2 diff --git a/boards/remote-reva/Makefile.include b/boards/remote-reva/Makefile.include new file mode 100644 index 0000000000..9072c84120 --- /dev/null +++ b/boards/remote-reva/Makefile.include @@ -0,0 +1,7 @@ +USEMODULE += remote-common + +# define the default port depending on the host OS +PORT_LINUX ?= /dev/ttyUSB0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) + +include $(RIOTBOARD)/remote-common/Makefile.include diff --git a/boards/remote-reva/README.md b/boards/remote-reva/README.md new file mode 100644 index 0000000000..d34cb85605 --- /dev/null +++ b/boards/remote-reva/README.md @@ -0,0 +1,111 @@ +Zolertia RE-Mote platform +============================================ + +The RE-Mote platform (Revision A) is a IoT Hardware development platform based +on TI's CC2538 system on chip (SoC), featuring an ARM Cortex-M3 with 512KB +flash, 32Kb RAM, double RF interface (Sub-1GHz CC1200 RF transceiver), and the +following goodies: + +* ISM 2.4-GHz IEEE 802.15.4 & Zigbee compliant. +* ISM 868-, 915-, 920-, 950-MHz ISM/SRD Band. +* AES-128/256, SHA2 Hardware Encryption Engine. +* ECC-128/256, RSA Hardware Acceleration Engine for Secure Key Exchange. +* Power consumption down to 150nA using our shutdown mode. +* Flashing over BSL without requiring to press any button to enter bootloader mode. +* Built-in battery charger (500mA), Energy Harvesting and Solar Panels to be connected to standards LiPo batteries. +* Power input with wide range 3.7-16VDC. + +Port Features +============= +In terms of hardware support, the following drivers have been implemented: + + * CC2538 System-on-Chip: + * UART + * Random number generator + * Low Power Modes + * General-Purpose Timers + * I2C/SPI library + * LEDs + * Buttons + * RF switch to programatically drive either 2.4GHz or sub-1GHz to a single RP-SMA + +And under work or pending at cc2538 base cpu: + + * RF 2.4GHz built-in in CC2538 + * Built-in core temperature and battery sensor. + * CC1200 sub-1GHz radio interface. + * Micro-SD external storage. + * ADC + * USB (in CDC-ACM). + * uDMA Controller. + +Requirements +============ + + * Toolchain to compile RIOT for the CC2538 + * Drivers to enable your host to communicate with the platform + * Built-in BSL programming over USB using cc2538-bsl (included) + + +Install a Toolchain +------------------- +The toolchain used to build is arm-gcc, to check if it is currently installed run: + + $ arm-none-eabi-gcc -v + Using built-in specs. + Target: arm-none-eabi + Configured with: /scratch/julian/lite-respin/eabi/src/gcc-4.3/configure + ... + (skip) + ... + Thread model: single + gcc version 4.3.2 (Sourcery G++ Lite 2008q3-66) + +Else install from + + +Drivers +------- +The RE-Mote features a CP2104 serial-to-USB module, the driver is commonly found in most OS, but if required it can be downloaded +from + + +### For the CC2538EM (USB CDC-ACM) +The RE-Mote has built-in support for USB 2.0 USB, Vendor and Product IDs are the following: + + * VID 0x0451 + * PID 0x16C8 + +On Linux and OS X this is straightforward, on windows you need to install the following driver: + + + +And replace the IDs accordingly. + +### Device Enumerations +For the UART, serial line settings are 115200 8N1, no flow control. + +Once all drivers have been installed correctly: + +On windows, devices will appear as a virtual `COM` port. + +On Linux, devices will appear under `/dev/`. + +On OS X, `/dev/tty.SLAB_USBtoUARTx`. + +On Linux: + +* RE-Mote over CP2104: `ttyUSB0` +* RE-Mote over USB driver (in CDC-ACM): `ttyACMn` (n=0, 1, ....) + +More Reading +============ +1. [Zolertia RE-Mote website][remote-site] +2. [Zolertia Wiki page][zolertia-wiki] +2. [CC2538 System-on-Chip Solution for 2.4-GHz IEEE 802.15.4 and ZigBee applications (SWRU319B)][cc2538] +3. [CC1200 sub-1GHz RF transceiver][cc1200] + +[remote-site]: http://www.zolertia.io/products "Zolertia RE-Mote" +[zolertia-wiki]: https://github.com/Zolertia/Resources/wiki +[cc1200]: http://www.ti.com/product/cc1200 "CC1200" +[cc2538]: http://www.ti.com/product/cc2538 "CC2538" diff --git a/boards/remote-reva/board.c b/boards/remote-reva/board.c new file mode 100644 index 0000000000..d5a60c8aa3 --- /dev/null +++ b/boards/remote-reva/board.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2015 Zolertia SL + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License v2.1. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @defgroup boards_remote + * @ingroup boards + * @{ + * + * @file + * @brief Board specific implementations for the RE-Mote revision A board + * + * @author Hauke Petersen + * Antonio Lignan + * + * @} + */ + +#include "board.h" +#include "cpu.h" +#include "fancy_leds.h" + +static inline void leds_init(void); +static inline void rf_switch_init(void); + +void board_init(void) +{ + /* initialize the boards LEDs */ + leds_init(); + /* initialize the CPU */ + cpu_init(); + /* initialize the 2.4GHz RF switch */ + rf_switch_init(); +} + +/** + * @brief Initialize the boards on-board LEDs + * + * The LED initialization is hard-coded in this function. As the LED (RGB) are + * soldered onto the board they are fixed to their CPU pins. + */ +static inline void leds_init(void) +{ + gpio_init(LED0_PIN, GPIO_OUT); + gpio_init(LED1_PIN, GPIO_OUT); + gpio_init(LED2_PIN, GPIO_OUT); + + /* Shoot rainbows */ + LED_RAINBOW(); +} + +/** + * @brief Initialize the Radio interface SW-controlled Switch + * + * The RE-Mote features an on-board RF switch to programatically select to + * enable either the 2.4GHz or Sub-1GHz RF interface to the RP-SMA connector + * to use an external antenna. As default we prefer to use the 2.4GHz RF. + * + */ +static void rf_switch_init(void) +{ + /* Set RF 2.4GHz as default */ + gpio_init(RF_SWITCH_GPIO, GPIO_OUT); + RF_SWITCH_2_4_GHZ; +} diff --git a/boards/remote-reva/include/board.h b/boards/remote-reva/include/board.h new file mode 100644 index 0000000000..48fddb18c4 --- /dev/null +++ b/boards/remote-reva/include/board.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2015 Zolertia SL + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License v2.1. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @ingroup boards_remote + * @brief Support for the RE-Mote board Revision A + * @{ + * + * @file + * @brief Board specific definitions for the RE-Mote board Revision A + * + * @author Hauke Petersen + * Antonio Lignan + */ + +#ifndef BOARD_H_ +#define BOARD_H_ + +#include "cpu.h" +#include "periph/gpio.h" +#include "periph/spi.h" +#include "board_common.h" + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @name LED pin definitions + * @{ + */ +#define LED0_PIN GPIO_PD5 +#define LED1_PIN GPIO_PD4 +#define LED2_PIN GPIO_PD3 + +#define LED0_MASK (1 << 5) +#define LED1_MASK (1 << 4) +#define LED2_MASK (1 << 3) + +#define LED0_ON (GPIO_D->DATA |= LED0_MASK) +#define LED0_OFF (GPIO_D->DATA &= ~LED0_MASK) +#define LED0_TOGGLE (GPIO_D->DATA ^= LED0_MASK) + +#define LED1_ON (GPIO_D->DATA |= LED1_MASK) +#define LED1_OFF (GPIO_D->DATA &= ~LED1_MASK) +#define LED1_TOGGLE (GPIO_D->DATA ^= LED1_MASK) + +#define LED2_ON (GPIO_D->DATA |= LED2_MASK) +#define LED2_OFF (GPIO_D->DATA &= ~LED2_MASK) +#define LED2_TOGGLE (GPIO_D->DATA ^= LED2_MASK) +/** @} */ + +/** + * @name RF switch controlled by SW + * @brief Controls which RF interface goes to the RP-SMA external antenna + * + * These values configure the required pin to drive the RF antenna switch, to + * either enable the sub-1Ghz RF interface (power-up the CC1200) or the 2.4GHz + * RF interface of the CC2538, both alternatively routed to a RP-SMA connector + * to allow using an external antenna for both cases. + * + * Note it is also possible to enable both RF interfaces at the same time, by + * switching On the sub-1GHz RF interface, and placing an 0Ohm resistor (R19), + * to select between using a ceramic chip antenna (not mounted), or to connect + * and external antenna over a pigtail to the U.Fl connector (not mounted). + * + * RF switch state: + * - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off. + * - HIGH: Sub-1GHz RF interface on RP-SMA connector. + * + * @{ + */ +#define RF_SWITCH_GPIO GPIO_PD2 +#define RF_SWITCH_SUB_GHZ gpio_set(RF_SWITCH_GPIO) +#define RF_SWITCH_2_4_GHZ gpio_clear(RF_SWITCH_GPIO) +#define RF_SWITCH_TOGGLE gpio_toggle(RF_SWITCH_GPIO) +/** @} */ + +/** + * @name Shutdown enable/done pins + * @{ + */ +#define SHUTDOWN_DONE_GPIO GPIO_PD0 +#define SHUTDOWN_EN_GPIO GPIO_PD1 +/** @} */ + +/** + * @name CC1200 SPI and pins definitions + * @{ + */ +#define CC1200_SPI_DEV SSI0 +#define CC1200_MOSI_GPIO GPIO_PB1 +#define CC1200_MISO_GPIO GPIO_PB3 +#define CC1200_SCLK_GPIO GPIO_PB2 +#define CC1200_CSN_GPIO GPIO_PB5 +#define CC1200_RESET_GPIO GPIO_PC7 +#define CC1200_GPD0_GPIO GPIO_PB4 +#define CC1200_GPD2_GPIO GPIO_PB0 +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif +#endif /* BOARD_H_ */ +/** @} */ diff --git a/boards/remote-reva/include/periph_conf.h b/boards/remote-reva/include/periph_conf.h new file mode 100644 index 0000000000..14f610c49e --- /dev/null +++ b/boards/remote-reva/include/periph_conf.h @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2015 Zolertia SL + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License v2.1. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @ingroup board_remote + * @{ + * + * @file + * @brief Peripheral MCU configuration for the RE-Mote board revision A + * + * @author Hauke Petersen + * Antonio Lignan + */ + +#ifndef PERIPH_CONF_H_ +#define PERIPH_CONF_H_ + +#include "cc2538_gpio.h" +#include "periph_cpu.h" +#include "periph_common.h" + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @name UART configuration + * @{ + */ +#define UART_NUMOF (1U) +#define UART_0_EN 1 +#define UART_IRQ_PRIO 1 + +/* UART 0 device configuration */ +#define UART_0_DEV UART0 +#define UART_0_IRQ UART0_IRQn +#define UART_0_ISR isr_uart0 +/* UART 0 pin configuration */ +#define UART_0_TX_PIN GPIO_PA1 +#define UART_0_RX_PIN GPIO_PA0 + +/** @} */ + +/** + * @name I2C configuration + * @{ + */ +#define I2C_NUMOF 1 +#define I2C_0_EN 1 +#define I2C_IRQ_PRIO 1 + +/* I2C 0 device configuration */ +#define I2C_0_DEV 0 +#define I2C_0_IRQ I2C_IRQn +#define I2C_0_IRQ_HANDLER isr_i2c +#define I2C_0_SCL_PIN GPIO_PC3 +#define I2C_0_SDA_PIN GPIO_PC2 + +static const i2c_conf_t i2c_config[I2C_NUMOF] = { + { + .scl_pin = I2C_0_SCL_PIN, + .sda_pin = I2C_0_SDA_PIN, + }, +}; +/** @} */ + +/** + * @name SPI configuration + * @{ + */ +#define SPI_NUMOF 2 +#define SPI_0_EN 1 +#define SPI_1_EN 1 + +#ifdef HAVE_PERIPH_SPI_CONF_T +static const periph_spi_conf_t spi_config[SPI_NUMOF] = { + { + .dev = SSI0, + .mosi_pin = GPIO_PB1, + .miso_pin = GPIO_PB3, + .sck_pin = GPIO_PB2, + .cs_pin = GPIO_PB5, + }, + { + .dev = SSI1, + .mosi_pin = GPIO_PC5, + .miso_pin = GPIO_PC6, + .sck_pin = GPIO_PC4, + .cs_pin = GPIO_PA7, + }, +}; +#endif +/** @} */ + +/** + * @name GPIO configuration + * @{ + */ +#define GPIO_IRQ_PRIO 1 + +/* Enable only up to PD5 as PD6-PD7 are used with the 32KHz XOSC */ +#define GPIO_0_EN 1 +#define GPIO_1_EN 1 +#define GPIO_2_EN 1 +#define GPIO_3_EN 1 +#define GPIO_4_EN 1 +#define GPIO_5_EN 1 +#define GPIO_6_EN 1 +#define GPIO_7_EN 1 +#define GPIO_8_EN 1 +#define GPIO_9_EN 1 +#define GPIO_10_EN 1 +#define GPIO_11_EN 1 +#define GPIO_12_EN 1 +#define GPIO_13_EN 1 +#define GPIO_14_EN 1 +#define GPIO_15_EN 1 +#define GPIO_16_EN 1 +#define GPIO_17_EN 1 +#define GPIO_18_EN 1 +#define GPIO_19_EN 1 +#define GPIO_20_EN 1 +#define GPIO_21_EN 1 +#define GPIO_22_EN 1 +#define GPIO_23_EN 1 +#define GPIO_24_EN 1 +#define GPIO_25_EN 1 +#define GPIO_26_EN 1 +#define GPIO_27_EN 1 +#define GPIO_28_EN 1 +#define GPIO_29_EN 1 + +/** + * @brief Port config + * + * These defines configures the port settings + */ +/* UART0 RX */ +#define GPIO_0_PIN GPIO_PA0 +/* UART0 TX */ +#define GPIO_1_PIN GPIO_PA1 +/* ADC3 */ +#define GPIO_2_PIN GPIO_PA2 +/* User button/Bootloader */ +#define GPIO_3_PIN GPIO_PA3 +/* ADC2 */ +#define GPIO_4_PIN GPIO_PA4 +/* ADC1 */ +#define GPIO_5_PIN GPIO_PA5 +/* SEL MicroSD */ +#define GPIO_6_PIN GPIO_PA6 +/* CSn MicroSD (shared with ADC extRef) */ +#define GPIO_7_PIN GPIO_PA7 +/* CC1200 GDO2 */ +#define GPIO_8_PIN GPIO_PB0 +/* SSI0 CC1200 MOSI */ +#define GPIO_9_PIN GPIO_PB1 +/* SSI0 CC1200 CLK */ +#define GPIO_10_PIN GPIO_PB2 +/* SSI0 CC1200 MISO */ +#define GPIO_11_PIN GPIO_PB3 +/* CC1200 GDO0 */ +#define GPIO_12_PIN GPIO_PB4 +/* CC1200 CSn */ +#define GPIO_13_PIN GPIO_PB5 +/* JTAG TDI */ +#define GPIO_14_PIN GPIO_PB6 +/* JTAG TDO */ +#define GPIO_15_PIN GPIO_PB7 +/* UART1 TX */ +#define GPIO_16_PIN GPIO_PC0 +/* UART1 RX */ +#define GPIO_17_PIN GPIO_PC1 +/* I2C SDA */ +#define GPIO_18_PIN GPIO_PC2 +/* I2C SCL */ +#define GPIO_19_PIN GPIO_PC3 +/* SSI1 MicroSD CLK */ +#define GPIO_20_PIN GPIO_PC4 +/* SSI1 MicroSD MOSI */ +#define GPIO_21_PIN GPIO_PC5 +/* SSI1 MicroSD MISO */ +#define GPIO_22_PIN GPIO_PC6 +/* CC1200 Reset */ +#define GPIO_23_PIN GPIO_PC7 +/* Power Management (shutdown) */ +#define GPIO_24_PIN GPIO_PD0 +/* Power Management (done) */ +#define GPIO_25_PIN GPIO_PD1 +/* RF SWITCH */ +#define GPIO_26_PIN GPIO_PD2 +/* LED2 Blue/UART1 RTS */ +#define GPIO_27_PIN GPIO_PD3 +/* LED1 Green/UART1 CTS */ +#define GPIO_28_PIN GPIO_PD4 +/* LED3 Red */ +#define GPIO_29_PIN GPIO_PD5 + +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* PERIPH_CONF_H_ */ +/** @} */