Questions about adding OTA functionality to nRF7002

Hello,

I'm trying to add Wi-Fi OTA functionality to a project I'm currently developing, but I'm having trouble getting it to work properly.

Would it be possible for you to review the uploaded files and let me know what I might be missing or doing wrong?

Development environment:

  • nRF5340 + nRF7002 + MX25R64

  • nRF5340 to nRF7002: QSPI

  • nRF5340 to MX25R64: SPI4

  • SDK v2.8.0, Visual Studio Code

We're also using the nPM1300 in this project.
The base example project is BLE Provisioning.

Additionally, is there any documentation or video guide that explains the steps for adding OTA functionality in sequence?

sysbuild.conf

SB_CONFIG_WIFI_NRF70=y

SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y

prj.conf

#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_WIFI=y
CONFIG_WIFI_NRF70=y
CONFIG_NRF70_SR_COEX=y
CONFIG_NRF70_SR_COEX_RF_SWITCH=y

# WPA supplicant
CONFIG_WIFI_NM_WPA_SUPPLICANT=y

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV6=n
CONFIG_NET_IPV4=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
CONFIG_NET_DHCPV4=y
CONFIG_DNS_RESOLVER=y

CONFIG_NET_STATISTICS=y

CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=32

CONFIG_NET_TCP_MAX_SEND_WINDOW_SIZE=8192
CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=8192

# TCP 재전송 및 연결 유지 최적화
CONFIG_NET_TCP_RETRY_COUNT=12
CONFIG_NET_TCP_ACK_TIMEOUT=300
CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT=500
CONFIG_NET_TCP_TIME_WAIT_DELAY=3000

# Below section is the primary contributor to SRAM and is currently
# tuned for performance, but this will be revisited in the future.
CONFIG_NET_BUF_RX_COUNT=16
CONFIG_NET_BUF_TX_COUNT=32
CONFIG_HEAP_MEM_POOL_SIZE=180000

CONFIG_NET_BUF_FIXED_DATA_SIZE=y
CONFIG_NET_BUF_DATA_SIZE=768

# 183600
CONFIG_NET_TC_TX_COUNT=1

CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_CONTEXT_SYNC_RECV=y

CONFIG_INIT_STACKS=y

CONFIG_NET_L2_ETHERNET=y

CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_INIT_TIMEOUT=0

CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.1.99"
# CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.168.1.242" 
#local.algorigo.com   "192.168.1.202", "125.132.163.152", "192.168.1.242"

CONFIG_NET_SOCKETS_CONNECT_TIMEOUT=3000
CONFIG_NET_SOCKETS_POLL_MAX=5

CONFIG_WIFI_PROV_ADV_DATA_UPDATE=y
CONFIG_WIFI_PROV_ADV_DATA_UPDATE_INTERVAL=5

# Memories
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=3072
CONFIG_NET_RX_STACK_SIZE=3072

# Debugging
CONFIG_STACK_SENTINEL=y
CONFIG_DEBUG_COREDUMP=y
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y

# Kernel options
CONFIG_ENTROPY_GENERATOR=y

# Logging
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_MODE_IMMEDIATE=y
# CONFIG_LOG_DEFAULT_LEVEL=4

# Increase buffer sizes
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096
CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN=64
CONFIG_SEGGER_RTT_MAX_NUM_UP_BUFFERS=2
CONFIG_SEGGER_RTT_MAX_NUM_DOWN_BUFFERS=2

CONFIG_LOG_PROCESS_THREAD=y
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048
CONFIG_LOG_BUFFER_SIZE=4096

CONFIG_NET_L2_WIFI_MGMT=y

CONFIG_BT=y
CONFIG_BT_SMP=y
CONFIG_BT_PERIPHERAL=y

CONFIG_BT_BUF_ACL_RX_SIZE=151
CONFIG_BT_L2CAP_TX_MTU=147
CONFIG_BT_BUF_ACL_TX_SIZE=151

