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

[WIP] cpu/cc26x2_cc13x2: add sub-1-ghz netdev driver #13295

Closed
wants to merge 13 commits into from
Closed
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/cc1312-launchpad/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
ifneq (,$(filter netdev_default,$(USEMODULE)))
USEMODULE += cc26x2_cc13x2_rf
endif
67 changes: 67 additions & 0 deletions boards/cc1312-launchpad/include/rf_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2020 Locha Inc
*
* 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_cc1312_launchpad
* @{
*
* @file
* @brief RF configuration
*
* @author Jean Pierre Dudey <jeandudey@hotmail.com>
*/

#ifndef RF_CONF_H
#define RF_CONF_H

#include "kernel_defines.h"
#include "cc26x2_cc13x2_rf_params.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name CC26x2/CC13x2 PA table configuration
* @{
*/
static cc26x2_cc13x2_rf_pa_t cc26x2_cc13x2_rf_patable[] =
{
/* VDDR high allows 14 dBm transmit power, VDDR high setting is only
* enabled if the CCFG is flashed */
#if IS_USED(CONFIG_CC26XX_CC13XX_VDDR_HH)
{ .dbm = 14, .val = CC26X2_CC13X2_RF_PA_ENTRY(63, 0, 1, 0) },
#endif
/* 12.5 rounded to 13 */
{ .dbm = 13, .val = CC26X2_CC13X2_RF_PA_ENTRY(36, 0, 0, 89) },
{ .dbm = 12, .val = CC26X2_CC13X2_RF_PA_ENTRY(16, 0, 0, 82) },
{ .dbm = 11, .val = CC26X2_CC13X2_RF_PA_ENTRY(26, 2, 0, 51) },
{ .dbm = 10, .val = CC26X2_CC13X2_RF_PA_ENTRY(18, 2, 0, 31) },
{ .dbm = 9, .val = CC26X2_CC13X2_RF_PA_ENTRY(28, 3, 0, 31) },
{ .dbm = 8, .val = CC26X2_CC13X2_RF_PA_ENTRY(24, 3, 0, 22) },
{ .dbm = 7, .val = CC26X2_CC13X2_RF_PA_ENTRY(20, 3, 0, 19) },
{ .dbm = 6, .val = CC26X2_CC13X2_RF_PA_ENTRY(17, 3, 0, 16) },
{ .dbm = 5, .val = CC26X2_CC13X2_RF_PA_ENTRY(14, 3, 0, 14) },
{ .dbm = 4, .val = CC26X2_CC13X2_RF_PA_ENTRY(13, 3, 0, 11) },
{ .dbm = 3, .val = CC26X2_CC13X2_RF_PA_ENTRY(11, 3, 0, 10) },
{ .dbm = 2, .val = CC26X2_CC13X2_RF_PA_ENTRY(10, 3, 0, 9) },
{ .dbm = 1, .val = CC26X2_CC13X2_RF_PA_ENTRY(9, 3, 0, 9) },
{ .dbm = 0, .val = CC26X2_CC13X2_RF_PA_ENTRY(8, 3, 0, 8) },
{ .dbm = -5, .val = CC26X2_CC13X2_RF_PA_ENTRY(4, 3, 0, 5) },
{ .dbm = -10, .val = CC26X2_CC13X2_RF_PA_ENTRY(2, 3, 0, 5) },
{ .dbm = -15, .val = CC26X2_CC13X2_RF_PA_ENTRY(1, 3, 0, 3) },
{ .dbm = -20, .val = CC26X2_CC13X2_RF_PA_ENTRY(0, 3, 0, 2) },
};
#define CC26X2_CC13X2_PA_TABLE_NUMOF ARRAY_SIZE(cc26x2_cc13x2_rf_patable)
/** @} */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* RF_CONF_H */
3 changes: 3 additions & 0 deletions boards/cc1352-launchpad/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
ifneq (,$(filter netdev_default,$(USEMODULE)))
USEMODULE += cc26x2_cc13x2_rf
endif
67 changes: 67 additions & 0 deletions boards/cc1352-launchpad/include/rf_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2020 Locha Inc
*
* 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_cc1352_launchpad
* @{
*
* @file
* @brief RF configuration
*
* @author Jean Pierre Dudey <jeandudey@hotmail.com>
*/

#ifndef RF_CONF_H
#define RF_CONF_H

#include "kernel_defines.h"
#include "cc26x2_cc13x2_rf_params.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name CC26x2/CC13x2 PA table configuration
* @{
*/
static cc26x2_cc13x2_rf_pa_t cc26x2_cc13x2_rf_patable[] =
{
/* VDDR high allows 14 dBm transmit power, VDDR high setting is only
* enabled if the CCFG is flashed */
#if IS_USED(CONFIG_CC26XX_CC13XX_VDDR_HH)
{ .dbm = 14, .val = CC26X2_CC13X2_RF_PA_ENTRY(63, 0, 1, 0) },
#endif
/* 12.5 rounded to 13 */
{ .dbm = 13, .val = CC26X2_CC13X2_RF_PA_ENTRY(36, 0, 0, 89) },
{ .dbm = 12, .val = CC26X2_CC13X2_RF_PA_ENTRY(16, 0, 0, 82) },
{ .dbm = 11, .val = CC26X2_CC13X2_RF_PA_ENTRY(26, 2, 0, 51) },
{ .dbm = 10, .val = CC26X2_CC13X2_RF_PA_ENTRY(18, 2, 0, 31) },
{ .dbm = 9, .val = CC26X2_CC13X2_RF_PA_ENTRY(28, 3, 0, 31) },
{ .dbm = 8, .val = CC26X2_CC13X2_RF_PA_ENTRY(24, 3, 0, 22) },
{ .dbm = 7, .val = CC26X2_CC13X2_RF_PA_ENTRY(20, 3, 0, 19) },
{ .dbm = 6, .val = CC26X2_CC13X2_RF_PA_ENTRY(17, 3, 0, 16) },
{ .dbm = 5, .val = CC26X2_CC13X2_RF_PA_ENTRY(14, 3, 0, 14) },
{ .dbm = 4, .val = CC26X2_CC13X2_RF_PA_ENTRY(13, 3, 0, 11) },
{ .dbm = 3, .val = CC26X2_CC13X2_RF_PA_ENTRY(11, 3, 0, 10) },
{ .dbm = 2, .val = CC26X2_CC13X2_RF_PA_ENTRY(10, 3, 0, 9) },
{ .dbm = 1, .val = CC26X2_CC13X2_RF_PA_ENTRY(9, 3, 0, 9) },
{ .dbm = 0, .val = CC26X2_CC13X2_RF_PA_ENTRY(8, 3, 0, 8) },
{ .dbm = -5, .val = CC26X2_CC13X2_RF_PA_ENTRY(4, 3, 0, 5) },
{ .dbm = -10, .val = CC26X2_CC13X2_RF_PA_ENTRY(2, 3, 0, 5) },
{ .dbm = -15, .val = CC26X2_CC13X2_RF_PA_ENTRY(1, 3, 0, 3) },
{ .dbm = -20, .val = CC26X2_CC13X2_RF_PA_ENTRY(0, 3, 0, 2) },
};
#define CC26X2_CC13X2_PA_TABLE_NUMOF ARRAY_SIZE(cc26x2_cc13x2_rf_patable)
/** @} */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* RF_CONF_H */
3 changes: 3 additions & 0 deletions boards/cc1352p-launchpad/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
ifneq (,$(filter netdev_default,$(USEMODULE)))
USEMODULE += cc26x2_cc13x2_rf
endif
67 changes: 67 additions & 0 deletions boards/cc1352p-launchpad/include/rf_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2020 Locha Inc
*
* 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_cc1352p_launchpad
* @{
*
* @file
* @brief RF configuration
*
* @author Jean Pierre Dudey <jeandudey@hotmail.com>
*/

#ifndef RF_CONF_H
#define RF_CONF_H

#include "kernel_defines.h"
#include "cc26x2_cc13x2_rf_params.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name CC26x2/CC13x2 PA table configuration
* @{
*/
static cc26x2_cc13x2_rf_pa_t cc26x2_cc13x2_rf_patable[] =
{
/* VDDR high allows 14 dBm transmit power, VDDR high setting is only
* enabled if the CCFG is flashed */
#if IS_USED(CONFIG_CC26XX_CC13XX_VDDR_HH)
{ .dbm = 14, .val = CC26X2_CC13X2_RF_PA_ENTRY(63, 0, 1, 0) },
#endif
/* 12.5 rounded to 13 */
{ .dbm = 13, .val = CC26X2_CC13X2_RF_PA_ENTRY(36, 0, 0, 89) },
{ .dbm = 12, .val = CC26X2_CC13X2_RF_PA_ENTRY(16, 0, 0, 82) },
{ .dbm = 11, .val = CC26X2_CC13X2_RF_PA_ENTRY(26, 2, 0, 51) },
{ .dbm = 10, .val = CC26X2_CC13X2_RF_PA_ENTRY(18, 2, 0, 31) },
{ .dbm = 9, .val = CC26X2_CC13X2_RF_PA_ENTRY(28, 3, 0, 31) },
{ .dbm = 8, .val = CC26X2_CC13X2_RF_PA_ENTRY(24, 3, 0, 22) },
{ .dbm = 7, .val = CC26X2_CC13X2_RF_PA_ENTRY(20, 3, 0, 19) },
{ .dbm = 6, .val = CC26X2_CC13X2_RF_PA_ENTRY(17, 3, 0, 16) },
{ .dbm = 5, .val = CC26X2_CC13X2_RF_PA_ENTRY(14, 3, 0, 14) },
{ .dbm = 4, .val = CC26X2_CC13X2_RF_PA_ENTRY(13, 3, 0, 11) },
{ .dbm = 3, .val = CC26X2_CC13X2_RF_PA_ENTRY(11, 3, 0, 10) },
{ .dbm = 2, .val = CC26X2_CC13X2_RF_PA_ENTRY(10, 3, 0, 9) },
{ .dbm = 1, .val = CC26X2_CC13X2_RF_PA_ENTRY(9, 3, 0, 9) },
{ .dbm = 0, .val = CC26X2_CC13X2_RF_PA_ENTRY(8, 3, 0, 8) },
{ .dbm = -5, .val = CC26X2_CC13X2_RF_PA_ENTRY(4, 3, 0, 5) },
{ .dbm = -10, .val = CC26X2_CC13X2_RF_PA_ENTRY(2, 3, 0, 5) },
{ .dbm = -15, .val = CC26X2_CC13X2_RF_PA_ENTRY(1, 3, 0, 3) },
{ .dbm = -20, .val = CC26X2_CC13X2_RF_PA_ENTRY(0, 3, 0, 2) },
};
#define CC26X2_CC13X2_PA_TABLE_NUMOF ARRAY_SIZE(cc26x2_cc13x2_rf_patable)
/** @} */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* RF_CONF_H */
2 changes: 2 additions & 0 deletions cpu/cc26x0_cc13x0/include/cc26x0_cc13x0_prcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ typedef struct {
#define PDSTAT1_RFC_ON 0x4
#define PDSTAT1_VIMS_ON 0x8

#define RFCCLKG_CLK_EN 0x1

#define GPIOCLKGR_CLK_EN 0x1
#define I2CCLKGR_CLK_EN 0x1
#define UARTCLKGR_CLK_EN_UART0 0x1
Expand Down
5 changes: 5 additions & 0 deletions cpu/cc26x2_cc13x2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ MODULE = cpu
# Add a list of subdirectories, that should also be built:
DIRS = periph $(RIOTCPU)/cortexm_common $(RIOTCPU)/cc26xx_cc13xx

ifneq (,$(filter cc26x2_cc13x2_rf,$(USEMODULE)))
DIRS += radio
DIRS += rfc
endif

include $(RIOTBASE)/Makefile.base
5 changes: 5 additions & 0 deletions cpu/cc26x2_cc13x2/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
USEMODULE += cc26xx_cc13xx

include ${RIOTCPU}/cc26xx_cc13xx/Makefile.dep

ifneq (,$(filter cc26x2_cc13x2_rf,$(USEMODULE)))
USEMODULE += cc26x2_cc13x2_rfc
USEMODULE += netdev_ieee802154_submac
endif
2 changes: 2 additions & 0 deletions cpu/cc26x2_cc13x2/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ RAM_LEN ?= 80K

include ${RIOTCPU}/cc26xx_cc13xx/Makefile.include
include $(RIOTMAKE)/arch/cortexm.inc.mk

INCLUDES += -I$(RIOTCPU)/cc26x2_cc13x2/include/vendor
2 changes: 2 additions & 0 deletions cpu/cc26x2_cc13x2/include/cc26x2_cc13x2_prcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ typedef struct {
#define PDSTAT1_RFC_ON 0x4
#define PDSTAT1_VIMS_ON 0x8

#define RFCCLKG_CLK_EN 0x1

#define GPIOCLKGR_CLK_EN 0x1
#define I2CCLKGR_CLK_EN 0x1
#define UARTCLKGR_CLK_EN_UART0 0x1
Expand Down
73 changes: 73 additions & 0 deletions cpu/cc26x2_cc13x2/include/cc26x2_cc13x2_rf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2020 Locha Inc
*
* 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_cc26x2_cc13x2
* @ingroup drivers_netdev
* @brief Driver for using the CC13x2's radio in IEEE802.15.4g mode.
*
*
* @{
*
* @file
* @brief Driver interface for using the CC13x2 in IEEE 802.15.4g mode.
*
* @author Jean Pierre Dudey <jeandudey@hotmail.com>
*/

#ifndef CC26X2_CC13X2_RF_H
#define CC26X2_CC13X2_RF_H

#if IS_USED(MODULE_IEEE802154_RADIO_HAL)
#include "net/ieee802154/radio.h"
#endif
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
#include "net/netdev/ieee802154_submac.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief IEEE 802.15.4 radio timer configuration
*
* This radio relies on a dedicated hardware timer to maintain IFS,
* the default timer may be overwritten in the board configuration.
*/
#ifndef CC26X2_CC13X2_RF_TIMER
#define CC26X2_CC13X2_RF_TIMER TIMER_DEV(2)
#endif

typedef struct {
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
netdev_ieee802154_submac_t netdev; /**< netdev SubMAC descriptor */
#endif
} cc26x2_cc13x2_rf_t;

/**
* @brief Initialize radio hardware (RF Core)
*/
void cc26x2_cc13x2_rf_init(void);

/**
* @brief Setup the netdev interface.
*
* @pre @p dev != NULL
*
* @param[in] dev Device descriptor.
*/
void cc26x2_cc13x2_rf_setup(cc26x2_cc13x2_rf_t *dev);

#ifdef __cplusplus
} /* end extern "C" */
#endif

#endif /* CC26X2_CC13X2_RF_H */

/*@}*/
Loading