Skip to content
Open
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
27 changes: 22 additions & 5 deletions boards/nordic/promicro_uf2/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,32 @@

#define ZEPHYR_USER_NODE DT_PATH(zephyr_user)

#define VCC_GPIO_PIN DT_GPIO_PIN(ZEPHYR_USER_NODE, vcc_gpios)
#define VCC_GPIO_PORT_NUM DT_PROP(DT_GPIO_CTLR(ZEPHYR_USER_NODE, vcc_gpios), port)
#if DT_NODE_HAS_PROP(ZEPHYR_USER_NODE, vcc_gpios)
#define VCC_GPIO_PIN DT_GPIO_PIN(ZEPHYR_USER_NODE, vcc_gpios)
#define VCC_GPIO_PORT_NUM DT_PROP(DT_GPIO_CTLR(ZEPHYR_USER_NODE, vcc_gpios), port)
#endif

#if DT_NODE_HAS_PROP(ZEPHYR_USER_NODE, gnd_gpios)
#define GND_GPIO_PIN DT_GPIO_PIN(ZEPHYR_USER_NODE, gnd_gpios)
#define GND_GPIO_PORT_NUM DT_PROP(DT_GPIO_CTLR(ZEPHYR_USER_NODE, gnd_gpios), port)
#endif

static int board_promicro_init(void)
{
/* using vcc-gpios for sensor power defined in promicro_uf2.dts
/* using vcc-gpios for sensor power defined in promicro_uf2.dts or variant device tree
*/
#if DT_NODE_HAS_PROP(ZEPHYR_USER_NODE, vcc_gpios)
nrf_gpio_cfg(NRF_GPIO_PIN_MAP(VCC_GPIO_PORT_NUM, VCC_GPIO_PIN), NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_D0H1, NRF_GPIO_PIN_NOSENSE);
nrf_gpio_pin_set(NRF_GPIO_PIN_MAP(VCC_GPIO_PORT_NUM, VCC_GPIO_PIN));
#endif

/* using gnd-gpios for sensor power defined in promicro_uf2.dts or variant or variant device tree
*/
nrf_gpio_cfg(NRF_GPIO_PIN_MAP(VCC_GPIO_PORT_NUM, VCC_GPIO_PIN), NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_D0H1, NRF_GPIO_PIN_NOSENSE);
nrf_gpio_pin_set(NRF_GPIO_PIN_MAP(VCC_GPIO_PORT_NUM, VCC_GPIO_PIN));
#if DT_NODE_HAS_PROP(ZEPHYR_USER_NODE, gnd_gpios)
nrf_gpio_cfg(NRF_GPIO_PIN_MAP(GND_GPIO_PORT_NUM, GND_GPIO_PIN), NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_D0H1, NRF_GPIO_PIN_NOSENSE);
nrf_gpio_pin_clear(NRF_GPIO_PIN_MAP(GND_GPIO_PORT_NUM, GND_GPIO_PIN));
#endif

/* pull down on P0.13, disables external 3V3 regulator
*/
nrf_gpio_cfg(NRF_GPIO_PIN_MAP(0, 13), NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
Expand Down
4 changes: 3 additions & 1 deletion boards/nordic/promicro_uf2/board.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ board:
- name: 'i2c'
- name: 'spi'
- name: 'smspi'
- name: 'chrysalis'
- name: 'chrysalis'
- name: 'stackedi2c'
- name: 'stackedspi'
48 changes: 48 additions & 0 deletions boards/nordic/promicro_uf2/promicro_uf2_stackedi2c.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) 2024 Nordic Semiconductor ASA
// SPDX-License-Identifier: Apache-2.0

/dts-v1/;
#include "promicro_uf2.dts"

&pinctrl {
i2c0_default: i2c0_default {
/delete-node/ group1;
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 24)>, <NRF_PSEL(TWIM_SCL, 0, 22)>;
bias-disable;
};
};

i2c0_sleep: i2c0_sleep {
/delete-node/ group1;
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 24)>, <NRF_PSEL(TWIM_SCL, 0, 22)>;
bias-disable;
low-power-enable;
};
};
};