CONFIG_BT_RX_STACK_SIZE=5120
CONFIG_BT_BONDABLE=n
CONFIG_BT_DEVICE_NAME_DYNAMIC=y

CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_NVS=y

####################################################################
# ===================================================
# FOTA(Wi-Fi OTA) 기능 추가를 위한 설정
# ===================================================
# CONFIG_PM_PARTITION_REGION_EXTERNAL_FLASH=y
# --- MCUboot 및 DFU(OTA) 설정 ---
# MCUboot를 부트로더로 사용하도록 애플리케이션을 설정
CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_PM_PARTITION_REGION_EXTERNAL_FLASH=y
CONFIG_PARTITION_MANAGER_ENABLED=y
CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="mx25r64"
CONFIG_PM_PARTITION_SIZE_SLOT_1=0x800000

CONFIG_DFU_TARGET=y
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_HTTP=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

CONFIG_MCUBOOT_SIGNATURE_TYPE_RSA=y
CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="root-rsa-2048.pem"
####################################################################
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y

CONFIG_WIFI_CREDENTIALS=y
CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES=1

CONFIG_NANOPB=y

CONFIG_BT_WIFI_PROV=y
CONFIG_BT_WIFI_PROV_LOG_LEVEL_INF=y

# BLE Provisioning 관련 스택(wifi MGMT 동작관련)
CONFIG_NET_MGMT_EVENT_STACK_SIZE=8192

CONFIG_WIFI_MGMT_EXT=y
# Setting BT supervision timeout to 75units (750ms) to avoid timeout of BT connection when radio is granted to Wi-Fi during scan.
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=75

# Similar to shell sample, add this option to ensure the event can get served.
CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=2000
CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=24

# Wi-Fi RPU 이벤트 처리 최적화
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=6144
CONFIG_MAIN_THREAD_PRIORITY=5

# Enable GPIO
CONFIG_GPIO=y

# Enable PINCTRL
CONFIG_PINCTRL=y

CONFIG_ADC=y

#enable SPI
CONFIG_SPI=y
CONFIG_SPI_NRFX=y

#enable PWM
CONFIG_PWM=y

# 기본 I2C 활성화
CONFIG_SHELL=y
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_SHELL=y
CONFIG_NRF_FUEL_GAUGE=y
CONFIG_I2C_SHELL=y
CONFIG_LED=y
CONFIG_MFD_NPM1300=y
CONFIG_REQUIRES_FLOAT_PRINTF=y

# TWIM 인스턴스 1 사용 (nRF5340에서 보통 I2C1 사용)
CONFIG_NRFX_TWIM1=y

# ble gatt 추가 250509
CONFIG_BT_GATT_DYNAMIC_DB=y

# CONFIG_THREAD_ANALYZER=y
# CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
# CONFIG_THREAD_ANALYZER_AUTO=y

#disable SPI_NOR
CONFIG_SPI_NOR=y

nrf7002dk_nrf5340_cpuapp.dts

