Contiki 3.x
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
platform
zoul
firefly
board.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
3
* Copyright (c) 2015, Zolertia
4
* All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
*
15
* 3. Neither the name of the copyright holder nor the names of its
16
* contributors may be used to endorse or promote products derived
17
* from this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30
* OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/**
33
* \addtogroup zoul-platforms
34
* @{
35
*
36
* \defgroup firefly Firefly platform
37
*
38
* The Zolertia Firefly is the most down-to-core development platform, exposing
39
* the Zoul core functionalities and features, with a slick design to allow a
40
* flexible and easier user experience.
41
*
42
* Defines related to the Firefly platform: a Zoul-based breakout board
43
*
44
* This file provides connectivity information on LEDs, Buttons, UART and
45
* other peripherals
46
*
47
* This file can be used as the basis to configure other platforms using the
48
* cc2538 SoC.
49
* @{
50
*
51
* \file
52
* Header file with definitions related to the I/O connections on the Zolertia's
53
* Firefly platform, Zoul-based
54
*
55
* \note Do not include this file directly. It gets included by contiki-conf
56
* after all relevant directives have been set.
57
*/
58
#ifndef BOARD_H_
59
#define BOARD_H_
60
61
#include "dev/gpio.h"
62
#include "
dev/nvic.h
"
63
/*---------------------------------------------------------------------------*/
64
/** \name Connector headers
65
*
66
* The Firefly features two 2.54 mm header rows over which exposes the following
67
* pins (facing up, Zolertia logo above and Micro-USB connector below):
68
* -----------------------------+---+---+--------------------------------------
69
* PIN_NAME |JP3|JP2| PIN_NAME
70
* -----------------------------+---+---+--------------------------------------
71
* PB5/CC1200.CS |-01|01-| LED1/PD5
72
* PB2/SPI0.SCLK/CC1200.SCLK |-02|02-| LED2/PD4
73
* PB1/SPIO0.MOSI/CC1200.MOSI |-03|03-| LED3/PD3
74
* PB3/SPIO0.MISO/CC1200.MISO |-04|04-| PD2
75
* PB3/CC1200.GPIO0 |-05|05-| PD1
76
* PC0/UART1.TX |-06|06-| PD0
77
* PC1/UART1.RX |-07|07-| AIN7/PA7
78
* PC2/I2C.SDA |-08|08-| AIN6/PA6
79
* PC3/I2C.SCL |-09|09-| ADC1/AIN5/PA5
80
* PC4/SPI1.SCLK |-10|10-| ADC2/AIN4/PA4
81
* PC5/SPI1.MOSI |-11|11-| BUTTON.USER/PA3
82
* PC6/SPI1.MISO |-12|12-| ADC3/AIN2/PA2
83
* USB.D+ |-13|13-| DGND
84
* USB.D- |-14|14-| D+3.3
85
* ---------------------------+-+---+---+-+------------------------------------
86
*/
87
/*---------------------------------------------------------------------------*/
88
/** \name Firefly LED configuration
89
*
90
* LEDs on the Firefly are connected as follows:
91
* - LED1 (Red) -> PD5
92
* - LED2 (Green) -> PD4
93
* - LED3 (Blue) -> PD3
94
*
95
* LED1 pin exposed in JP2 connector
96
* LED2 pin exposed in JP2 connector
97
* LED3 pin exposed in JP2 connector
98
* @{
99
*/
100
/*---------------------------------------------------------------------------*/
101
/* Some files include leds.h before us, so we need to get rid of defaults in
102
* leds.h before we provide correct definitions */
103
#undef LEDS_GREEN
104
#undef LEDS_YELLOW
105
#undef LEDS_BLUE
106
#undef LEDS_RED
107
#undef LEDS_CONF_ALL
108
109
/* In leds.h the LEDS_BLUE is defined by LED_YELLOW definition */
110
#define LEDS_GREEN (1 << 4)
/**< LED1 (Green) -> PD4 */
111
#define LEDS_BLUE (1 << 3)
/**< LED2 (Blue) -> PD3 */
112
#define LEDS_RED (1 << 5)
/**< LED3 (Red) -> PD5 */
113
114
#define LEDS_CONF_ALL (LEDS_GREEN | LEDS_BLUE | LEDS_RED)
115
116
#define LEDS_LIGHT_BLUE (LEDS_GREEN | LEDS_BLUE)
/**< Green + Blue (24) */
117
#define LEDS_YELLOW (LEDS_GREEN | LEDS_RED)
/**< Green + Red (48) */
118
#define LEDS_PURPLE (LEDS_BLUE | LEDS_RED)
/**< Blue + Red (40) */
119
#define LEDS_WHITE LEDS_ALL
/**< Green + Blue + Red (56) */
120
121
/* Notify various examples that we have LEDs */
122
#define PLATFORM_HAS_LEDS 1
123
/** @} */
124
/*---------------------------------------------------------------------------*/
125
/** \name USB configuration
126
*
127
* The USB pullup is to be enabled by an external resistor, as it is not mapped
128
* to a GPIO.
129
*/
130
#ifdef USB_PULLUP_PORT
131
#undef USB_PULLUP_PORT
132
#endif
133
#ifdef USB_PULLUP_PIN
134
#undef USB_PULLUP_PIN
135
#endif
136
/** @} */
137
/*---------------------------------------------------------------------------*/
138
/** \name UART configuration
139
*
140
* On the Firefly, the UARTs are connected to the following ports/pins:
141
*
142
* - UART0:
143
* - RX: PA0, connected to CP2104 serial-to-usb converter TX pin
144
* - TX: PA1, connected to CP2104 serial-to-usb converter RX pin
145
* - UART1:
146
* - RX: PC1
147
* - TX: PC0
148
* - CTS: not used, one suggestion however is to use PD1
149
* - RTS: not used, one suggestion however is to use PD0
150
*
151
* We configure the port to use UART0 and UART1, CTS/RTS only for UART1,
152
* both without a HW pull-up resistor.
153
* UART0 is not exposed anywhere, UART1 pins are exposed over the JP3 connector.
154
* @{
155
*/
156
#define UART0_RX_PORT GPIO_A_NUM
157
#define UART0_RX_PIN 0
158
#define UART0_TX_PORT GPIO_A_NUM
159
#define UART0_TX_PIN 1
160
161
#define UART1_RX_PORT GPIO_C_NUM
162
#define UART1_RX_PIN 1
163
#define UART1_TX_PORT GPIO_C_NUM
164
#define UART1_TX_PIN 0
165
#define UART1_CTS_PORT (-1)
/**< GPIO_D_NUM */
166
#define UART1_CTS_PIN (-1)
/**< 1 */
167
#define UART1_RTS_PORT (-1)
/**< GPIO_D_NUM */
168
#define UART1_RTS_PIN (-1)
/**< 0 */
169
/** @} */
170
/*---------------------------------------------------------------------------*/
171
/**
172
* \name ADC configuration
173
*
174
* These values configure which CC2538 pins and ADC channels to use for the ADC
175
* inputs. There pins are suggested as they can be changed, but note that only
176
* pins from PA can be configured as ADC.
177
*
178
* - ADC1: up to 3.3V.
179
* - ADC2: up to 3.3V.
180
* - ADC3: up to 3.3V.
181
* - ADC4: up to 3.3V.
182
* - ADC5: up to 3.3V.
183
* - ADC6: up to 3.3V, shared with user button.
184
*
185
* Only ADC1 and ADC3 are enabled as default.
186
*
187
* The internal ADC reference is 1190mV, use either a voltage divider as input,
188
* or a different voltage reference, like AVDD5 or other externally (AIN7 or
189
* AIN6).
190
* @{
191
*/
192
#define ADC_SENSORS_PORT GPIO_A_NUM
/**< ADC GPIO control port */
193
194
#ifndef ADC_SENSORS_CONF_ADC1_PIN
195
#define ADC_SENSORS_ADC1_PIN 5
/**< ADC1 to PA5 */
196
#else
197
#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5))
198
#error "ADC1 channel should be mapped to PA5 or disabled with -1"
199
#else
200
#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN
201
#endif
202
#endif
203
204
#ifndef ADC_SENSORS_CONF_ADC2_PIN
205
#define ADC_SENSORS_ADC2_PIN 4
/**< ADC2 to PA4 */
206
#else
207
#if ((ADC_SENSORS_CONF_ADC2_PIN != -1) && (ADC_SENSORS_CONF_ADC2_PIN != 4))
208
#error "ADC2 channel should be mapped to PA4 or disabled with -1"
209
#else
210
#define ADC_SENSORS_ADC2_PIN ADC_SENSORS_CONF_ADC2_PIN
211
#endif
212
#endif
213
214
#ifndef ADC_SENSORS_CONF_ADC3_PIN
215
#define ADC_SENSORS_ADC3_PIN 2
/**< ADC3 to PA2 */
216
#else
217
#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2))
218
#error "ADC3 channel should be mapped to PA2 or disabled with -1"
219
#else
220
#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN
221
#endif
222
#endif
223
224
#ifndef ADC_SENSORS_CONF_ADC4_PIN
225
#define ADC_SENSORS_ADC4_PIN 6
/**< ADC4 to PA6 */
226
#else
227
#if ((ADC_SENSORS_CONF_ADC4_PIN != -1) && (ADC_SENSORS_CONF_ADC4_PIN != 6))
228
#error "ADC4 channel should be mapped to PA6 or disabled with -1"
229
#else
230
#define ADC_SENSORS_ADC4_PIN ADC_SENSORS_CONF_ADC4_PIN
231
#endif
232
#endif
233
234
#ifndef ADC_SENSORS_CONF_ADC5_PIN
235
#define ADC_SENSORS_ADC5_PIN 7
/**< ADC5 to PA7 */
236
#else
237
#if ((ADC_SENSORS_CONF_ADC5_PIN != -1) && (ADC_SENSORS_CONF_ADC5_PIN != 7))
238
#error "ADC5 channel should be mapped to PA7 or disabled with -1"
239
#else
240
#define ADC_SENSORS_ADC5_PIN ADC_SENSORS_CONF_ADC5_PIN
241
#endif
242
#endif
243
244
#ifndef ADC_SENSORS_CONF_ADC6_PIN
245
#define ADC_SENSORS_ADC6_PIN (-1)
/**< ADC6 not declared */
246
#else
247
#define ADC_SENSORS_ADC6_PIN 3
/**< Hard-coded to PA3 */
248
#endif
249
250
#ifndef ADC_SENSORS_CONF_MAX
251
#define ADC_SENSORS_MAX 5
/**< Maximum sensors */
252
#else
253
#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX
254
#endif
255
/** @} */
256
/*---------------------------------------------------------------------------*/
257
/** \name Firefly Button configuration
258
*
259
* Buttons on the Firefly are connected as follows:
260
* - BUTTON_USER -> PA3, S1 user button, shared with bootloader
261
* - BUTTON_RESET -> RESET_N line
262
* @{
263
*/
264
/** BUTTON_USER -> PA3 */
265
#define BUTTON_USER_PORT GPIO_A_NUM
266
#define BUTTON_USER_PIN 3
267
#define BUTTON_USER_VECTOR NVIC_INT_GPIO_PORT_A
268
269
/* Notify various examples that we have an user button.
270
* If ADC6 channel is used, then disable the user button
271
*/
272
#ifdef PLATFORM_CONF_WITH_BUTTON
273
#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3))
274
#error "The ADC6 (PA3) and user button cannot be enabled at the same time"
275
#else
276
#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \
277
!(ADC_SENSORS_ADC6_PIN == 3))
278
#endif
/* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */
279
#else
280
#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3)
281
#endif
/* PLATFORM_CONF_WITH_BUTTON */
282
/** @} */
283
/*---------------------------------------------------------------------------*/
284
/**
285
* \name SPI (SSI0) configuration
286
*
287
* These values configure which CC2538 pins to use for the SPI (SSI0) lines,
288
* reserved exclusively for the CC1200 RF transceiver. These pins are exposed
289
* to the JP3 connector. To disable the CC1200 and use these pins, just
290
* remove the R10 resistor (0 ohm), which powers both the CC2538 and CC1200 to
291
* only power the SoC.
292
* TX -> MOSI, RX -> MISO
293
* @{
294
*/
295
#define SPI0_CLK_PORT GPIO_B_NUM
296
#define SPI0_CLK_PIN 2
297
#define SPI0_TX_PORT GPIO_B_NUM
298
#define SPI0_TX_PIN 1
299
#define SPI0_RX_PORT GPIO_B_NUM
300
#define SPI0_RX_PIN 3
301
/** @} */
302
/*---------------------------------------------------------------------------*/
303
/**
304
* \name SPI (SSI1) configuration
305
*
306
* These values configure which CC2538 pins to use for the SPI (SSI1) lines,
307
* exposed over JP3 connector.
308
* TX -> MOSI, RX -> MISO
309
* @{
310
*/
311
#define SPI1_CLK_PORT GPIO_C_NUM
312
#define SPI1_CLK_PIN 4
313
#define SPI1_TX_PORT GPIO_C_NUM
314
#define SPI1_TX_PIN 5
315
#define SPI1_RX_PORT GPIO_C_NUM
316
#define SPI1_RX_PIN 6
317
/** @} */
318
/*---------------------------------------------------------------------------*/
319
/**
320
* \name I2C configuration
321
*
322
* These values configure which CC2538 pins to use for the I2C lines, exposed
323
* over JP3 connector.
324
* @{
325
*/
326
#define I2C_SCL_PORT GPIO_C_NUM
327
#define I2C_SCL_PIN 3
328
#define I2C_SDA_PORT GPIO_C_NUM
329
#define I2C_SDA_PIN 2
330
#define I2C_INT_PORT GPIO_D_NUM
331
#define I2C_INT_PIN 1
332
#define I2C_INT_VECTOR NVIC_INT_GPIO_PORT_D
333
/** @} */
334
/*---------------------------------------------------------------------------*/
335
/**
336
* \name Dual RF interface support
337
*
338
* Enables support for dual band operation (both CC1200 and 2.4GHz enabled).
339
* Unlike the RE-Mote, the Firefly doesn't have a RF switch, so both interfaces
340
* should be always enabled if the R10 resistor is mounted. If only using the
341
* 2.4GHz RF interface, the resistor can be removed to power-off the CC1200.
342
* @{
343
*/
344
#define REMOTE_DUAL_RF_ENABLED 1
345
/** @} */
346
/*---------------------------------------------------------------------------*/
347
/**
348
* \name CC1200 configuration
349
*
350
* These values configure the required pins to drive the CC1200
351
* None of the following pins are exposed to any connector, kept for internal
352
* use only
353
* @{
354
*/
355
#define CC1200_SPI_INSTANCE 0
356
#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT
357
#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN
358
#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT
359
#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN
360
#define CC1200_SPI_MISO_PORT SPI0_RX_PORT
361
#define CC1200_SPI_MISO_PIN SPI0_RX_PIN
362
#define CC1200_SPI_CSN_PORT GPIO_B_NUM
363
#define CC1200_SPI_CSN_PIN 5
364
#define CC1200_GDO0_PORT GPIO_B_NUM
365
#define CC1200_GDO0_PIN 4
366
#define CC1200_GDO2_PORT GPIO_B_NUM
367
#define CC1200_GDO2_PIN 0
368
#define CC1200_RESET_PORT GPIO_C_NUM
369
#define CC1200_RESET_PIN 7
370
#define CC1200_GPIOx_VECTOR NVIC_INT_GPIO_PORT_B
371
/** @} */
372
/*---------------------------------------------------------------------------*/
373
/**
374
* \name Device string used on startup
375
* @{
376
*/
377
#define BOARD_STRING "Zolertia Firefly platform"
378
/** @} */
379
380
#endif
/* BOARD_H_ */
381
382
/**
383
* @}
384
* @}
385
*/
nvic.h
Header file for the ARM Nested Vectored Interrupt Controller.
Generated on Thu Jul 6 2017 20:52:49 for Contiki 3.x by
1.8.6