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
* \defgroup remote-reva RE-Mote platform revision A
37
*
38
* The RE-Mote was designed jointly with universities and industry partners in
39
* RERUM European project, to ease the development of private and secure
40
* applications for IoT and Smart City applications. The RE-Mote packs several
41
* on-board resources, like a RTC, external WDT, Micro-SD, RF switch and a
42
* Shutdown mode to reduce its power consumption down to 300nA.
43
*
44
* This file provides connectivity information on LEDs, Buttons, UART and
45
* other RE-Mote revision A 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
* RE-Mote platform (revision A), cc2538-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 RE-Mote features two 2.54 mm header rows over which exposes the following
67
* pins (facing up, Zolertia/RERUM logo above, buttons and micro USB at bottom):
68
* ----------------------+---+---+---------------------------------------------
69
* PIN_NAME |JP6|JP5| PIN_NAME
70
* ----------------------+---+---+---------------------------------------------
71
* LED1/EXT_WDT/PD5 |-01|18-| PC6/SPI1.MISO/USD.MISO
72
* LED2/UART1.CTS/PD4 |-02|17-| PC5/SPI1.MOSI/USD.MOSI
73
* LED3/UART1.RTS/PD3 |-03|16-| PC4/SPI1.SCLK/USD.SCLK
74
* UART0.RX/PA0 |-04|15-| PA3/BUTTON.USER
75
* UART0.TX/PA1 |-05|14-| RESET/JTAG.RESET/BUTTON.RESET
76
* SHUTDOWN_ENABLE/PD1 |-06|13-| DGND
77
* RTC.SDA/I2C.SDA/PC2 |-07|12-| D+3.3
78
* RTC.SCL/I2C.SCL/PC3 |-08|11-| PA5/AIN5/ADC1
79
* DGND |-09|10-| PA4/RTC_INT1/AIN4/ADC2
80
* D+3.3 |-10|09-| DGND
81
* USD.CS/AIN7/PA7 |-11|08-| D+5.1
82
* SHUTDOWN_DONE/PD0 |-12|07-| PA2/AIN2/ADC3
83
* UART1.RX/PC1 |-13|06-| JTAG.TMS
84
* UART1.TX/PC0 |-14|05-| JTAG.TCK
85
* DGND |-15|04-| PB7/JTAG.TDO
86
* D+3.3 |-16|03-| PB6/JTAG.TDI
87
* DGND |-17|02-| PS+EXT
88
* +VBAT |-18|01-| DGND
89
* ----------------------+---+---+---------------------------------------------
90
*/
91
/*---------------------------------------------------------------------------*/
92
/** \name RE-Mote LED configuration
93
*
94
* LEDs on the RE-Mote are connected as follows:
95
* - LED1 (Red) -> PD5
96
* - LED2 (Green) -> PD4
97
* - LED3 (Blue) -> PD3
98
*
99
* LED1 pin shared with EXT_WDT and exposed in JP6 connector
100
* LED2 pin shared with UART1 CTS, pin exposed in JP6 connector
101
* LED3 pin shared with UART1 RTS, exposed in JP6 connector
102
* @{
103
*/
104
/*---------------------------------------------------------------------------*/
105
#define LEDS_ARCH_L1_PORT GPIO_D_NUM
106
#define LEDS_ARCH_L1_PIN 5
107
#define LEDS_ARCH_L2_PORT GPIO_D_NUM
108
#define LEDS_ARCH_L2_PIN 4
109
#define LEDS_ARCH_L3_PORT GPIO_D_NUM
110
#define LEDS_ARCH_L3_PIN 3
111
112
#define LEDS_CONF_RED 1
113
#define LEDS_CONF_GREEN 2
114
#define LEDS_CONF_BLUE 4
115
116
#define LEDS_CONF_COUNT 3
117
/** @} */
118
/*---------------------------------------------------------------------------*/
119
/** \name USB configuration
120
*
121
* The USB pullup is enabled by an external resistor, not mapped to a GPIO
122
* @{
123
*/
124
#ifdef USB_PULLUP_PORT
125
#undef USB_PULLUP_PORT
126
#endif
127
#ifdef USB_PULLUP_PIN
128
#undef USB_PULLUP_PIN
129
#endif
130
/** @} */
131
/*---------------------------------------------------------------------------*/
132
/** \name UART configuration
133
*
134
* On the RE-Mote, the UARTs are connected to the following ports/pins:
135
*
136
* - UART0:
137
* - RX: PA0, connected to CP2104 serial-to-usb converter TX pin
138
* - TX: PA1, connected to CP2104 serial-to-usb converter RX pin
139
* - UART1:
140
* - RX: PC1
141
* - TX: PC0
142
* - CTS: PD4, shared with LED2 (Green), disabled as default
143
* - RTS: PD3, shared with LED3 (Blue), disabled as default
144
*
145
* We configure the port to use UART0 and UART1, CTS/RTS only for UART1,
146
* both without a HW pull-up resistor
147
* UART0 and UART1 pins are exposed over the JP6 connector
148
* @{
149
*/
150
#define UART0_RX_PORT GPIO_A_NUM
151
#define UART0_RX_PIN 0
152
#define UART0_TX_PORT GPIO_A_NUM
153
#define UART0_TX_PIN 1
154
155
#define UART1_RX_PORT GPIO_C_NUM
156
#define UART1_RX_PIN 1
157
#define UART1_TX_PORT GPIO_C_NUM
158
#define UART1_TX_PIN 0
159
#define UART1_CTS_PORT (-1)
160
#define UART1_CTS_PIN (-1)
161
#define UART1_RTS_PORT (-1)
162
#define UART1_RTS_PIN (-1)
163
/** @} */
164
/*---------------------------------------------------------------------------*/
165
/**
166
* \name ADC configuration
167
*
168
* These values configure which CC2538 pins and ADC channels to use for the ADC
169
* inputs. By default the RE-Mote allows two out-of-the-box ADC ports with a
170
* phidget-like 3-pin connector (GND/VDD/ADC)
171
*
172
* The RE-Mote allows both 3.3V and 5V analogue sensors as follow:
173
*
174
* - ADC1: up to 3.3V.
175
* - ADC2: up to 3.3V, shared with RTC_INT
176
* - ADC3: up to 5V, by means of a 2/3 voltage divider.
177
*
178
* Also there are other ADC channels shared by default with Micro SD card and
179
* user button implementations:
180
* - ADC4: up to 3.3V.
181
* - ADC5: up to 3.3V.
182
* - ADC6: up to 3.3V.
183
*
184
* ADC inputs can only be on port A.
185
* All ADCx are exposed in JP5 connector, but only ADC1 and ADC3 have GND and
186
* VDD (3/5V) pins next to it, so these can be exposed into a 3-pin phidget-like
187
* connector, for ADC2 either solder a wire to connect, or use a 4-pin connector
188
* to expose both ADC1 and ADC2 in a single connector, but this will leave no
189
* space for a ADC3 connector.
190
* The internal ADC reference is 1190mV, use either a voltage divider as input,
191
* or a different voltage reference, like AVDD5 or other externally (AIN7), but
192
* note the PA7 is shared with the Micro-SD CSn pin, likewise for PA6 (AIN6)
193
* shared witht the Micro-SD select pin
194
* To use the ADC2 pin, remove the resistor on the Zoul's PA4 pin (JP1, pin 10)
195
* and enable below (replace -1 with 4).
196
* @{
197
*/
198
#define ADC_SENSORS_PORT GPIO_A_NUM
/**< ADC GPIO control port */
199
200
#ifndef ADC_SENSORS_CONF_ADC1_PIN
201
#define ADC_SENSORS_ADC1_PIN 5
/**< ADC1 to PA5, 3V3 */
202
#else
203
#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5))
204
#error "ADC1 channel should be mapped to PA5 or disabled with -1"
205
#else
206
#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN
207
#endif
208
#endif
209
210
#ifndef ADC_SENSORS_CONF_ADC3_PIN
211
#define ADC_SENSORS_ADC3_PIN 2
/**< ADC3 to PA2, 5V */
212
#else
213
#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2))
214
#error "ADC3 channel should be mapped to PA2 or disabled with -1"
215
#else
216
#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN
217
#endif
218
#endif
219
220
#ifndef ADC_SENSORS_CONF_ADC2_PIN
221
#define ADC_SENSORS_ADC2_PIN (-1)
/**< ADC2 no declared */
222
#else
223
#define ADC_SENSORS_ADC2_PIN 4
/**< Hard-coded to PA4 */
224
#endif
225
226
#ifndef ADC_SENSORS_CONF_ADC4_PIN
227
#define ADC_SENSORS_ADC4_PIN (-1)
/**< ADC4 not declared */
228
#else
229
#define ADC_SENSORS_ADC4_PIN 6
/**< Hard-coded to PA6 */
230
#endif
231
232
#ifndef ADC_SENSORS_CONF_ADC5_PIN
233
#define ADC_SENSORS_ADC5_PIN (-1)
/**< ADC5 not declared */
234
#else
235
#define ADC_SENSORS_ADC5_PIN 7
/**< Hard-coded to PA7 */
236
#endif
237
238
#ifndef ADC_SENSORS_CONF_ADC6_PIN
239
#define ADC_SENSORS_ADC6_PIN (-1)
/**< ADC6 not declared */
240
#else
241
#define ADC_SENSORS_ADC6_PIN 3
/**< Hard-coded to PA3 */
242
#endif
243
244
#ifndef ADC_SENSORS_CONF_MAX
245
#define ADC_SENSORS_MAX 2
/**< Maximum sensors */
246
#else
247
#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX
248
#endif
249
/** @} */
250
/*---------------------------------------------------------------------------*/
251
/** \name RE-Mote Button configuration
252
*
253
* Buttons on the RE-Mote are connected as follows:
254
* - BUTTON_USER -> PA3, S1 user button, shared with bootloader and RTC_INT1
255
* - BUTTON_RESET -> RESET_N line, S2 reset both CC2538 and CoP
256
* - BUTTON_PIC1W -> shared with SHUTDOWN_ENABLE, not mounted.
257
* @{
258
*/
259
/** BUTTON_USER -> PA3 */
260
#define BUTTON_USER_PORT GPIO_A_NUM
261
#define BUTTON_USER_PIN 3
262
#define BUTTON_USER_VECTOR GPIO_A_IRQn
263
264
/* Notify various examples that we have an user button.
265
* If ADC6 channel is used, then disable the user button
266
*/
267
#ifdef PLATFORM_CONF_WITH_BUTTON
268
#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3))
269
#error "The ADC6 (PA3) and user button cannot be enabled at the same time"
270
#else
271
#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \
272
!(ADC_SENSORS_ADC6_PIN == 3))
273
#endif
/* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */
274
#else
275
#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3)
276
#endif
/* PLATFORM_CONF_WITH_BUTTON */
277
/** @} */
278
/*---------------------------------------------------------------------------*/
279
/**
280
* \name SPI (SSI0) configuration
281
*
282
* These values configure which CC2538 pins to use for the SPI (SSI0) lines,
283
* reserved exclusively for the CC1200 RF transceiver. These pins are not
284
* exposed to any connector, and should be avoid to use it.
285
* TX -> MOSI, RX -> MISO
286
* @{
287
*/
288
#define SPI0_CLK_PORT GPIO_B_NUM
289
#define SPI0_CLK_PIN 2
290
#define SPI0_TX_PORT GPIO_B_NUM
291
#define SPI0_TX_PIN 1
292
#define SPI0_RX_PORT GPIO_B_NUM
293
#define SPI0_RX_PIN 3
294
/** @} */
295
/*---------------------------------------------------------------------------*/
296
/**
297
* \name SPI (SSI1) configuration
298
*
299
* These values configure which CC2538 pins to use for the SPI (SSI1) lines,
300
* shared with the microSD and exposed over JP5 connector.
301
* It is advisable to use a CSn pin other than the Micro-SD's.
302
* TX -> MOSI, RX -> MISO
303
* @{
304
*/
305
#define SPI1_CLK_PORT GPIO_C_NUM
306
#define SPI1_CLK_PIN 4
307
#define SPI1_TX_PORT GPIO_C_NUM
308
#define SPI1_TX_PIN 5
309
#define SPI1_RX_PORT GPIO_C_NUM
310
#define SPI1_RX_PIN 6
311
/** @} */
312
/*---------------------------------------------------------------------------*/
313
/**
314
* \name I2C configuration
315
*
316
* These values configure which CC2538 pins to use for the I2C lines, exposed
317
* over JP6 connector, also available as testpoints T2 (PC2) and T3 (PC3).
318
* The I2C bus is shared with the on-board RTC.
319
* The I2C is exposed over the JP6 header, using a 5-pin connector with 2.54 mm
320
* spacing, providing also D+3.3V, GND and a generic pin that can be used as an
321
* interrupt pin
322
* @{
323
*/
324
#define I2C_SCL_PORT GPIO_C_NUM
325
#define I2C_SCL_PIN 3
326
#define I2C_SDA_PORT GPIO_C_NUM
327
#define I2C_SDA_PIN 2
328
#define I2C_INT_PORT GPIO_D_NUM
329
#define I2C_INT_PIN 1
330
#define I2C_INT_VECTOR GPIO_D_IRQn
331
/** @} */
332
/*---------------------------------------------------------------------------*/
333
/**
334
* \name Antenna switch configuration
335
*
336
* These values configure the required pin to drive the RF antenna switch, to
337
* either enable the sub-1Ghz RF interface (power-up the CC1200) or the 2.4GHz
338
* RF interface of the CC2538, both alternatively routed to a RP-SMA connector
339
* to allow using an external antenna for both cases.
340
*
341
* Note it is also possible to enable both RF interfaces at the same time, by
342
* switching On the sub-1GHz RF interface, and placing an 0Ohm resistor (R19),
343
* to select between using a ceramic chip antenna (not mounted), or to connect
344
* and external antenna over a pigtail to the U.Fl connector (not mounted).
345
*
346
* RF switch state:
347
* - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off.
348
* - HIGH: Sub-1GHz RF interface on RP-SMA connector.
349
* @{
350
*/
351
#define ANTENNA_RF_SW_PORT GPIO_D_NUM
352
#define ANTENNA_RF_SW_PIN 2
353
/** @} */
354
/*---------------------------------------------------------------------------*/
355
/**
356
* \name Dual RF interface support
357
*
358
* Enables support for dual band operation (both CC1200 and 2.4GHz enabled).
359
* The driver checks the selected Radio stack, and forces the antenna switch to
360
* either position. Enabling the definition below forces to skip this check.
361
* @{
362
*/
363
#ifndef REMOTE_DUAL_RF_ENABLED
364
#define REMOTE_DUAL_RF_ENABLED 0
365
#endif
366
/** @} */
367
/*---------------------------------------------------------------------------*/
368
/**
369
* \name CC1200 configuration
370
*
371
* These values configure the required pins to drive the CC1200
372
* None of the following pins are exposed to any connector, kept for internal
373
* use only
374
* @{
375
*/
376
#define CC1200_SPI_INSTANCE 0
377
#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT
378
#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN
379
#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT
380
#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN
381
#define CC1200_SPI_MISO_PORT SPI0_RX_PORT
382
#define CC1200_SPI_MISO_PIN SPI0_RX_PIN
383
#define CC1200_SPI_CSN_PORT GPIO_B_NUM
384
#define CC1200_SPI_CSN_PIN 5
385
#define CC1200_GDO0_PORT GPIO_B_NUM
386
#define CC1200_GDO0_PIN 4
387
#define CC1200_GDO2_PORT GPIO_B_NUM
388
#define CC1200_GDO2_PIN 0
389
#define CC1200_RESET_PORT GPIO_C_NUM
390
#define CC1200_RESET_PIN 7
391
#define CC1200_GPIOx_VECTOR GPIO_B_IRQn
392
/** @} */
393
/*---------------------------------------------------------------------------*/
394
/**
395
* \name microSD configuration
396
*
397
* These values configure the required pins to drive the built-in microSD
398
* external module, to be used with SSI1
399
* @{
400
*/
401
#define USD_SPI_INSTANCE 1
402
#define USD_CLK_PORT SPI1_CLK_PORT
403
#define USD_CLK_PIN SPI1_CLK_PIN
404
#define USD_MOSI_PORT SPI1_TX_PORT
405
#define USD_MOSI_PIN SPI1_TX_PIN
406
#define USD_MISO_PORT SPI1_RX_PORT
407
#define USD_MISO_PIN SPI1_RX_PIN
408
#define USD_CSN_PORT GPIO_A_NUM
409
#define USD_CSN_PIN 7
410
#define USD_SEL_PORT GPIO_A_NUM
411
#define USD_SEL_PIN 6
412
/** @} */
413
/*---------------------------------------------------------------------------*/
414
/**
415
* \name Power management and shutdown mode
416
*
417
* The shutdown mode is an ultra-low power operation mode that effectively
418
* powers-down the entire RE-Mote (CC2538, CC1200, attached sensors, etc) and
419
* only keeps running a power gating timer (NanoTimer), the on-board RTC and
420
* an ultra-low power consumption MCU (PIC12F635). The Shutdown mode allows:
421
*
422
* - Put the RE-Mote in an ultra-low power sleep (shutdown) drawing <200nA avg.
423
* - Periodically awake and execute tasks, being the shutdown period selectable
424
* via R47 resistor value (22KOhm as default for 1 minute shutdown period).
425
* - Enter shutdown mode before the shutdown period expiration, by invoking the
426
* PM_SHUTDOWN_NOW macrp
427
*
428
* The shutdown mode can be disabled by hardware by short-circuiting or placing
429
* an 0Ohm resistor across W1 pad.
430
* @{
431
*/
432
#define PM_DONE_PORT GPIO_D_NUM
433
#define PM_DONE_PIN 0
434
#define PM_CMD_PORT GPIO_D_NUM
435
#define PM_CMD_PIN 1
436
/** @} */
437
/*---------------------------------------------------------------------------*/
438
/**
439
* \name On-board RTC
440
*
441
* The shutdown mode can be disabled by hardware by short-circuiting or placing
442
* an 0Ohm resistor across W1 pad. As the RTC_INT1 pin is also shared with the
443
* BUTTON_USER, so either disable or not use the user button, or upon receiving
444
* an interrupt, poll the RTC.
445
*
446
* The RTC_INT1 can be used to exit the CC2538's LPM3 mode.
447
* A second interruption pin is connected to the PIC12F635, for applications
448
* requiring to put the PIC into deep-sleep and waking up at a certain time.
449
* @{
450
*/
451
#define PLATFORM_HAS_RTC 1
452
#define RTC_SDA_PORT I2C_SDA_PORT
453
#define RTC_SDA_PIN I2C_SDA_PIN
454
#define RTC_SCL_PORT I2C_SCL_PORT
455
#define RTC_SCL_PIN I2C_SCL_PIN
456
#define RTC_INT1_PORT GPIO_A_NUM
457
#define RTC_INT1_PIN 4
458
#define RTC_INT1_VECTOR GPIO_A_IRQn
459
/** @} */
460
/*---------------------------------------------------------------------------*/
461
/**
462
* \name On-board external WDT
463
* The RE-Mote features an on-board external WDT and battery monitor, which
464
* adds more robustness and prevents the mote to run wild if any unexpected
465
* problem shows-up.
466
* The external WDT requires a short pulse (<1ms) to be sent before a 2-second
467
* period. The battery monitor keeps the device in Reset if the voltage input
468
* is lower than 2.5V.
469
* The external WDT can be disabled by removing the R40 0Ohm resistor.
470
* The EXT_WDT pin is shared with LED1 (Red). For long-time operation, it is
471
* advised to remove R14 resistor to disable LED1.
472
* As default the Texas Instrument's TPS3823 WDT is not mounted.
473
* @{
474
*/
475
#define EXT_WDT_PORT GPIO_D_NUM
476
#define EXT_WDT_PIN 5
477
/** @} */
478
/*---------------------------------------------------------------------------*/
479
/**
480
* \name Device string used on startup
481
* @{
482
*/
483
#define BOARD_STRING "Zolertia RE-Mote revision A platform"
484
/** @} */
485
486
#endif
/* BOARD_H_ */
487
488
/**
489
* @}
490
* @}
491
*/
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
remote-reva
board.h
Generated on
for Contiki-NG by
1.17.0