Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
{boardname: "nrf52840dk/nrf52840", fileformat: "hex", filename: "SlimeNRF_nRF52840dk_Receiver"},
{boardname: "butterfly_p1_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_Butterfly_P1_Receiver"},
{boardname: "butterfly_p2_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_Butterfly_P2_Receiver"},
{boardname: "butterfly_p3/nrf52820", fileformat: "hex", filename: "SlimeNRF_Butterfly_P3_Receiver"},
]
if: always()
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions boards/slimevr/butterfly_p3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources(board.c)
5 changes: 5 additions & 0 deletions boards/slimevr/butterfly_p3/Kconfig.butterfly_p3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_BUTTERFLY_P3
select SOC_NRF52820_QDAA
42 changes: 42 additions & 0 deletions boards/slimevr/butterfly_p3/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2018 Nordic Semiconductor ASA.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/init.h>
#include <hal/nrf_power.h>

static int board_butterfly_p3_init(void)
{

/* needed for fem and debugging
*/
if ((nrf_power_mainregstatus_get(NRF_POWER) ==
NRF_POWER_MAINREGSTATUS_HIGH) &&
((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
(UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))) {

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
;
}

NRF_UICR->REGOUT0 =
(NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
(UICR_REGOUT0_VOUT_3V0 << UICR_REGOUT0_VOUT_Pos);

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
;
}

/* a reset is required for changes to take effect */
NVIC_SystemReset();
}

return 0;
}

SYS_INIT(board_butterfly_p3_init, PRE_KERNEL_1,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
9 changes: 9 additions & 0 deletions boards/slimevr/butterfly_p3/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=nrf52820_xxaa" "--speed=4000")
board_runner_args(pyocd "--target=nrf52820" "--frequency=4000000")

include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
8 changes: 8 additions & 0 deletions boards/slimevr/butterfly_p3/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

board:
name: butterfly_p3
vendor: slimevr
socs:
- name: nrf52820
67 changes: 67 additions & 0 deletions boards/slimevr/butterfly_p3/butterfly_p3.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright (c) 2024 Nordic Semiconductor ASA
// SPDX-License-Identifier: Apache-2.0

/dts-v1/;
#include <nordic/nrf52820_qdaa.dtsi>

/ {
model = "butterfly_p3";
compatible = "butterfly_p3";

aliases {
sw0 = &button0;
};

buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button switch 0";
};
};

chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart0;
zephyr,shell-uart = &cdc_acm_uart0;
};

nrf_radio_fem: skyFem { // ripped straight from holyiot dts, but it works
compatible = "skyworks,sky66112-11", "generic-fem-two-ctrl-pins";
ctx-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
ctx-settle-time-us = <1>;
crx-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
crx-settle-time-us = <1>;
tx-gain-db = <22>;
rx-gain-db = <12>;
};

zephyr,user {
led-gpios = <&gpio0 14 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
};
};

&reg0 {
status = "okay";
};

&gpio0 {
status = "okay";
};

&gpiote {
status = "okay";
};

&radio {
fem = <&nrf_radio_fem>;
};

zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};
14 changes: 14 additions & 0 deletions boards/slimevr/butterfly_p3/butterfly_p3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

identifier: butterfly_p3
name: butterfly_p3
vendor: slimevr
type: mcu
arch: arm
ram: 32
flash: 256
toolchain:
- zephyr
- gnuarmemb
- xtools
12 changes: 12 additions & 0 deletions boards/slimevr/butterfly_p3/butterfly_p3_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y

CONFIG_USB_DEVICE_MANUFACTURER="SlimeVR"
CONFIG_USB_DEVICE_PRODUCT="SlimeNRF Receiver Butterfly P3"

#generate for adafruit uf2 bootloader flashing
#CONFIG_BUILD_OUTPUT_UF2=y
#CONFIG_FLASH_LOAD_OFFSET=0x1000
Loading