mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/openmote-b: Add board support
This commit is contained in:
parent
ccb5653f8a
commit
a48b8e741b
3
boards/openmote-b/Makefile
Normal file
3
boards/openmote-b/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
5
boards/openmote-b/Makefile.dep
Normal file
5
boards/openmote-b/Makefile.dep
Normal file
@ -0,0 +1,5 @@
|
||||
ifneq (,$(filter gnrc_netdev_default,$(USEMODULE)))
|
||||
USEMODULE += netif
|
||||
USEMODULE += cc2538_rf
|
||||
USEMODULE += netdev_ieee802154
|
||||
endif
|
12
boards/openmote-b/Makefile.features
Normal file
12
boards/openmote-b/Makefile.features
Normal file
@ -0,0 +1,12 @@
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_adc
|
||||
FEATURES_PROVIDED += periph_gpio
|
||||
FEATURES_PROVIDED += periph_i2c
|
||||
FEATURES_PROVIDED += periph_spi
|
||||
FEATURES_PROVIDED += periph_timer
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
|
||||
# The board MPU family (used for grouping by the CI system)
|
||||
FEATURES_MCU_GROUP = cortex_m3_2
|
||||
|
||||
-include $(RIOTCPU)/cc2538/Makefile.features
|
36
boards/openmote-b/Makefile.include
Normal file
36
boards/openmote-b/Makefile.include
Normal file
@ -0,0 +1,36 @@
|
||||
# define the cpu used by the OpenMote-B 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*)))
|
||||
|
||||
# Set default flash tool
|
||||
export PROGRAMMER ?= cc2538-bsl
|
||||
|
||||
ifeq ($(PROGRAMMER),cc2538-bsl)
|
||||
OS := $(shell uname)
|
||||
ifeq ($(OS),Linux)
|
||||
PORT_BSL ?= $(PORT_LINUX)
|
||||
else ifeq ($(OS),Darwin)
|
||||
PORT_BSL ?= $(PORT_DARWIN)
|
||||
endif
|
||||
export FLASHER = $(RIOTBASE)/dist/tools/cc2538-bsl/cc2538-bsl.py
|
||||
export FFLAGS = -p "$(PORT_BSL)" --bootloader-invert-lines -e -w -v -b 460800 $(HEXFILE)
|
||||
else ifeq ($(PROGRAMMER),jlink)
|
||||
export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh
|
||||
export FFLAGS = $(BINDIR) $(HEXFILE)
|
||||
export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh
|
||||
export DEBUGSERVER = JLinkGDBServer -device CC2538SF53
|
||||
export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh
|
||||
endif
|
||||
|
||||
export OFLAGS = -O binary
|
||||
export HEXFILE = $(ELFFILE:.elf=.bin)
|
||||
export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE)
|
||||
export RESET_FLAGS = $(BINDIR)
|
||||
export OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb
|
||||
|
||||
# setup serial terminal
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
42
boards/openmote-b/board.c
Normal file
42
boards/openmote-b/board.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
* Copyright (C) 2018 HAW Hamburg
|
||||
*
|
||||
* 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_openmote-b
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations for the OpenMote-B board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Kevin Weiss <kevin.weiss@haw-hamburg.de>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the boards LEDs */
|
||||
gpio_init(LED0_PIN, GPIO_OUT);
|
||||
gpio_init(LED1_PIN, GPIO_OUT);
|
||||
gpio_init(LED2_PIN, GPIO_OUT);
|
||||
gpio_init(LED3_PIN, GPIO_OUT);
|
||||
gpio_init(USER_BUTTON_PIN, GPIO_IN);
|
||||
gpio_init(RF_SWITCH_2_4_GHZ_PIN, GPIO_OUT);
|
||||
gpio_init(RF_SWITCH_SUB_GHZ_PIN, GPIO_OUT);
|
||||
|
||||
/* start with cc2538 2.4ghz radio*/
|
||||
RF_SWITCH_2_4_GHZ_ON;
|
||||
RF_SWITCH_SUB_GHZ_OFF;
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
113
boards/openmote-b/include/board.h
Normal file
113
boards/openmote-b/include/board.h
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
* Copyright (C) 2018 HAW Hamburg
|
||||
*
|
||||
* 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_openmote-b OpenMote-B
|
||||
* @ingroup boards
|
||||
* @brief Support for the OpenMote-B board
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific definitions for the OpenMote-B board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Kevin Weiss <kevin.weiss@haw-hamburg.de>
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name LED pin definitions and handlers
|
||||
* @{
|
||||
*/
|
||||
#define LED0_PIN GPIO_PIN(2, 4)
|
||||
#define LED1_PIN GPIO_PIN(2, 7)
|
||||
#define LED2_PIN GPIO_PIN(2, 6)
|
||||
#define LED3_PIN GPIO_PIN(2, 5)
|
||||
#define LED3_PIN GPIO_PIN(2, 5)
|
||||
#define USER_BUTTON_PIN GPIO_PIN(2, 5)
|
||||
#define RF_SWITCH_2_4_GHZ_PIN GPIO_PIN(3, 4) /**< PD4 -- 2.4ghz */
|
||||
#define RF_SWITCH_SUB_GHZ_PIN GPIO_PIN(3, 3) /**< PD3 -- subghz */
|
||||
|
||||
#define LED_PORT GPIO_C
|
||||
#define LED0_MASK (1 << 4)
|
||||
#define LED1_MASK (1 << 7)
|
||||
#define LED2_MASK (1 << 6)
|
||||
#define LED3_MASK (1 << 5)
|
||||
|
||||
#define RF_SWITCH_PORT GPIO_D
|
||||
#define RF_SWITCH_2_4_GHZ_MASK (1 << 4)
|
||||
#define RF_SWITCH_SUB_GHZ_MASK (1 << 3)
|
||||
|
||||
#define LED0_ON (LED_PORT->DATA &= ~LED0_MASK)
|
||||
#define LED0_OFF (LED_PORT->DATA |= LED0_MASK)
|
||||
#define LED0_TOGGLE (LED_PORT->DATA ^= LED0_MASK)
|
||||
|
||||
#define LED1_ON (LED_PORT->DATA &= ~LED1_MASK)
|
||||
#define LED1_OFF (LED_PORT->DATA |= LED1_MASK)
|
||||
#define LED1_TOGGLE (LED_PORT->DATA ^= LED1_MASK)
|
||||
|
||||
#define LED2_ON (LED_PORT->DATA &= ~LED2_MASK)
|
||||
#define LED2_OFF (LED_PORT->DATA |= LED2_MASK)
|
||||
#define LED2_TOGGLE (LED_PORT->DATA ^= LED2_MASK)
|
||||
|
||||
#define LED3_ON (LED_PORT->DATA &= ~LED3_MASK)
|
||||
#define LED3_OFF (LED_PORT->DATA |= LED3_MASK)
|
||||
#define LED3_TOGGLE (LED_PORT->DATA ^= LED3_MASK)
|
||||
|
||||
#define RF_SWITCH_2_4_GHZ_ON (RF_SWITCH_PORT->DATA |= RF_SWITCH_2_4_GHZ_MASK)
|
||||
#define RF_SWITCH_2_4_GHZ_OFF (RF_SWITCH_PORT->DATA &= ~RF_SWITCH_2_4_GHZ_MASK)
|
||||
#define RF_SWITCH_2_4_GHZ_TOGGLE (RF_SWITCH_PORT->DATA ^= RF_SWITCH_2_4_GHZ_MASK)
|
||||
|
||||
#define RF_SWITCH_SUB_GHZ_ON (RF_SWITCH_PORT->DATA |= RF_SWITCH_SUB_GHZ_MASK)
|
||||
#define RF_SWITCH_SUB_GHZ_OFF (RF_SWITCH_PORT->DATA &= ~RF_SWITCH_SUB_GHZ_MASK)
|
||||
#define RF_SWITCH_SUB_GHZ_TOGGLE (RF_SWITCH_PORT->DATA ^= RF_SWITCH_SUB_GHZ_MASK)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name xtimer configuration
|
||||
* @{
|
||||
*/
|
||||
#define XTIMER_WIDTH (16)
|
||||
#define XTIMER_BACKOFF (50)
|
||||
#define XTIMER_ISR_BACKOFF (40)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @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 (6) /**< BSL_BOOT Pin */
|
||||
#define CCA_BACKDOOR_ACTIVE_LEVEL (0) /**< Active low */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
170
boards/openmote-b/include/periph_conf.h
Normal file
170
boards/openmote-b/include/periph_conf.h
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
* Copyright (C) 2018 HAW Hamburg
|
||||
*
|
||||
* 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_openmote-b
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral MCU configuration for the OpenMote-B board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
* @author Kevin Weiss <kevin.weiss@haw-hamburg.de>
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CONF_H
|
||||
#define PERIPH_CONF_H
|
||||
|
||||
#include "cc2538_gpio.h"
|
||||
#include "periph_cpu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Clock system configuration
|
||||
* @{
|
||||
*/
|
||||
#define CLOCK_CORECLOCK (32000000U) /* desired core clock frequency, 32MHz */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Timer configuration
|
||||
*
|
||||
* General purpose timers (GPT[0-3]) are configured consecutively and
|
||||
* in order (without gaps) starting from GPT0, i.e. if multiple timers are enabled.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
static const timer_conf_t timer_config[] = {
|
||||
{
|
||||
.chn = 2,
|
||||
.cfg = GPTMCFG_16_BIT_TIMER, /* required for XTIMER */
|
||||
},
|
||||
{
|
||||
.chn = 1,
|
||||
.cfg = GPTMCFG_32_BIT_TIMER,
|
||||
},
|
||||
{
|
||||
.chn = 2,
|
||||
.cfg = GPTMCFG_16_BIT_TIMER,
|
||||
},
|
||||
{
|
||||
.chn = 1,
|
||||
.cfg = GPTMCFG_32_BIT_TIMER,
|
||||
},
|
||||
};
|
||||
|
||||
#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
|
||||
#define TIMER_IRQ_PRIO 1
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name ADC configuration
|
||||
* @{
|
||||
*/
|
||||
#define SOC_ADC_ADCCON_REF SOC_ADC_ADCCON_REF_AVDD5
|
||||
|
||||
static const adc_conf_t adc_config[] = {
|
||||
GPIO_PIN(1, 0), /**< GPIO_PB0 = GPIO0_PIN */
|
||||
GPIO_PIN(1, 1), /**< GPIO_PB1 = GPIO1_PIN */
|
||||
GPIO_PIN(1, 2), /**< GPIO_PB2 = GPIO2_PIN */
|
||||
GPIO_PIN(1, 3), /**< GPIO_PB3 = GPIO3_PIN */
|
||||
GPIO_PIN(2, 3), /**< GPIO_PC3 = GPIO4_PIN */
|
||||
GPIO_PIN(0, 7), /**< GPIO_PA7 = GPIO5_PIN */
|
||||
|
||||
};
|
||||
|
||||
#define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0]))
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name UART configuration
|
||||
* @{
|
||||
*/
|
||||
static const uart_conf_t uart_config[] = {
|
||||
{
|
||||
.dev = UART0_BASEADDR,
|
||||
.rx_pin = GPIO_PIN(0, 0),
|
||||
.tx_pin = GPIO_PIN(0, 1),
|
||||
.cts_pin = GPIO_UNDEF,
|
||||
.rts_pin = GPIO_UNDEF
|
||||
}
|
||||
};
|
||||
|
||||
/* interrupt function name mapping */
|
||||
#define UART_0_ISR isr_uart0
|
||||
|
||||
/* macros common across all UARTs */
|
||||
#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name I2C configuration
|
||||
* @{
|
||||
*/
|
||||
#define I2C_IRQ_PRIO 1
|
||||
|
||||
static const i2c_conf_t i2c_config[] = {
|
||||
{
|
||||
.speed = I2C_SPEED_FAST, /**< bus speed */
|
||||
.scl_pin = GPIO_PIN(1, 5), /* SI7006 Temp/RH sensor */
|
||||
.sda_pin = GPIO_PIN(1, 4) /* SI7006 Temp/RH sensor */
|
||||
},
|
||||
};
|
||||
|
||||
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz)
|
||||
*
|
||||
* Calculated with (CPSR * (SCR + 1)) = (CLOCK_CORECLOCK / bus_freq),
|
||||
* where 1 < CPSR < 255 and 0 < SCR < 256
|
||||
*/
|
||||
static const spi_clk_conf_t spi_clk_config[] = {
|
||||
{ .cpsr = 10, .scr = 31 }, /* 100khz */
|
||||
{ .cpsr = 2, .scr = 39 }, /* 400khz */
|
||||
{ .cpsr = 2, .scr = 15 }, /* 1MHz */
|
||||
{ .cpsr = 2, .scr = 2 }, /* ~4.5MHz */
|
||||
{ .cpsr = 2, .scr = 1 } /* ~10.7MHz */
|
||||
};
|
||||
|
||||
/**
|
||||
* @name SPI configuration
|
||||
* @{
|
||||
*/
|
||||
static const spi_conf_t spi_config[] = {
|
||||
{
|
||||
.dev = SSI0,
|
||||
.mosi_pin = GPIO_PA5,
|
||||
.miso_pin = GPIO_PA4,
|
||||
.sck_pin = GPIO_PA2,
|
||||
.cs_pin = GPIO_PA3,
|
||||
},
|
||||
};
|
||||
|
||||
#define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Radio peripheral configuration
|
||||
* @{
|
||||
*/
|
||||
#define RADIO_IRQ_PRIO 1
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CONF_H */
|
||||
/** @} */
|
@ -18,10 +18,10 @@ BOARD_INSUFFICIENT_MEMORY := bluepill calliope-mini cc2650-launchpad \
|
||||
b-l072z-lrwan1 cc2538dk ek-lm4f120xl feather-m0 \
|
||||
ikea-tradfri limifrog-v1 mbed_lpc1768 nrf6310 \
|
||||
nucleo-f091rc nucleo-l073rz nz32-sc151 \
|
||||
openmote-cc2538 pba-d-01-kw2x remote-pa \
|
||||
remote-reva remote-revb samd21-xpro saml21-xpro \
|
||||
samr21-xpro seeeduino_arch-pro slstk3401a \
|
||||
sltb001a slwstk6220a sodaq-autonomo \
|
||||
openmote-cc2538 openmote-b pba-d-01-kw2x \
|
||||
remote-pa remote-reva remote-revb samd21-xpro \
|
||||
saml21-xpro samr21-xpro seeeduino_arch-pro \
|
||||
slstk3401a sltb001a slwstk6220a sodaq-autonomo \
|
||||
sodaq-explorer stk3600 stm32f3discovery \
|
||||
yunjia-nrf51822
|
||||
|
||||
|
@ -49,6 +49,7 @@ BOARD_INSUFFICIENT_MEMORY := airfy-beacon \
|
||||
opencm904 \
|
||||
openmote \
|
||||
openmote-cc2538 \
|
||||
openmote-b \
|
||||
pba-d-01-kw2x \
|
||||
remote-pa \
|
||||
remote-reva \
|
||||
|
Loading…
Reference in New Issue
Block a user