Skip to content

Commit

Permalink
Zolertia Re-Mote platform (cc2538 + cc1120) port
Browse files Browse the repository at this point in the history
  • Loading branch information
alignan committed Aug 17, 2015
1 parent bc3aba2 commit b8823b7
Show file tree
Hide file tree
Showing 13 changed files with 666 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boards/cc2538dk/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh
export 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)
else ifeq ($(PROGRAMMER),jlink)
export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh
Expand Down
4 changes: 4 additions & 0 deletions boards/remote/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Tell the Makefile.base which module to build:
MODULE = $(BOARD)_base

include $(RIOTBASE)/Makefile.base
6 changes: 6 additions & 0 deletions boards/remote/Makefile.features
Original file line number Diff line number Diff line change
@@ -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 changes: 39 additions & 0 deletions boards/remote/Makefile.include
Original file line number Diff line number Diff line change
@@ -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 changes: 117 additions & 0 deletions boards/remote/README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 90 additions & 0 deletions boards/remote/board.c
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions boards/remote/dist/debug.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions boards/remote/dist/flash.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions boards/remote/dist/reset.sh
Original file line number Diff line number Diff line change
@@ -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 ""
Loading

0 comments on commit b8823b7

Please sign in to comment.