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 #define USB_PULLUP_PORT GPIO_C_NUM
100 #define USB_PULLUP_PIN 0
101 /** @} */
102 /*---------------------------------------------------------------------------*/
103 /** \name UART configuration
104  *
105  * On the SmartRF06EB, the UART (XDS back channel) is connected to the
106  * following ports/pins
107  * - RX: PA0
108  * - TX: PA1
109  * - CTS: PB0 (Can only be used with UART1)
110  * - RTS: PD3 (Can only be used with UART1)
111  *
112  * We configure the port to use UART0. To use UART1, replace UART0_* with
113  * UART1_* below.
114  * @{
115  */
116 #define UART0_RX_PORT GPIO_A_NUM
117 #define UART0_RX_PIN 0
118 
119 #define UART0_TX_PORT GPIO_A_NUM
120 #define UART0_TX_PIN 1
121 
122 #define UART1_CTS_PORT GPIO_B_NUM
123 #define UART1_CTS_PIN 0
124 
125 #define UART1_RTS_PORT GPIO_D_NUM
126 #define UART1_RTS_PIN 3
127 /** @} */
128 /*---------------------------------------------------------------------------*/
129 /** \name SmartRF Button configuration
130  *
131  * Buttons on the SmartRF06 are connected as follows:
132  * - BUTTON_SELECT -> PA3
133  * - BUTTON_LEFT -> PC4
134  * - BUTTON_RIGHT -> PC5
135  * - BUTTON_UP -> PC6
136  * - BUTTON_DOWN -> PC7
137  * @{
138  */
139 /** BUTTON_SELECT -> PA3 */
140 #define BUTTON_SELECT_PORT GPIO_A_NUM
141 #define BUTTON_SELECT_PIN 3
142 #define BUTTON_SELECT_VECTOR GPIO_A_IRQn
143 
144 /** BUTTON_LEFT -> PC4 */
145 #define BUTTON_LEFT_PORT GPIO_C_NUM
146 #define BUTTON_LEFT_PIN 4
147 #define BUTTON_LEFT_VECTOR GPIO_C_IRQn
148 
149 /** BUTTON_RIGHT -> PC5 */
150 #define BUTTON_RIGHT_PORT GPIO_C_NUM
151 #define BUTTON_RIGHT_PIN 5
152 #define BUTTON_RIGHT_VECTOR GPIO_C_IRQn
153 
154 /** BUTTON_UP -> PC6 */
155 #define BUTTON_UP_PORT GPIO_C_NUM
156 #define BUTTON_UP_PIN 6
157 #define BUTTON_UP_VECTOR GPIO_C_IRQn
158 
159 /** BUTTON_DOWN -> PC7 */
160 #define BUTTON_DOWN_PORT GPIO_C_NUM
161 #define BUTTON_DOWN_PIN 7
162 #define BUTTON_DOWN_VECTOR GPIO_C_IRQn
163 
164 /* Notify various examples that we have Buttons */
165 #define PLATFORM_HAS_BUTTON 1
166 #define PLATFORM_SUPPORTS_BUTTON_HAL 1
167 /** @} */
168 /*---------------------------------------------------------------------------*/
169 /**
170  * \name ADC configuration
171  *
172  * These values configure which CC2538 pins and ADC channels to use for the ADC
173  * inputs.
174  *
175  * ADC inputs can only be on port A.
176  * @{
177  */
178 #define ADC_ALS_PWR_PORT GPIO_A_NUM /**< ALS power GPIO control port */
179 #define ADC_ALS_PWR_PIN 7 /**< ALS power GPIO control pin */
180 #define ADC_ALS_OUT_PIN 6 /**< ALS output ADC input pin on port A */
181 /** @} */
182 /*---------------------------------------------------------------------------*/
183 /**
184  * \name SPI configuration
185  *
186  * These values configure which CC2538 pins to use for the SPI lines. Both
187  * SPI instances can be used independently by providing the corresponding
188  * port / pin macros.
189  * @{
190  */
191 #define SPI0_IN_USE 0
192 #define SPI1_IN_USE 0
193 #if SPI0_IN_USE
194 /** Clock port SPI0 */
195 #define SPI0_CLK_PORT GPIO_A_NUM
196 /** Clock pin SPI0 */
197 #define SPI0_CLK_PIN 2
198 /** TX port SPI0 (master mode: MOSI) */
199 #define SPI0_TX_PORT GPIO_A_NUM
200 /** TX pin SPI0 */
201 #define SPI0_TX_PIN 4
202 /** RX port SPI0 (master mode: MISO */
203 #define SPI0_RX_PORT GPIO_A_NUM
204 /** RX pin SPI0 */
205 #define SPI0_RX_PIN 5
206 #endif /* #if SPI0_IN_USE */
207 #if SPI1_IN_USE
208 /** Clock port SPI1 */
209 #define SPI1_CLK_PORT GPIO_A_NUM
210 /** Clock pin SPI1 */
211 #define SPI1_CLK_PIN 2
212 /** TX port SPI1 (master mode: MOSI) */
213 #define SPI1_TX_PORT GPIO_A_NUM
214 /** TX pin SPI1 */
215 #define SPI1_TX_PIN 4
216 /** RX port SPI1 (master mode: MISO) */
217 #define SPI1_RX_PORT GPIO_A_NUM
218 /** RX pin SPI1 */
219 #define SPI1_RX_PIN 5
220 #endif /* #if SPI1_IN_USE */
221 /** @} */
222 /*---------------------------------------------------------------------------*/
223 /**
224  * \name CC2538 TSCH configuration
225  *
226  * @{
227  */
228 #define RADIO_PHY_OVERHEAD CC2538_PHY_OVERHEAD
229 #define RADIO_BYTE_AIR_TIME CC2538_BYTE_AIR_TIME
230 #define RADIO_DELAY_BEFORE_TX CC2538_DELAY_BEFORE_TX
231 #define RADIO_DELAY_BEFORE_RX CC2538_DELAY_BEFORE_RX
232 #define RADIO_DELAY_BEFORE_DETECT CC2538_DELAY_BEFORE_DETECT
233 /** @} */
234 /*---------------------------------------------------------------------------*/
235 /**
236  * \name Device string used on startup
237  * @{
238  */
239 #define BOARD_STRING "TI SmartRF06 + cc2538EM"
240 /** @} */
241 
242 #endif /* BOARD_H_ */
243 
244 /**
245  * @}
246  * @}
247  */
Header file for the ARM Nested Vectored Interrupt Controller.
Header file with register and macro declarations for the cc2538 GPIO module.