diff --git a/cpu/cc26xx-cc13xx/Makefile.cc13xx b/cpu/cc26xx-cc13xx/Makefile.cc13xx index 56593ee9f..093aa1f02 100644 --- a/cpu/cc26xx-cc13xx/Makefile.cc13xx +++ b/cpu/cc26xx-cc13xx/Makefile.cc13xx @@ -1,6 +1,6 @@ TI_XXWARE_PATH = lib/cc13xxware -CONTIKI_CPU_SOURCEFILES += smartrf-settings.c prop-mode.c +CONTIKI_CPU_SOURCEFILES += smartrf-settings.c prop-mode.c prop-mode-tx-power.c CFLAGS += -DCPU_FAMILY_CC13XX=1 diff --git a/cpu/cc26xx-cc13xx/rf-core/dot-15-4g.h b/cpu/cc26xx-cc13xx/rf-core/dot-15-4g.h index 30dc63367..37a88fbff 100644 --- a/cpu/cc26xx-cc13xx/rf-core/dot-15-4g.h +++ b/cpu/cc26xx-cc13xx/rf-core/dot-15-4g.h @@ -45,6 +45,8 @@ #define DOT_15_4G_H_ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" + +#include "driverlib/rf_mailbox.h" /*---------------------------------------------------------------------------*/ /* IEEE 802.15.4g frequency band identifiers (Table 68f) */ #define DOT_15_4G_FREQUENCY_BAND_169 0 /* 169.400–169.475 (Europe) - 169 MHz band */ @@ -81,6 +83,8 @@ #define DOT_15_4G_CHANNEL_SPACING 200 #define DOT_15_4G_CHAN0_FREQUENCY 470200 #define PROP_MODE_CONF_LO_DIVIDER 0x0A +#define SMARTRF_SETTINGS_CONF_BAND_OVERRIDES HW32_ARRAY_OVERRIDE(0x405C,1), \ + (uint32_t)0x18000280, #elif DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_780 #define DOT_15_4G_CHANNEL_MAX 38 diff --git a/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c b/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c index 1bc7de0fd..2b11852c3 100644 --- a/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c +++ b/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c @@ -56,6 +56,7 @@ #include "lpm.h" #include "ti-lib.h" #include "rf-core/rf-core.h" +#include "rf-core/rf-switch.h" #include "rf-core/rf-ble.h" /*---------------------------------------------------------------------------*/ /* RF core and RF HAL API */ @@ -272,6 +273,12 @@ volatile static uint8_t *rx_read_entry; static uint8_t tx_buf[TX_BUF_HDR_LEN + TX_BUF_PAYLOAD_LEN] CC_ALIGN(4); /*---------------------------------------------------------------------------*/ +#ifdef IEEE_MODE_CONF_BOARD_OVERRIDES +#define IEEE_MODE_BOARD_OVERRIDES IEEE_MODE_CONF_BOARD_OVERRIDES +#else +#define IEEE_MODE_BOARD_OVERRIDES +#endif +/*---------------------------------------------------------------------------*/ /* Overrides for IEEE 802.15.4, differential mode */ static uint32_t ieee_overrides[] = { 0x00354038, /* Synth: Set RTRIM (POTAILRESTRIM) to 5 */ @@ -286,6 +293,7 @@ static uint32_t ieee_overrides[] = { 0x002B50DC, /* Adjust AGC DC filter */ 0x05000243, /* Increase synth programming timeout */ 0x002082C3, /* Increase synth programming timeout */ + IEEE_MODE_BOARD_OVERRIDES 0xFFFFFFFF, /* End of override list */ }; /*---------------------------------------------------------------------------*/ @@ -484,11 +492,15 @@ rf_radio_setup() uint32_t cmd_status; rfc_CMD_RADIO_SETUP_t cmd; + rf_switch_select_path(RF_SWITCH_PATH_2_4GHZ); + /* Create radio setup command */ rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_RADIO_SETUP); cmd.txPower = tx_power_current->tx_power; cmd.pRegOverride = ieee_overrides; + cmd.config.frontEndMode = RF_CORE_RADIO_SETUP_FRONT_END_MODE; + cmd.config.biasMode = RF_CORE_RADIO_SETUP_BIAS_MODE; cmd.mode = 1; /* Send Radio setup to RF Core */ diff --git a/cpu/cc26xx-cc13xx/rf-core/prop-mode-tx-power.c b/cpu/cc26xx-cc13xx/rf-core/prop-mode-tx-power.c new file mode 100644 index 000000000..2f14c30e9 --- /dev/null +++ b/cpu/cc26xx-cc13xx/rf-core/prop-mode-tx-power.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup rf-core-prop + * @{ + * + * \file + * Default TX power settings. The board can override + */ +/*---------------------------------------------------------------------------*/ +#include "contiki-conf.h" +#include "dev/radio.h" +#include "rf-core/prop-mode.h" +/*---------------------------------------------------------------------------*/ +/* Default TX power settings for the 779-930MHz band */ +const prop_mode_tx_power_config_t prop_mode_tx_power_779_930[] = { + { 14, 0xa73f }, + { 13, 0xa63f }, /* 12.5 */ + { 12, 0xb818 }, + { 11, 0x50da }, + { 10, 0x38d3 }, + { 9, 0x2ccd }, + { 8, 0x24cb }, + { 7, 0x20c9 }, + { 6, 0x1cc7 }, + { 5, 0x18c6 }, + { 4, 0x18c5 }, + { 3, 0x14c4 }, + { 2, 0x1042 }, + { 1, 0x10c3 }, + { 0, 0x0041 }, + { -10, 0x08c0 }, + {-128, 0xFFFF }, +}; +/*---------------------------------------------------------------------------*/ +/* Default TX power settings for the 431-527MHz band */ +const prop_mode_tx_power_config_t prop_mode_tx_power_431_527[] = { + { 15, 0x003f }, + { 14, 0xbe3f }, /* 13.7 */ + { 13, 0x6a0f }, + { 10, 0x3dcb }, + { 6, 0x22c4 }, + {-128, 0xFFFF }, +}; +/*---------------------------------------------------------------------------*/ +/** + * @} + */ diff --git a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c index 0de61f36e..96d0fba78 100644 --- a/cpu/cc26xx-cc13xx/rf-core/prop-mode.c +++ b/cpu/cc26xx-cc13xx/rf-core/prop-mode.c @@ -29,11 +29,7 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup rf-core - * @{ - * - * \defgroup rf-core-prop CC13xx Prop mode driver - * + * \addtogroup rf-core-prop * @{ * * \file @@ -56,7 +52,9 @@ #include "lpm.h" #include "ti-lib.h" #include "rf-core/rf-core.h" +#include "rf-core/rf-switch.h" #include "rf-core/rf-ble.h" +#include "rf-core/prop-mode.h" #include "rf-core/dot-15-4g.h" /*---------------------------------------------------------------------------*/ /* RF core and RF HAL API */ @@ -179,40 +177,35 @@ static rfc_propRxOutput_t rx_stats; /* How long to wait for the RF to enter RX in rf_cmd_ieee_rx */ #define ENTER_RX_WAIT_TIMEOUT (RTIMER_SECOND >> 10) /*---------------------------------------------------------------------------*/ -/* TX Power dBm lookup table - values from SmartRF Studio */ -typedef struct output_config { - radio_value_t dbm; - uint16_t tx_power; /* Value for the PROP_DIV_RADIO_SETUP.txPower field */ -} output_config_t; - -static const output_config_t output_power[] = { - { 14, 0xa73f }, - { 13, 0xa63f }, /* 12.5 */ - { 12, 0xb818 }, - { 11, 0x50da }, - { 10, 0x38d3 }, - { 9, 0x2ccd }, - { 8, 0x24cb }, - { 7, 0x20c9 }, - { 6, 0x1cc7 }, - { 5, 0x18c6 }, - { 4, 0x18c5 }, - { 3, 0x14c4 }, - { 2, 0x1042 }, - { 1, 0x10c3 }, - { 0, 0x0041 }, - {-10, 0x08c0 }, -}; - -#define OUTPUT_CONFIG_COUNT (sizeof(output_power) / sizeof(output_config_t)) +/* TX power table for the 431-527MHz band */ +#ifdef PROP_MODE_CONF_TX_POWER_431_527 +#define PROP_MODE_TX_POWER_431_527 PROP_MODE_CONF_TX_POWER_431_527 +#else +#define PROP_MODE_TX_POWER_431_527 prop_mode_tx_power_431_527 +#endif +/*---------------------------------------------------------------------------*/ +/* TX power table for the 779-930MHz band */ +#ifdef PROP_MODE_CONF_TX_POWER_779_930 +#define PROP_MODE_TX_POWER_779_930 PROP_MODE_CONF_TX_POWER_779_930 +#else +#define PROP_MODE_TX_POWER_779_930 prop_mode_tx_power_779_930 +#endif +/*---------------------------------------------------------------------------*/ +/* Select power table based on the frequency band */ +#if DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_470 +#define TX_POWER_DRIVER PROP_MODE_TX_POWER_431_527 +#else +#define TX_POWER_DRIVER PROP_MODE_TX_POWER_779_930 +#endif +/*---------------------------------------------------------------------------*/ +extern const prop_mode_tx_power_config_t TX_POWER_DRIVER[]; /* Max and Min Output Power in dBm */ -#define OUTPUT_POWER_MIN (output_power[OUTPUT_CONFIG_COUNT - 1].dbm) -#define OUTPUT_POWER_MAX (output_power[0].dbm) +#define OUTPUT_POWER_MAX (TX_POWER_DRIVER[0].dbm) #define OUTPUT_POWER_UNKNOWN 0xFFFF /* Default TX Power - position in output_power[] */ -const output_config_t *tx_power_current = &output_power[1]; +const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1]; /*---------------------------------------------------------------------------*/ #ifdef PROP_MODE_CONF_LO_DIVIDER #define PROP_MODE_LO_DIVIDER PROP_MODE_CONF_LO_DIVIDER @@ -344,6 +337,19 @@ set_channel(uint8_t channel) smartrf_settings_cmd_fs.fractFreq = frac; } /*---------------------------------------------------------------------------*/ +static uint8_t +get_tx_power_array_last_element(void) +{ + const prop_mode_tx_power_config_t *array = TX_POWER_DRIVER; + uint8_t count = 0; + + while(array->tx_power != OUTPUT_POWER_UNKNOWN) { + count++; + array++; + } + return count - 1; +} +/*---------------------------------------------------------------------------*/ /* Returns the current TX power in dBm */ static radio_value_t get_tx_power(void) @@ -352,7 +358,7 @@ get_tx_power(void) } /*---------------------------------------------------------------------------*/ /* - * The caller must make sure to send a new CMD_PROP_RADIO_DIV_SETP to the + * The caller must make sure to send a new CMD_PROP_RADIO_DIV_SETUP to the * radio after calling this function. */ static void @@ -360,14 +366,14 @@ set_tx_power(radio_value_t power) { int i; - for(i = OUTPUT_CONFIG_COUNT - 1; i >= 0; --i) { - if(power <= output_power[i].dbm) { + for(i = get_tx_power_array_last_element(); i >= 0; --i) { + if(power <= TX_POWER_DRIVER[i].dbm) { /* * Merely save the value. It will be used in all subsequent usages of * CMD_PROP_RADIO_DIV_SETP, including one immediately after this function * has returned */ - tx_power_current = &output_power[i]; + tx_power_current = &TX_POWER_DRIVER[i]; return; } @@ -380,12 +386,20 @@ prop_div_radio_setup(void) uint32_t cmd_status; rfc_radioOp_t *cmd = (rfc_radioOp_t *)&smartrf_settings_cmd_prop_radio_div_setup; + rf_switch_select_path(RF_SWITCH_PATH_SUBGHZ); + /* Adjust loDivider depending on the selected band */ smartrf_settings_cmd_prop_radio_div_setup.loDivider = PROP_MODE_LO_DIVIDER; /* Update to the correct TX power setting */ smartrf_settings_cmd_prop_radio_div_setup.txPower = tx_power_current->tx_power; + /* Adjust RF Front End and Bias based on the board */ + smartrf_settings_cmd_prop_radio_div_setup.config.frontEndMode = + RF_CORE_PROP_FRONT_END_MODE; + smartrf_settings_cmd_prop_radio_div_setup.config.biasMode = + RF_CORE_PROP_BIAS_MODE; + /* Send Radio setup to RF Core */ if(rf_core_send_cmd((uint32_t)cmd, &cmd_status) != RF_CORE_CMD_OK) { PRINTF("prop_div_radio_setup: DIV_SETUP, CMDSTA=0x%08lx, status=0x%04x\n", @@ -1024,7 +1038,7 @@ get_value(radio_param_t param, radio_value_t *value) *value = DOT_15_4G_CHANNEL_MAX; return RADIO_RESULT_OK; case RADIO_CONST_TXPOWER_MIN: - *value = OUTPUT_POWER_MIN; + *value = TX_POWER_DRIVER[get_tx_power_array_last_element()].dbm; return RADIO_RESULT_OK; case RADIO_CONST_TXPOWER_MAX: *value = OUTPUT_POWER_MAX; @@ -1069,7 +1083,8 @@ set_value(radio_param_t param, radio_value_t value) set_channel((uint8_t)value); break; case RADIO_PARAM_TXPOWER: - if(value < OUTPUT_POWER_MIN || value > OUTPUT_POWER_MAX) { + if(value < TX_POWER_DRIVER[get_tx_power_array_last_element()].dbm || + value > OUTPUT_POWER_MAX) { return RADIO_RESULT_INVALID_VALUE; } @@ -1149,6 +1164,5 @@ const struct radio_driver prop_mode_driver = { }; /*---------------------------------------------------------------------------*/ /** - * @} * @} */ diff --git a/cpu/cc26xx-cc13xx/rf-core/prop-mode.h b/cpu/cc26xx-cc13xx/rf-core/prop-mode.h new file mode 100644 index 000000000..55048777a --- /dev/null +++ b/cpu/cc26xx-cc13xx/rf-core/prop-mode.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup rf-core + * @{ + * + * \defgroup rf-core-prop CC13xx Prop mode driver + * + * @{ + * + * \file + * Header file for the CC13xx prop mode NETSTACK_RADIO driver + */ +/*---------------------------------------------------------------------------*/ +#ifndef PROP_MODE_H_ +#define PROP_MODE_H_ +/*---------------------------------------------------------------------------*/ +#include "contiki-conf.h" +#include "rf-core/dot-15-4g.h" + +#include +/*---------------------------------------------------------------------------*/ +typedef struct prop_mode_tx_power_config { + radio_value_t dbm; + uint16_t tx_power; /* Value for the PROP_DIV_RADIO_SETUP.txPower field */ +} prop_mode_tx_power_config_t; +/*---------------------------------------------------------------------------*/ +#endif /* PROP_MODE_H_ */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/cpu/cc26xx-cc13xx/rf-core/rf-ble.c b/cpu/cc26xx-cc13xx/rf-core/rf-ble.c index 3cfea03bd..bceb9c138 100644 --- a/cpu/cc26xx-cc13xx/rf-core/rf-ble.c +++ b/cpu/cc26xx-cc13xx/rf-core/rf-ble.c @@ -45,6 +45,7 @@ #include "net/linkaddr.h" #include "dev/oscillators.h" #include "rf-core/rf-core.h" +#include "rf-core/rf-switch.h" #include "rf-core/rf-ble.h" #include "driverlib/rf_ble_cmd.h" #include "driverlib/rf_common_cmd.h" @@ -89,6 +90,12 @@ static struct ble_beacond_config { char adv_name[BLE_ADV_NAME_BUF_LEN]; } beacond_config = { .interval = BLE_ADV_INTERVAL }; /*---------------------------------------------------------------------------*/ +#ifdef RF_BLE_CONF_BOARD_OVERRIDES +#define RF_BLE_BOARD_OVERRIDES RF_BLE_CONF_BOARD_OVERRIDES +#else +#define RF_BLE_BOARD_OVERRIDES +#endif +/*---------------------------------------------------------------------------*/ /* BLE overrides */ static uint32_t ble_overrides[] = { 0x00364038, /* Synth: Set RTRIM (POTAILRESTRIM) to 6 */ @@ -97,6 +104,7 @@ static uint32_t ble_overrides[] = { 0xEAE00603, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, LSB) */ 0x00010623, /* Synth: Set loop bandwidth after lock to 80 kHz (K3, MSB) */ 0x00456088, /* Adjust AGC reference level */ + RF_BLE_BOARD_OVERRIDES 0xFFFFFFFF, /* End of override list */ }; /*---------------------------------------------------------------------------*/ @@ -210,11 +218,15 @@ rf_radio_setup() uint32_t cmd_status; rfc_CMD_RADIO_SETUP_t cmd; + rf_switch_select_path(RF_SWITCH_PATH_2_4GHZ); + /* Create radio setup command */ rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_RADIO_SETUP); cmd.txPower = tx_power; cmd.pRegOverride = ble_overrides; + cmd.config.frontEndMode = RF_CORE_RADIO_SETUP_FRONT_END_MODE; + cmd.config.biasMode = RF_CORE_RADIO_SETUP_BIAS_MODE; cmd.mode = 0; /* Send Radio setup to RF Core */ diff --git a/cpu/cc26xx-cc13xx/rf-core/rf-core.c b/cpu/cc26xx-cc13xx/rf-core/rf-core.c index 0708d8cc7..fe6b57509 100644 --- a/cpu/cc26xx-cc13xx/rf-core/rf-core.c +++ b/cpu/cc26xx-cc13xx/rf-core/rf-core.c @@ -45,6 +45,7 @@ #include "net/packetbuf.h" #include "net/rime/rimestats.h" #include "rf-core/rf-core.h" +#include "rf-core/rf-switch.h" #include "ti-lib.h" /*---------------------------------------------------------------------------*/ /* RF core and RF HAL API */ @@ -260,6 +261,8 @@ rf_core_power_up() ti_lib_int_master_enable(); } + rf_switch_power_up(); + /* Let CPE boot */ HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RF_CORE_CLOCKS_MASK; @@ -365,6 +368,8 @@ rf_core_power_down() while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE) != PRCM_DOMAIN_POWER_OFF); + rf_switch_power_down(); + ti_lib_int_pend_clear(INT_RFC_CPE_0); ti_lib_int_pend_clear(INT_RFC_CPE_1); ti_lib_int_enable(INT_RFC_CPE_0); diff --git a/cpu/cc26xx-cc13xx/rf-core/rf-core.h b/cpu/cc26xx-cc13xx/rf-core/rf-core.h index 7a75bde50..762aa5650 100644 --- a/cpu/cc26xx-cc13xx/rf-core/rf-core.h +++ b/cpu/cc26xx-cc13xx/rf-core/rf-core.h @@ -64,6 +64,45 @@ #define RF_CORE_CHANNEL 25 #endif /* RF_CORE_CONF_IEEE_MODE_CHANNEL */ /*---------------------------------------------------------------------------*/ +#define RF_CORE_FRONT_END_MODE_DIFFERENTIAL 0 +#define RF_CORE_FRONT_END_MODE_SINGLE_RFP 1 +#define RF_CORE_FRONT_END_MODE_SINGLE_RFN 2 + +#define RF_CORE_BIAS_MODE_INTERNAL 0 +#define RF_CORE_BIAS_MODE_EXTERNAL 1 +/*---------------------------------------------------------------------------*/ +/* + * RF Front-End Mode and Bias for CMD_RADIO_SETUP (IEEE and BLE) + * Default: Differential mode, internal bias + */ +#ifdef RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE +#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE +#else +#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL +#endif + +#ifdef RF_CORE_CONF_RADIO_SETUP_BIAS_MODE +#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_CONF_RADIO_SETUP_BIAS_MODE +#else +#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_BIAS_MODE_INTERNAL +#endif +/*---------------------------------------------------------------------------*/ +/* + * RF Front-End Mode and Bias for CMD_PROP_DIV_RADIO_SETUP (PROP mode) + * Default: Differential mode, external bias + */ +#ifdef RF_CORE_CONF_PROP_FRONT_END_MODE +#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_CONF_PROP_FRONT_END_MODE +#else +#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL +#endif + +#ifdef RF_CORE_CONF_PROP_BIAS_MODE +#define RF_CORE_PROP_BIAS_MODE RF_CORE_CONF_PROP_BIAS_MODE +#else +#define RF_CORE_PROP_BIAS_MODE RF_CORE_BIAS_MODE_EXTERNAL +#endif +/*---------------------------------------------------------------------------*/ #define RF_CORE_CMD_ERROR 0 #define RF_CORE_CMD_OK 1 /*---------------------------------------------------------------------------*/ diff --git a/cpu/cc26xx-cc13xx/rf-core/rf-switch.h b/cpu/cc26xx-cc13xx/rf-core/rf-switch.h new file mode 100644 index 000000000..e50b9ff1f --- /dev/null +++ b/cpu/cc26xx-cc13xx/rf-core/rf-switch.h @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** \addtogroup rf-core + * @{ + * + * \defgroup rf-switch RF Switch + * + * Header file for RF switch support + * + * @{ + * + * \file + * Header file with definitions related to RF switch support + */ +/*---------------------------------------------------------------------------*/ +#ifndef RF_SWITCH_H_ +#define RF_SWITCH_H_ +/*---------------------------------------------------------------------------*/ +#include "contiki-conf.h" + +#include +/*---------------------------------------------------------------------------*/ +#ifdef RF_SWITCH_CONF_PATH_2_4GHZ +#define RF_SWITCH_PATH_2_4GHZ RF_SWITCH_CONF_PATH_2_4GHZ +#else +#define RF_SWITCH_PATH_2_4GHZ 0 +#endif + +#ifdef RF_SWITCH_CONF_PATH_SUBGHZ +#define RF_SWITCH_PATH_SUBGHZ RF_SWITCH_CONF_PATH_SUBGHZ +#else +#define RF_SWITCH_PATH_SUBGHZ 1 +#endif +/*---------------------------------------------------------------------------*/ +#ifdef RF_SWITCH_CONF_ENABLE +#define RF_SWITCH_ENABLE RF_SWITCH_CONF_ENABLE +#else +#define RF_SWITCH_ENABLE 0 +#endif +/*---------------------------------------------------------------------------*/ +#if RF_SWITCH_ENABLE +/** + * \brief Initialise RF switch pin states. + */ +void rf_switch_init(void); + +/** + * \brief Power up the RF switch. + */ +void rf_switch_power_up(void); + +/** + * \brief Power down the RF switch. + */ +void rf_switch_power_down(void); + +/** + * \brief Select RF path + * \param path The RF path to select on the switch. + * + * The path argument can take values RF_SWITCH_PATH_xyz + */ +void rf_switch_select_path(uint8_t path); +#else +#define rf_switch_init() +#define rf_switch_power_up() +#define rf_switch_power_down() +#define rf_switch_select_path(p) +#endif /* RF_SWITCH_ENABLE */ +/*---------------------------------------------------------------------------*/ +#endif /* RF_SWITCH_H_ */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c b/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c index 3d411463e..e42b6b66f 100644 --- a/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c +++ b/cpu/cc26xx-cc13xx/rf-core/smartrf-settings.c @@ -28,9 +28,53 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ /*---------------------------------------------------------------------------*/ +#include "contiki-conf.h" + +#include "rf-core/dot-15-4g.h" #include "driverlib/rf_mailbox.h" #include "driverlib/rf_common_cmd.h" #include "driverlib/rf_prop_cmd.h" + +#include +/*---------------------------------------------------------------------------*/ +#ifdef SMARTRF_SETTINGS_CONF_BOARD_OVERRIDES +#define SMARTRF_SETTINGS_BOARD_OVERRIDES SMARTRF_SETTINGS_CONF_BOARD_OVERRIDES +#else +#define SMARTRF_SETTINGS_BOARD_OVERRIDES +#endif +/*---------------------------------------------------------------------------*/ +#ifdef SMARTRF_SETTINGS_CONF_BAND_OVERRIDES +#define SMARTRF_SETTINGS_BAND_OVERRIDES SMARTRF_SETTINGS_CONF_BAND_OVERRIDES +#else +#define SMARTRF_SETTINGS_BAND_OVERRIDES +#endif +/*---------------------------------------------------------------------------*/ +/* RSSI offset configuration for the 431-527MHz band */ +#ifdef SMARTRF_SETTINGS_CONF_RSSI_OFFSET_431_527 +#define SMARTRF_SETTINGS_RSSI_OFFSET_431_527 SMARTRF_SETTINGS_CONF_RSSI_OFFSET_431_527 +#else +#define SMARTRF_SETTINGS_RSSI_OFFSET_431_527 0x000288A3 +#endif +/*---------------------------------------------------------------------------*/ +/* RSSI offset configuration for the 779-930MHz band */ +#ifdef SMARTRF_SETTINGS_CONF_RSSI_OFFSET_779_930 +#define SMARTRF_SETTINGS_RSSI_OFFSET_779_930 SMARTRF_SETTINGS_CONF_RSSI_OFFSET_779_930 +#else +#define SMARTRF_SETTINGS_RSSI_OFFSET_779_930 0x00FB88A3 +#endif +/*---------------------------------------------------------------------------*/ +#ifdef SMARTRF_SETTINGS_CONF_OVERRIDE_TRIM_OFFSET +#define SMARTRF_SETTINGS_OVERRIDE_TRIM_OFFSET SMARTRF_SETTINGS_CONF_OVERRIDE_TRIM_OFFSET +#else +#define SMARTRF_SETTINGS_OVERRIDE_TRIM_OFFSET 0x00038883 +#endif +/*---------------------------------------------------------------------------*/ +/* Select RSSI offset value based on the frequency band */ +#if DOT_15_4G_FREQUENCY_BAND_ID==DOT_15_4G_FREQUENCY_BAND_470 +#define RSSI_OFFSET SMARTRF_SETTINGS_RSSI_OFFSET_431_527 +#else +#define RSSI_OFFSET SMARTRF_SETTINGS_RSSI_OFFSET_779_930 +#endif /*---------------------------------------------------------------------------*/ /* Overrides for CMD_PROP_RADIO_DIV_SETUP */ static uint32_t overrides[] = @@ -80,9 +124,9 @@ static uint32_t overrides[] = ADI_HALFREG_OVERRIDE(0, 61, 0xF, 0xD), /* * override_phy_gfsk_rx.xml - * Rx: Set LNA bias current trim offset to 3 + * Rx: Set LNA bias current trim offset. The board can override this */ - (uint32_t)0x00038883, + (uint32_t)SMARTRF_SETTINGS_OVERRIDE_TRIM_OFFSET, /* Rx: Freeze RSSI on sync found event */ HW_REG_OVERRIDE(0x6084, 0x35F1), /* @@ -93,10 +137,11 @@ static uint32_t overrides[] = /* Tx: Configure PA ramping setting */ HW_REG_OVERRIDE(0x608C, 0x8213), /* - * override_phy_rx_rssi_offset_5db.xml - * Rx: Set RSSI offset to adjust reported RSSI by +5 dB + * Rx: Set RSSI offset to adjust reported RSSI + * The board can override this */ - (uint32_t)0x00FB88A3, + (uint32_t)RSSI_OFFSET, + /* * TX power override * Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8) @@ -107,6 +152,12 @@ static uint32_t overrides[] = (uint32_t)0x943, (uint32_t)0x963, + /* Board-specific overrides, if any */ + SMARTRF_SETTINGS_BOARD_OVERRIDES + + /* Band-specific overrides, if any */ + SMARTRF_SETTINGS_BAND_OVERRIDES + (uint32_t)0xFFFFFFFF, }; /*---------------------------------------------------------------------------*/ @@ -137,8 +188,8 @@ rfc_CMD_PROP_RADIO_DIV_SETUP_t smartrf_settings_cmd_prop_radio_div_setup = /* 7: .4g mode with dynamic whitening and CRC choice */ .formatConf.whitenMode = 0x7, - .config.frontEndMode = 0x0, /* Differential mode */ - .config.biasMode = 0x1, /* External bias*/ + .config.frontEndMode = 0x00, /* Set by the driver */ + .config.biasMode = 0x00, /* Set by the driver */ .config.analogCfgMode = 0x0, .config.bNoFsPowerUp = 0x0, .txPower = 0x00, /* Driver sets correct value */ diff --git a/examples/cc26xx/cc26xx-demo.c b/examples/cc26xx/cc26xx-demo.c index 50d2190d3..f5045a5bd 100644 --- a/examples/cc26xx/cc26xx-demo.c +++ b/examples/cc26xx/cc26xx-demo.c @@ -39,21 +39,12 @@ * * \defgroup cc26xx-demo CC26xx Demo Project * - * Example project demonstrating the CC26xx platforms + * Example project demonstrating the CC13xx/CC26xx platforms * * This example will work for the following boards: - * - srf06-cc26xx: SmartRF06EB + CC26XX EM - * - sensortag-cc26xx: CC26XX sensortag - * - The CC2650 LaunchPad - * - * By default, the example will build for the srf06-cc26xx board. To switch - * between platforms: - * - make clean - * - make BOARD=sensortag-cc26xx savetarget - * - * or - * - * make BOARD=srf06-cc26xx savetarget + * - srf06-cc26xx: SmartRF06EB + CC13xx/CC26xx EM + * - CC2650 and CC1350 SensorTag + * - CC1310, CC1350, CC2650 LaunchPads * * This is an IPv6/RPL-enabled example. Thus, if you have a border router in * your installation (same RDC layer, same PAN ID and RF channel), you should diff --git a/examples/cc26xx/very-sleepy-demo/README.md b/examples/cc26xx/very-sleepy-demo/README.md index fcdedf77f..851150432 100644 --- a/examples/cc26xx/very-sleepy-demo/README.md +++ b/examples/cc26xx/very-sleepy-demo/README.md @@ -23,7 +23,7 @@ as per the instructions below. When the node is duty-cycling the radio, either because it is in normal mode or because network maintenance is taking place, it will keep its green LED on thus -providing an indication that it is reachable. +providing an indication that it is reachable (red LED for the CC1350 tag). A normal mode stint can be manually triggered by pressing the left button. diff --git a/platform/srf06-cc26xx/README.md b/platform/srf06-cc26xx/README.md index b95f3e9cd..ae8645426 100644 --- a/platform/srf06-cc26xx/README.md +++ b/platform/srf06-cc26xx/README.md @@ -2,13 +2,15 @@ Getting Started with Contiki for TI CC26xx ========================================== This guide's aim is to help you start using Contiki for TI's CC26xx. The -platform supports two different boards: +platform supports multiple boards: * SmartRF 06 Evaluation Board with a CC26xx or CC13xx Evaluation Module (relevant files and drivers are under `srf06/`) * CC2650 SensorTag 2.0 (relevant drivers under `sensortag/cc2650`) +* CC1350 SensorTag 2.0 (relevant drivers under `sensortag/cc1350`) * CC2650 LaunchPad (relevant drivers under `launchpad/cc2650`) * CC1310 LaunchPad (relevant drivers under `launchpad/cc1310`) +* CC1350 LaunchPad (relevant drivers under `launchpad/cc1350`) The CPU code, common for both platforms, can be found under `$(CONTIKI)/cpu/cc26xx-cc13xx`. The port was developed and tested with CC2650s, but the intention is for it to @@ -100,8 +102,10 @@ Other options for the `BOARD` make variable are: * Srf06+CC26xxEM: Set `BOARD=srf06/cc26xx` * Srf06+CC13xxEM: Set `BOARD=srf06/cc13xx` * CC2650 tag: Set `BOARD=sensortag/cc2650` +* CC1350 tag: Set `BOARD=sensortag/cc1350` * CC2650 Launchpad: Set `BOARD=launchpad/cc2650` * CC1310 Launchpad: Set `BOARD=launchpad/cc1310` +* CC1350 Launchpad: Set `BOARD=launchpad/cc1350` If the `BOARD` variable is unspecified, an image for the Srf06 CC26XXEM will be built. diff --git a/platform/srf06-cc26xx/common/ext-flash.c b/platform/srf06-cc26xx/common/ext-flash.c index 7faaab0c0..5631297ac 100644 --- a/platform/srf06-cc26xx/common/ext-flash.c +++ b/platform/srf06-cc26xx/common/ext-flash.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the LaunchPad Flash and the Sensortag WinBond W25X20CL/W25X40CL + * Sensortag/LaunchPad External Flash Driver */ /*---------------------------------------------------------------------------*/ #include "contiki.h" diff --git a/platform/srf06-cc26xx/contiki-main.c b/platform/srf06-cc26xx/contiki-main.c index 0aa1c4526..78b10d0df 100644 --- a/platform/srf06-cc26xx/contiki-main.c +++ b/platform/srf06-cc26xx/contiki-main.c @@ -32,14 +32,16 @@ * \addtogroup cc26xx-platforms * @{ * - * \defgroup cc26xx-srf-tag SmartRF+CC13xx/CC26xx EM, CC2650 SensorTag and LaunchPads + * \defgroup cc26xx-srf-tag SmartRF+CC13xx/CC26xx EM, SensorTags and LaunchPads * * This platform supports a number of different boards: * - A standard TI SmartRF06EB with a CC26xx EM mounted on it * - A standard TI SmartRF06EB with a CC1310 EM mounted on it - * - The new TI SensorTag2.0 + * - The TI CC2650 SensorTag + * - The TI CC1350 SensorTag * - The TI CC2650 LaunchPad * - The TI CC1310 LaunchPad + * - The TI CC1350 LaunchPad * @{ */ #include "ti-lib.h" diff --git a/platform/srf06-cc26xx/launchpad/board.c b/platform/srf06-cc26xx/launchpad/board.c index 6482212d8..11a213cf1 100644 --- a/platform/srf06-cc26xx/launchpad/board.c +++ b/platform/srf06-cc26xx/launchpad/board.c @@ -41,6 +41,7 @@ #include "lpm.h" #include "ti-lib.h" #include "board-peripherals.h" +#include "rf-core/rf-switch.h" #include #include @@ -51,8 +52,8 @@ wakeup_handler(void) { /* Turn on the PERIPH PD */ ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH); - while((ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) - != PRCM_DOMAIN_POWER_ON)); + while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) + != PRCM_DOMAIN_POWER_ON); } /*---------------------------------------------------------------------------*/ /* @@ -66,13 +67,7 @@ LPM_MODULE(launchpad_module, NULL, NULL, wakeup_handler, LPM_DOMAIN_NONE); static void configure_unused_pins(void) { - uint32_t pins[] = { - BOARD_IOID_CS, BOARD_IOID_TDO, BOARD_IOID_TDI, BOARD_IOID_DIO12, - BOARD_IOID_DIO15, BOARD_IOID_DIO21, BOARD_IOID_DIO22, BOARD_IOID_DIO23, - BOARD_IOID_DIO24, BOARD_IOID_DIO25, BOARD_IOID_DIO26, BOARD_IOID_DIO27, - BOARD_IOID_DIO28, BOARD_IOID_DIO29, BOARD_IOID_DIO30, - IOID_UNUSED - }; + uint32_t pins[] = BOARD_UNUSED_PINS; uint32_t *pin; @@ -106,6 +101,9 @@ board_init() /* For unsupported peripherals, select a default pin configuration */ configure_unused_pins(); + /* Initialise the RF switch if present */ + rf_switch_init(); + /* Re-enable interrupt if initially enabled. */ if(!int_disabled) { ti_lib_int_master_enable(); diff --git a/platform/srf06-cc26xx/launchpad/cc1310/board.h b/platform/srf06-cc26xx/launchpad/cc1310/board.h index 9c750e0f9..a4b2efbba 100644 --- a/platform/srf06-cc26xx/launchpad/cc1310/board.h +++ b/platform/srf06-cc26xx/launchpad/cc1310/board.h @@ -178,6 +178,7 @@ * Those values are not meant to be modified by the user * @{ */ +#define BOARD_IOID_DIO1 IOID_1 #define BOARD_IOID_CS IOID_11 #define BOARD_IOID_TDO IOID_16 #define BOARD_IOID_TDI IOID_17 @@ -193,6 +194,14 @@ #define BOARD_IOID_DIO28 IOID_28 #define BOARD_IOID_DIO29 IOID_29 #define BOARD_IOID_DIO30 IOID_30 + +#define BOARD_UNUSED_PINS { \ + BOARD_IOID_DIO1, BOARD_IOID_CS, BOARD_IOID_TDO, BOARD_IOID_TDI, \ + BOARD_IOID_DIO12, BOARD_IOID_DIO15, BOARD_IOID_DIO21, BOARD_IOID_DIO22, \ + BOARD_IOID_DIO23, BOARD_IOID_DIO24, BOARD_IOID_DIO25, BOARD_IOID_DIO26, \ + BOARD_IOID_DIO27, BOARD_IOID_DIO28, BOARD_IOID_DIO29, BOARD_IOID_DIO30, \ + IOID_UNUSED \ + } /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/platform/srf06-cc26xx/launchpad/cc1350/Makefile.cc1350 b/platform/srf06-cc26xx/launchpad/cc1350/Makefile.cc1350 new file mode 100644 index 000000000..0d1f65359 --- /dev/null +++ b/platform/srf06-cc26xx/launchpad/cc1350/Makefile.cc1350 @@ -0,0 +1,10 @@ +### Will allow the inclusion of the correct CPU makefile +CPU_FAMILY = cc13xx + +### Add to the source dirs +CONTIKI_TARGET_DIRS += launchpad/cc1350 + +BOARD_SOURCEFILES += rf-switch.c tx-power-driver.c + +### Include the common launchpad makefile +include $(PLATFORM_ROOT_DIR)/launchpad/Makefile.launchpad diff --git a/platform/srf06-cc26xx/launchpad/cc1350/board.h b/platform/srf06-cc26xx/launchpad/cc1350/board.h new file mode 100644 index 000000000..e645b8b0b --- /dev/null +++ b/platform/srf06-cc26xx/launchpad/cc1350/board.h @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** \addtogroup launchpad-peripherals + * @{ + * + * \defgroup launchpad-cc1350-specific CC1350 LaunchPad Peripherals + * + * Defines related to the CC1350 LaunchPad + * + * This file provides connectivity information on LEDs, Buttons, UART and + * other peripherals + * + * This file is not meant to be modified by the user. + * @{ + * + * \file + * Header file with definitions related to the I/O connections on the TI + * CC1350 LaunchPad + * + * \note Do not include this file directly. It gets included by contiki-conf + * after all relevant directives have been set. + */ +/*---------------------------------------------------------------------------*/ +#ifndef BOARD_H_ +#define BOARD_H_ +/*---------------------------------------------------------------------------*/ +#include "ioc.h" +/*---------------------------------------------------------------------------*/ +/** + * \name LED configurations + * + * Those values are not meant to be modified by the user + * @{ + */ +/* Some files include leds.h before us, so we need to get rid of defaults in + * leds.h before we provide correct definitions */ +#undef LEDS_GREEN +#undef LEDS_YELLOW +#undef LEDS_RED +#undef LEDS_CONF_ALL + +#define LEDS_RED 1 +#define LEDS_GREEN 2 +#define LEDS_YELLOW LEDS_GREEN +#define LEDS_ORANGE LEDS_RED + +#define LEDS_CONF_ALL 3 + +/* Notify various examples that we have LEDs */ +#define PLATFORM_HAS_LEDS 1 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name LED IOID mappings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_LED_1 IOID_6 +#define BOARD_IOID_LED_2 IOID_7 +#define BOARD_LED_1 (1 << BOARD_IOID_LED_1) +#define BOARD_LED_2 (1 << BOARD_IOID_LED_2) +#define BOARD_LED_ALL (BOARD_LED_1 | BOARD_LED_2) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name UART IOID mapping + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_UART_RX IOID_2 +#define BOARD_IOID_UART_TX IOID_3 +#define BOARD_IOID_UART_RTS IOID_18 +#define BOARD_IOID_UART_CTS IOID_19 +#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) +#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) +#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) +#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Button IOID mapping + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_KEY_LEFT IOID_13 +#define BOARD_IOID_KEY_RIGHT IOID_14 +#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) +#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief SPI IOID mappings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_SPI_MOSI IOID_9 +#define BOARD_IOID_SPI_MISO IOID_8 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name External flash IOID mapping + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_FLASH_CS IOID_20 +#define BOARD_FLASH_CS (1 << BOARD_IOID_FLASH_CS) +#define BOARD_IOID_SPI_CLK_FLASH IOID_10 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief I2C IOID mappings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_SCL IOID_4 +#define BOARD_IOID_SDA IOID_5 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief CC1350LP RF Switch + * + * Those values are not meant to be modified by the user + * @{ + */ +#define RF_SWITCH_CONF_ENABLE 1 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief TX power settings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define PROP_MODE_CONF_TX_POWER_779_930 tx_power_driver_779_930 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief ROM bootloader configuration + * + * Change SET_CCFG_BL_CONFIG_BL_PIN_NUMBER to BOARD_IOID_KEY_xyz to select + * which button triggers the bootloader on reset. + * + * The remaining values are not meant to be modified by the user + * @{ + */ +#if ROM_BOOTLOADER_ENABLE +#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 +#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 +#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER BOARD_IOID_KEY_LEFT +#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 +#else +#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0x00 +#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x01 +#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0xFF +#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xFF +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief Remaining pins + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_CS IOID_11 +#define BOARD_IOID_TDO IOID_16 +#define BOARD_IOID_TDI IOID_17 +#define BOARD_IOID_DIO12 IOID_12 +#define BOARD_IOID_DIO15 IOID_15 +#define BOARD_IOID_DIO21 IOID_21 +#define BOARD_IOID_DIO22 IOID_22 +#define BOARD_IOID_DIO23 IOID_23 +#define BOARD_IOID_DIO24 IOID_24 +#define BOARD_IOID_DIO25 IOID_25 +#define BOARD_IOID_DIO26 IOID_26 +#define BOARD_IOID_DIO27 IOID_27 +#define BOARD_IOID_DIO28 IOID_28 +#define BOARD_IOID_DIO29 IOID_29 +#define BOARD_IOID_DIO30 IOID_30 + +#define BOARD_UNUSED_PINS { \ + BOARD_IOID_CS, BOARD_IOID_TDO, BOARD_IOID_TDI, BOARD_IOID_DIO12, \ + BOARD_IOID_DIO15, BOARD_IOID_DIO21, BOARD_IOID_DIO22, BOARD_IOID_DIO23, \ + BOARD_IOID_DIO24, BOARD_IOID_DIO25, BOARD_IOID_DIO26, BOARD_IOID_DIO27, \ + BOARD_IOID_DIO28, BOARD_IOID_DIO29, \ + IOID_UNUSED \ + } +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Device string used on startup + * @{ + */ +#define BOARD_STRING "TI CC1350 LaunchPad" +/** @} */ +/*---------------------------------------------------------------------------*/ +#endif /* BOARD_H_ */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/platform/srf06-cc26xx/launchpad/cc1350/rf-switch.c b/platform/srf06-cc26xx/launchpad/cc1350/rf-switch.c new file mode 100644 index 000000000..3e0ccff0e --- /dev/null +++ b/platform/srf06-cc26xx/launchpad/cc1350/rf-switch.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup rf-switch + * @{ + * + * \file + * CC1350 LP RF switch driver + */ +/*---------------------------------------------------------------------------*/ +#include "contiki-conf.h" +#include "lpm.h" +#include "rf-core/rf-switch.h" +#include "ti-lib.h" + +#include +#include +#include +/*---------------------------------------------------------------------------*/ +#define POWER_PIN IOID_30 +#define SELECT_PIN IOID_1 +/*---------------------------------------------------------------------------*/ +static void +shutdown_handler(uint8_t mode) +{ + ti_lib_gpio_clear_dio(POWER_PIN); +} +/*---------------------------------------------------------------------------*/ +/* + * Declare a data structure to register with LPM. Always turn off the switch + * when we are dropping to deep sleep. We let the RF driver turn it on though. + */ +LPM_MODULE(rf_switch_module, NULL, shutdown_handler, NULL, LPM_DOMAIN_NONE); +/*---------------------------------------------------------------------------*/ +void +rf_switch_init() +{ + ti_lib_rom_ioc_pin_type_gpio_output(POWER_PIN); + ti_lib_gpio_clear_dio(POWER_PIN); + ti_lib_rom_ioc_pin_type_gpio_output(SELECT_PIN); + ti_lib_gpio_clear_dio(SELECT_PIN); + + lpm_register_module(&rf_switch_module); +} +/*---------------------------------------------------------------------------*/ +void +rf_switch_power_up() +{ + ti_lib_gpio_set_dio(POWER_PIN); +} +/*---------------------------------------------------------------------------*/ +void +rf_switch_power_down() +{ + ti_lib_gpio_clear_dio(POWER_PIN); +} +/*---------------------------------------------------------------------------*/ +void +rf_switch_select_path(uint8_t path) +{ + ti_lib_gpio_write_dio(SELECT_PIN, path); +} +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/platform/srf06-cc26xx/launchpad/cc1350/tx-power-driver.c b/platform/srf06-cc26xx/launchpad/cc1350/tx-power-driver.c new file mode 100644 index 000000000..d39556a51 --- /dev/null +++ b/platform/srf06-cc26xx/launchpad/cc1350/tx-power-driver.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup rf-core-prop + * @{ + * + * \file + * TX power settings for the CC1350 LP + */ +/*---------------------------------------------------------------------------*/ +#include "contiki-conf.h" +#include "dev/radio.h" +#include "rf-core/prop-mode.h" +/*---------------------------------------------------------------------------*/ +/* TX power settings for the 779-930MHz band */ +const prop_mode_tx_power_config_t tx_power_driver_779_930[] = { + { 14, 0xab3f }, + { 12, 0xbc2b }, + { 11, 0x90e5 }, + { 10, 0x58d8 }, + { 9, 0x40d2 }, + { 8, 0x32ce }, + { 7, 0x2acb }, + { 6, 0x24c9 }, + { 5, 0x20c8 }, + { 4, 0x1844 }, + { 3, 0x1cc6 }, + { 2, 0x18c5 }, + { 1, 0x16c4 }, + { 0, 0x12c3 }, + { -10, 0x04c0 }, + {-128, 0xFFFF }, +}; +/*---------------------------------------------------------------------------*/ +/** + * @} + */ diff --git a/platform/srf06-cc26xx/launchpad/cc2650/board.h b/platform/srf06-cc26xx/launchpad/cc2650/board.h index d71896c3c..9b9d00bf0 100644 --- a/platform/srf06-cc26xx/launchpad/cc2650/board.h +++ b/platform/srf06-cc26xx/launchpad/cc2650/board.h @@ -178,6 +178,8 @@ * Those values are not meant to be modified by the user * @{ */ +#define BOARD_IOID_DIO0 IOID_0 +#define BOARD_IOID_DIO1 IOID_1 #define BOARD_IOID_CS IOID_11 #define BOARD_IOID_TDO IOID_16 #define BOARD_IOID_TDI IOID_17 @@ -193,6 +195,14 @@ #define BOARD_IOID_DIO28 IOID_28 #define BOARD_IOID_DIO29 IOID_29 #define BOARD_IOID_DIO30 IOID_30 + +#define BOARD_UNUSED_PINS { \ + BOARD_IOID_DIO0, BOARD_IOID_DIO1, BOARD_IOID_CS, BOARD_IOID_TDO, \ + BOARD_IOID_TDI, BOARD_IOID_DIO12, BOARD_IOID_DIO15, BOARD_IOID_DIO21, \ + BOARD_IOID_DIO22, BOARD_IOID_DIO23, BOARD_IOID_DIO24, BOARD_IOID_DIO25, \ + BOARD_IOID_DIO26, BOARD_IOID_DIO27, BOARD_IOID_DIO28, BOARD_IOID_DIO29, \ + BOARD_IOID_DIO30, IOID_UNUSED \ + } /** @} */ /*---------------------------------------------------------------------------*/ /** diff --git a/platform/srf06-cc26xx/sensortag/bmp-280-sensor.c b/platform/srf06-cc26xx/sensortag/bmp-280-sensor.c index 4ed9e06fc..a6e525cb1 100644 --- a/platform/srf06-cc26xx/sensortag/bmp-280-sensor.c +++ b/platform/srf06-cc26xx/sensortag/bmp-280-sensor.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26XX BMP280 Altimeter / Pressure Sensor + * Driver for the Sensortag BMP280 Altimeter / Pressure Sensor */ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" diff --git a/platform/srf06-cc26xx/sensortag/bmp-280-sensor.h b/platform/srf06-cc26xx/sensortag/bmp-280-sensor.h index 8bff65787..0047aaa9a 100644 --- a/platform/srf06-cc26xx/sensortag/bmp-280-sensor.h +++ b/platform/srf06-cc26xx/sensortag/bmp-280-sensor.h @@ -49,7 +49,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26xx BMP280 Altimeter / Pressure Sensor + * Header file for the Sensortag BMP280 Altimeter / Pressure Sensor */ /*---------------------------------------------------------------------------*/ #ifndef BMP_280_SENSOR_H_ diff --git a/platform/srf06-cc26xx/sensortag/board-i2c.c b/platform/srf06-cc26xx/sensortag/board-i2c.c index 3fa54a7d1..238d091c1 100644 --- a/platform/srf06-cc26xx/sensortag/board-i2c.c +++ b/platform/srf06-cc26xx/sensortag/board-i2c.c @@ -34,7 +34,7 @@ * @{ * * \file - * Board-specific I2C driver for the Sensortag-CC26xx + * Board-specific I2C driver for the Sensortags */ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" diff --git a/platform/srf06-cc26xx/sensortag/board-i2c.h b/platform/srf06-cc26xx/sensortag/board-i2c.h index 40832c9bd..46233c332 100644 --- a/platform/srf06-cc26xx/sensortag/board-i2c.h +++ b/platform/srf06-cc26xx/sensortag/board-i2c.h @@ -36,7 +36,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26xx I2C Driver + * Header file for the Sensortag I2C Driver */ /*---------------------------------------------------------------------------*/ #ifndef BOARD_I2C_H_ diff --git a/platform/srf06-cc26xx/sensortag/board-peripherals.h b/platform/srf06-cc26xx/sensortag/board-peripherals.h index 9c994d9e6..42e22d4c8 100644 --- a/platform/srf06-cc26xx/sensortag/board-peripherals.h +++ b/platform/srf06-cc26xx/sensortag/board-peripherals.h @@ -29,10 +29,18 @@ */ /*---------------------------------------------------------------------------*/ /** \addtogroup cc26xx-srf-tag + * @{ + * + * \defgroup sensortag-cc26xx-peripherals Sensortag CC1350/CC2650 common + * + * Defines related to Sensortag sensors. The two sensortags are identical to a + * very large extent. Everything documented within this group applies to both + * sensortags. + * * @{ * * \file - * Header file with definitions related to the sensors on the Sensortag-CC26xx + * Header file with definitions related to the sensors on the Sensortags * * \note Do not include this file directly. */ @@ -52,5 +60,6 @@ #endif /* BOARD_PERIPHERALS_H_ */ /*---------------------------------------------------------------------------*/ /** + * @} * @} */ diff --git a/platform/srf06-cc26xx/sensortag/button-sensor.c b/platform/srf06-cc26xx/sensortag/button-sensor.c index 9df55d21d..7ec0a5a18 100644 --- a/platform/srf06-cc26xx/sensortag/button-sensor.c +++ b/platform/srf06-cc26xx/sensortag/button-sensor.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26xx buttons + * Driver for Sensortag buttons */ /*---------------------------------------------------------------------------*/ #include "contiki.h" diff --git a/platform/srf06-cc26xx/sensortag/button-sensor.h b/platform/srf06-cc26xx/sensortag/button-sensor.h index 25acb104f..1355a5855 100644 --- a/platform/srf06-cc26xx/sensortag/button-sensor.h +++ b/platform/srf06-cc26xx/sensortag/button-sensor.h @@ -38,7 +38,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26xx Button Driver + * Header file for the Sensortag Button Driver */ /*---------------------------------------------------------------------------*/ #ifndef BUTTON_SENSOR_H_ diff --git a/platform/srf06-cc26xx/sensortag/buzzer.c b/platform/srf06-cc26xx/sensortag/buzzer.c index d7f48e4de..47ce799d4 100644 --- a/platform/srf06-cc26xx/sensortag/buzzer.c +++ b/platform/srf06-cc26xx/sensortag/buzzer.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26XX Buzzer + * Driver for the Sensortag Buzzer */ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" diff --git a/platform/srf06-cc26xx/sensortag/buzzer.h b/platform/srf06-cc26xx/sensortag/buzzer.h index 653b46f88..679729245 100644 --- a/platform/srf06-cc26xx/sensortag/buzzer.h +++ b/platform/srf06-cc26xx/sensortag/buzzer.h @@ -36,7 +36,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26xx Buzzer + * Header file for the Sensortag Buzzer */ /*---------------------------------------------------------------------------*/ #ifndef BUZZER_H_ diff --git a/platform/srf06-cc26xx/sensortag/cc1350/Makefile.cc1350 b/platform/srf06-cc26xx/sensortag/cc1350/Makefile.cc1350 new file mode 100644 index 000000000..3cacec197 --- /dev/null +++ b/platform/srf06-cc26xx/sensortag/cc1350/Makefile.cc1350 @@ -0,0 +1,11 @@ +### Add to the source list +BOARD_SOURCEFILES += leds-arch.c + +### Will allow the inclusion of the correct CPU makefile +CPU_FAMILY = cc13xx + +### Add to the source dirs +CONTIKI_TARGET_DIRS += sensortag/cc1350 + +### Include the common sensortag makefile +include $(PLATFORM_ROOT_DIR)/sensortag/Makefile.sensortag diff --git a/platform/srf06-cc26xx/sensortag/cc1350/board.h b/platform/srf06-cc26xx/sensortag/cc1350/board.h new file mode 100644 index 000000000..7db4c9357 --- /dev/null +++ b/platform/srf06-cc26xx/sensortag/cc1350/board.h @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** \addtogroup cc26xx-srf-tag + * @{ + * + * \defgroup sensortag-cc13xx-peripherals CC1350 Sensortag Peripherals + * + * Defines related to the CC1350 Sensortag + * + * This file provides connectivity information on LEDs, Buttons, UART and + * other peripherals + * + * This file can be used as the basis to configure other boards using the + * CC13xx code as their basis. + * + * This file is not meant to be modified by the user. + * @{ + * + * \file + * Header file with definitions related to the I/O connections on the TI + * Sensortag + * + * \note Do not include this file directly. It gets included by contiki-conf + * after all relevant directives have been set. + */ +/*---------------------------------------------------------------------------*/ +#ifndef BOARD_H_ +#define BOARD_H_ +/*---------------------------------------------------------------------------*/ +#include "ioc.h" +/*---------------------------------------------------------------------------*/ +/** + * \name LED configurations + * + * Those values are not meant to be modified by the user + * @{ + */ +/* Some files include leds.h before us, so we need to get rid of defaults in + * leds.h before we provide correct definitions */ +#undef LEDS_GREEN +#undef LEDS_YELLOW +#undef LEDS_RED +#undef LEDS_CONF_ALL + +#define LEDS_RED 1 +#define LEDS_GREEN LEDS_RED +#define LEDS_YELLOW LEDS_RED +#define LEDS_ORANGE LEDS_RED + +#define LEDS_CONF_ALL 1 + +/* Notify various examples that we have LEDs */ +#define PLATFORM_HAS_LEDS 1 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name LED IOID mappings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_LED_1 IOID_10 +#define BOARD_LED_1 (1 << BOARD_IOID_LED_1) +#define BOARD_LED_ALL BOARD_LED_1 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name UART IOID mapping + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_DP4_UARTRX IOID_28 +#define BOARD_IOID_DP5_UARTTX IOID_29 + +#if BOARD_CONF_DEBUGGER_DEVPACK +#define BOARD_IOID_UART_RX BOARD_IOID_DP4_UARTRX +#define BOARD_IOID_UART_TX BOARD_IOID_DP5_UARTTX +#else +#define BOARD_IOID_UART_RX IOID_17 +#define BOARD_IOID_UART_TX IOID_16 +#endif + +#define BOARD_IOID_UART_CTS IOID_UNUSED +#define BOARD_IOID_UART_RTS IOID_UNUSED +#define BOARD_UART_RX (1 << BOARD_IOID_UART_RX) +#define BOARD_UART_TX (1 << BOARD_IOID_UART_TX) +#define BOARD_UART_CTS (1 << BOARD_IOID_UART_CTS) +#define BOARD_UART_RTS (1 << BOARD_IOID_UART_RTS) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Button IOID mapping + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_KEY_LEFT IOID_15 +#define BOARD_IOID_KEY_RIGHT IOID_4 +#define BOARD_KEY_LEFT (1 << BOARD_IOID_KEY_LEFT) +#define BOARD_KEY_RIGHT (1 << BOARD_IOID_KEY_RIGHT) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief SPI IOID mappings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_SPI_MOSI IOID_19 +#define BOARD_IOID_SPI_MISO IOID_18 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Buzzer configuration + * @{ + */ +#define BOARD_IOID_BUZZER IOID_21 /**< Buzzer Pin */ +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Reed Relay IOID mapping + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_REED_RELAY IOID_1 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name External flash IOID mapping and part-related constants + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_FLASH_CS IOID_14 +#define BOARD_FLASH_CS (1 << BOARD_IOID_FLASH_CS) +#define BOARD_IOID_SPI_CLK_FLASH IOID_17 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief I2C IOID mappings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_SDA IOID_5 /**< Interface 0 SDA: All sensors bar MPU */ +#define BOARD_IOID_SCL IOID_6 /**< Interface 0 SCL: All sensors bar MPU */ +#define BOARD_IOID_SDA_HP IOID_8 /**< Interface 1 SDA: MPU */ +#define BOARD_IOID_SCL_HP IOID_9 /**< Interface 1 SCL: MPU */ +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief MPU IOID mappings + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_MPU_INT IOID_7 +#define BOARD_IOID_MPU_POWER IOID_12 +#define BOARD_MPU_INT (1 << BOARD_IOID_MPU_INT) +#define BOARD_MPU_POWER (1 << BOARD_IOID_MPU_POWER) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief Board devpack IOID mappings (LCD etc.) + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_AUDIOFS_TDO IOID_16 +#define BOARD_IOID_DEVPACK_CS IOID_20 +#define BOARD_IOID_DEVPK_LCD_EXTCOMIN IOID_22 +#define BOARD_IOID_AUDIODO IOID_22 +#define BOARD_IOID_DP2 IOID_23 +#define BOARD_IOID_DP1 IOID_24 +#define BOARD_IOID_DP0 IOID_25 +#define BOARD_IOID_DP3 IOID_27 +#define BOARD_IOID_DEVPK_ID IOID_30 +#define BOARD_DEVPACK_CS (1 << BOARD_IOID_DEVPACK_CS) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief TMP Sensor + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_TMP_RDY IOID_11 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief Digital Microphone + * + * Those values are not meant to be modified by the user + * @{ + */ +#define BOARD_IOID_MIC_POWER IOID_13 +#define BOARD_IOID_AUDIO_DI IOID_2 +#define BOARD_IOID_AUDIO_CLK IOID_3 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name RF Front End configuration + * + * Those values are not meant to be modified by the user + * @{ + */ +#define RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE 0x01 /* Single-Ended, RFP */ +#define RF_CORE_CONF_RADIO_SETUP_BIAS_MODE 0x01 /* External */ +#define RF_CORE_CONF_PROP_FRONT_END_MODE 0x02 /* Single-Ended, RFN */ +#define RF_CORE_CONF_PROP_BIAS_MODE 0x01 /* External */ +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Board-specific overrides + * + * Those values are not meant to be modified by the user + * @{ + */ +#define IEEE_MODE_CONF_BOARD_OVERRIDES ADI_HALFREG_OVERRIDE(0, 16, 0x7, 1), +#define RF_BLE_CONF_BOARD_OVERRIDES ADI_HALFREG_OVERRIDE(0, 16, 0x7, 1), +#define SMARTRF_SETTINGS_CONF_BOARD_OVERRIDES ADI_HALFREG_OVERRIDE(0, 16, 0x7, 2), + +#define SMARTRF_SETTINGS_CONF_RSSI_OFFSET_779_930 0x00F688A3 +#define SMARTRF_SETTINGS_CONF_OVERRIDE_TRIM_OFFSET 0x00018883 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Device string used on startup + * @{ + */ +#define BOARD_STRING "TI CC1350 SensorTag" + +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \brief Board specific iniatialisation + * @{ + */ +void board_init(void); +/** @} */ +/*---------------------------------------------------------------------------*/ +#endif /* BOARD_H_ */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/platform/srf06-cc26xx/sensortag/cc1350/leds-arch.c b/platform/srf06-cc26xx/sensortag/cc1350/leds-arch.c new file mode 100644 index 000000000..f4214628e --- /dev/null +++ b/platform/srf06-cc26xx/sensortag/cc1350/leds-arch.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup sensortag-cc13xx-peripherals + * @{ + * + * \file + * Driver for the Sensortag-CC1350 LEDs + */ +/*---------------------------------------------------------------------------*/ +#include "contiki.h" +#include "dev/leds.h" + +#include "ti-lib.h" +/*---------------------------------------------------------------------------*/ +static unsigned char c; +static int inited = 0; +/*---------------------------------------------------------------------------*/ +void +leds_arch_init(void) +{ + if(inited) { + return; + } + inited = 1; + + ti_lib_rom_ioc_pin_type_gpio_output(BOARD_IOID_LED_1); + + ti_lib_gpio_clear_multi_dio(BOARD_LED_ALL); +} +/*---------------------------------------------------------------------------*/ +unsigned char +leds_arch_get(void) +{ + return c; +} +/*---------------------------------------------------------------------------*/ +void +leds_arch_set(unsigned char leds) +{ + c = leds; + ti_lib_gpio_clear_dio(BOARD_IOID_LED_1); + + if((leds & LEDS_RED) == LEDS_RED) { + ti_lib_gpio_set_dio(BOARD_IOID_LED_1); + } +} +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/platform/srf06-cc26xx/sensortag/cc2650/board.h b/platform/srf06-cc26xx/sensortag/cc2650/board.h index 68580d4ff..0cf828850 100644 --- a/platform/srf06-cc26xx/sensortag/cc2650/board.h +++ b/platform/srf06-cc26xx/sensortag/cc2650/board.h @@ -31,7 +31,7 @@ /** \addtogroup cc26xx-srf-tag * @{ * - * \defgroup sensortag-cc26xx-peripherals Sensortag Peripherals + * \defgroup sensortag-cc26xx-specific CC2650 Sensortag Peripherals * * Defines related to the CC2650 Sensortag * diff --git a/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.c b/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.c index b8da56fef..ec300bf22 100644 --- a/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.c +++ b/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26xx HDC sensor + * Driver for the Sensortag HDC sensor */ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" diff --git a/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.h b/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.h index 990b1ab69..d3089d742 100755 --- a/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.h +++ b/platform/srf06-cc26xx/sensortag/hdc-1000-sensor.h @@ -1,32 +1,3 @@ -/* - * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ /* * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ * All rights reserved. @@ -85,7 +56,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26ss TI HDC1000 sensor + * Header file for the Sensortag TI HDC1000 sensor */ /*---------------------------------------------------------------------------*/ #ifndef HDC_1000_SENSOR_H diff --git a/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.c b/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.c index 5a97666b3..886cccb6e 100644 --- a/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.c +++ b/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26XX Invensense MPU9250 motion processing unit + * Driver for the Sensortag Invensense MPU9250 motion processing unit */ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" diff --git a/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.h b/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.h index c6c4d5534..da4386412 100644 --- a/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.h +++ b/platform/srf06-cc26xx/sensortag/mpu-9250-sensor.h @@ -62,7 +62,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26XX Invensense MPU9250 motion processing unit + * Header file for the Sensortag Invensense MPU9250 motion processing unit */ /*---------------------------------------------------------------------------*/ #ifndef MPU_9250_SENSOR_H_ diff --git a/platform/srf06-cc26xx/sensortag/opt-3001-sensor.c b/platform/srf06-cc26xx/sensortag/opt-3001-sensor.c index 7d903e18b..a9b7ba01f 100644 --- a/platform/srf06-cc26xx/sensortag/opt-3001-sensor.c +++ b/platform/srf06-cc26xx/sensortag/opt-3001-sensor.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26xx Opt3001 light sensor + * Driver for the Sensortag Opt3001 light sensor */ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" diff --git a/platform/srf06-cc26xx/sensortag/opt-3001-sensor.h b/platform/srf06-cc26xx/sensortag/opt-3001-sensor.h index a4160b729..e9fa379a4 100644 --- a/platform/srf06-cc26xx/sensortag/opt-3001-sensor.h +++ b/platform/srf06-cc26xx/sensortag/opt-3001-sensor.h @@ -53,7 +53,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26xx Opt3001 light sensor + * Header file for the Sensortag Opt3001 light sensor */ /*---------------------------------------------------------------------------*/ #ifndef OPT_3001_SENSOR_H_ diff --git a/platform/srf06-cc26xx/sensortag/reed-relay.c b/platform/srf06-cc26xx/sensortag/reed-relay.c index 598bfd970..8cecad9d6 100644 --- a/platform/srf06-cc26xx/sensortag/reed-relay.c +++ b/platform/srf06-cc26xx/sensortag/reed-relay.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26XX Reed Relay + * Driver for the Sensortag Reed Relay */ /*---------------------------------------------------------------------------*/ #include "contiki.h" diff --git a/platform/srf06-cc26xx/sensortag/reed-relay.h b/platform/srf06-cc26xx/sensortag/reed-relay.h index 3ec712719..0ed6dd819 100644 --- a/platform/srf06-cc26xx/sensortag/reed-relay.h +++ b/platform/srf06-cc26xx/sensortag/reed-relay.h @@ -41,7 +41,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26XX Reed Relay + * Header file for the Sensortag Reed Relay */ /*---------------------------------------------------------------------------*/ #ifndef REED_RELAY_H diff --git a/platform/srf06-cc26xx/sensortag/sensor-common.h b/platform/srf06-cc26xx/sensortag/sensor-common.h index 977650d5e..7f2bab4f1 100644 --- a/platform/srf06-cc26xx/sensortag/sensor-common.h +++ b/platform/srf06-cc26xx/sensortag/sensor-common.h @@ -36,7 +36,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26xx Common sensor utilities + * Header file for the Sensortag Common sensor utilities */ /*---------------------------------------------------------------------------*/ #ifndef SENSOR_H diff --git a/platform/srf06-cc26xx/sensortag/sensortag-sensors.c b/platform/srf06-cc26xx/sensortag/sensortag-sensors.c index bcd0fe367..26d08591d 100644 --- a/platform/srf06-cc26xx/sensortag/sensortag-sensors.c +++ b/platform/srf06-cc26xx/sensortag/sensortag-sensors.c @@ -33,7 +33,7 @@ * @{ * * \file - * Generic module controlling sensors on CC26XX Sensortag + * Generic module controlling sensors on Sensortags */ /*---------------------------------------------------------------------------*/ #include "contiki.h" diff --git a/platform/srf06-cc26xx/sensortag/tmp-007-sensor.c b/platform/srf06-cc26xx/sensortag/tmp-007-sensor.c index 1c462a0e0..fdbd975b1 100644 --- a/platform/srf06-cc26xx/sensortag/tmp-007-sensor.c +++ b/platform/srf06-cc26xx/sensortag/tmp-007-sensor.c @@ -33,7 +33,7 @@ * @{ * * \file - * Driver for the Sensortag-CC26xx TI TMP007 infrared thermophile sensor + * Driver for the Sensortag TI TMP007 infrared thermophile sensor */ /*---------------------------------------------------------------------------*/ #include "contiki-conf.h" diff --git a/platform/srf06-cc26xx/sensortag/tmp-007-sensor.h b/platform/srf06-cc26xx/sensortag/tmp-007-sensor.h index 10c96c8a0..5260c9152 100644 --- a/platform/srf06-cc26xx/sensortag/tmp-007-sensor.h +++ b/platform/srf06-cc26xx/sensortag/tmp-007-sensor.h @@ -56,7 +56,7 @@ * @{ * * \file - * Header file for the Sensortag-CC26xx TI TMP007 infrared thermophile sensor + * Header file for the Sensortag TI TMP007 infrared thermophile sensor */ /*---------------------------------------------------------------------------*/ #ifndef TMP_007_SENSOR_H_ diff --git a/regression-tests/18-compile-arm-ports/Makefile b/regression-tests/18-compile-arm-ports/Makefile index debdbd53d..f42101ba8 100644 --- a/regression-tests/18-compile-arm-ports/Makefile +++ b/regression-tests/18-compile-arm-ports/Makefile @@ -9,9 +9,11 @@ ipv6/multicast/ev-aducrf101mkxz \ cc26xx/cc26xx-web-demo/srf06-cc26xx \ cc26xx/very-sleepy-demo/srf06-cc26xx:BOARD=sensortag/cc2650 \ cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=sensortag/cc2650 \ +cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=sensortag/cc1350 \ cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=srf06/cc13xx \ cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=launchpad/cc2650 \ cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=launchpad/cc1310 \ +cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=launchpad/cc1350 \ cc26xx/very-sleepy-demo/srf06-cc26xx \ hello-world/cc2538dk \ ipv6/rpl-border-router/cc2538dk \