/ {
buttons {
/delete-node/ button0;
button0: button_0 {
gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};

aliases {
sw0 = &button0;
};

zephyr,user {
/delete-property/ int0-gpios;
/delete-property/ vcc-gpios;
int0-gpios = <&gpio0 2 0>;
clk-gpios = <&gpio1 11 GPIO_OPEN_DRAIN>;
vcc-gpios = <&gpio0 17 GPIO_OPEN_SOURCE>;
gnd-gpios = <&gpio0 20 GPIO_OPEN_DRAIN>;
};
};

/delete-node/ &spi3;
14 changes: 14 additions & 0 deletions boards/nordic/promicro_uf2/promicro_uf2_stackedi2c.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: promicro_uf2/nrf52840/stackedi2c
name: promicro_uf2_stackedi2c
vendor: nordic
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
- gnuarmemb
- xtools
15 changes: 15 additions & 0 deletions boards/nordic/promicro_uf2/promicro_uf2_stackedi2c_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y

CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_MANUFACTURER="SlimeVR"
CONFIG_USB_DEVICE_PRODUCT="SlimeNRF Tracker ProMicro"

CONFIG_BATTERY_USE_REG_LDO_MAPPING=y

#generate for adafruit uf2 bootloader flashing
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_FLASH_LOAD_OFFSET=0x1000
55 changes: 55 additions & 0 deletions boards/nordic/promicro_uf2/promicro_uf2_stackedspi.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright (c) 2024 Nordic Semiconductor ASA
// SPDX-License-Identifier: Apache-2.0

/dts-v1/;
#include "promicro_uf2.dts"

&pinctrl {
spi3_default: spi3_default {
/delete-node/ group1;
group1 {
psels = <NRF_PSEL(SPIM_MISO, 0, 11)>,
<NRF_PSEL(SPIM_MOSI, 0, 24)>,
<NRF_PSEL(SPIM_SCK, 0, 22)>;
};
};

spi3_sleep: spi3_sleep {
/delete-node/ group1;
group1 {
psels = <NRF_PSEL(SPIM_MISO, 0, 11)>,
<NRF_PSEL(SPIM_MOSI, 0, 24)>,
<NRF_PSEL(SPIM_SCK, 0, 22)>;
low-power-enable;
};
};
};

/ {
buttons {
/delete-node/ button0;
button0: button_0 {
gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};

aliases {
sw0 = &button0;
};

zephyr,user {
/delete-property/ int0-gpios;
/delete-property/ vcc-gpios;
int0-gpios = <&gpio0 2 0>;
clk-gpios = <&gpio1 11 GPIO_OPEN_DRAIN>;
vcc-gpios = <&gpio0 17 GPIO_OPEN_SOURCE>;
gnd-gpios = <&gpio0 20 GPIO_OPEN_DRAIN>;
};
};

/delete-node/ &i2c0;

&spi3 {
/delete-property/ cs-gpios;
cs-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
};
14 changes: 14 additions & 0 deletions boards/nordic/promicro_uf2/promicro_uf2_stackedspi.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: promicro_uf2/nrf52840/stackedspi
name: promicro_uf2_stackedspi
vendor: nordic
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
- gnuarmemb
- xtools
15 changes: 15 additions & 0 deletions boards/nordic/promicro_uf2/promicro_uf2_stackedspi_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y

CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_MANUFACTURER="SlimeVR"
CONFIG_USB_DEVICE_PRODUCT="SlimeNRF Tracker ProMicro"

CONFIG_BATTERY_USE_REG_LDO_MAPPING=y

#generate for adafruit uf2 bootloader flashing
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_FLASH_LOAD_OFFSET=0x1000
10 changes: 10 additions & 0 deletions pm_static_promicro_uf2_nrf52840_stackedi2c.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bootloader:
address: 0x0
end_address: 0x1000
region: flash_primary
size: 0x1000
uf2_bootloader:
address: 0xf4000
end_address: 0x100000
region: flash_primary
size: 0xc000
10 changes: 10 additions & 0 deletions pm_static_promicro_uf2_nrf52840_stackedspi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bootloader:
address: 0x0
end_address: 0x1000
region: flash_primary
size: 0x1000
uf2_bootloader:
address: 0xf4000
end_address: 0x100000
region: flash_primary
size: 0xc000
34 changes: 34 additions & 0 deletions socs/nrf52840_stackedi2c.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/ {
sram0@2003f000 {
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x2003f000 DT_SIZE_K(4)>;
zephyr,memory-region = "RETAINED_MEM";
status = "okay";

retainedmem0: retainedmem {
compatible = "zephyr,retained-ram";
status = "okay";
};
};

sram0@20007f7c {
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x20007f7c 4>;
zephyr,memory-region = "DFU_DBL_RESET_MEM";
status = "okay";

retainedmem {
compatible = "zephyr,retained-ram";
status = "okay";
};
};

aliases {
retainedmemdevice = &retainedmem0;
};
};

&sram0 {
/* Shrink SRAM size to avoid overlap with retained memory region */
reg = <0x20000000 DT_SIZE_K(252)>;
};
34 changes: 34 additions & 0 deletions socs/nrf52840_stackedspi.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/ {
sram0@2003f000 {
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x2003f000 DT_SIZE_K(4)>;
zephyr,memory-region = "RETAINED_MEM";
status = "okay";

retainedmem0: retainedmem {
compatible = "zephyr,retained-ram";
status = "okay";
};
};

sram0@20007f7c {
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x20007f7c 4>;
zephyr,memory-region = "DFU_DBL_RESET_MEM";
status = "okay";

retainedmem {
compatible = "zephyr,retained-ram";
status = "okay";
};
};

aliases {
retainedmemdevice = &retainedmem0;
};
};

&sram0 {
/* Shrink SRAM size to avoid overlap with retained memory region */
reg = <0x20000000 DT_SIZE_K(252)>;
};
Loading