Contiki-NG
board.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012, 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 *
14 * 3. Neither the name of the copyright holder nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 * OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31/**
32 * \addtogroup cc2538dk
33 * @{
34 *
35 * \defgroup cc2538-smartrf SmartRF06EB Peripherals
36 *
37 * Defines related to the SmartRF06EB
38 *
39 * This file provides connectivity information on LEDs, Buttons, UART and
40 * other SmartRF peripherals
41 *
42 * Notably, PC0 is used to drive LED1 as well as the USB D+ pullup. Therefore
43 * when USB is enabled, LED1 can not be driven by firmware.
44 *
45 * This file can be used as the basis to configure other platforms using the
46 * cc2538 SoC.
47 * @{
48 *
49 * \file
50 * Header file with definitions related to the I/O connections on the TI
51 * SmartRF06EB
52 *
53 * \note Do not include this file directly. It gets included by contiki-conf
54 * after all relevant directives have been set.
55 */
56#ifndef BOARD_H_
57#define BOARD_H_
58
59#include "dev/gpio.h"
60#include "dev/nvic.h"
61/*---------------------------------------------------------------------------*/
62/** \name SmartRF LED configuration
63 *
64 * LEDs on the SmartRF06 (EB and BB) are connected as follows:
65 * - LED1 (Red) -> PC0
66 * - LED2 (Yellow) -> PC1
67 * - LED3 (Green) -> PC2
68 * - LED4 (Orange) -> PC3
69 *
70 * LED1 shares the same pin with the USB pullup
71 * @{
72 */
73/*---------------------------------------------------------------------------*/
74#define LEDS_CONF_YELLOW 1
75#define LEDS_CONF_GREEN 2
76#define LEDS_CONF_ORANGE 4
77
78#define LEDS_ARCH_L1_PORT GPIO_C_NUM
79#define LEDS_ARCH_L1_PIN 1
80#define LEDS_ARCH_L2_PORT GPIO_C_NUM
81#define LEDS_ARCH_L2_PIN 2
82#define LEDS_ARCH_L3_PORT GPIO_C_NUM
83#define LEDS_ARCH_L3_PIN 3
84
85#if USB_SERIAL_CONF_ENABLE
86#define LEDS_CONF_COUNT 3
87#else
88#define LEDS_ARCH_L4_PORT GPIO_C_NUM
89#define LEDS_ARCH_L4_PIN 0
90#define LEDS_CONF_RED 8
91#define LEDS_CONF_COUNT 4
92#endif
93/** @} */
94/*---------------------------------------------------------------------------*/
95/** \name USB configuration
96 *
97 * The USB pullup is driven by PC0 and is shared with LED1
98 * @{
99 */
100#define USB_PULLUP_PORT GPIO_C_NUM
101#define USB_PULLUP_PIN 0
102/** @} */
103/*---------------------------------------------------------------------------*/
104/** \name UART configuration
105 *
106 * On the SmartRF06EB, the UART (XDS back channel) is connected to the
107 * following ports/pins
108 * - RX: PA0
109 * - TX: PA1
110 * - CTS: PB0 (Can only be used with UART1)
111 * - RTS: PD3 (Can only be used with UART1)
112 *
113 * We configure the port to use UART0. To use UART1, replace UART0_* with
114 * UART1_* below.
115 * @{
116 */
117#define UART0_RX_PORT GPIO_A_NUM
118#define UART0_RX_PIN 0
119
120#define UART0_TX_PORT GPIO_A_NUM
121#define UART0_TX_PIN 1
122
123#define UART1_CTS_PORT GPIO_B_NUM
124#define UART1_CTS_PIN 0
125
126#define UART1_RTS_PORT GPIO_D_NUM
127#define UART1_RTS_PIN 3
128/** @} */
129/*---------------------------------------------------------------------------*/
130/** \name SmartRF Button configuration
131 *
132 * Buttons on the SmartRF06 are connected as follows:
133 * - BUTTON_SELECT -> PA3
134 * - BUTTON_LEFT -> PC4
135 * - BUTTON_RIGHT -> PC5
136 * - BUTTON_UP -> PC6
137 * - BUTTON_DOWN -> PC7
138 * @{
139 */
140/** BUTTON_SELECT -> PA3 */
141#define BUTTON_SELECT_PORT GPIO_A_NUM
142#define BUTTON_SELECT_PIN 3
143#define BUTTON_SELECT_VECTOR GPIO_A_IRQn
144
145/** BUTTON_LEFT -> PC4 */
146#define BUTTON_LEFT_PORT GPIO_C_NUM
147#define BUTTON_LEFT_PIN 4
148#define BUTTON_LEFT_VECTOR GPIO_C_IRQn
149
150/** BUTTON_RIGHT -> PC5 */
151#define BUTTON_RIGHT_PORT GPIO_C_NUM
152#define BUTTON_RIGHT_PIN 5
153#define BUTTON_RIGHT_VECTOR GPIO_C_IRQn
154
155/** BUTTON_UP -> PC6 */
156#define BUTTON_UP_PORT GPIO_C_NUM
157#define BUTTON_UP_PIN 6
158#define BUTTON_UP_VECTOR GPIO_C_IRQn
159
160/** BUTTON_DOWN -> PC7 */
161#define BUTTON_DOWN_PORT GPIO_C_NUM
162#define BUTTON_DOWN_PIN 7
163#define BUTTON_DOWN_VECTOR GPIO_C_IRQn
164
165/* Notify various examples that we have Buttons */
166#define PLATFORM_HAS_BUTTON 1
167#define PLATFORM_SUPPORTS_BUTTON_HAL 1
168/** @} */
169/*---------------------------------------------------------------------------*/
170/**
171 * \name ADC configuration
172 *
173 * These values configure which CC2538 pins and ADC channels to use for the ADC
174 * inputs.
175 *
176 * ADC inputs can only be on port A.
177 * @{
178 */
179#define ADC_ALS_PWR_PORT GPIO_A_NUM /**< ALS power GPIO control port */
180#define ADC_ALS_PWR_PIN 7 /**< ALS power GPIO control pin */
181#define ADC_ALS_OUT_PIN 6 /**< ALS output ADC input pin on port A */
182/** @} */
183/*---------------------------------------------------------------------------*/
184/**
185 * \name SPI configuration
186 *
187 * These values configure which CC2538 pins to use for the SPI lines. Both
188 * SPI instances can be used independently by providing the corresponding
189 * port / pin macros.
190 * @{
191 */
192#define SPI0_IN_USE 0
193#define SPI1_IN_USE 0
194#if SPI0_IN_USE
195/** Clock port SPI0 */
196#define SPI0_CLK_PORT GPIO_A_NUM
197/** Clock pin SPI0 */
198#define SPI0_CLK_PIN 2
199/** TX port SPI0 (master mode: MOSI) */
200#define SPI0_TX_PORT GPIO_A_NUM
201/** TX pin SPI0 */
202#define SPI0_TX_PIN 4
203/** RX port SPI0 (master mode: MISO */
204#define SPI0_RX_PORT GPIO_A_NUM
205/** RX pin SPI0 */
206#define SPI0_RX_PIN 5
207#endif /* #if SPI0_IN_USE */
208#if SPI1_IN_USE
209/** Clock port SPI1 */
210#define SPI1_CLK_PORT GPIO_A_NUM
211/** Clock pin SPI1 */
212#define SPI1_CLK_PIN 2
213/** TX port SPI1 (master mode: MOSI) */
214#define SPI1_TX_PORT GPIO_A_NUM
215/** TX pin SPI1 */
216#define SPI1_TX_PIN 4
217/** RX port SPI1 (master mode: MISO) */
218#define SPI1_RX_PORT GPIO_A_NUM
219/** RX pin SPI1 */
220#define SPI1_RX_PIN 5
221#endif /* #if SPI1_IN_USE */
222/** @} */
223/*---------------------------------------------------------------------------*/
224/**
225 * \name CC2538 TSCH configuration
226 *
227 * @{
228 */
229#define RADIO_PHY_OVERHEAD CC2538_PHY_OVERHEAD
230#define RADIO_BYTE_AIR_TIME CC2538_BYTE_AIR_TIME
231#define RADIO_DELAY_BEFORE_TX CC2538_DELAY_BEFORE_TX
232#define RADIO_DELAY_BEFORE_RX CC2538_DELAY_BEFORE_RX
233#define RADIO_DELAY_BEFORE_DETECT CC2538_DELAY_BEFORE_DETECT
234/** @} */
235/*---------------------------------------------------------------------------*/
236/**
237 * \name Device string used on startup
238 * @{
239 */
240#define BOARD_STRING "TI SmartRF06 + cc2538EM"
241/** @} */
242
243#endif /* BOARD_H_ */
244
245/**
246 * @}
247 * @}
248 */
Header file with register and macro declarations for the cc2538 GPIO module.
Header file for the ARM Nested Vectored Interrupt Controller.