Add b-parasite with nRF52833 board definition

This commit is contained in:
rbaron 2022-11-30 19:09:33 +01:00
parent fe09c0b2f1
commit 0bda7de7cf
8 changed files with 280 additions and 0 deletions

View file

@ -0,0 +1,9 @@
if BOARD_BPARASITE_NRF52833
config BOARD_ENABLE_DCDC
bool "DCDC mode"
select SOC_DCDC_NRF52X
default y
endif # BOARD_BPARASITE_NRF52833

View file

@ -0,0 +1,4 @@
config BOARD_BPARASITE_NRF52833
bool "b-parasite nRF52833 board"
depends on SOC_NRF52833_QIAA

View file

@ -0,0 +1,10 @@
if BOARD_BPARASITE_NRF52833
config BOARD
default "bparasite_nrf52833"
config BT_CTLR
default BT
endif # BOARD_BPARASITE_NRF52833

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(jlink "--device=nRF52833_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52833" "--frequency=4000000")
# set(OPENOCD_NRF5_SUBFAMILY "nrf52")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.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,48 @@
&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 25)>,
<NRF_PSEL(UART_RX, 0, 23)>;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 25)>,
<NRF_PSEL(UART_RX, 0, 23)>;
low-power-enable;
};
};
/* Configure pwm0 instance to use pin 5. */
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 5)>;
nordic,invert;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 5)>;
low-power-enable;
};
};
/* Configure i2c0 instance to use pins 24 (SDA) & 13 (SCL). */
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 24)>,
<NRF_PSEL(TWIM_SCL, 0, 13)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 24)>,
<NRF_PSEL(TWIM_SCL, 0, 13)>;
low-power-enable;
};
};
};

View file

@ -0,0 +1,172 @@
/dts-v1/;
#include <nordic/nrf52833_qiaa.dtsi>
#include "bparasite_nrf52833-pinctrl.dtsi"
/ {
model = "A soil moisture sensor based on Nordic's nRF52833";
compatible = "rbaron,bparasite_nrf52833";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
};
zephyr,user {
io-channels = <&adc 0>, <&adc 1>, <&adc 2>;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
// P0.28.
gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
};
};
buttons {
compatible = "gpio-keys";
button0: button_0 {
// P0.12.
gpios = <&gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button switch 0";
};
};
soil_pwm: soil_pwm {
compatible = "pwm-fixed";
pwms = <&pwm0 0 PWM_USEC(2) PWM_POLARITY_NORMAL>;
pulse = <PWM_USEC(1)>;
};
ctrl {
compatible = "gpio-keys";
fast_disch: fast_disch {
// P0.25.
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
label = "Fast discharge circuitry";
};
};
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uart";
status = "disabled";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
shtc3: shtc3@70 {
compatible = "i2c-device";
reg = <0x70>;
label = "SHTC3";
};
};
&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};
&adc {
#address-cells = <1>;
#size-cells = <0>;
status = "ok";
// Soil.
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_VDD_1_4";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
// P0.03.
zephyr,input-positive = <NRF_SAADC_AIN1>;
zephyr,resolution = <10>;
};
// Photo.
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
// P0.02.
zephyr,input-positive = <NRF_SAADC_AIN0>;
zephyr,resolution = <10>;
};
// Battery.
channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_VDD>;
zephyr,resolution = <10>;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x0000C000>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000C000 0x00067000>;
};
slot1_partition: partition@73000 {
label = "image-1";
reg = <0x00073000 0x00067000>;
};
scratch_partition: partition@da000 {
label = "image-scratch";
reg = <0x000da000 0x0001e000>;
};
/*
* The flash starting at 0x000f8000 and ending at
* 0x000fffff is reserved for use by the application.
*/
/*
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@f8000 {
label = "storage";
reg = <0x000f8000 0x00008000>;
};
};
};

View file

@ -0,0 +1,21 @@
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52833_QIAA=y
CONFIG_BOARD_BPARASITE_NRF52833=y
# Enable MPU
CONFIG_ARM_MPU=y
# Enable RTT
CONFIG_USE_SEGGER_RTT=y
# enable GPIO
CONFIG_GPIO=y
# enable console
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_GPIO_AS_PINRESET=y
CONFIG_PINCTRL=y

View file

@ -0,0 +1,7 @@
# Copyright (c) 2022 Nordic Semiconductor
# SPDX-License-Identifier: Apache-2.0
# Suppress "unique_unit_address_if_enabled" to handle the following overlaps:
# - power@40000000 & clock@40000000 & bprot@40000000
# - acl@4001e000 & flash-controller@4001e000
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")