Contiki 3.x
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
platform
zoul
muntjac
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
* Copyright (c) 2016, University of Southampton, updated for the Muntjac
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* 2. Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
*
16
* 3. Neither the name of the copyright holder nor the names of its
17
* contributors may be used to endorse or promote products derived
18
* from this software without specific prior written permission.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
* OF THE POSSIBILITY OF SUCH DAMAGE.
32
*/
33
/**
34
* \addtogroup zoul-platforms
35
* @{
36
*
37
* \defgroup muntjac Muntjac platform
38
*
39
* The Muntjac is a platform similar to the Zolertia RE-Mote (CC2538 & CC1200/CC1120)
40
* that is pin-compatible with the Zolertia Z1.
41
*
42
* The Muntjac was designed by the University of Southampton as part of the Mountainsensing
43
* project and is intended to be used with an MS1/MS2 baseboard. The Muntjac includes a TMP102
44
* temperature sensor, M25P16 2MB flash, SD card and dedicated antenna outputs for 868MHz (SMA)
45
* and 2.4GHz (U.FL). Unlike the Z1, separate SPI buses are used for the radio and storage.
46
*
47
* This file provides connectivity information on LEDs, Buttons, UART and other Muntjac,
48
* MS1/MS2 peripherals and sensors. With the Muntjac, D1 and D2 I/O on the MS1/MS2 are not
49
* used due to pin count limitations.
50
*
51
* This file can be used as the basis to configure other platforms using the
52
* cc2538 SoC.
53
* @{
54
*
55
* \file
56
* Header file with definitions related to the I/O connections on the
57
* Muntjac platform, cc2538-based
58
*
59
* \note Do not include this file directly. It gets included by contiki-conf
60
* after all relevant directives have been set.
61
*/
62
#ifndef BOARD_H_
63
#define BOARD_H_
64
65
// Override the Coffee config to use the data flash and not program flash
66
#define COFFEE_CONF_CUSTOM_PORT "muntjac/muntjac-coffee-arch.h"
67
68
// Set our clock rate to 16Mhz
69
#define SYS_CTRL_CONF_SYS_DIV SYS_CTRL_CLOCK_CTRL_SYS_DIV_16MHZ
70
71
#include "dev/gpio.h"
72
#include "
dev/nvic.h
"
73
74
/*---------------------------------------------------------------------------*/
75
/** \name Connector headers
76
*
77
* The Muntjac has three banks of header rows which are in the same formfactor and layout
78
* as the Zolertia Z1. Due to the limited number of pins available on the CC2538, not all
79
* pins on the headers are connected. Ports are defined as per the Z1 datasheet.
80
* Port orientation is defined with the Micro-USB and U.FL connectors to north and the
81
* SMA south.
82
*
83
*
84
* North Port (JP1A) - Analogue IO: Only three ADCs are available on this port.
85
* ADC3 and ADC 1 can be used with Z1 Phidgets. ADC2 is NOT 5V tollerant.
86
* ----------------------+---+---+---------------------------------------------
87
* PIN_NAME | Pin | PIN_NAME
88
* ----------------------+---+---+---------------------------------------------
89
* GND |-01|02-| GND
90
* USB+5V |-03|04-| VCC+3.3V
91
* |-05|06-| ADC3 (PA2)
92
* |-07|08-|
93
* ADC2 (PA4) |-09|10-|
94
* GND |-11|12-| GND
95
* USB+5V |-13|14-| VCC+3.3V
96
* |-15|16-| ADC1 (PA5)
97
* ----------------------+---+---+---------------------------------------------
98
*
99
*
100
* East Port (JP1B) - Digital Busses
101
* The TMP102 is powered from the sensor power control pin (PD1) so is powered
102
* whenever the external sensors are enabled.
103
* ----------------------+---+---+---------------------------------------------
104
* PIN_NAME | Pin | PIN_NAME
105
* ----------------------+---+---+---------------------------------------------
106
* USBGND |-17|18-| GND
107
* D_P |-19|20-| +3.3V_Serial
108
* D_N |-21|22-| +3.3V
109
* USB+5V |-23|24-| GND
110
* PWR_SENSE_EN (PD1) |-25|26-| I2C_SCL (PC3)
111
* |-27|28-| I2C_SDA (PC2)
112
* |-29|30-| PWR_RADIO_EN (PD2)
113
* UART1_RX (PC1) |-31|32-| PWR_SENSE_EN (PD1)
114
* UART1_TX (PC0) |-33|34-| RADIO_SPI_CLK (PB2)
115
* UART0_RX (PA0) |-35|36-| RADIO_SPI_MOSI (PB1)
116
* UART0_TX (PA1) |-37|38-| RADIO_SPI_MISO (PB3)
117
* ----------------------+---+---+---------------------------------------------
118
*
119
*
120
* South Port (JP1C) - Miscellaneous pins.
121
* TEMP_ALERT is only connected to the temperature alert pin of the TMP102. It is
122
* not connected to the CC2538 but can be used for an external alert.
123
* The SD/Flash memory SPI bus is brought out on this port rather than the east port
124
* to maintain compatibility with MS1.
125
* ----------------------+---+---+---------------------------------------------
126
* PIN_NAME | Pin | PIN_NAME
127
* ----------------------+---+---+---------------------------------------------
128
* RADIO_GPIO0 (PB4) |-54|53-| UART0_TX (PA1)
129
* SD_SPI_MISO (PC6) |-52|51-|
130
* SD_SPI_MOSI (PC5) |-50|49-|
131
* RADIO_SPI_CSn (PB5) |-48|47-| UART0_RX (PA0)
132
* RS485_TXEN (PD0) |-46|45-| SD_SPI_CLK (PC4)
133
* USER_BUTTON (PA3) |-44|43-| RADIO_RESET_N (PC7)
134
* RADIO_GPIO2 (PB0) |-42|41-| TEMP_ALERT
135
* +3.3V |-40|39-| GND
136
* ----------------------+---+---+---------------------------------------------
137
*/
138
/*---------------------------------------------------------------------------*/
139
/** \name Muntjac LED configuration
140
*
141
* LEDs on the Muntjac are connected in the same way as the RE-Mote:
142
* - LED1 (Red) -> PD5
143
* - LED2 (Green) -> PD4
144
* - LED3 (Blue) -> PD3
145
*
146
* LED pins are not exposed on the external headers.
147
* @{
148
*/
149
/*---------------------------------------------------------------------------*/
150
/* Some files include leds.h before us, so we need to get rid of defaults in
151
* leds.h before we provide correct definitions */
152
#undef LEDS_GREEN
153
#undef LEDS_YELLOW
154
#undef LEDS_BLUE
155
#undef LEDS_RED
156
#undef LEDS_CONF_ALL
157
158
/* In leds.h the LEDS_BLUE is defined by LED_YELLOW definition */
159
#define LEDS_GREEN (1 << 4)
/**< LED1 (Green) -> PD4 */
160
#define LEDS_BLUE (1 << 3)
/**< LED2 (Blue) -> PD3 */
161
#define LEDS_RED (1 << 5)
/**< LED3 (Red) -> PD5 */
162
163
#define LEDS_CONF_ALL (LEDS_GREEN | LEDS_BLUE | LEDS_RED)
164
165
#define LEDS_LIGHT_BLUE (LEDS_GREEN | LEDS_BLUE)
/**< Green + Blue (24) */
166
#define LEDS_YELLOW (LEDS_GREEN | LEDS_RED)
/**< Green + Red (48) */
167
#define LEDS_PURPLE (LEDS_BLUE | LEDS_RED)
/**< Blue + Red (40) */
168
#define LEDS_WHITE LEDS_ALL
/**< Green + Blue + Red (56) */
169
170
/* Notify various examples that we have LEDs */
171
#define PLATFORM_HAS_LEDS 1
172
/** @} */
173
/*---------------------------------------------------------------------------*/
174
/** \name USB configuration
175
*
176
* The USB pullup is enabled by an external resistor, not mapped to a GPIO
177
*/
178
#ifdef USB_PULLUP_PORT
179
#undef USB_PULLUP_PORT
180
#endif
181
#ifdef USB_PULLUP_PIN
182
#undef USB_PULLUP_PIN
183
#endif
184
/** @} */
185
/*---------------------------------------------------------------------------*/
186
/** \name UART configuration
187
*
188
* On the Muntjac, the UARTs are connected to the following ports/pins:
189
*
190
* - UART0:
191
* - RX: PA0, connected to CP2104 serial-to-usb converter TX pin
192
* - TX: PA1, connected to CP2104 serial-to-usb converter RX pin
193
* - UART1:
194
* - RX: PC1
195
* - TX: PC0
196
*
197
* UART0 and UART1 are both configured without HW pull-up resistor and neither
198
* port supports CTS or RTS. UART0 and UART1 are exposed on the east port.
199
* UART0 is also exposed on the south port.
200
* @{
201
*/
202
#define UART0_RX_PORT GPIO_A_NUM
203
#define UART0_RX_PIN 0
204
#define UART0_TX_PORT GPIO_A_NUM
205
#define UART0_TX_PIN 1
206
207
#define UART1_RX_PORT GPIO_C_NUM
208
#define UART1_RX_PIN 1
209
#define UART1_TX_PORT GPIO_C_NUM
210
#define UART1_TX_PIN 0
211
#define UART1_CTS_PORT (-1)
212
#define UART1_CTS_PIN (-1)
213
#define UART1_RTS_PORT (-1)
214
#define UART1_RTS_PIN (-1)
215
216
#define RS485_UART 1
217
#define RS485_UART_BASE UART_1_BASE
218
#undef UART1_CONF_BAUD_RATE
219
#define UART1_CONF_BAUD_RATE 9600
220
/** @} */
221
/*---------------------------------------------------------------------------*/
222
/**
223
* \name ADC configuration
224
*
225
* These values configure which CC2538 pins and ADC channels to use for the ADC
226
* inputs. The Muntjac has three accessible ADCs exposed on the north port.
227
* ADC 1 and ADC 3 are connected next to 3.3V and ground so that they can be
228
* used with phidget-like connectors. All of the exposed ADCs support 3.3V
229
* operation only.
230
*
231
* - ADC1 (PA5): ADC1 on Z1 header. Connected to ADC1 header on MS1/MS2.
232
* - ADC2 (PA4): ADC2 on Z1 header. Connected to ADC2 header on MS1/MS2.
233
* - ADC3 (PA2): ADC7 on Z1 header. Used for Batvolts on MS1/MS1.
234
*
235
* The other ADC channels of the CC2538 are not available for use as the pins
236
* are used for the user button and the SD card.
237
* @{
238
*/
239
#define ADC_SENSORS_PORT GPIO_A_NUM
/**< ADC GPIO control port */
240
241
#ifndef ADC_SENSORS_CONF_ADC1_PIN
242
#define ADC_SENSORS_ADC1_PIN 5
/**< ADC1 to PA5, 3V3 */
243
#else
244
#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5))
245
#error "ADC1 channel should be mapped to PA5 or disabled with -1"
246
#else
247
#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN
248
#endif
249
#endif
250
251
#ifndef ADC_SENSORS_CONF_ADC3_PIN
252
#define ADC_SENSORS_ADC3_PIN 2
/**< ADC3 to PA2, 3V3 */
253
#else
254
#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2))
255
#error "ADC3 channel should be mapped to PA2 or disabled with -1"
256
#else
257
#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN
258
#endif
259
#endif
260
261
#ifndef ADC_SENSORS_CONF_ADC2_PIN
262
#define ADC_SENSORS_ADC2_PIN 4
/**< ADC2 to PA4, 3V3 */
263
#else
264
#if ((ADC_SENSORS_CONF_ADC2_PIN != -1) && (ADC_SENSORS_CONF_ADC2_PIN != 4))
265
#error "ADC2 channel should be mapped to PA4 or disabled with -1"
266
#else
267
#define ADC_SENSORS_ADC2_PIN ADC_SENSORS_CONF_ADC2_PIN
268
#endif
269
#endif
270
271
#ifndef ADC_SENSORS_CONF_ADC4_PIN
272
#define ADC_SENSORS_ADC4_PIN (-1)
/**< ADC4 not declared */
273
#else
274
#error "ADC4 should be disabled"
275
#endif
276
277
#ifndef ADC_SENSORS_CONF_ADC5_PIN
278
#define ADC_SENSORS_ADC5_PIN (-1)
/**< ADC5 not declared */
279
#else
280
#error "ADC5 should be disabled"
281
#endif
282
283
#ifndef ADC_SENSORS_CONF_ADC6_PIN
284
#define ADC_SENSORS_ADC6_PIN (-1)
/**< ADC6 not declared */
285
#else
286
#error "ADC6 should be disabled"
287
#endif
288
289
#ifndef ADC_SENSORS_CONF_MAX
290
#define ADC_SENSORS_MAX 3
/**< Maximum sensors */
291
#else
292
#if (ADC_SENSORS_CONF_MAX > 3)
293
#error "Too many ADC sensors defined. Maximum is 3."
294
#else
295
#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX
296
#endif
297
#endif
298
/** @} */
299
/*---------------------------------------------------------------------------*/
300
/** \name Muntjac Button configuration
301
*
302
* Buttons on the RE-Mote are connected as follows:
303
* - BUTTON_USER -> PA3, USR user button, shared with bootloader
304
* - BUTTON_RESET -> RESET_N line, RST reset CC2538
305
* @{
306
*/
307
/** BUTTON_USER -> PA3 */
308
#define BUTTON_USER_PORT GPIO_A_NUM
309
#define BUTTON_USER_PIN 3
310
#define BUTTON_USER_VECTOR NVIC_INT_GPIO_PORT_A
311
312
/* Notify various examples that we have a user button.
313
* This is hard-coded as ADC6 cannot be used.
314
*/
315
#define PLATFORM_HAS_BUTTON 1
316
/** @} */
317
/*---------------------------------------------------------------------------*/
318
/** \name Muntjac RAIN_INT configuration
319
*
320
* The RAIN_INT is connected to the USD_DETECT as a bodge becausewe forgot to
321
* hook up the real pin and are now out.
322
* @{
323
*/
324
#define RAIN_INT_PORT USD_DETECT_PORT
325
#define RAIN_INT_PIN USD_DETECT_PIN
326
#define RAIN_INT_VECTOR NVIC_INT_GPIO_PORT_B
327
/** @} */
328
/*---------------------------------------------------------------------------*/
329
/**
330
* \name SPI (SSI0) configuration
331
*
332
* These values configure which CC2538 pins to use for the SPI (SSI0) lines,
333
* reserved exclusively for the CC1200 RF transceiver. These pins are exposed
334
* on the east port but their use for anything else should be avoided.
335
* TX -> MOSI, RX -> MISO
336
* @{
337
*/
338
#define SPI0_CLK_PORT GPIO_B_NUM
339
#define SPI0_CLK_PIN 2
340
#define SPI0_TX_PORT GPIO_B_NUM
341
#define SPI0_TX_PIN 1
342
#define SPI0_RX_PORT GPIO_B_NUM
343
#define SPI0_RX_PIN 3
344
345
/** @} */
346
/*---------------------------------------------------------------------------*/
347
/**
348
* \name SPI (SSI1) configuration
349
*
350
* These values configure which CC2538 pins to use for the SPI (SSI1) lines,
351
* shared by the micro SD card and M25P16 flash. This bus is exposed on the
352
* south port. No pins are available for external CSn without sacrificing other
353
* functionality.
354
* TX -> MOSI, RX -> MISO
355
* @{
356
*/
357
#define SPI1_CLK_PORT GPIO_C_NUM
358
#define SPI1_CLK_PIN 4
359
#define SPI1_TX_PORT GPIO_C_NUM
360
#define SPI1_TX_PIN 5
361
#define SPI1_RX_PORT GPIO_C_NUM
362
#define SPI1_RX_PIN 6
363
/** @} */
364
/*---------------------------------------------------------------------------*/
365
/**
366
* \name I2C configuration
367
*
368
* These values configure which CC2538 pins to use for the I2C lines, exposed
369
* over JP6 connector, also available as testpoints T2 (PC2) and T3 (PC3).
370
* The I2C bus is used for the RTC on MS1/MS2 and is shared with the on-board TMP102.
371
* The I2C is exposed on the east port. Due to pin limitations, no interrupt pin is
372
* exposed.
373
* @{
374
*/
375
#define I2C_SCL_PORT GPIO_C_NUM
376
#define I2C_SCL_PIN 3
377
#define I2C_SDA_PORT GPIO_C_NUM
378
#define I2C_SDA_PIN 2
379
#define I2C_INT_PORT (-1)
380
#define I2C_INT_PIN (-1)
381
#define I2C_INT_VECTOR (-1)
382
/** @} */
383
/*---------------------------------------------------------------------------*/
384
/**
385
* \name CC1200 configuration
386
*
387
* These values configure the required pins to drive the CC1200
388
* These pins are exposed on the east port but their use for anything
389
* else should be avoided.
390
* @{
391
*/
392
393
394
/* TODO Consolidate*/
395
#define RADIO_SPI_CLK_PORT SPI0_CLK_PORT
396
#define RADIO_SPI_CLK_PIN SPI0_CLK_PIN
397
#define RADIO_SPI_MOSI_PORT SPI0_TX_PORT
398
#define RADIO_SPI_MOSI_PIN SPI0_TX_PIN
399
#define RADIO_SPI_MISO_PORT SPI0_RX_PORT
400
#define RADIO_SPI_MISO_PIN SPI0_RX_PIN
401
#define RADIO_SPI_CSN_PORT GPIO_B_NUM
402
#define RADIO_SPI_CSN_PIN 5
403
#define RADIO_RESET_PORT GPIO_C_NUM
404
#define RADIO_RESET_PIN 7
405
#define RADIO_GPIO0_PORT GPIO_B_NUM
406
#define RADIO_GPIO0_PIN 4
407
#define RADIO_GPIO2_PORT GPIO_B_NUM
408
#define RADIO_GPIO2_PIN 0
409
410
#define CC1200_SPI_INSTANCE 0
411
#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT
412
#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN
413
#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT
414
#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN
415
#define CC1200_SPI_MISO_PORT SPI0_RX_PORT
416
#define CC1200_SPI_MISO_PIN SPI0_RX_PIN
417
#define CC1200_SPI_CSN_PORT GPIO_B_NUM
418
#define CC1200_SPI_CSN_PIN 5
419
#define CC1200_GDO0_PORT GPIO_B_NUM
420
#define CC1200_GDO0_PIN 4
421
#define CC1200_GDO2_PORT GPIO_B_NUM
422
#define CC1200_GDO2_PIN 0
423
#define CC1200_RESET_PORT GPIO_C_NUM
424
#define CC1200_RESET_PIN 7
425
#define CC1200_GPIOx_VECTOR NVIC_INT_GPIO_PORT_B
426
/** @} */
427
/*---------------------------------------------------------------------------*/
428
/**
429
* \name Misc Peripheral Control control
430
*
431
* These values configure the pins used to control peripherals on the Muntjac and MS1/MS2.
432
* PWR_RADIO_EN is used to control power to the on-board CC1200.
433
* PWR_SENSE_EN is used to control sensors/sensor power supplies.
434
* RS485_TXEN is used to put the half-duplex RS485 transciever into TX.
435
* @{
436
*/
437
#define PWR_RADIO_EN_PORT GPIO_D_NUM
438
#define PWR_RADIO_EN_PIN 2
439
#define PWR_SD_EN_PORT GPIO_A_NUM
440
#define PWR_SD_EN_PIN 6
441
442
#define PWR_SENSE_EN_PORT GPIO_D_NUM
443
#define PWR_SENSE_EN_PIN 1
444
445
#define RS485_TXEN_PORT GPIO_D_NUM
446
#define RS485_TXEN_PIN 0
447
/** @} */
448
/*---------------------------------------------------------------------------*/
449
/**
450
* \name Storage Configuration
451
*
452
* These values configure the required pins to drive the built-in flash storage.
453
* The Muntjac has the facility for both a microSD card and an on-board M25P16 2MB
454
* flash. Both are connected to SSI1/SPI1.
455
*
456
* PA6 is used to disable power to the SD card. The M25P16 is always powered. The
457
* control and data lines for the SD card are buffered through a level translator
458
* to prevent the SD card drawing (mA +) quiescent current through CSn and the SPI
459
* bus.
460
*
461
* PB7 is used for SD card presence detection, but can be used for !HOLD on the
462
* M25P16 with a hardware modification if required.
463
* @{
464
*/
465
#define USD_CLK_PORT SPI1_CLK_PORT
466
#define USD_CLK_PIN SPI1_CLK_PIN
467
#define USD_MOSI_PORT SPI1_TX_PORT
468
#define USD_MOSI_PIN SPI1_TX_PIN
469
#define USD_MISO_PORT SPI1_RX_PORT
470
#define USD_MISO_PIN SPI1_RX_PIN
471
#define USD_CSN_PORT GPIO_A_NUM
472
#define USD_CSN_PIN 7
473
#define USD_DETECT_PORT GPIO_B_NUM
474
#define USD_DETECT_PIN 7
475
476
#define FLASH_CSN_PORT GPIO_B_NUM
477
#define FLASH_CSN_PIN 6
478
#define FLASH_SPI_INSTANCE 1
479
480
/** @} */
481
/*---------------------------------------------------------------------------*/
482
/**
483
* \name On-board external WDT
484
* The Muntjac does not feature an on-board external WDT like the RE-Mote.
485
* @{
486
*/
487
#define EXT_WDT_PORT (-1)
488
#define EXT_WDT_PIN (-1)
489
490
/** @} */
491
/*---------------------------------------------------------------------------*/
492
/**
493
* \name Device string used on startup
494
* @{
495
*/
496
#define BOARD_STRING "UoS Muntjac platform"
497
/** @} */
498
499
#endif
/* BOARD_H_ */
500
501
/**
502
* @}
503
* @}
504
*/
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