Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

board-support: cc2650stk #4675

Merged
merged 6 commits into from
Apr 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions boards/cc2650stk/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE = board

include $(RIOTBASE)/Makefile.base
11 changes: 11 additions & 0 deletions boards/cc2650stk/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_cpuid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the template as in other Makefile.features files here, e.g. from boards/stm32f4discovery/Makefile.features

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like this?

FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

# Various other features (if any)
FEATURES_PROVIDED += cpp

# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m3_1
14 changes: 14 additions & 0 deletions boards/cc2650stk/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export CPU = cc26x0
export CPU_MODEL = cc26x0f128

# set default port depending on operating system
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))

# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial

# configure the flash tool
export UNIFLASH_PATH ?= "UNIFLASH_PATH unconfigured"
export FLASHER = $(UNIFLASH_PATH)/uniflash.sh
export FFLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/cc26x0stk.ccxml -program $(ELFFILE)
32 changes: 32 additions & 0 deletions boards/cc2650stk/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2016 Leon George
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_cc2650stk
* @{
*
* @file
* @brief Board specific implementations for the CC2650STK board
*
* @author Leon M. George <[email protected]>
*
* @}
*/

#include "cpu.h"
#include "board.h"

/**
* @brief initialise the board
*/
void board_init(void)
{
cpu_init();

gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
}
14 changes: 14 additions & 0 deletions boards/cc2650stk/dist/cc26x0stk.ccxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="configuration_0">
<instance XML_version="1.2" desc="Texas Instruments XDS110 USB Debug Probe" href="connections/TIXDS110_Connection.xml" id="Texas Instruments XDS110 USB Debug Probe" xml="TIXDS110_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS110 USB Debug Probe">
<instance XML_version="1.2" href="drivers/tixds510icepick_c.xml" id="drivers" xml="tixds510icepick_c.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds510cs_dap.xml" id="drivers" xml="tixds510cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds510cortexM.xml" id="drivers" xml="tixds510cortexM.xml" xmlpath="drivers"/>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="CC2650F128" href="devices/cc2650f128.xml" id="CC2650F128" xml="cc2650f128.xml" xmlpath="devices"/>
</platform>
</connection>
</configuration>
</configurations>
72 changes: 72 additions & 0 deletions boards/cc2650stk/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2016 Leon George
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @defgroup boards_cc2650stk CC2650STK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general idea: I think it would make sense to rename the board to sensor-tag. The more 'human readable' name the better and easier to use, and in this case this is the official name for the board, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple SensortTags by TI. TI may make other SensortTags in the future.

http://www.ti.com/tool/cc2541dk-sensor
http://www.ti.com/tool/cc2650stk

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, then I guess we have to live with cc2650stk.

