Initial commit

Initial commit.
This commit is contained in:
kntran1
2026-03-23 14:40:39 -05:00
parent e84b2b4166
commit 4e2a5258a5
872 changed files with 165227 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
config BOARD_CYBER_NRF52840
select SOC_NRF52840_QIAA

View File

@@ -0,0 +1,6 @@
if BOARD_CYBER_NRF52840
config BT_CTLR
default BT
endif # BOARD_CYBER_NRF52840

View File

@@ -0,0 +1,9 @@
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
set(OPENOCD_NRF5_SUBFAMILY "nrf52")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)

View File

@@ -0,0 +1,5 @@
board:
name: cyber_nrf52840
vendor: MAPS
socs:
- name: nrf52840

View File

@@ -0,0 +1,123 @@
&pinctrl {
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 0, 8)>,
<NRF_PSEL(TWIM_SDA, 0, 6)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 0, 8)>,
<NRF_PSEL(TWIM_SDA, 0, 6)>;
low-power-enable;
};
};
i2c1_default: i2c1_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
<NRF_PSEL(TWIM_SCL, 0, 27)>;
};
};
i2c1_sleep: i2c1_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
<NRF_PSEL(TWIM_SCL, 0, 27)>;
low-power-enable;
};
};
i2s0_default: i2s0_default {
group1 {
/* Using i2s SDOUT to drive LED ring. SCK and LRCK not needed but Zephyr driver will not
* drive SDOUT without them. Workaround : Burn up 2 unused GPIO for SCK and LRCK.
*/
psels = <NRF_PSEL(I2S_SCK_M, 0, 14)>,
<NRF_PSEL(I2S_LRCK_M, 1, 14)>,
<NRF_PSEL(I2S_SDOUT, 0, 7)>;
};
};
i2s0_sleep: i2s0_sleep {
group1 {
psels = <NRF_PSEL(I2S_SCK_M, 0, 14)>,
<NRF_PSEL(I2S_LRCK_M, 1, 14)>,
<NRF_PSEL(I2S_SDOUT, 0, 7)>;
low-power-enable;
};
};
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 9)>,
<NRF_PSEL(PWM_OUT1, 0, 3)>,
<NRF_PSEL(PWM_OUT2, 1, 15)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 9)>,
<NRF_PSEL(PWM_OUT1, 0, 3)>,
<NRF_PSEL(PWM_OUT2, 1, 15)>;
low-power-enable;
};
};
qspi_default: qspi_default {
group1 {
psels = <NRF_PSEL(QSPI_SCK, 0, 19)>,
<NRF_PSEL(QSPI_CSN, 0, 20)>,
<NRF_PSEL(QSPI_IO0, 0, 23)>,
<NRF_PSEL(QSPI_IO1, 1, 0)>,
<NRF_PSEL(QSPI_IO2, 0, 22)>,
<NRF_PSEL(QSPI_IO3, 0, 21)>;
};
};
qspi_sleep: qspi_sleep {
group1 {
psels = <NRF_PSEL(QSPI_SCK, 0, 19)>,
<NRF_PSEL(QSPI_CSN, 0, 20)>,
<NRF_PSEL(QSPI_IO0, 0, 23)>,
<NRF_PSEL(QSPI_IO1, 1, 0)>,
<NRF_PSEL(QSPI_IO2, 0, 22)>,
<NRF_PSEL(QSPI_IO3, 0, 21)>;
low-power-enable;
};
};
spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 19)>,
<NRF_PSEL(SPIM_MOSI, 0, 23)>,
<NRF_PSEL(SPIM_MISO, 1, 0)>;
};
};
spi2_sleep: spi2_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 19)>,
<NRF_PSEL(SPIM_MOSI, 0, 23)>,
<NRF_PSEL(SPIM_MISO, 1, 0)>;
low-power-enable;
};
};
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 12)>,
<NRF_PSEL(UART_RX, 1, 11)>;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 12)>,
<NRF_PSEL(UART_RX, 1, 11)>;
low-power-enable;
};
};
};

View File