/*
 * Copyright (c) 2024 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/dts-v1/;
#include <nordic/nrf5340_cpuapp_qkaa.dtsi>
#include "nrf5340_cpuapp_common.dtsi"
#include "nrf7002dk_nrf5340_cpuapp_pinctrl.dtsi"

/ {
	model = "Nordic NRF7002 DK NRF5340 Application";
	compatible = "nordic,nrf7002-dk-nrf5340-cpuapp";

	chosen {
		zephyr,sram = &sram0_image;
		zephyr,flash = &flash0;
		zephyr,code-partition = &slot0_partition;
		zephyr,sram-secure-partition = &sram0_s;
		zephyr,sram-non-secure-partition = &sram0_ns;
		zephyr,wifi = &wlan0;
	};

	zephyr,user {
		io-channels = <&adc 0>;
	   
		DT1-gpios = <&gpio1 11 0>;
		DT2-gpios = <&gpio1 13 0>;
		DT3-gpios = <&gpio0 7 0>;
		DT4-gpios = <&gpio0 25 0>;
 
		MOTOR_POWER_EN-gpios = <&gpio1 0 0>;

		// MOTOR_PWM-gpios = <&gpio0 2 0>;
		pwms = <&pwm0 0 20 PWM_POLARITY_NORMAL>;
	};

	buttons {
		compatible = "gpio-keys";
		button0: button_0 {
			gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "Push button 1";
			zephyr,code = <INPUT_KEY_0>;
		};
		button1: button_1 {
			status = "disabled";
		};
	};
};

&pinctrl {
	pwm0_default: pwm0_default {
		group1 {
			psels = <NRF_PSEL(PWM_OUT0, 1, 2)>;
			// nordic,invert;
		};
	};

	pwm0_sleep: pwm0_sleep {
		group1 {
			psels = <NRF_PSEL(PWM_OUT0, 1, 2)>;
			low-power-enable;
		};
	};
	
	spi0_default: spi0_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 1, 12)>,        /* SPI SCK 핀 */
					<NRF_PSEL(SPIM_MOSI, 0, 31)>,       /* SPI MOSI 핀 */
					<NRF_PSEL(SPIM_MISO, 1, 1)>;       /* SPI MISO 핀 */
		};
	};

	spi0_sleep: spi0_sleep {
		group1 {
				psels = <NRF_PSEL(SPIM_SCK, 1, 12)>,        /* SPI SCK 핀 */
						<NRF_PSEL(SPIM_MOSI, 0, 31)>,       /* SPI MOSI 핀 */
						<NRF_PSEL(SPIM_MISO, 1, 1)>;       /* SPI MISO 핀 */
				low-power-enable;
		};
	};

	i2c1_default: i2c1_default {
        group1 {
            psels = <NRF_PSEL(TWIM_SCL, 1, 6)>,
                    <NRF_PSEL(TWIM_SDA, 1, 4)>;
        };
    };

    i2c1_sleep: i2c1_sleep {
        group1 {
            psels = <NRF_PSEL(TWIM_SCL, 1, 6)>, 
                    <NRF_PSEL(TWIM_SDA, 1, 4)>;
            low-power-enable;
        };
    };
};


&qspi {
	nrf70: nrf7002@1 {
		compatible = "nordic,nrf7002-qspi";
		status = "okay";
		reg = <1>;
		qspi-frequency = <24000000>;
		qspi-quad-mode;

		#include "nrf70_common.dtsi"
		#include "nrf70_common_5g.dtsi"
	};
};

&adc {
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";
 
	channel@0 {
		reg = <0>;
		zephyr,gain = "ADC_GAIN_1_2";
		zephyr,reference = "ADC_REF_VDD_1_4";
		zephyr,acquisition-time = <0>;
		zephyr,resolution = <14>;
		zephyr,input-positive = <NRF_SAADC_AIN0>;
	};
	channel@1 {
		reg = <1>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_VDD_1_4";
		zephyr,acquisition-time = <0>;
		zephyr,resolution = <12>;
		zephyr,input-positive = <NRF_SAADC_AIN1>;
	};
 };

&spi0 {
	compatible = "nordic,nrf-spim";
    status = "okay";

	pinctrl-0 = <&spi0_default>;
	pinctrl-1 = <&spi0_sleep>;
	pinctrl-names = "default", "sleep"; 

	label = "SPI_0";
    
    cs-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>,  /* CS 4151_1 */
               <&gpio0 21 GPIO_ACTIVE_HIGH>,  /* CS 4152_2 */
               <&gpio0 20 GPIO_ACTIVE_HIGH>;  /* CS 4052_2 */
               
    slave1: spi-dev1@0 {
        compatible = "spi-device";
        reg = <0>;       /* 슬레이브 1의 ID */
        spi-max-frequency = <8000000>;
        // cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
    };

    slave2: spi-dev2@1 {
        compatible = "spi-device";
        reg = <1>;       /* 슬레이브 2의 ID */
        spi-max-frequency = <8000000>;
        // cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
    };

    slave3: spi-dev3@2 {
        compatible = "spi-device";
        reg = <2>;       /* 슬레이브 3의 ID */
        spi-max-frequency = <8000000>;
        // cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
    };
};