* @ingroup boards
* @brief SimpleLink™ CC2650 sensor tag
* @{
*
* @file
* @brief Board configuration for the CC2650STK
*
* @author Leon M. George <[email protected]>
*/

#ifndef BOARD_H_
#define BOARD_H_

#include "periph/gpio.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Xtimer configuration
* @{
*/
#define XTIMER_MASK (0xFFFF0000)
#define XTIMER_SHIFT_ON_COMPARE (7)
/** @} */

/**
* @brief On-board button configuration
* @{
*/
#define BUTTON1_DIO GPIO_PIN(0, 4)
#define BUTTON2_DIO GPIO_PIN(0, 0)
/** @} */

/**
* @brief Macros for controlling the on-board LEDs
* @{
*/
#define LED0_PIN GPIO_PIN(0, 10)
#define LED1_PIN GPIO_PIN(0, 15)

#define LED0_ON gpio_set(LED0_PIN)
#define LED0_OFF gpio_clear(LED0_PIN)
#define LED0_TOGGLE gpio_toggle(LED0_PIN)

#define LED1_ON gpio_set(LED1_PIN)
#define LED1_OFF gpio_clear(LED1_PIN)
#define LED1_TOGGLE gpio_toggle(LED1_PIN)
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs, and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_H_ */
/** @} */
77 changes: 77 additions & 0 deletions boards/cc2650stk/include/periph_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright (C) 2016 Leon George
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup boards_cc2650stk
* @{
*
* @file
* @brief Peripheral MCU configuration for the CC2650STK board
*
* @author Leon M. George <[email protected]>
*/

#ifndef PERIPH_CONF_H_
#define PERIPH_CONF_H_

#include "periph_cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Clock configuration
* @{
*/
/* the main clock is fixed to 48MHZ */
#define CLOCK_CORECLOCK (48000000U)
/** @} */

/**
* @brief Timer configuration
* @{
*/
static const timer_conf_t timer_config[] = {
{
.dev = GPT0,
.num = 0
},
{
.dev = GPT1,
.num = 1
}
};

#define TIMER_0_ISR isr_timer0_chan0
#define TIMER_1_ISR isr_timer1_chan0

#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
/** @} */

/**
* @brief UART configuration
*
* The used CC26x0 CPU only supports a single UART device, so all we need to
* configure are the RX and TX pins.
*
* Optionally we can enable hardware flow control, by setting UART_HW_FLOW_CTRL
* to 1 and defining pins for UART_CTS_PIN and UART_RTS_PIN.
* @{
*/
#define UART_NUMOF (1)
#define UART_RX_PIN (28)
#define UART_TX_PIN (29)
/** @} */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CPU has more than 1 UART, right? So you should use a struct based configuration here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cpu has only one uart

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I would drop the zero and there is no need to define UART_0_IRQ and UART_0_ISR... Also drop UART_0_EN as this is deprecated.


#ifdef __cplusplus
}
#endif

#endif /* PERIPH_CONF_H_ */
/** @} */
7 changes: 7 additions & 0 deletions cpu/cc26x0/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Define the module that is built:
MODULE = cpu

# Add a list of subdirectories, that should also be built:
DIRS = periph $(RIOTCPU)/cortexm_common

include $(RIOTBASE)/Makefile.base
3 changes: 3 additions & 0 deletions cpu/cc26x0/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export CPU_ARCH := cortex-m3

include $(RIOTCPU)/Makefile.include.cortexm_common
54 changes: 54 additions & 0 deletions cpu/cc26x0/cpu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (C) 2016 Leon George
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup cpu_cc26x0
* @{
*
* @file
* @brief implementation of the CPU initialization
*
* @author Leon M. George <[email protected]>
* @}
*/

#include "cpu.h"
#include "periph_conf.h"

#ifndef HF_CLOCK_SOURCE
#define HF_CLOCK_SOURCE DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_RCOSC /* set 48MHz RCOSC */
#endif
#ifndef LF_CLOCK_SOURCE
#define LF_CLOCK_SOURCE DDI_0_OSC_CTL0_SCLK_LF_SRC_SEL_HF_RCOSC /* set 31.25kHz derived from 48MHz RCOSC */
#endif

/**
*@brief Configure the MCU system clock
*/
static void cpu_clock_init(void);

/**
* @brief Initialize the CPU, set IRQ priorities
*/
void cpu_init(void)
{
/* initialize the Cortex-M core */
cortexm_init();

/* initialize the system clock */
cpu_clock_init();
}

static void cpu_clock_init(void)
{
AON_WUC->AUXCTL |= AUXCTL_AUX_FORCE_ON; /* power on AUX_PD */
while(!(AON_WUC->PWRSTAT & PWRSTAT_AUX_PD_ON)); /* wait for AUX_PD to be powered on */
AUX_WUC->MODCLKEN0 |= MODCLKEN0_AUX_DDI0_OSC_EN; /* turn on oscillator interface clock */

DDI_0_OSC->CTL0 |= HF_CLOCK_SOURCE | LF_CLOCK_SOURCE; /* configure HF and LF clocks */
}
15 changes: 15 additions & 0 deletions cpu/cc26x0/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @defgroup cpu_cc26x0 Texas Instruments CC26x0
* @ingroup cpu
* @brief Texas Instruments CC26x0 Cortex-M3 MCU specific code
*/

/**
* @defgroup cpu_specific_peripheral_memory_map
* @ingroup cpu
*/

/**
* @defgroup cpu_cc26x0_definitions Texas Instruments CC26x0 definitions
* @ingroup cpu_cc26x0
*/
Loading