Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
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
* \addtogroup firefly
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 USB connector below):
68
* -----------------------------+---+---+--------------------------------------
69
* PIN_NAME |JP3|JP2| PIN_NAME
70
* -----------------------------+---+---+--------------------------------------
71
* PB5/CC1200.CS |-01|15-| PD2/SPI1.MISO
72
* PB2/SPI0.SCLK/CC1200.SCLK |-02|16-| PD0/SPI1.SCLK
73
* PB1/SPIO0.MOSI/CC1200.MOSI |-03|17-| ADC5/AIN7/PA7
74
* PB3/SPIO0.MISO/CC1200.MISO |-04|18-| ADC4/AIN6/PA6
75
* PB4/CC1200.GPIO0 |-05|19-| DGND
76
* PB0/CC1200.GPIO2 |-06|20-| +VDD
77
* PD1/I2C.INT |-07|21-| ADC1/AIN5/PA5
78
* PC2/I2C.SDA |-08|22-| ADC2/AIN4/PA4
79
* PC3/I2C.SCL |-09|23-| BUTTON.USER/ADC6/AIN3/PA3
80
* DGND |-10|24-| ADC3/AIN2/PA2
81
* +VDD |-11|25-| PC0/UART1.TX
82
* PC6/SPI1.MOSI |-12|26-| PC1/UART1.RX
83
* USB.D+ |-13|27-| PC4
84
* USB.D- |-14|28-| PC5
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
#define LEDS_ARCH_L1_PORT GPIO_D_NUM
102
#define LEDS_ARCH_L1_PIN 5
103
#define LEDS_ARCH_L2_PORT GPIO_D_NUM
104
#define LEDS_ARCH_L2_PIN 4
105
#define LEDS_ARCH_L3_PORT GPIO_D_NUM
106
#define LEDS_ARCH_L3_PIN 3
107
108
#define LEDS_CONF_RED 1
109
#define LEDS_CONF_GREEN 2
110
#define LEDS_CONF_BLUE 4
111
112
#define LEDS_CONF_COUNT 3
113
/** @} */
114
/*---------------------------------------------------------------------------*/
115
/** \name USB configuration
116
*
117
* The USB pullup is to be enabled by an external resistor, as it is not mapped
118
* to a GPIO.
119
* @{
120
*/
121
#ifdef USB_PULLUP_PORT
122
#undef USB_PULLUP_PORT
123
#endif
124
#ifdef USB_PULLUP_PIN
125
#undef USB_PULLUP_PIN
126
#endif
127
/** @} */
128
/*---------------------------------------------------------------------------*/
129
/** \name UART configuration
130
*
131
* On the Firefly, the UARTs are connected to the following ports/pins:
132
*
133
* - UART0:
134
* - RX: PA0, connected to CP2104 serial-to-usb converter TX pin
135
* - TX: PA1, connected to CP2104 serial-to-usb converter RX pin
136
* - UART1:
137
* - RX: PC1
138
* - TX: PC0
139
* - CTS: not used, one suggestion however is to use PC4
140
* - RTS: not used, one suggestion however is to use PC5
141
*
142
* We configure the port to use UART0 and UART1, CTS/RTS only for UART1,
143
* both without a HW pull-up resistor.
144
* UART0 is not exposed anywhere, UART1 pins are exposed over the JP3 connector.
145
* @{
146
*/
147
#define UART0_RX_PORT GPIO_A_NUM
148
#define UART0_RX_PIN 0
149
#define UART0_TX_PORT GPIO_A_NUM
150
#define UART0_TX_PIN 1
151
152
#define UART1_RX_PORT GPIO_C_NUM
153
#define UART1_RX_PIN 1
154
#define UART1_TX_PORT GPIO_C_NUM
155
#define UART1_TX_PIN 0
156
#define UART1_CTS_PORT (-1)
/**< GPIO_D_NUM */
157
#define UART1_CTS_PIN (-1)
/**< 1 */
158
#define UART1_RTS_PORT (-1)
/**< GPIO_D_NUM */
159
#define UART1_RTS_PIN (-1)
/**< 0 */
160
/** @} */
161
/*---------------------------------------------------------------------------*/
162
/**
163
* \name ADC configuration
164
*
165
* These values configure which CC2538 pins and ADC channels to use for the ADC
166
* inputs. There pins are suggested as they can be changed, but note that only
167
* pins from PA can be configured as ADC.
168
*
169
* - ADC1: up to 3.3V.
170
* - ADC2: up to 3.3V.
171
* - ADC3: up to 3.3V.
172
* - ADC4: up to 3.3V.
173
* - ADC5: up to 3.3V.
174
* - ADC6: up to 3.3V, shared with user button.
175
*
176
* The internal ADC reference is 1190mV, use either a voltage divider as input,
177
* or a different voltage reference, like AVDD5 or other externally (AIN7 or
178
* AIN6).
179
*
180
* Warning: if using ADC6 (PA3), you will need to disable the bootloader by
181
* making FLASH_CCA_CONF_BOOTLDR_BACKDOOR equal to zero
182
* @{
183
*/
184
#define ADC_SENSORS_PORT GPIO_A_NUM
/**< ADC GPIO control port */
185
186
#ifndef ADC_SENSORS_CONF_ADC1_PIN
187
#define ADC_SENSORS_ADC1_PIN 5
/**< ADC1 to PA5 */
188
#else
189
#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5))
190
#error "ADC1 channel should be mapped to PA5 or disabled with -1"
191
#else
192
#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN
193
#endif
194
#endif
195
196
#ifndef ADC_SENSORS_CONF_ADC2_PIN
197
#define ADC_SENSORS_ADC2_PIN 4
/**< ADC2 to PA4 */
198
#else
199
#if ((ADC_SENSORS_CONF_ADC2_PIN != -1) && (ADC_SENSORS_CONF_ADC2_PIN != 4))
200
#error "ADC2 channel should be mapped to PA4 or disabled with -1"
201
#else
202
#define ADC_SENSORS_ADC2_PIN ADC_SENSORS_CONF_ADC2_PIN
203
#endif
204
#endif
205
206
#ifndef ADC_SENSORS_CONF_ADC3_PIN
207
#define ADC_SENSORS_ADC3_PIN 2
/**< ADC3 to PA2 */
208
#else
209
#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2))
210
#error "ADC3 channel should be mapped to PA2 or disabled with -1"
211
#else
212
#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN
213
#endif
214
#endif
215
216
#ifndef ADC_SENSORS_CONF_ADC4_PIN
217
#define ADC_SENSORS_ADC4_PIN 6
/**< ADC4 to PA6 */
218
#else
219
#if ((ADC_SENSORS_CONF_ADC4_PIN != -1) && (ADC_SENSORS_CONF_ADC4_PIN != 6))
220
#error "ADC4 channel should be mapped to PA6 or disabled with -1"
221
#else
222
#define ADC_SENSORS_ADC4_PIN ADC_SENSORS_CONF_ADC4_PIN
223
#endif
224
#endif
225
226
#ifndef ADC_SENSORS_CONF_ADC5_PIN
227
#define ADC_SENSORS_ADC5_PIN 7
/**< ADC5 to PA7 */
228
#else
229
#if ((ADC_SENSORS_CONF_ADC5_PIN != -1) && (ADC_SENSORS_CONF_ADC5_PIN != 7))
230
#error "ADC5 channel should be mapped to PA7 or disabled with -1"
231
#else
232
#define ADC_SENSORS_ADC5_PIN ADC_SENSORS_CONF_ADC5_PIN
233
#endif
234
#endif
235
236
#ifndef ADC_SENSORS_CONF_ADC6_PIN
237
#define ADC_SENSORS_ADC6_PIN (-1)
/**< ADC6 not declared */
238
#else
239
#define ADC_SENSORS_ADC6_PIN 3
/**< Hard-coded to PA3 */
240
#endif
241
242
#ifndef ADC_SENSORS_CONF_MAX
243
#define ADC_SENSORS_MAX 5
/**< Maximum sensors */
244
#else
245
#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX
246
#endif
247
/** @} */
248
/*---------------------------------------------------------------------------*/
249
/** \name Firefly Button configuration
250
*
251
* Buttons on the Firefly are connected as follows:
252
* - BUTTON_USER -> PA3, S1 user button, shared with bootloader
253
* - BUTTON_RESET -> RESET_N line
254
* @{
255
*/
256
/** BUTTON_USER -> PA3 */
257
#define BUTTON_USER_PORT GPIO_A_NUM
258
#define BUTTON_USER_PIN 3
259
#define BUTTON_USER_VECTOR GPIO_A_IRQn
260
261
/* Notify various examples that we have an user button.
262
* If ADC6 channel is used, then disable the user button
263
*/
264
#ifdef PLATFORM_CONF_WITH_BUTTON
265
#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3))
266
#error "The ADC6 (PA3) and user button cannot be enabled at the same time"
267
#else
268
#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \
269
!(ADC_SENSORS_ADC6_PIN == 3))
270
#endif
/* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */
271
#else
272
#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3)
273
#endif
/* PLATFORM_CONF_WITH_BUTTON */
274
/** @} */
275
/*---------------------------------------------------------------------------*/
276
/**
277
* \name SPI (SSI0) configuration
278
*
279
* These values configure which CC2538 pins to use for the SPI (SSI0) lines,
280
* reserved exclusively for the CC1200 RF transceiver. These pins are exposed
281
* to the JP3 connector. To disable the CC1200 and use these pins, just
282
* remove the R10 resistor (0 ohm), which powers both the CC2538 and CC1200 to
283
* only power the SoC.
284
* TX -> MOSI, RX -> MISO
285
* @{
286
*/
287
#define SPI0_CLK_PORT GPIO_B_NUM
288
#define SPI0_CLK_PIN 2
289
#define SPI0_TX_PORT GPIO_B_NUM
290
#define SPI0_TX_PIN 1
291
#define SPI0_RX_PORT GPIO_B_NUM
292
#define SPI0_RX_PIN 3
293
/** @} */
294
/*---------------------------------------------------------------------------*/
295
/**
296
* \name SPI (SSI1) configuration
297
*
298
* These values configure which CC2538 pins to use for the SPI (SSI1) lines,
299
* exposed over JP3 connector.
300
* TX -> MOSI, RX -> MISO
301
* @{
302
*/
303
#define SPI1_CLK_PORT GPIO_D_NUM
304
#define SPI1_CLK_PIN 0
305
#define SPI1_TX_PORT GPIO_C_NUM
306
#define SPI1_TX_PIN 6
307
#define SPI1_RX_PORT GPIO_D_NUM
308
#define SPI1_RX_PIN 2
309
/** @} */
310
/*---------------------------------------------------------------------------*/
311
/**
312
* \name I2C configuration
313
*
314
* These values configure which CC2538 pins to use for the I2C lines, exposed
315
* over JP3 connector.
316
* @{
317
*/
318
#define I2C_SCL_PORT GPIO_C_NUM
319
#define I2C_SCL_PIN 3
320
#define I2C_SDA_PORT GPIO_C_NUM
321
#define I2C_SDA_PIN 2
322
#define I2C_INT_PORT GPIO_D_NUM
323
#define I2C_INT_PIN 1
324
#define I2C_INT_VECTOR GPIO_D_IRQn
325
/** @} */
326
/*---------------------------------------------------------------------------*/
327
/**
328
* \name Dual RF interface support
329
*
330
* Enables support for dual band operation (both CC1200 and 2.4GHz enabled).
331
* Unlike the RE-Mote, the Firefly doesn't have a RF switch, so both interfaces
332
* should be always enabled if the R10 resistor is mounted. If only using the
333
* 2.4GHz RF interface, the resistor can be removed to power-off the CC1200.
334
* @{
335
*/
336
#ifndef REMOTE_DUAL_RF_ENABLED
337
#define REMOTE_DUAL_RF_ENABLED 1
338
#endif
339
/** @} */
340
/*---------------------------------------------------------------------------*/
341
/**
342
* \name CC1200 configuration
343
*
344
* These values configure the required pins to drive the CC1200
345
* None of the following pins are exposed to any connector, kept for internal
346
* use only
347
* @{
348
*/
349
#define CC1200_SPI_INSTANCE 0
350
#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT
351
#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN
352
#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT
353
#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN
354
#define CC1200_SPI_MISO_PORT SPI0_RX_PORT
355
#define CC1200_SPI_MISO_PIN SPI0_RX_PIN
356
#define CC1200_SPI_CSN_PORT GPIO_B_NUM
357
#define CC1200_SPI_CSN_PIN 5
358
#define CC1200_GDO0_PORT GPIO_B_NUM
359
#define CC1200_GDO0_PIN 4
360
#define CC1200_GDO2_PORT GPIO_B_NUM
361
#define CC1200_GDO2_PIN 0
362
#define CC1200_RESET_PORT GPIO_C_NUM
363
#define CC1200_RESET_PIN 7
364
#define CC1200_GPIOx_VECTOR GPIO_B_IRQn
365
/** @} */
366
/*---------------------------------------------------------------------------*/
367
/**
368
* \name Device string used on startup
369
* @{
370
*/
371
#define BOARD_STRING "Zolertia Firefly revision A platform"
372
/** @} */
373
374
#endif
/* BOARD_H_ */
375
376
/**
377
* @}
378
* @}
379
*/
gpio.h
Header file with register and macro declarations for the cc2538 GPIO module.
nvic.h
Header file for the ARM Nested Vectored Interrupt Controller.
arch
platform
zoul
firefly-reva
board.h
Generated on
for Contiki-NG by
1.17.0