&pwm0 {
    status = "okay";                      /* PWM 컨트롤러 활성화 */
    pinctrl-0 = <&pwm0_default>;          /* 기본 설정 */
	pinctrl-1 = <&pwm0_sleep>; 
    pinctrl-names = "default", "sleep";
	// label = "PWM_0";
};

// Disable
&uart0 {
    status = "disabled";
};

&gpio_fwd {
    status = "disabled";

	uart {
        status = "disabled";
    };
};

// &spi4 {
//     status = "disabled";

// 	mx25r64: mx25r6435f@0 {
// 		status = "disabled";
// 	};
// };

// 250626
// &spi4 {
// 	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
// };

&spi4 {
    status = "okay";
    compatible = "nordic,nrf-spim";
    
	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;

    mx25r64: mx25r6435f@0 {
        compatible = "jedec,spi-nor";
        reg = <0>;
        label = "mx25r64";
        spi-max-frequency = <8000000>;
        jedec-id = [c2 28 17];  // MX25R6435F
        size = <0x800000>;     // 8MB
        has-dpd;
        t-enter-dpd = <10000>;
        t-exit-dpd = <35000>;
    };
};

sc50_i2c: &i2c1 {
    status = "okay"; 
	compatible = "nordic,nrf-twim";  // I2C 마스터 모드 사용
    clock-frequency = <I2C_BITRATE_FAST>; // 400kHz 설정 (400kHz)
    
    pinctrl-0 = <&i2c1_default>;
    pinctrl-1 = <&i2c1_sleep>;
    pinctrl-names = "default", "sleep";

    nPM1300: pmic@6b {
        compatible = "nordic,npm1300";
        reg = <0x6B>;  // nPM1300의 I2C 주소
        status = "okay";
    };
};

&led0 {
	status = "disabled";
	gpios = <&gpio1 12 0>;
};

&led1 {
	status = "disabled";
	gpios = <&gpio1 12 0>;
};

&pwm_led0 {
	status = "disabled";
	pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};


/* Flash Memory에 새로운 영역 추가 */
// &flash0 {
//     partitions {
//         compatible = "fixed-partitions";

//         /* 새로운 Flash 영역 추가 */
//         custom_flash_storage: partition@100000 {
//             label = "custom_storage";  // ✅ 기존 storage와 구분하기 위해 이름 변경
//             reg = <0x000f8000 0x00002000>;  /* 128 KB (0x100000 ~ 0x120000) */
//         };
//     };
// };


#include <dt-bindings/regulator/npm1300.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>

