Contiki-NG
cc13xx-cc26xx-conf.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018, 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 * 3. Neither the name of the copyright holder nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/**
31 * \addtogroup cc13xx-cc26xx-cpu
32 * @{
33 *
34 * \file
35 * Header with configuration defines common to the CC13xx/CC26xx
36 * platform.
37 * \author
38 * Edvard Pettersen <e.pettersen@ti.com>
39 */
40/*---------------------------------------------------------------------------*/
41#ifndef CC13XX_CC26XX_CONF_H_
42#define CC13XX_CC26XX_CONF_H_
43/*---------------------------------------------------------------------------*/
44#include "cc13xx-cc26xx-def.h"
45
46#include "rf/rf.h"
47/*---------------------------------------------------------------------------*/
48/**
49 * \name Board Configuration.
50 *
51 * @{
52 */
53
54/* Configure that a board has sensors for the dev/sensors.h API. */
55#ifndef BOARD_CONF_HAS_SENSORS
56#define BOARD_CONF_HAS_SENSORS 0
57#endif
58
59/* Enable/disable the dev/sensors.h API for the given board. */
60#ifndef BOARD_CONF_SENSORS_DISABLE
61#define BOARD_CONF_SENSORS_DISABLE 0
62#endif
63/** @} */
64/*---------------------------------------------------------------------------*/
65/**
66 * \name Watchdog Configuration.
67 *
68 * @{
69 */
70#ifndef WATCHDOG_CONF_DISABLE
71#define WATCHDOG_CONF_DISABLE 0
72#endif
73
74#ifndef WATCHDOG_CONF_TIMEOUT_MS
75#define WATCHDOG_CONF_TIMEOUT_MS 1000
76#endif
77/** @} */
78/*---------------------------------------------------------------------------*/
79/**
80 * \name RF configuration.
81 *
82 * @{
83 */
84
85/*
86 * Set the inactivity timeout period for the RF driver. This determines how
87 * long the RF driver will wait when inactive until turning off the RF Core.
88 * Specified in microseconds.
89 */
90#ifndef RF_CONF_INACTIVITY_TIMEOUT
91#define RF_CONF_INACTIVITY_TIMEOUT 2000 /**< 2 ms */
92#endif
93
94/*
95 * Configure the TX power for the netstack, specified in dBm. Defaults to
96 * maximum available TX power setting for the specific PHY.
97 */
98#ifndef RF_CONF_TXPOWER_DBM
99#define RF_CONF_TXPOWER_DBM RF_TXPOWER_MAX_DBM
100#endif
101
102/*
103 * Configure the TX power for the BLE beacon, specified in dBm.
104 * Defaults to maximum available TX power setting for the specific PHY.
105 */
106#ifndef RF_CONF_BLE_TXPOWER_DBM
107#define RF_CONF_BLE_TXPOWER_DBM RF_TXPOWER_MAX_DBM
108#endif
109
110/*
111 * CC13xx only: Configure TX power to use boot mode, allowing to gain
112 * up to 14 dBm with the default PA. This will, however, increase power
113 * consumption.
114 */
115#ifndef RF_CONF_TXPOWER_BOOST_MODE
116#define RF_CONF_TXPOWER_BOOST_MODE 0
117#endif
118
119/*
120 * Configure RF mode. That is, whether to run on Sub-1 GHz (Prop-mode) or
121 * 2.4 GHz (IEEE-mode).
122 */
123#ifdef RF_CONF_MODE
124/* Sanity check a valid configuration is provided. */
125#if !(RF_CONF_MODE & RF_MODE_BM)
126#error "Invalid RF_CONF_MODE provided"
127#endif
128
129#define RF_MODE RF_CONF_MODE
130#endif /* RF_CONF_MODE */
131
132/* Sub-1 GHz path front-end mode configuration */
133#ifdef RF_SUB_1_GHZ_CONF_FRONT_END_MODE
134#define RF_SUB_1_GHZ_FRONT_END_MODE RF_SUB_1_GHZ_CONF_FRONT_END_MODE
135#else
136#define RF_SUB_1_GHZ_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
137#endif
138
139#ifdef RF_SUB_1_GHZ_CONF_BIAS_MODE
140#define RF_SUB_1_GHZ_BIAS_MODE RF_SUB_1_GHZ_CONF_BIAS_MODE
141#else
142#define RF_SUB_1_GHZ_BIAS_MODE RF_BIAS_MODE_INTERNAL
143#endif
144
145/* 2.4 GHz path front-end mode configuration */
146#ifdef RF_2_4_GHZ_CONF_FRONT_END_MODE
147#define RF_2_4_GHZ_FRONT_END_MODE RF_2_4_GHZ_CONF_FRONT_END_MODE
148#else
149#define RF_2_4_GHZ_FRONT_END_MODE RF_FRONT_END_MODE_DIFFERENTIAL
150#endif
151
152#ifdef RF_2_4_GHZ_CONF_BIAS_MODE
153#define RF_2_4_GHZ_BIAS_MODE RF_2_4_GHZ_CONF_BIAS_MODE
154#else
155#define RF_2_4_GHZ_BIAS_MODE RF_BIAS_MODE_INTERNAL
156#endif
157
158/* Number of RX buffers. */
159#ifndef RF_CONF_RX_BUF_CNT
160#define RF_CONF_RX_BUF_CNT 4
161#endif
162
163/* Size of each RX buffer in bytes. */
164#ifndef RF_CONF_RX_BUF_SIZE
165#define RF_CONF_RX_BUF_SIZE 146
166#endif
167
168/* Enable/disable BLE beacon. */
169#ifndef RF_CONF_BLE_BEACON_ENABLE
170#define RF_CONF_BLE_BEACON_ENABLE 0
171#endif
172
173#if (RF_CONF_BLE_BEACON_ENABLE) && !(SUPPORTS_BLE_BEACON)
174#error "Device does not support BLE for BLE beacon"
175#endif
176
177/*----- CC13xx Device Line --------------------------------------------------*/
178/* CC13xx supports both IEEE and Prop mode, depending on which device. */
179#if defined(DEVICE_LINE_CC13XX)
180
181/* Default to Prop-mode for CC13xx devices if not configured. */
182#ifndef RF_MODE
183#define RF_MODE RF_MODE_SUB_1_GHZ
184#endif
185
186/*----- CC13xx Prop-mode ----------------------------------------------------*/
187#if (RF_MODE == RF_MODE_SUB_1_GHZ) && (SUPPORTS_PROP_MODE)
188
189/* Netstack configuration. */
190#define NETSTACK_CONF_RADIO prop_mode_driver
191
192/* CSMA configuration. */
193#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300)
194#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)
195#define CSMA_CONF_SEND_SOFT_ACK 1
196
197/*----- CC13xx IEEE-mode ----------------------------------------------------*/
198#elif (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
199
200/* Netstack configuration. */
201#define NETSTACK_CONF_RADIO ieee_mode_driver
202
203/* CSMA configuration. */
204#define CSMA_CONF_SEND_SOFT_ACK 0
205
206#else
207/*----- CC13xx Unsupported Mode ---------------------------------------------*/
208#error "Invalid RF mode configuration of CC13xx device"
209#endif /* CC13xx RF Mode configuration */
210
211/*----- CC26xx Device Line --------------------------------------------------*/
212/* CC26xx only supports IEEE mode */
213#elif defined(DEVICE_LINE_CC26XX)
214
215/* Default to IEEE-mode for CC26xx devices if not configured */
216#ifndef RF_MODE
217#define RF_MODE RF_MODE_2_4_GHZ
218#endif
219
220/*----- CC26xx IEEE-mode ----------------------------------------------------*/
221#if (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
222
223/* Netstack configuration */
224#define NETSTACK_CONF_RADIO ieee_mode_driver
225
226/* CSMA configuration */
227#define CSMA_CONF_SEND_SOFT_ACK 0
228
229/* Frequncy band configuration */
230#undef DOT_15_4G_FREQ_BAND_ID
231#define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450
232
233#else
234/*----- CC26xx Unsupported Mode ---------------------------------------------*/
235#error "IEEE-mode only supported by CC26xx devices"
236#endif /* CC26xx RF Mode configuration */
237
238/*----- Unsupported device line ---------------------------------------------*/
239#else
240#error "Unsupported Device Line defined"
241#endif /* Unsupported device line */
242/** @} */
243/*---------------------------------------------------------------------------*/
244/**
245 * \name IEEE address configuration. Used to generate our link-local and
246 * global IPv6 addresses.
247 * @{
248 */
249
250/**
251 * \brief Location of the IEEE address.
252 * 0 => Read from InfoPage.
253 * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS.
254 */
255#ifndef IEEE_ADDR_CONF_HARDCODED
256#define IEEE_ADDR_CONF_HARDCODED 0
257#endif
258
259/**
260 * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED
261 * is defined as 1. Must be a byte array of size 8.
262 */
263#ifndef IEEE_ADDR_CONF_ADDRESS
264#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF }
265#endif
266/** @} */
267/*---------------------------------------------------------------------------*/
268/**
269 * \name IEEE-mode configuration.
270 *
271 * @{
272 */
273
274/**
275 * \brief Configuration to enable/disable auto ACKs in IEEE-mode.
276 * 0 => ACK generated by software
277 * 1 => ACK generated by the radio.
278 */
279#ifndef IEEE_MODE_CONF_AUTOACK
280#define IEEE_MODE_CONF_AUTOACK 1
281#endif
282
283/**
284 * \brief Configuration to enable/disable frame filtering in IEEE-mode.
285 * 0 => Disable promiscous mode.
286 * 1 => Enable promiscous mode.
287 */
288#ifndef IEEE_MODE_CONF_PROMISCOUS
289#define IEEE_MODE_CONF_PROMISCOUS 0
290#endif
291
292/**
293 * \brief Configuration to set the RSSI threshold in dBm in IEEE-mode.
294 * Defaults to -90 dBm.
295 */
296#ifndef IEEE_MODE_CONF_CCA_RSSI_THRESHOLD
297#define IEEE_MODE_CONF_CCA_RSSI_THRESHOLD 0xA6
298#endif
299/** @} */
300/*---------------------------------------------------------------------------*/
301/**
302 * \name Prop-mode configuration.
303 *
304 * @{
305 */
306
307/**
308 * \brief Configuration to set whitener in Prop-mode.
309 * 0 => No whitener
310 * 1 => Whitener.
311 */
312#ifndef PROP_MODE_CONF_DW
313#define PROP_MODE_CONF_DW 0
314#endif
315
316/**
317 * \brief Use 16-bit or 32-bit CRC in Prop-mode.
318 * 0 => 32-bit CRC.
319 * 1 => 16-bit CRC.
320 */
321#ifndef PROP_MODE_CONF_USE_CRC16
322#define PROP_MODE_CONF_USE_CRC16 0
323#endif
324
325/**
326 * \brief Configuration to set the RSSI threshold in dBm in Prop-mode.
327 * Defaults to -90 dBm.
328 */
329#ifndef PROP_MODE_CONF_CCA_RSSI_THRESHOLD
330#define PROP_MODE_CONF_CCA_RSSI_THRESHOLD 0xA6
331#endif
332/** @} */
333/*---------------------------------------------------------------------------*/
334/**
335 * \name TI Drivers Configuration.
336 *
337 * @{
338 */
339
340/**
341 * \brief Enable or disable UART driver.
342 */
343#ifndef TI_UART_CONF_ENABLE
344#define TI_UART_CONF_ENABLE 1
345#endif
346
347/**
348 * \brief Enable or disable UART0 peripheral.
349 */
350#ifndef TI_UART_CONF_UART0_ENABLE
351#define TI_UART_CONF_UART0_ENABLE TI_UART_CONF_ENABLE
352#endif
353
354/**
355 * \brief Enable or disable UART1 peripheral.
356 */
357#ifndef TI_UART_CONF_UART1_ENABLE
358#define TI_UART_CONF_UART1_ENABLE 0
359#endif
360
361/**
362 * \brief UART driver baud rate configuration.
363 */
364#ifndef TI_UART_CONF_BAUD_RATE
365#define TI_UART_CONF_BAUD_RATE 115200
366#endif
367
368/**
369 * \brief Enable or disable SPI driver.
370 */
371#ifndef TI_SPI_CONF_ENABLE
372#define TI_SPI_CONF_ENABLE 1
373#endif
374
375/**
376 * \brief Enable or disable SPI0 peripheral.
377 */
378#ifndef TI_SPI_CONF_SPI0_ENABLE
379#define TI_SPI_CONF_SPI0_ENABLE TI_SPI_CONF_ENABLE
380#endif
381
382/**
383 * \brief Enable or disable SPI1 peripheral.
384 */
385#ifndef TI_SPI_CONF_SPI1_ENABLE
386#define TI_SPI_CONF_SPI1_ENABLE 0
387#endif
388
389/**
390 * \brief Enable or disable I2C driver.
391 */
392#ifndef TI_I2C_CONF_ENABLE
393#define TI_I2C_CONF_ENABLE 1
394#endif
395
396/**
397 * \brief Enable or disable I2C0 peripheral.
398 */
399#ifndef TI_I2C_CONF_I2C0_ENABLE
400#define TI_I2C_CONF_I2C0_ENABLE TI_I2C_CONF_ENABLE
401#endif
402
403/**
404 * \brief Enable or disable Non-Volatile Storage (NVS) driver.
405 */
406#ifndef TI_NVS_CONF_ENABLE
407#define TI_NVS_CONF_ENABLE 0
408#endif
409
410/**
411 * \brief Enable or disable internal flash storage.
412 */
413#ifndef TI_NVS_CONF_NVS_INTERNAL_ENABLE
414#define TI_NVS_CONF_NVS_INTERNAL_ENABLE TI_NVS_CONF_ENABLE
415#endif
416
417/**
418 * \brief Enable or disable external flash storage.
419 */
420#ifndef TI_NVS_CONF_NVS_EXTERNAL_ENABLE
421#define TI_NVS_CONF_NVS_EXTERNAL_ENABLE TI_NVS_CONF_ENABLE
422#endif
423
424/**
425 * \brief Enable or disable SD driver.
426 */
427#ifndef TI_SD_CONF_ENABLE
428#define TI_SD_CONF_ENABLE 0
429#endif
430/** @} */
431/*---------------------------------------------------------------------------*/
432/**
433 * \name SPI HAL configuration.
434 *
435 * CC13x0/CC26x0 has one SPI interface, while CC13x2/CC26x2 has two
436 * SPI interfaces. Some additional checks has to be made for the
437 * SPI_CONF_CONTROLLER_COUNT configuration, as this relies on whether the
438 * available SPI interfaces are enabled or not, as well as if the SPI driver
439 * is enabled at all.
440 *
441 * @{
442 */
443#if TI_SPI_CONF_ENABLE
444/*
445 * The SPI driver is enabled. Therefore, the number of SPI interfaces depends
446 * on which Device family parent the device falls under and if any of its
447 * corresponding SPI interfaces are enabled or not.
448 */
449
450#define SPI0_IS_ENABLED ((TI_SPI_CONF_SPI0_ENABLE) ? 1 : 0)
451#define SPI1_IS_ENABLED ((TI_SPI_CONF_SPI1_ENABLE) ? 1 : 0)
452
453#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
454
455/* CC13x0/CC26x0 only has one SPI interface: SPI0. */
456#define SPI_CONF_CONTROLLER_COUNT (SPI0_IS_ENABLED)
457
458#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
459
460/* CC13x0/CC26x0 only has two SPI interface: SPI0 and SPI1. */
461#define SPI_CONF_CONTROLLER_COUNT (SPI0_IS_ENABLED + SPI1_IS_ENABLED)
462
463#endif /* DeviceFamily_PARENT */
464
465#else /* TI_SPI_CONF_ENABLE */
466/*
467 * If the SPI driver is disabled then there are 0 available
468 * SPI interfaces. */
469#define SPI_CONF_CONTROLLER_COUNT 0
470#endif /* TI_SPI_CONF_ENABLE */
471/** @} */
472/*---------------------------------------------------------------------------*/
473/**
474 * \name Slip configuration
475 *
476 * @{
477 */
478#ifndef SLIP_ARCH_CONF_ENABLED
479/*
480 * Determine whether we need SLIP
481 * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT
482 * keep using SLIP
483 */
484#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT)
485#define SLIP_ARCH_CONF_ENABLED 1
486#endif
487
488#endif /* SLIP_ARCH_CONF_ENABLED */
489/** @} */
490/*---------------------------------------------------------------------------*/
491#endif /* CC13XX_CC26XX_CONF_H_ */
492/*---------------------------------------------------------------------------*/
493/** @} */
Header file of common CC13xx/CC26xx RF functionality.