Add support for the CC1350 Launchpad

This commit is contained in:
George Oikonomou 2016-11-06 17:19:55 +00:00 committed by Simon Duquennoy
parent 6216b7f8e6
commit c6523d010d
5 changed files with 409 additions and 2 deletions

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

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