&sc50_i2c {
	npm1300_ek_pmic: pmic@6b {
		compatible = "nordic,npm1300";
		reg = <0x6b>;

		npm1300_ek_gpio: gpio-controller {
			compatible = "nordic,npm1300-gpio";
			gpio-controller;
			#gpio-cells = <2>;
			ngpios = <5>;
		};

		npm1300_ek_regulators: regulators {
			compatible = "nordic,npm1300-regulator";

			/* limits are set to min/max allowed values */
			npm1300_ek_buck1: BUCK1 {
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <3300000>;
				regulator-init-microvolt =  <3000000>;
				retention-microvolt = <3000000>;
			};

			npm1300_ek_buck2: BUCK2 {
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <3300000>;
			};

			npm1300_ek_ldo1: LDO1 {
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <3300000>;
			};

			npm1300_ek_ldo2: LDO2 {
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <3300000>;
			};
		};

		npm1300_ek_charger: charger {
			// compatible = "nordic,npm1300-charger";
			// term-microvolt = <4150000>;
			// term-warm-microvolt = <4000000>;
			// current-microamp = <500000>;//150000
			// dischg-limit-microamp = <1000000>;
			// vbus-limit-microamp = <500000>;
			// thermistor-ohms = <10000>;
			// thermistor-beta = <3380>;
			// charging-enable;
			// vbatlow-charge-enable;

			compatible = "nordic,npm1300-charger";
			term-microvolt = <4200000>;         // 충전 종료 전압 4.20V
			term-warm-microvolt = <3600000>;    // 배터리 온도 높을 때 충전 제한 전압 3.6V
			current-microamp = <800000>;       	// 충전 전류 800mA (1A, 2600mAh 배터리의 0.5C)
			dischg-limit-microamp = <1000000>;  // 방전 제한 1A
			vbus-limit-microamp = <500000>;     // 기본 500mA로 제한 후 코드에서 충전 전류 상승
			thermistor-ohms = <10000>;          // 배터리 NTC 서미스터 10kΩ
			thermistor-beta = <3380>;           // NTC B 값 3380
			charging-enable;                    // 충전 활성화
			//vbatlow-charge-enable;              // 배터리 저전압에서도 충전 가능
		};

		npm1300_ek_buttons: buttons {
			compatible = "gpio-keys";
			pmic_button0: pmic_button_0 {
				gpios = < &npm1300_ek_gpio 0 GPIO_ACTIVE_HIGH>;
				label = "Pmic button switch 0";
			zephyr,code = <INPUT_KEY_0>;
			};
		};

		npm1300_ek_leds: leds {
			compatible = "nordic,npm1300-led";
			nordic,led0-mode = "error";			// 파랑 "error"
			nordic,led1-mode = "host";			// 초록 Full charging
			nordic,led2-mode = "charging";		// 빨강 "charging"
		};
	};
};

nrf5340_cpuapp_common.dtsi

/*
 * Copyright (c) 2024 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */
#include "nrf5340_cpuapp_common_pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
	chosen {
		zephyr,console = &uart0;
		zephyr,shell-uart = &uart0;
		zephyr,uart-mcumgr = &uart0;
		zephyr,bt-mon-uart = &uart0;
		zephyr,bt-c2h-uart = &uart0;
		zephyr,bt-hci = &bt_hci_ipc0;
		nordic,802154-spinel-ipc = &ipc0;
		zephyr,ieee802154 = &ieee802154;
	};

	leds {
		compatible = "gpio-leds";
		led0: led_0 {
			gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
			label = "Green LED 0";
		};
		led1: led_1 {
			gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
			label = "Green LED 1";
		};
	};

	pwmleds {
		compatible = "pwm-leds";
		pwm_led0: pwm_led_0 {
			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
		};
	};

	buttons {
		compatible = "gpio-keys";
		button0: button_0 {
			gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "Push button 1";
			zephyr,code = <INPUT_KEY_0>;
		};
		button1: button_1 {
			gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "Push button 2";
			zephyr,code = <INPUT_KEY_1>;
		};
	};

	arduino_header: connector {
		compatible = "arduino-header-r3";
		#gpio-cells = <2>;
		gpio-map-mask = <0xffffffff 0xffffffc0>;
		gpio-map-pass-thru = <0 0x3f>;
		gpio-map = <0 0 &gpio0 4 0>,	/* A0 */
			   <1 0 &gpio0 5 0>,	/* A1 */
			   <2 0 &gpio0 6 0>,	/* A2 */
			   <3 0 &gpio0 7 0>,	/* A3 */
			   <4 0 &gpio0 25 0>,	/* A4 */
			   <5 0 &gpio0 26 0>,	/* A5 */
			   <6 0 &gpio1 0 0>,	/* D0 */
			   <7 0 &gpio1 1 0>,	/* D1 */
			   <8 0 &gpio1 4 0>,	/* D2 */
			   <9 0 &gpio1 5 0>,	/* D3 */
			   <10 0 &gpio1 6 0>,	/* D4 */
			   <11 0 &gpio1 7 0>,	/* D5 */
			   <12 0 &gpio1 8 0>,	/* D6 */
			   <13 0 &gpio1 9 0>,	/* D7 */
			   <14 0 &gpio1 10 0>,	/* D8 */
			   <15 0 &gpio1 11 0>,	/* D9 */
			   <16 0 &gpio1 12 0>,	/* D10 */
			   <17 0 &gpio1 13 0>,	/* D11 */
			   <18 0 &gpio1 14 0>,	/* D12 */
			   <19 0 &gpio1 15 0>,	/* D13 */
			   <20 0 &gpio1 2 0>,	/* D14 */
			   <21 0 &gpio1 3 0>;	/* D15 */
	};

	arduino_adc: analog-connector {
		compatible = "arduino,uno-adc";
		#io-channel-cells = <1>;
		io-channel-map = <0 &adc 0>,	/* A0 = P0.4 = AIN0 */
				 <1 &adc 1>,	/* A1 = P0.5 = AIN1 */
				 <2 &adc 2>,	/* A2 = P0.6 = AIN2 */
				 <3 &adc 3>,	/* A3 = P0.7 = AIN3 */
				 <4 &adc 4>,	/* A4 = P0.25 = AIN4 */
				 <5 &adc 5>;	/* A5 = P0.26 = AIN5 */
	};

	gpio_fwd: nrf-gpio-forwarder {
		compatible = "nordic,nrf-gpio-forwarder";
		status = "okay";
		uart {
			gpios = <&gpio1 1 0>, <&gpio1 0 0>, <&gpio1 5 0>, <&gpio1 4 0>;
		};
	};

	/* These aliases are provided for compatibility with samples */
	aliases {
		led0 = &led0;
		led1 = &led1;
		pwm-led0 = &pwm_led0;
		sw0 = &button0;
		sw1 = &button1;
		bootloader-led0 = &led0;
		mcuboot-button0 = &button0;
		mcuboot-led0 = &led0;
		watchdog0 = &wdt0;
	};
};

