Contiki-NG
Loading...
Searching...
No Matches
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#ifndef NETSTACK_CONF_RADIO
191#define NETSTACK_CONF_RADIO prop_mode_driver
192#endif
193
194/* CSMA configuration. */
195#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300)
196#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)
197#define CSMA_CONF_SEND_SOFT_ACK 1
198
199/*----- CC13xx IEEE-mode ----------------------------------------------------*/
200#elif (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
201
202/* Netstack configuration. */
203#ifndef NETSTACK_CONF_RADIO
204#define NETSTACK_CONF_RADIO ieee_mode_driver
205#endif
206
207/* CSMA configuration. */
208#define CSMA_CONF_SEND_SOFT_ACK 0
209
210#else
211/*----- CC13xx Unsupported Mode ---------------------------------------------*/
212#error "Invalid RF mode configuration of CC13xx device"
213#endif /* CC13xx RF Mode configuration */
214
215/*----- CC26xx Device Line --------------------------------------------------*/
216/* CC26xx only supports IEEE mode */
217#elif defined(DEVICE_LINE_CC26XX)
218
219/* Default to IEEE-mode for CC26xx devices if not configured */
220#ifndef RF_MODE
221#define RF_MODE RF_MODE_2_4_GHZ
222#endif
223
224/*----- CC26xx IEEE-mode ----------------------------------------------------*/
225#if (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
226
227/* Netstack configuration */
228#ifndef NETSTACK_CONF_RADIO
229#define NETSTACK_CONF_RADIO ieee_mode_driver
230#endif
231
232/* CSMA configuration */
233#define CSMA_CONF_SEND_SOFT_ACK 0
234
235/* Frequncy band configuration */
236#undef DOT_15_4G_FREQ_BAND_ID
237#define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450
238
239#else
240/*----- CC26xx Unsupported Mode ---------------------------------------------*/
241#error "IEEE-mode only supported by CC26xx devices"
242#endif /* CC26xx RF Mode configuration */
243
244/*----- Unsupported device line ---------------------------------------------*/
245#else
246#error "Unsupported Device Line defined"
247#endif /* Unsupported device line */
248/** @} */
249/*---------------------------------------------------------------------------*/
250/**
251 * \name IEEE address configuration. Used to generate our link-local and
252 * global IPv6 addresses.
253 * @{
254 */
255
256/**
257 * \brief Location of the IEEE address.
258 * 0 => Read from InfoPage.
259 * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS.
260 */
261#ifndef IEEE_ADDR_CONF_HARDCODED
262#define IEEE_ADDR_CONF_HARDCODED 0
263#endif
264
265/**
266 * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED
267 * is defined as 1. Must be a byte array of size 8.
268 */
269#ifndef IEEE_ADDR_CONF_ADDRESS
270#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF }
271#endif
272/** @} */
273/*---------------------------------------------------------------------------*/
274/**
275 * \name IEEE-mode configuration.
276 *
277 * @{
278 */
279
280/**
281 * \brief Configuration to enable/disable auto ACKs in IEEE-mode.
282 * 0 => ACK generated by software
283 * 1 => ACK generated by the radio.
284 */
285#ifndef IEEE_MODE_CONF_AUTOACK
286#define IEEE_MODE_CONF_AUTOACK 1
287#endif
288
289/**
290 * \brief Configuration to enable/disable frame filtering in IEEE-mode.
291 * 0 => Disable promiscous mode.
292 * 1 => Enable promiscous mode.
293 */
294#ifndef IEEE_MODE_CONF_PROMISCOUS
295#define IEEE_MODE_CONF_PROMISCOUS 0
296#endif
297
298/**
299 * \brief Configuration to set the RSSI threshold in dBm in IEEE-mode.
300 * Defaults to -90 dBm.
301 */
302#ifndef IEEE_MODE_CONF_CCA_RSSI_THRESHOLD
303#define IEEE_MODE_CONF_CCA_RSSI_THRESHOLD 0xA6
304#endif
305/** @} */
306/*---------------------------------------------------------------------------*/
307/**
308 * \name Prop-mode configuration.
309 *
310 * @{
311 */
312
313/**
314 * \brief Configuration to set whitener in Prop-mode.
315 * 0 => No whitener
316 * 1 => Whitener.
317 */
318#ifndef PROP_MODE_CONF_DW
319#define PROP_MODE_CONF_DW 0
320#endif
321
322/**
323 * \brief Use 16-bit or 32-bit CRC in Prop-mode.
324 * 0 => 32-bit CRC.
325 * 1 => 16-bit CRC.
326 */
327#ifndef PROP_MODE_CONF_USE_CRC16
328#define PROP_MODE_CONF_USE_CRC16 0
329#endif
330
331/**
332 * \brief Configuration to set the RSSI threshold in dBm in Prop-mode.
333 * Defaults to -90 dBm.
334 */
335#ifndef PROP_MODE_CONF_CCA_RSSI_THRESHOLD
336#define PROP_MODE_CONF_CCA_RSSI_THRESHOLD 0xA6
337#endif
338/** @} */
339/*---------------------------------------------------------------------------*/
340/**
341 * \name TI Drivers Configuration.
342 *
343 * @{
344 */
345
346/**
347 * \brief Enable or disable UART driver.
348 */
349#ifndef TI_UART_CONF_ENABLE
350#define TI_UART_CONF_ENABLE 1
351#endif
352
353/**
354 * \brief Enable or disable UART0 peripheral.
355 */
356#ifndef TI_UART_CONF_UART0_ENABLE
357#define TI_UART_CONF_UART0_ENABLE TI_UART_CONF_ENABLE
358#endif
359
360/**
361 * \brief Enable or disable UART1 peripheral.
362 */
363#ifndef TI_UART_CONF_UART1_ENABLE
364#define TI_UART_CONF_UART1_ENABLE 0
365#endif
366
367/**
368 * \brief UART driver baud rate configuration.
369 */
370#ifndef TI_UART_CONF_BAUD_RATE
371#define TI_UART_CONF_BAUD_RATE 115200
372#endif
373
374/**
375 * \brief Enable or disable SPI driver.
376 */
377#ifndef TI_SPI_CONF_ENABLE
378#define TI_SPI_CONF_ENABLE 1
379#endif
380
381/**
382 * \brief Enable or disable SPI0 peripheral.
383 */
384#ifndef TI_SPI_CONF_SPI0_ENABLE
385#define TI_SPI_CONF_SPI0_ENABLE TI_SPI_CONF_ENABLE
386#endif
387
388/**
389 * \brief Enable or disable SPI1 peripheral.
390 */
391#ifndef TI_SPI_CONF_SPI1_ENABLE
392#define TI_SPI_CONF_SPI1_ENABLE 0
393#endif
394
395/**
396 * \brief Enable or disable I2C driver.
397 */
398#ifndef TI_I2C_CONF_ENABLE
399#define TI_I2C_CONF_ENABLE 1
400#endif
401
402/**
403 * \brief Enable or disable I2C0 peripheral.
404 */
405#ifndef TI_I2C_CONF_I2C0_ENABLE
406#define TI_I2C_CONF_I2C0_ENABLE TI_I2C_CONF_ENABLE
407#endif
408
409/**
410 * \brief Enable or disable Non-Volatile Storage (NVS) driver.
411 */
412#ifndef TI_NVS_CONF_ENABLE
413#define TI_NVS_CONF_ENABLE 0
414#endif
415
416/**
417 * \brief Enable or disable internal flash storage.
418 */
419#ifndef TI_NVS_CONF_NVS_INTERNAL_ENABLE
420#define TI_NVS_CONF_NVS_INTERNAL_ENABLE TI_NVS_CONF_ENABLE
421#endif
422
423/**
424 * \brief Enable or disable external flash storage.
425 */
426#ifndef TI_NVS_CONF_NVS_EXTERNAL_ENABLE
427#define TI_NVS_CONF_NVS_EXTERNAL_ENABLE TI_NVS_CONF_ENABLE
428#endif
429
430/**
431 * \brief Enable or disable SD driver.
432 */
433#ifndef TI_SD_CONF_ENABLE
434#define TI_SD_CONF_ENABLE 0
435#endif
436/** @} */
437/*---------------------------------------------------------------------------*/
438/**
439 * \name SPI HAL configuration.
440 *
441 * CC13x0/CC26x0 has one SPI interface, while CC13x2/CC26x2 has two
442 * SPI interfaces. Some additional checks has to be made for the
443 * SPI_CONF_CONTROLLER_COUNT configuration, as this relies on whether the
444 * available SPI interfaces are enabled or not, as well as if the SPI driver
445 * is enabled at all.
446 *
447 * @{
448 */
449#if TI_SPI_CONF_ENABLE
450/*
451 * The SPI driver is enabled. Therefore, the number of SPI interfaces depends
452 * on which Device family parent the device falls under and if any of its
453 * corresponding SPI interfaces are enabled or not.
454 */
455
456#define SPI0_IS_ENABLED ((TI_SPI_CONF_SPI0_ENABLE) ? 1 : 0)
457#define SPI1_IS_ENABLED ((TI_SPI_CONF_SPI1_ENABLE) ? 1 : 0)
458
459#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
460
461/* CC13x0/CC26x0 only has one SPI interface: SPI0. */
462#define SPI_CONF_CONTROLLER_COUNT (SPI0_IS_ENABLED)
463
464#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
465
466/* CC13x0/CC26x0 only has two SPI interface: SPI0 and SPI1. */
467#define SPI_CONF_CONTROLLER_COUNT (SPI0_IS_ENABLED + SPI1_IS_ENABLED)
468
469#endif /* DeviceFamily_PARENT */
470
471#else /* TI_SPI_CONF_ENABLE */
472/*
473 * If the SPI driver is disabled then there are 0 available
474 * SPI interfaces. */
475#define SPI_CONF_CONTROLLER_COUNT 0
476#endif /* TI_SPI_CONF_ENABLE */
477/** @} */
478/*---------------------------------------------------------------------------*/
479/**
480 * \name Slip configuration
481 *
482 * @{
483 */
484#ifndef SLIP_ARCH_CONF_ENABLED
485/*
486 * Determine whether we need SLIP
487 * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT
488 * keep using SLIP
489 */
490#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT)
491#define SLIP_ARCH_CONF_ENABLED 1
492#endif
493
494#endif /* SLIP_ARCH_CONF_ENABLED */
495/** @} */
496/*---------------------------------------------------------------------------*/
497#endif /* CC13XX_CC26XX_CONF_H_ */
498/*---------------------------------------------------------------------------*/
499/** @} */
Header file of common CC13xx/CC26xx RF functionality.