-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards: arm: add BeaglePlay on-board CC1352
Add support for BeaglePlay, a TI AM6254 SoC based development board with a CC1352P7 wireless microcontroller for supporting software defined 2.4GHz and SubGHz wireless protocols. Support for running Zephyr on the quad-A53 SoC or the programmable M4 on the SoC would be provided separately. See https://beagleplay.org for details. Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
- Loading branch information
Showing
10 changed files
with
492 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
zephyr_library() | ||
zephyr_library_sources( | ||
board_antenna.c | ||
) | ||
|
||
zephyr_library_compile_definitions("DeviceFamily_CC13X2X7") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# BeaglePlay CC1352 board configuration | ||
|
||
# Copyright (c) 2020 Erik Larson | ||
# Copyright (c) 2021-2022 Jason Kridner, BeagleBoard.org Foundation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_BEAGLEPLAY_CC1352 | ||
bool "BeaglePlay CC1352" | ||
depends on SOC_CC1352P7 | ||
|
||
if BOARD_BEAGLEPLAY_CC1352 | ||
|
||
config BOARD_ANTENNA_INIT_PRIO | ||
int "Board antenna switch initialization priority" | ||
default 70 | ||
help | ||
Set the priority for board init, must be greater than | ||
KERNEL_INIT_PRIORITY_DEVICE but smaller than | ||
IEEE802154_CC13XX_CC26XX_SUB_GHZ_INIT_PRIO. | ||
|
||
endif # BOARD_BEAGLEPLAY_CC1352 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# BeaglePlay CC1352 board configuration | ||
|
||
# Copyright (c) 2022 Jason Kridner, BeagleBoard.org Foundation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if BOARD_BEAGLEPLAY_CC1352 | ||
|
||
config BOARD | ||
default "beagleplay_cc1352" | ||
|
||
endif # BOARD_BEAGLEPLAY_CC1352 |
34 changes: 34 additions & 0 deletions
34
boards/arm/beagle_play_cc1352/beagleplay-cc1352-pinctrl.dtsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2022 Vaishnav Achath | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h> | ||
|
||
&pinctrl { | ||
/* UART0 */ | ||
uart0_tx_default: uart0_tx_default { | ||
pinmux = <13 IOC_PORT_MCU_UART0_TX>; | ||
bias-disable; | ||
}; | ||
uart0_rx_default: uart0_rx_default { | ||
pinmux = <12 IOC_PORT_MCU_UART0_RX>; | ||
bias-disable; | ||
input-enable; | ||
}; | ||
|
||
/* On-board antenna pinmux states */ | ||
board_ant_tx_pa_off: board_ant_tx_pa_off { | ||
pinmux = <29 IOC_PORT_GPIO>; | ||
}; | ||
board_ant_tx_pa_on: board_ant_tx_pa_on { | ||
pinmux = <29 IOC_PORT_RFC_GPO3>; | ||
}; | ||
board_ant_subg_off: board_ant_subg_off { | ||
pinmux = <30 IOC_PORT_GPIO>; | ||
}; | ||
board_ant_subg_on: board_ant_subg_on { | ||
pinmux = <30 IOC_PORT_RFC_GPO0>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright (c) 2022 Jason Kridner, BeagleBoard.org Foundation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
|
||
#include <ti/cc1352r7.dtsi> | ||
#include "beagleplay-cc1352-pinctrl.dtsi" | ||
|
||
/ { | ||
model = "beagleplay"; | ||
compatible = "beagle,beagleplay-cc1352"; | ||
|
||
aliases { | ||
led0 = &led0; | ||
led1 = &led1; | ||
}; | ||
|
||
chosen { | ||
zephyr,sram = &sram0; | ||
zephyr,console = &uart0; | ||
zephyr,shell-uart = &uart0; | ||
zephyr,flash = &flash0; | ||
zephyr,ieee802154 = &ieee802154g; | ||
}; | ||
|
||
leds: leds { | ||
compatible = "gpio-leds"; | ||
led0: led_0 { | ||
gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; | ||
label = "LED1"; | ||
}; | ||
|
||
led1: led_1 { | ||
gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; | ||
label = "LED2"; | ||
}; | ||
|
||
/* U.FL connector switch */ | ||
rf_sw: rf_sw { | ||
label = "RF_SW"; | ||
gpios = | ||
<&gpio0 29 GPIO_ACTIVE_HIGH>, // SubG TX +20dB | ||
<&gpio0 30 GPIO_ACTIVE_HIGH>; // SubG TX/RX 0dB | ||
}; | ||
}; | ||
|
||
power-states { | ||
idle: idle { | ||
compatible = "zephyr,power-state"; | ||
power-state-name = "suspend-to-idle"; | ||
min-residency-us = <1000>; | ||
}; | ||
|
||
standby: standby { | ||
compatible = "zephyr,power-state"; | ||
power-state-name = "standby"; | ||
min-residency-us = <5000>; | ||
exit-latency-us = <240>; | ||
}; | ||
}; | ||
}; | ||
|
||
&cpu0 { | ||
clock-frequency = <48000000>; | ||
cpu-power-states = <&idle &standby>; | ||
}; | ||
|
||
&trng { | ||
status = "okay"; | ||
}; | ||
|
||
&gpio0 { | ||
status = "okay"; | ||
}; | ||
|
||
&uart0 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart0_rx_default &uart0_tx_default>; | ||
pinctrl-names = "default"; | ||
}; | ||
|
||
&rtc { | ||
status = "okay"; | ||
}; | ||
|
||
&ieee802154 { | ||
status = "okay"; | ||
}; | ||
|
||
&ieee802154g { | ||
status = "okay"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
identifier: beagleplay_cc1352 | ||
name: BeaglePlay CC1352 | ||
type: mcu | ||
arch: arm | ||
ram: 144 | ||
flash: 704 | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
- xtools | ||
supported: | ||
- gpio | ||
- uart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Copyright (c) 2022 Jason Kridner, BeagleBoard.org Foundation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
CONFIG_SOC_SERIES_CC13X2X7_CC26X2X7=y | ||
CONFIG_SOC_CC1352P7=y | ||
CONFIG_BOARD_BEAGLEPLAY_CC1352=y | ||
CONFIG_BUILD_OUTPUT_HEX=y | ||
CONFIG_CC13X2_CC26X2_HAS_CUSTOM_RF_HWATTRS=y | ||
CONFIG_CC13X2_CC26X2_BOOTLOADER_ENABLE=y | ||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y | ||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15 | ||
CONFIG_ARM_MPU=y | ||
CONFIG_HW_STACK_PROTECTION=y | ||
CONFIG_PINCTRL=y | ||
CONFIG_PINCTRL_DYNAMIC=y | ||
CONFIG_PINCTRL_CC13XX_CC26XX=y | ||
CONFIG_GPIO=y | ||
CONFIG_SERIAL=y | ||
|
||
# Per Seeed recommendation | ||
CONFIG_CC13X2_CC26X2_XOSC_CAPARRAY_DELTA=0xD5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2020 Erik Larson | ||
# Copyright (c) 2023 Jason Kridner, BeagleBoard.org Foundation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Copy https://git.beagleboard.org/beagleconnect/cc1352-flasher/-/raw/c99f5e0e8227d8e60171e39b1a45ddb03a6cb763/cc1352-flasher.py here | ||
# Install python gpiod library | ||
# Be sure to disable the bcfserial driver because it will capture /dev/ttyS4 | ||
|
||
board_set_flasher_ifnset(misc-flasher) | ||
board_finalize_runner_args(misc-flasher "$ENV{ZEPHYR_BASE}/boards/arm/beagle_play_cc1352/cc1352-flasher.py --play") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright (c) 2021 Florin Stancu | ||
* Copyright (c) 2021 Jason Kridner, BeagleBoard.org Foundation | ||
* | ||
*/ | ||
|
||
/* | ||
* Implements the RF driver callback to configure the on-board antenna | ||
* switch. | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/device.h> | ||
#include <zephyr/init.h> | ||
|
||
#include <ti/drivers/rf/RF.h> | ||
#include <driverlib/gpio.h> | ||
#include <driverlib/ioc.h> | ||
#include <driverlib/rom.h> | ||
|
||
/* DIOs for RF antenna paths */ | ||
#define BOARD_RF_HIGH_PA 29 /* TODO: pull from DT */ | ||
#define BOARD_RF_SUB1GHZ 30 /* TODO: pull from DT */ | ||
|
||
static void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, | ||
void *arg); | ||
|
||
|
||
const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { | ||
.hwiPriority = INT_PRI_LEVEL7, | ||
.swiPriority = 0, | ||
.xoscHfAlwaysNeeded = true, | ||
/* RF driver callback for custom antenna switching */ | ||
.globalCallback = board_cc13xx_rf_callback, | ||
/* Subscribe to events */ | ||
.globalEventMask = (RF_GlobalEventRadioSetup | | ||
RF_GlobalEventRadioPowerDown), | ||
}; | ||
|
||
/** | ||
* Antenna switch GPIO init routine. | ||
*/ | ||
static int board_antenna_init(const struct device *dev) | ||
{ | ||
ARG_UNUSED(dev); | ||
|
||
/* set all paths to low */ | ||
IOCPinTypeGpioOutput(BOARD_RF_HIGH_PA); | ||
GPIO_setOutputEnableDio(BOARD_RF_HIGH_PA, GPIO_OUTPUT_DISABLE); | ||
IOCPinTypeGpioOutput(BOARD_RF_SUB1GHZ); | ||
GPIO_setOutputEnableDio(BOARD_RF_SUB1GHZ, GPIO_OUTPUT_DISABLE); | ||
return 0; | ||
} | ||
|
||
SYS_INIT(board_antenna_init, POST_KERNEL, CONFIG_BOARD_ANTENNA_INIT_PRIO); | ||
|
||
void board_cc13xx_rf_callback(RF_Handle client, RF_GlobalEvent events, void *arg) | ||
{ | ||
bool sub1GHz = false; | ||
uint8_t loDivider = 0; | ||
|
||
/* Switch off all paths first. Needs to be done anyway in every sub-case below. */ | ||
GPIO_setOutputEnableDio(BOARD_RF_HIGH_PA, GPIO_OUTPUT_DISABLE); | ||
GPIO_setOutputEnableDio(BOARD_RF_SUB1GHZ, GPIO_OUTPUT_DISABLE); | ||
|
||
if (events & RF_GlobalEventRadioSetup) { | ||
/* Decode the current PA configuration. */ | ||
RF_TxPowerTable_PAType paType = (RF_TxPowerTable_PAType) | ||
RF_getTxPower(client).paType; | ||
/* Decode the generic argument as a setup command. */ | ||
RF_RadioSetup *setupCommand = (RF_RadioSetup *)arg; | ||
|
||
switch (setupCommand->common.commandNo) { | ||
case (CMD_RADIO_SETUP): | ||
case (CMD_BLE5_RADIO_SETUP): | ||
loDivider = RF_LODIVIDER_MASK & setupCommand->common.loDivider; | ||
/* Sub-1GHz front-end. */ | ||
if (loDivider != 0) | ||
sub1GHz = true; | ||
break; | ||
case (CMD_PROP_RADIO_DIV_SETUP): | ||
loDivider = RF_LODIVIDER_MASK & setupCommand->prop_div.loDivider; | ||
/* Sub-1GHz front-end. */ | ||
if (loDivider != 0) | ||
sub1GHz = true; | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
/* Sub-1 GHz */ | ||
if (paType == RF_TxPowerTable_HighPA) { | ||
/* PA enable --> HIGH PA */ | ||
/* LNA enable --> Sub-1 GHz */ | ||
/* Note: RFC_GPO3 is a work-around because the RFC_GPO1 */ | ||
/* is sometimes not de-asserted on CC1352 Rev A. */ | ||
IOCPortConfigureSet(BOARD_RF_HIGH_PA, | ||
IOC_PORT_RFC_GPO3, IOC_IOMODE_NORMAL); | ||
IOCPortConfigureSet(BOARD_RF_SUB1GHZ, | ||
IOC_PORT_RFC_GPO0, IOC_IOMODE_NORMAL); | ||
} else { | ||
/* RF core active --> Sub-1 GHz */ | ||
IOCPortConfigureSet(BOARD_RF_HIGH_PA, | ||
IOC_PORT_GPIO, IOC_IOMODE_NORMAL); | ||
IOCPortConfigureSet(BOARD_RF_SUB1GHZ, | ||
IOC_PORT_GPIO, IOC_IOMODE_NORMAL); | ||
GPIO_setOutputEnableDio(BOARD_RF_SUB1GHZ, GPIO_OUTPUT_ENABLE); | ||
} | ||
} else { | ||
/* Reset the IO multiplexer to GPIO functionality */ | ||
IOCPortConfigureSet(BOARD_RF_HIGH_PA, | ||
IOC_PORT_GPIO, IOC_IOMODE_NORMAL); | ||
IOCPortConfigureSet(BOARD_RF_SUB1GHZ, | ||
IOC_PORT_GPIO, IOC_IOMODE_NORMAL); | ||
} | ||
} |
Oops, something went wrong.