&vregmain {
	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
};

&vregradio {
	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
};

&vregh {
	status = "okay";
};

&adc {
	status = "okay";
};

&gpiote {
	status = "okay";
};

&gpio0 {
	status = "okay";
};

&gpio1 {
	status = "okay";
};

arduino_i2c: &i2c1 {
	compatible = "nordic,nrf-twim";
	status = "okay";
	pinctrl-0 = <&i2c1_default>;
	pinctrl-1 = <&i2c1_sleep>;
	pinctrl-names = "default", "sleep";
};

&uart0 {
	status = "okay";
	current-speed = <115200>;
	pinctrl-0 = <&uart0_default>;
	pinctrl-1 = <&uart0_sleep>;
	pinctrl-names = "default", "sleep";
};

&pwm0 {
	status = "okay";
	pinctrl-0 = <&pwm0_default>;
	pinctrl-1 = <&pwm0_sleep>;
	pinctrl-names = "default", "sleep";
};

&spi4 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	pinctrl-0 = <&spi4_default>;
	pinctrl-1 = <&spi4_sleep>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
	mx25r64: mx25r6435f@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <33000000>;
		jedec-id = [c2 28 17];
		sfdp-bfp = [
			e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
			ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
			10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
			30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
		];
		size = <67108864>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <5000>;
	};
};

&qspi {
	status = "okay";
	pinctrl-0 = <&qspi_default>;
	pinctrl-1 = <&qspi_sleep>;
	pinctrl-names = "default", "sleep";
};

arduino_serial: &uart1 {
	compatible = "nordic,nrf-uarte";
	current-speed = <115200>;
	pinctrl-0 = <&uart1_default>;
	pinctrl-1 = <&uart1_sleep>;
	pinctrl-names = "default", "sleep";
};

arduino_spi: &spi3 {
	compatible = "nordic,nrf-spim";
	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
	pinctrl-0 = <&spi3_default>;
	pinctrl-1 = <&spi3_sleep>;
	pinctrl-names = "default", "sleep";
};

