Merge pull request #3062 from alignan/pull/remote-port
New Zolertia Re-Mote platform (CC2538 + CC1120)
This commit is contained in:
commit
014939805e
@ -15,7 +15,7 @@ export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh
|
|||||||
export PROGRAMMER ?= cc2538-bsl
|
export PROGRAMMER ?= cc2538-bsl
|
||||||
|
|
||||||
ifeq ($(PROGRAMMER),cc2538-bsl)
|
ifeq ($(PROGRAMMER),cc2538-bsl)
|
||||||
export FLASHER = python $(RIOTBOARD)/$(BOARD)/dist/cc2538-bsl.py
|
export FLASHER = python $(RIOTBASE)/dist/tools/cc2538-bsl/cc2538-bsl.py
|
||||||
export FFLAGS = -p "$(PORT)" -e -w -v $(HEXFILE)
|
export FFLAGS = -p "$(PORT)" -e -w -v $(HEXFILE)
|
||||||
else ifeq ($(PROGRAMMER),jlink)
|
else ifeq ($(PROGRAMMER),jlink)
|
||||||
export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh
|
export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh
|
||||||
|
|||||||
4
boards/remote/Makefile
Normal file
4
boards/remote/Makefile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Tell the Makefile.base which module to build:
|
||||||
|
MODULE = $(BOARD)_base
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
6
boards/remote/Makefile.features
Normal file
6
boards/remote/Makefile.features
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FEATURES_PROVIDED += cpp
|
||||||
|
FEATURES_PROVIDED += periph_uart
|
||||||
|
FEATURES_PROVIDED += periph_gpio
|
||||||
|
FEATURES_PROVIDED += periph_random
|
||||||
|
FEATURES_PROVIDED += periph_cpuid
|
||||||
|
FEATURES_MCU_GROUP = cortex_m3_2
|
||||||
39
boards/remote/Makefile.include
Normal file
39
boards/remote/Makefile.include
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# 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 ?= $(shell ls -1 /dev/tty.usbserial-* | head -n 2 | tail -n 1)
|
||||||
|
|
||||||
|
# define the 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 = python $(RIOTBASE)/dist/tools/cc2538-bsl/cc2538-bsl.py
|
||||||
|
export FFLAGS = -p "$(PORT_BSL)" -e -w -v -b 115200 $(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 --gap-fill 0xff
|
||||||
|
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 $(RIOTBOARD)/Makefile.include.serial
|
||||||
|
|
||||||
|
# include cortex defaults
|
||||||
|
include $(RIOTBOARD)/Makefile.include.cortexm_common
|
||||||
117
boards/remote/README.md
Normal file
117
boards/remote/README.md
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
Zolertia Re-Mote platform
|
||||||
|
============================================
|
||||||
|
|
||||||
|
<a href="url"><img src="http://goo.gl/3AGZkI" align="center" height="320" ></a>
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
* 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 3uA using our shutdown mode.
|
||||||
|
* Co-Processor to allow peripheral management, programming 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 2-26VDC.
|
||||||
|
* Built-in TMP102 temperature sensor
|
||||||
|
* Small form-factor (as the Z1 mote, half the size of an Arduino) 57x35 mm.
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
* ADC
|
||||||
|
* LEDs
|
||||||
|
* Buttons
|
||||||
|
* Internal/external 2.4GHz antenna switch controllable by SW.
|
||||||
|
|
||||||
|
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.
|
||||||
|
* Micro-SD external storage.
|
||||||
|
* 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 <https://launchpad.net/gcc-arm-embedded>
|
||||||
|
|
||||||
|
|
||||||
|
Drivers
|
||||||
|
-------
|
||||||
|
The Re-Mote features a FTDI serial-to-USB module, the driver is commonly found in most OS, but if required it can be downloaded
|
||||||
|
from <http://www.ftdichip.com/Drivers/VCP.htm>
|
||||||
|
|
||||||
|
|
||||||
|
### 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:
|
||||||
|
|
||||||
|
<https://github.com/alignan/lufa/blob/remote-zongle/LUFA/CodeTemplates/WindowsINF/LUFA%20CDC-ACM.inf>
|
||||||
|
|
||||||
|
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 and OS X, devices will appear under `/dev/`.
|
||||||
|
|
||||||
|
On OS X:
|
||||||
|
|
||||||
|
* XDS backchannel: `tty.usbserial-<serial number>`
|
||||||
|
* EM in CDC-ACM: `tty.usbmodemf<X><ABC>` (X a letter, ABC a number e.g. `tty.usbmodemfd121`)
|
||||||
|
|
||||||
|
On Linux:
|
||||||
|
|
||||||
|
* Re-Mote over FTDI: `ttyUSB1`
|
||||||
|
* Re-Mote over USB driver (in CDC-ACM): `ttyACMn` (n=0, 1, ....)
|
||||||
|
|
||||||
|
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"
|
||||||
90
boards/remote/board.c
Normal file
90
boards/remote/board.c
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* 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 Board specific implementations for the Re-Mote board
|
||||||
|
*
|
||||||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
* Antonio Lignan <alinan@zolertia.com>
|
||||||
|
*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "board.h"
|
||||||
|
#include "cpu.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 (LD3 and LD4)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* The LEDs are connected to the following pins:
|
||||||
|
* - LED1: PD2 (red)
|
||||||
|
* - LED2: PC3 (blue)
|
||||||
|
* - LED3: PD5 (green)
|
||||||
|
*/
|
||||||
|
static inline void leds_init(void)
|
||||||
|
{
|
||||||
|
/* set pins to be controlled by software */
|
||||||
|
LED_PORT_C->AFSEL &= ~(1 << LED_BLUE_PIN);
|
||||||
|
LED_PORT_D->AFSEL &= ~((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN));
|
||||||
|
|
||||||
|
/* configure pins as output */
|
||||||
|
LED_PORT_C->DIR |= (1 << LED_BLUE_PIN);
|
||||||
|
LED_PORT_D->DIR |= ((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN));
|
||||||
|
|
||||||
|
/* configure io-mux for used pins */
|
||||||
|
IOC->PC_OVER[LED_BLUE_PIN] = IOC_OVERRIDE_OE;
|
||||||
|
IOC->PD_OVER[LED_GREEN_PIN] = IOC_OVERRIDE_OE;
|
||||||
|
IOC->PD_OVER[LED_RED_PIN] = IOC_OVERRIDE_OE;
|
||||||
|
|
||||||
|
/* Shoot rainbows */
|
||||||
|
LED_RAINBOW();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize the 2.4GHz Radio Frequency SW-controlled Switch
|
||||||
|
*
|
||||||
|
* The Re-Mote features an on-board RF switch to programatically select to
|
||||||
|
* enable either the internal ceramic antenna, or an external antenna over an
|
||||||
|
* uFL connector. As default we prefer to use the internal one.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void rf_switch_init(void)
|
||||||
|
{
|
||||||
|
/* set pins to be controlled by software */
|
||||||
|
RF_SWITCH_PORT->AFSEL &= ~(1 << RF_SWITCH_PIN);
|
||||||
|
|
||||||
|
/* configure pins as output */
|
||||||
|
RF_SWITCH_PORT->DIR |= (1 << RF_SWITCH_PIN);
|
||||||
|
|
||||||
|
/* configure io-mux for used pins */
|
||||||
|
IOC->PC_OVER[RF_SWITCH_PIN] = IOC_OVERRIDE_OE;
|
||||||
|
|
||||||
|
/* Set to default */
|
||||||
|
RF_SWITCH_INTERNAL;
|
||||||
|
}
|
||||||
17
boards/remote/dist/debug.sh
vendored
Executable file
17
boards/remote/dist/debug.sh
vendored
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Start in-circuit debugging on this board: this script starts up the GDB
|
||||||
|
# client and connects to a GDB server.
|
||||||
|
#
|
||||||
|
# Start the GDB server first using the 'make debugserver' target
|
||||||
|
|
||||||
|
# @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
|
||||||
|
BINDIR=$1
|
||||||
|
ELFFILE=$2
|
||||||
|
|
||||||
|
# write GDB config file
|
||||||
|
echo "target extended-remote 127.0.0.1:2331" > $BINDIR/gdb.cfg
|
||||||
|
|
||||||
|
# run GDB
|
||||||
|
arm-none-eabi-gdb -tui -command=$BINDIR/gdb.cfg $ELFFILE
|
||||||
23
boards/remote/dist/flash.sh
vendored
Executable file
23
boards/remote/dist/flash.sh
vendored
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This flash script dynamically generates a file with a set of commands which
|
||||||
|
# have to be handed to the flashing script of SEGGER (JLinkExe >4.84).
|
||||||
|
# After that, JLinkExe will be executed with that set of commands to flash the
|
||||||
|
# latest .bin file to the board.
|
||||||
|
|
||||||
|
# @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
|
||||||
|
BINDIR=$1
|
||||||
|
HEXFILE=$2
|
||||||
|
FLASHADDR=200000
|
||||||
|
|
||||||
|
# setup JLink command file
|
||||||
|
echo "speed 1000" >> $BINDIR/burn.seg
|
||||||
|
echo "loadbin $HEXFILE $FLASHADDR" >> $BINDIR/burn.seg
|
||||||
|
echo "r" >> $BINDIR/burn.seg
|
||||||
|
echo "g" >> $BINDIR/burn.seg
|
||||||
|
echo "exit" >> $BINDIR/burn.seg
|
||||||
|
|
||||||
|
# flash new binary to the board
|
||||||
|
JLinkExe -device CC2538SF53 < $BINDIR/burn.seg
|
||||||
|
echo ""
|
||||||
17
boards/remote/dist/reset.sh
vendored
Executable file
17
boards/remote/dist/reset.sh
vendored
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This script resets a CC2538SF53 target using JLink called
|
||||||
|
# with a pre-defined reset sequence.
|
||||||
|
|
||||||
|
# @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
|
||||||
|
BINDIR=$1
|
||||||
|
|
||||||
|
# create JLink command file for resetting the board
|
||||||
|
echo "r" >> $BINDIR/reset.seg
|
||||||
|
echo "g" >> $BINDIR/reset.seg
|
||||||
|
echo "exit" >> $BINDIR/reset.seg
|
||||||
|
|
||||||
|
# reset the board
|
||||||
|
JLinkExe -device CC2538SF53 < $BINDIR/reset.seg
|
||||||
|
echo ""
|
||||||
149
boards/remote/include/board.h
Normal file
149
boards/remote/include/board.h
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
* 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 board_remote Re-Mote
|
||||||
|
* @ingroup boards
|
||||||
|
* @brief Support for the Re-Mote board
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Board specific definitions for the Re-Mote board
|
||||||
|
*
|
||||||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
* Antonio Lignan <alinan@zolertia.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOARD_H_
|
||||||
|
#define BOARD_H_
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name The nominal CPU core clock in this board
|
||||||
|
*/
|
||||||
|
#define F_CPU (32000000UL)
|
||||||
|
/**
|
||||||
|
* @name Assign the peripheral timer to be used as hardware timer
|
||||||
|
*/
|
||||||
|
#define HW_TIMER TIMER_0
|
||||||
|
/**
|
||||||
|
* @name Assign the UART interface to be used for stdio
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define STDIO UART_0
|
||||||
|
#define STDIO_BAUDRATE (115200U)
|
||||||
|
#define STDIO_RX_BUFSIZE (64U)
|
||||||
|
/** @} */
|
||||||
|
/**
|
||||||
|
* @name LED pin definitions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LED_PORT_C GPIO_C
|
||||||
|
#define LED_PORT_D GPIO_D
|
||||||
|
#define LED_RED_PIN (2)
|
||||||
|
#define LED_GREEN_PIN (5)
|
||||||
|
#define LED_BLUE_PIN (3)
|
||||||
|
/** @} */
|
||||||
|
/**
|
||||||
|
* @name Macros for controlling the on-board LEDs
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LED_RED_ON (LED_PORT_D->DATA &= ~(1 << LED_RED_PIN))
|
||||||
|
#define LED_RED_OFF (LED_PORT_D->DATA |= (1 << LED_RED_PIN))
|
||||||
|
#define LED_RED_TOGGLE (LED_PORT_D->DATA ^= (1 << LED_RED_PIN))
|
||||||
|
#define LED_GREEN_ON (LED_PORT_D->DATA &= ~(1 << LED_GREEN_PIN))
|
||||||
|
#define LED_GREEN_OFF (LED_PORT_D->DATA |= (1 << LED_GREEN_PIN))
|
||||||
|
#define LED_GREEN_TOGGLE (LED_PORT_D->DATA ^= (1 << LED_GREEN_PIN))
|
||||||
|
#define LED_BLUE_ON (LED_PORT_C->DATA &= ~(1 << LED_BLUE_PIN))
|
||||||
|
#define LED_BLUE_OFF (LED_PORT_C->DATA |= (1 << LED_BLUE_PIN))
|
||||||
|
#define LED_BLUE_TOGGLE (LED_PORT_C->DATA ^= (1 << LED_BLUE_PIN))
|
||||||
|
#define LED_ALL_OFF LED_GREEN_OFF; \
|
||||||
|
LED_RED_OFF; \
|
||||||
|
LED_BLUE_OFF
|
||||||
|
/* Output is color white */
|
||||||
|
#define LED_ALL_ON LED_BLUE_ON; \
|
||||||
|
LED_RED_ON; \
|
||||||
|
LED_GREEN_ON
|
||||||
|
#define LED_YELLOW_ON LED_BLUE_OFF; \
|
||||||
|
LED_GREEN_ON; \
|
||||||
|
LED_RED_ON
|
||||||
|
#define LED_YELLOW_OFF LED_GREEN_OFF; \
|
||||||
|
LED_RED_OFF
|
||||||
|
#define LED_YELLOW_TOGGLE LED_GREEN_TOGGLE; \
|
||||||
|
LED_RED_TOGGLE
|
||||||
|
#define LED_PURPLE_ON LED_GREEN_OFF; \
|
||||||
|
LED_BLUE_ON; \
|
||||||
|
LED_RED_ON
|
||||||
|
#define LED_PURPLE_OFF LED_BLUE_OFF; \
|
||||||
|
LED_RED_OFF
|
||||||
|
#define LED_PURPLE_TOGGLE LED_BLUE_TOGGLE; \
|
||||||
|
LED_RED_TOGGLE
|
||||||
|
/* Take LED_COLOR as argument, i.e LED_RED */
|
||||||
|
#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(LED_YELLOW); \
|
||||||
|
LED_FADE_EXPAND(LED_RED); \
|
||||||
|
LED_FADE_EXPAND(LED_PURPLE); \
|
||||||
|
LED_FADE_EXPAND(LED_BLUE); \
|
||||||
|
LED_FADE_EXPAND(LED_GREEN); \
|
||||||
|
/** @} */
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define RF_SWITCH_PORT GPIO_D
|
||||||
|
#define RF_SWITCH_PIN (4)
|
||||||
|
#define RF_SWITCH_EXTERNAL (RF_SWITCH_PORT->DATA |= (1 << RF_SWITCH_PIN))
|
||||||
|
#define RF_SWITCH_INTERNAL (RF_SWITCH_PORT->DATA &= ~(1 << RF_SWITCH_PIN))
|
||||||
|
#define RF_SWITCH_TOGGLE (RF_SWITCH_PORT->DATA ^= (1 << RF_SWITCH_PIN))
|
||||||
|
/** @} */
|
||||||
|
/**
|
||||||
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||||
|
*/
|
||||||
|
void board_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* end extern "C" */
|
||||||
|
#endif
|
||||||
|
#endif /* BOARD_H_ */
|
||||||
|
/** @} */
|
||||||
202
boards/remote/include/periph_conf.h
Normal file
202
boards/remote/include/periph_conf.h
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
* Antonio Lignan <alinan@zolertia.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PERIPH_CONF_H_
|
||||||
|
#define PERIPH_CONF_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 NUM_CHANNELS_PER_GPTIMER
|
||||||
|
#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 NUM_CHANNELS_PER_GPTIMER
|
||||||
|
#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 NUM_CHANNELS_PER_GPTIMER
|
||||||
|
#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 NUM_CHANNELS_PER_GPTIMER
|
||||||
|
#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
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#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 Random Number Generator configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define RANDOM_NUMOF 1
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name GPIO configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define GPIO_IRQ_PRIO 1
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Port config
|
||||||
|
*
|
||||||
|
* These defines configures the port settings
|
||||||
|
*/
|
||||||
|
/* GPIO 0 configuration - LED1 Green */
|
||||||
|
#define GPIO_0_PIN GPIO_PD5
|
||||||
|
/* GPIO 1 configuration - LED2 Blue */
|
||||||
|
#define GPIO_1_PIN GPIO_PC3
|
||||||
|
/* GPIO 2 configuration - LED3 Red */
|
||||||
|
#define GPIO_2_PIN GPIO_PD2
|
||||||
|
/* GPIO 3 configuration - UART0 RX */
|
||||||
|
#define GPIO_3_PIN GPIO_PA0
|
||||||
|
/* GPIO 4 configuration - UART0 TX */
|
||||||
|
#define GPIO_4_PIN GPIO_PA1
|
||||||
|
/* GPIO 5 configuration - UART1 TX */
|
||||||
|
#define GPIO_5_PIN GPIO_PC5
|
||||||
|
/* GPIO 6 configuration - UART1 RX */
|
||||||
|
#define GPIO_6_PIN GPIO_PC6
|
||||||
|
/* GPIO 7 configuration - UART1 CTS */
|
||||||
|
#define GPIO_7_PIN GPIO_PC1
|
||||||
|
/* GPIO 8 configuration - UART RTS */
|
||||||
|
#define GPIO_8_PIN GPIO_PC2
|
||||||
|
/* GPIO 9 configuration - User button/Bootloader */
|
||||||
|
#define GPIO_9_PIN GPIO_PA3
|
||||||
|
/* GPIO 10 configuration - ADC2 */
|
||||||
|
#define GPIO_10_PIN GPIO_PA6
|
||||||
|
/* GPIO 11 configuration - ADC3 */
|
||||||
|
#define GPIO_11_PIN GPIO_PA7
|
||||||
|
/* GPIO 12 configuration - SSI0 CC1120 CLK */
|
||||||
|
#define GPIO_12_PIN GPIO_PD1
|
||||||
|
/* GPIO 13 configuration - SSI0 CC1120 MOSI */
|
||||||
|
#define GPIO_13_PIN GPIO_PD0
|
||||||
|
/* GPIO 14 configuration - SSI0 CC1120 MISO */
|
||||||
|
#define GPIO_14_PIN GPIO_PC4
|
||||||
|
/* GPIO 15 configuration - I2C SCL */
|
||||||
|
#define GPIO_15_PIN GPIO_PB1
|
||||||
|
/* GPIO 16 configuration - I2C SDA */
|
||||||
|
#define GPIO_16_PIN GPIO_PB0
|
||||||
|
/* GPIO 17 configuration - RF SWITCH */
|
||||||
|
#define GPIO_17_PIN GPIO_PD4
|
||||||
|
/* GPIO 18 configuration - SSI1 MicroSD CLK */
|
||||||
|
#define GPIO_18_PIN GPIO_PB5
|
||||||
|
/* GPIO 19 configuration - SSI1 MicroSD MOSI */
|
||||||
|
#define GPIO_19_PIN GPIO_PC7
|
||||||
|
/* GPIO 20 configuration - SSI1 MicroSD MISO */
|
||||||
|
#define GPIO_20_PIN GPIO_PA4
|
||||||
|
/* GPIO 21 configuration - CC1120 CSn */
|
||||||
|
#define GPIO_21_PIN GPIO_PD3
|
||||||
|
/* GPIO 22 configuration - CC1120 GDO0 */
|
||||||
|
#define GPIO_22_PIN GPIO_PB4
|
||||||
|
/* GPIO 23 configuration - CC1120 GDO2 */
|
||||||
|
#define GPIO_23_PIN GPIO_PB3
|
||||||
|
/* GPIO 24 configuration - CC1120 Reset */
|
||||||
|
#define GPIO_24_PIN GPIO_PB2
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* end extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PERIPH_CONF_H_ */
|
||||||
|
/** @} */
|
||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "board.h"
|
||||||
#include "vectors_cortexm.h"
|
#include "vectors_cortexm.h"
|
||||||
|
|
||||||
/* get the start of the ISR stack as defined in the linkerscript */
|
/* get the start of the ISR stack as defined in the linkerscript */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user