@@ -0,0 +1,243 @@
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "cyber_nrf52840-pinctrl.dtsi"
/* For use with WS2812 LEDs. */
#include <zephyr/dt-bindings/led/led.h>
/ {
model = "MAPS - Cyber NRF52840 Board";
compatible = "MAPS,cyber-nrf52840";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,console = &uart0;
};
zephyr,user {
io-channels = <&adc 0>;
};
aliases {
mcuboot-led = &mcuboot_led;
left-button = &left_button;
center-button = &center_button;
right-button = &right_button;
pwr-5v-enable = &pwr_5v_enable;
led-ring-pwr = &led_ring_pwr;
led-ring-level-shift-enable = &led_ring_level_shift_enable;
led-ring-din = &led_ring_din;
battery-check-enable = &battery_check_enable;
imu-int = &imu_int;
bubble-led = &bubble_led;
pin-led = &pin_led;
fiber-led = &fiber_led;
led-ring = &led_ring;
watchdog0 = &wdt0;
// spi-flash0 = &mx25r64;
// bootloader-led0 = &bubble_led;
// mcuboot-button0 = &center_button;
// mcuboot-led0 = &bubble_led;
};
// GPIO enable assumes true is whatever the logic level is set to. Set everything to active high here so we can control in code.
gpios {
compatible = "gpio-keys";
mcuboot_led: mcuboot_led {
gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
};
left_button: left_button {
gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
};
center_button: center_button {
gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
};
right_button: right_button {
gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
};
pwr_5v_enable: pwr_5v_enable {
gpios = <&gpio0 12 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
};
led_ring_pwr: led_ring_pwr {
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
};
led_ring_level_shift_enable: led_ring_level_shift_enable {
gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
};
led_ring_din: led_ring_din {
gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
};
battery_check_enable: battery_check_enable {
gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
};
imu_int: imu_int {
gpios = <&gpio0 11 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
};
charger_status: charger_status {
gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
};
};
pwmleds: pwmleds {
compatible = "pwm-leds";
bubble_led: bubble_led {
pwms = <&pwm0 0 PWM_USEC(4000) PWM_POLARITY_NORMAL>;
};
pin_led: pin_led {
pwms = <&pwm0 1 PWM_USEC(4000) PWM_POLARITY_NORMAL>;
};
fiber_led: fiber_led {
pwms = <&pwm0 2 PWM_USEC(4000) PWM_POLARITY_NORMAL>;
};
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(48)>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000c000 DT_SIZE_K(472)>;
};
slot1_partition: partition@82000 {
label = "image-1";
reg = <0x00082000 DT_SIZE_K(472)>;
};
storage_partition: partition@f8000 {
label = "storage";
reg = <0x000f8000 DT_SIZE_K(32)>;
};
};
};
&uicr {
/* Pins P0.09 and P0.10 are defaulted to be used with NFC, need to configure for standard GPIO
* https://devzone.nordicsemi.com/f/nordic-q-a/35505/nrf52-enabling-gpio-on-nfc-pins
*/
nfct-pins-as-gpios;
};
&adc {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN0>; /* P0.02 */
zephyr,resolution = <12>;
};
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&gpiote {
status = "okay";
};
&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c1 {
compatible = "nordic,nrf-twim";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";
};
i2s_led: &i2s0 {
status = "okay";
pinctrl-0 = <&i2s0_default>;
pinctrl-1 = <&i2s0_sleep>;
pinctrl-names = "default", "sleep";
led_ring: ws2812 {
compatible = "worldsemi,ws2812-i2s";
i2s-dev = < &i2s_led >;
chain-length = <24>;
color-mapping = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
// out-active-low;
reset-delay = <120>;
};
};
&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
};
&uart0 {
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
current-speed = <115200>;
};
&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};
&qspi {
status = "disabled";
pinctrl-0 = <&qspi_default>;
pinctrl-1 = <&qspi_sleep>;
pinctrl-names = "default", "sleep";
};
&rtc2 {
status = "okay";
clock-frequency = <32768>;
prescaler = <4095>; /* +1 for prescaler */
};
&wdt0 {
status = "okay";
};

View File

@@ -0,0 +1,11 @@
identifier: cyber_nrf52840/nrf52840
name: Custom Board auto generated by nRF Connect for VS Code
vendor: MAPS
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
supported:
- gpio

View File

@@ -0,0 +1,12 @@
# Enable MPU
CONFIG_ARM_MPU=y
# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y
# Enable uart driver
CONFIG_SERIAL=y
# Enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

View File

@@ -0,0 +1,2 @@
# Suppress "unique_unit_address_if_enabled" to handle some overlaps
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")