Merge pull request #1932 from g-oikonomou/contrib/cc1350/lp-and-st

Add support for the CC1350 LP and Sensortag
This commit is contained in:
George Oikonomou 2017-04-24 15:34:22 +01:00 committed by GitHub
commit 7b193ee014
49 changed files with 1269 additions and 127 deletions

View File

@ -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

View File

@ -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.400169.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

View File

@ -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 */

View File

@ -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 },
};
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -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 = {
};
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -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 <stdint.h>
/*---------------------------------------------------------------------------*/
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_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -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 */

View File

@ -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);

View File

@ -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
/*---------------------------------------------------------------------------*/

View File

@ -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 <stdint.h>
/*---------------------------------------------------------------------------*/
#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_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -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 <stdint.h>
/*---------------------------------------------------------------------------*/
#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 */

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -33,7 +33,7 @@
* @{
*
* \file
* Driver for the LaunchPad Flash and the Sensortag WinBond W25X20CL/W25X40CL
* Sensortag/LaunchPad External Flash Driver
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"

View File

@ -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"

View File

@ -41,6 +41,7 @@
#include "lpm.h"
#include "ti-lib.h"
#include "board-peripherals.h"
#include "rf-core/rf-switch.h"
#include <stdint.h>
#include <string.h>
@ -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();

View File

@ -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 \
}
/** @} */
/*---------------------------------------------------------------------------*/
/**

View File

@ -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

View File

@ -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_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/

View File

@ -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 <stdint.h>
#include <string.h>
#include <stdbool.h>
/*---------------------------------------------------------------------------*/
#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);
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -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 },
};
/*---------------------------------------------------------------------------*/
/**
* @}
*/

View File

@ -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 \
}
/** @} */
/*---------------------------------------------------------------------------*/
/**

View File

@ -33,7 +33,7 @@
* @{