Contiki-NG
Loading...
Searching...
No Matches
board.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * This file is part of the Contiki operating system.
31 *
32 */
33/* -------------------------------------------------------------------------- */
34/**
35 * \addtogroup openmote-boards
36 * @{
37 *
38 * \defgroup openmote-b OpenMote-B
39 * OpenMote-B is a new board by OpenMote Technologies, released in 2018.
40 * @{
41 *
42 * \file
43 * This file provides connectivity information on LEDs, Buttons, UART and
44 * other OpenMote-B peripherals.
45 *
46 * This file can be used as the basis to configure other platforms using the
47 * cc2538 SoC.
48 *
49 * \note Do not include this file directly. It gets included by contiki-conf
50 * after all relevant directives have been set.
51 */
52
53#ifndef BOARD_H_
54#define BOARD_H_
55/*---------------------------------------------------------------------------*/
56#include "dev/gpio.h"
57#include "dev/nvic.h"
58/*---------------------------------------------------------------------------*/
59/** \name OpenMote-B LED configuration
60 *
61 * LEDs on the OpenMote-B are connected as follows:
62 * - LED1 (Red) -> PC4
63 * - LED2 (Yellow) -> PC6
64 * - LED3 (Green) -> PC7
65 * - LED4 (Orange) -> PC5
66 *
67 * @{
68 */
69/*---------------------------------------------------------------------------*/
70#define LEDS_ARCH_L1_PORT GPIO_C_NUM
71#define LEDS_ARCH_L1_PIN 4
72#define LEDS_ARCH_L2_PORT GPIO_C_NUM
73#define LEDS_ARCH_L2_PIN 6
74#define LEDS_ARCH_L3_PORT GPIO_C_NUM
75#define LEDS_ARCH_L3_PIN 7
76#define LEDS_ARCH_L4_PORT GPIO_C_NUM
77#define LEDS_ARCH_L4_PIN 5
78
79#define LEDS_CONF_RED 1
80#define LEDS_CONF_YELLOW 2
81#define LEDS_CONF_GREEN 4
82#define LEDS_CONF_ORANGE 8
83
84#define LEDS_CONF_COUNT 4
85/** @} */
86/*---------------------------------------------------------------------------*/
87/** \name USB configuration
88 *
89 * The USB pullup is to be enabled by an external resistor, as it is not mapped
90 * to a GPIO.
91 * @{
92 */
93#ifdef USB_PULLUP_PORT
94#undef USB_PULLUP_PORT
95#endif
96#ifdef USB_PULLUP_PIN
97#undef USB_PULLUP_PIN
98#endif
99/** @} */
100/*---------------------------------------------------------------------------*/
101/** \name UART configuration
102 *
103 * On the OpenMote-B, the UART is connected to the
104 * following ports/pins
105 * - RX: PA0
106 * - TX: PA1
107 *
108 * We configure the port to use UART0.
109 * @{
110 */
111#define UART0_RX_PORT GPIO_A_NUM
112#define UART0_RX_PIN 0
113#define UART0_TX_PORT GPIO_A_NUM
114#define UART0_TX_PIN 1
115/** @} */
116/*---------------------------------------------------------------------------*/
117/** \name OpenMote-B Button configuration
118 *
119 * Buttons on the OpenMote-B are connected as follows:
120 * - BUTTON_USER -> PD5
121 * @{
122 */
123/** BUTTON_USER -> PD5 */
124#define BUTTON_USER_PORT GPIO_D_NUM
125#define BUTTON_USER_PIN 5
126#define BUTTON_USER_VECTOR GPIO_D_IRQn
127/* Notify various examples that we have Buttons */
128#define PLATFORM_HAS_BUTTON 1
129#define PLATFORM_SUPPORTS_BUTTON_HAL 1
130/** @} */
131/*---------------------------------------------------------------------------*/
132/**
133 * \name SPI (SSI0) configuration
134 *
135 * These values configure which CC2538 pins to use for the SPI (SSI0) lines.
136 * The SPI0 is currently used for interface with the AT86RF215 radio.
137 * @{
138 */
139#define SPI0_CLK_PORT GPIO_A_NUM
140#define SPI0_CLK_PIN 2
141#define SPI0_TX_PORT GPIO_A_NUM
142#define SPI0_TX_PIN 5
143#define SPI0_RX_PORT GPIO_A_NUM
144#define SPI0_RX_PIN 4
145/** @} */
146/*---------------------------------------------------------------------------*/
147/**
148 * \name SPI (SSI1) configuration
149 *
150 * These values configure which CC2538 pins to use for the SPI (SSI1) lines.
151 * The SSI1 is currently not used.
152 * @{
153 */
154#define SPI1_CLK_PORT GPIO_C_NUM
155#define SPI1_CLK_PIN 4
156#define SPI1_TX_PORT GPIO_C_NUM
157#define SPI1_TX_PIN 5
158#define SPI1_RX_PORT GPIO_C_NUM
159#define SPI1_RX_PIN 6
160/** @} */
161/*---------------------------------------------------------------------------*/
162/**
163 * \name I2C configuration
164 *
165 * These values configure which CC2538 pins to use for the I2C lines.
166 * @{
167 */
168#define I2C_SCL_PORT GPIO_B_NUM
169#define I2C_SCL_PIN 5
170#define I2C_SDA_PORT GPIO_B_NUM
171#define I2C_SDA_PIN 4
172/** @} */
173/*---------------------------------------------------------------------------*/
174/**
175 * \name OpenMote-B antenna switch configuration
176 *
177 * @{
178 */
179#define ANTENNA_BSP_RADIO_BASE GPIO_PORT_TO_BASE(GPIO_D_NUM)
180#define ANTENNA_BSP_RADIO_24GHZ_CC2538 GPIO_PIN_MASK(3)
181#define ANTENNA_BSP_RADIO_24GHZ_AT86RF215 GPIO_PIN_MASK(4)
182/** @} */
183/*---------------------------------------------------------------------------*/
184/**
185 * \name Atmel's AT86RF215 radio configuration
186 *
187 * @{
188 */
189#define AT86RF215_SPI_INSTANCE 0
190#define AT86RF215_SPI_CSN_PORT GPIO_A_NUM
191#define AT86RF215_SPI_CSN_PIN 3
192#define AT86RF215_RSTN_PORT GPIO_D_NUM
193#define AT86RF215_RSTN_PIN 1
194#define AT86RF215_PWR_PORT GPIO_C_NUM
195#define AT86RF215_PWR_PIN 0
196#define AT86RF215_IRQ_PORT GPIO_D_NUM
197#define AT86RF215_IRQ_PIN 0
198#define AT86RF215_GPIOx_VECTOR GPIO_D_IRQn
199/** @} */
200/*---------------------------------------------------------------------------*/
201/**
202 * \name Radio configuration - use either AT86RF215 or CC2538
203 *
204 * OpenMoteB can use either the AT86RF215 or the CC2538 radio.
205 * @{
206 */
207#ifndef OPENMOTEB_CONF_USE_ATMEL_RADIO
208#define OPENMOTEB_USE_ATMEL_RADIO 0
209#else
210#define OPENMOTEB_USE_ATMEL_RADIO OPENMOTEB_CONF_USE_ATMEL_RADIO
211#endif
212
213/** Configuration of Atmel AT86RF215 radio */
214#if OPENMOTEB_USE_ATMEL_RADIO == 1
215
216 #include "at86rf215-def.h"
217
218 #define NETSTACK_CONF_RADIO at86rf215_driver
219
220 #define RADIO_PHY_OVERHEAD AT86RF215_PHY_OVERHEAD
221 #define RADIO_BYTE_AIR_TIME AT86RF215_BYTE_AIR_TIME
222 #define RADIO_DELAY_BEFORE_TX AT86RF215_DELAY_BEFORE_TX
223 #define RADIO_DELAY_BEFORE_RX AT86RF215_DELAY_BEFORE_RX
224 #define RADIO_DELAY_BEFORE_DETECT AT86RF215_DELAY_BEFORE_DETECT
225
226 /* Use 32 MHz clock, so the SPI speed can be at at least at 16MHz */
227 #define SYS_CTRL_CONF_SYS_DIV SYS_CTRL_CLOCK_CTRL_SYS_DIV_32MHZ
228
229/** Configuration of Texas Instrument CC2538 radio */
230#else
231
232 #define NETSTACK_CONF_RADIO cc2538_rf_driver
233
234 #define RADIO_PHY_OVERHEAD CC2538_PHY_OVERHEAD
235 #define RADIO_BYTE_AIR_TIME CC2538_BYTE_AIR_TIME
236 #define RADIO_DELAY_BEFORE_TX CC2538_DELAY_BEFORE_TX
237 #define RADIO_DELAY_BEFORE_RX CC2538_DELAY_BEFORE_RX
238 #define RADIO_DELAY_BEFORE_DETECT CC2538_DELAY_BEFORE_DETECT
239#endif /* OPENMOTEB_USE_ATMEL_RADIO */
240
241/** @} */
242/*---------------------------------------------------------------------------*/
243/**
244 * \name Device string used on startup
245 * @{
246 */
247#define BOARD_STRING "OpenMote-B"
248/** @} */
249/*---------------------------------------------------------------------------*/
250#endif /* BOARD_H_ */
251/*---------------------------------------------------------------------------*/
252/**
253 * @}
254 * @}
255 */
AT86RF215 radio constants and defines.
Header file with register and macro declarations for the cc2538 GPIO module.
Header file for the ARM Nested Vectored Interrupt Controller.