&ieee802154 {
	status = "okay";
};

zephyr_udc0: &usbd {
	compatible = "nordic,nrf-usbd";
	status = "okay";
};

/* Include default memory partition configuration file */
#include <common/nordic/nrf5340_cpuapp_partition.dtsi>

C:\ncs\v2.8.0\zephyr\dts\common\nordic\nrf5340_cpuapp_partition.dtsi

/*
 * Copyright 2024 Embeint Inc
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Default memory partitioning for nRF5340 application CPU.
 */

&flash0 {
	/*
	 * Default Flash planning for nRF5340 series SoCs.
	 * This layout matches (by necessity) that in the TF-M repository:
	 *
	 * 0x0000_0000 BL2 - MCUBoot (64 KB)
	 * 0x0001_0000 Primary image area (448 KB):
	 *    0x0001_0000 Secure     image primary (256 KB)
	 *    0x0005_0000 Non-secure image primary (192 KB)
	 * 0x0008_0000 Secondary image area (448 KB):
	 *    0x0008_0000 Secure     image secondary (256 KB)
	 *    0x000c_0000 Non-secure image secondary (192 KB)
	 * 0x000f_0000 Protected Storage Area (16 KB)
	 * 0x000f_4000 Internal Trusted Storage Area (8 KB)
	 * 0x000f_6000 OTP / NV counters area (8 KB)
	 * 0x000f_8000 Non-secure storage, used when built with NRF_NS_STORAGE=ON,
	 *             otherwise unused (32 KB)
	 */
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 0x10000>;
		};
		slot0_partition: partition@10000 {
			label = "image-0";
			reg = <0x00010000 0x40000>;
		};
		slot0_ns_partition: partition@50000 {
			label = "image-0-nonsecure";
			reg = <0x00050000 0x30000>;
		};
		slot1_partition: partition@80000 {
			label = "image-1";
			reg = <0x00080000 0x40000>;
		};
		slot1_ns_partition: partition@c0000 {
			label = "image-1-nonsecure";
			reg = <0x000c0000 0x30000>;
		};
		tfm_ps_partition: partition@f0000 {
			label = "tfm-ps";
			reg = <0x000f0000 0x00004000>;
		};
		tfm_its_partition: partition@f4000 {
			label = "tfm-its";
			reg = <0x000f4000 0x00002000>;
		};
		tfm_otp_partition: partition@f6000 {
			label = "tfm-otp";
			reg = <0x000f6000 0x00002000>;
		};
		storage_partition: partition@f8000 {
			label = "storage";
			reg = <0x000f8000 0x00004000>;
		};
		custom_storage_partition: partition@fe000 {
			label = "custom_storage";
			reg = <0x000fe000 0x00002000>; // 8KB
		};
	};
};

/ {
	/* Default SRAM planning when building for nRF5340 with ARM TF-M support
	 * - Lowest 256 kB SRAM allocated to Secure image (sram0_s)
	 * - Upper 256 kB allocated to Non-Secure image (sram0_ns)
	 * Of the memory allocated to the Non-Secure image
	 * - 192 kB SRAM allocated to the Non-Secure application (sram0_ns_app).
	 * - 64 kB allocated to shared memory (sram0_shared).
	 *   (See nrf5340_shared_sram_partition.dtsi)
	 */
	reserved-memory {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		sram0_image: image@20000000 {
			/* Zephyr image(s) memory */
			reg = <0x20000000 DT_SIZE_K(448)>;
		};

		sram0_s: image_s@20000000 {
			/* Secure image memory */
			reg = <0x20000000 0x40000>;
		};

		sram0_ns: image_ns@20040000 {
			/* Non-Secure image memory */
			reg = <0x20040000 0x40000>;
		};

		sram0_ns_app: image_ns_app@20040000 {
			/* Non-Secure image memory */
			reg = <0x20040000 0x30000>;
		};
	};
};

#include "nrf5340_shared_sram_partition.dtsi"

Related