diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt b/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt new file mode 100644 index 00000000000..c950fd91724 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (c) 2021 Nordic Semiconductor ASA. +# SPDX-License-Identifier: Apache-2.0 + +if ((CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS) + AND CONFIG_BOARD_ENABLE_CPUNET) + zephyr_library() + zephyr_library_sources(nrf5340_audio_dk_cpunet_reset.c) + + if (CONFIG_BUILD_WITH_TFM) + zephyr_library_include_directories( + $/install/interface/include + ) + endif() + +endif() diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig b/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig new file mode 100644 index 00000000000..fc237786896 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig @@ -0,0 +1,58 @@ +# nRF5340 Audio DK board configuration + +# Copyright (c) 2019 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +config BOARD_ENABLE_DCDC_APP + bool "Application MCU DCDC converter" + select SOC_DCDC_NRF53X_APP + default y + +config BOARD_ENABLE_DCDC_NET + bool "Network MCU DCDC converter" + select SOC_DCDC_NRF53X_NET + default y + +config BOARD_ENABLE_DCDC_HV + bool "High Voltage DCDC converter" + select SOC_DCDC_NRF53X_HV + default y + +config BOARD_ENABLE_CPUNET + bool "nRF53 Network MCU" + select SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 if \ + $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIO_FORWARDER)) + help + This option enables releasing the Network 'force off' signal, which + as a consequence will power up the Network MCU during system boot. + Additionally, the option allocates GPIO pins that will be used by UARTE + of the Network MCU. + Note: GPIO pin allocation can only be configured by the secure Application + MCU firmware, so when this option is used with the non-secure version of + the board, the application needs to take into consideration, that the + secure firmware image must already have configured GPIO allocation for the + Network MCU. + default y if (BT || NRF_802154_SER_HOST) + +config DOMAIN_CPUNET_BOARD + string + default "nrf5340_audio_dk_nrf5340_cpunet" + depends on BOARD_ENABLE_CPUNET + help + The board which will be used for CPUNET domain when creating a multi + image application where one or more images should be located on + another board. For example hci_rpmsg on the nRF5340_cpunet for + Bluetooth applications. + +endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +config DOMAIN_CPUAPP_BOARD + string + default "nrf5340_audio_dk_nrf5340_cpuapp" + depends on BOARD_NRF5340_AUDIO_DK_NRF5340_CPUNET + help + The board which will be used for CPUAPP domain when creating a multi + image application where one or more images should be located on + another board. diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig.board b/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig.board new file mode 100644 index 00000000000..5b407f03564 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig.board @@ -0,0 +1,18 @@ +# nRF5340 Audio DK board configuration + +# Copyright (c) 2019 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF5340_CPUAPP_QKAA + +config BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP + bool "nrf5340 Audio DK nRF5340 Application MCU" + +config BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + bool "nrf5340 Audio DK nRF5340 Application MCU non-secure" + +endif # SOC_NRF5340_CPUAPP_QKAA + +config BOARD_NRF5340_AUDIO_DK_NRF5340_CPUNET + bool "nrf5340 Audio DK NRF5340 Network MCU" + depends on SOC_NRF5340_CPUNET_QKAA diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig.defconfig b/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig.defconfig new file mode 100644 index 00000000000..c433ed87468 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/Kconfig.defconfig @@ -0,0 +1,96 @@ +# nRF5340 Audio DK board configuration + +# Copyright (c) 2019 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +config BOARD + default "nrf5340_audio_dk_nrf5340_cpuapp" if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +# Code Partition: +# +# For the secure version of the board the firmware is linked at the beginning +# of the flash, or into the code-partition defined in DT if it is intended to +# be loaded by MCUboot. If the secure firmware is to be combined with a non- +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always +# be restricted to the size of its code partition. +# +# For the non-secure version of the board, the firmware +# must be linked into the code-partition (non-secure) defined in DT, regardless. +# Apply this configuration below by setting the Kconfig symbols used by +# the linker according to the information extracted from DT partitions. + +# SRAM Partition: +# +# If the secure firmware is to be combined with a non-secure image +# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always +# be restricted to the secure image SRAM partition (sram-secure-partition). +# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram +# may be used by the image. +# +# For the non-secure version of the board, the firmware image SRAM is +# always restricted to the allocated non-secure SRAM partition. +# +# Workaround for not being able to have commas in macro arguments +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition +DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition + +if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config SRAM_SIZE + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) + +endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP && TRUSTED_EXECUTION_SECURE + +if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +config FLASH_LOAD_OFFSET + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +config FLASH_LOAD_SIZE + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) + +endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +config BOARD + default "nrf5340_audio_dk_nrf5340_cpunet" if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUNET + +config IPM_NRFX + default IPM + +config MBOX_NRFX_IPC + default MBOX + +if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +choice BT_HCI_BUS_TYPE + default BT_RPMSG if BT +endchoice + +config HEAP_MEM_POOL_SIZE + default 4096 if BT_RPMSG + +endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP || BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS + +if BOARD_NRF5340_AUDIO_DK_NRF5340_CPUNET + +config BT_CTLR + default y if BT + +endif # BOARD_NRF5340_AUDIO_DK_NRF5340_CPUNET + +config UART_NRF_DK_SERIAL_WORKAROUND + default y if ZTEST + +# When the nRF DK serial workaround is enabled, increase the stack size in +# tests built with no optimizations, as the standard size may be insufficient +# then. Use 512 to align with the FPU_SHARING case, where the default value +# is also modified. +config TEST_EXTRA_STACK_SIZE + default 512 if UART_NRF_DK_SERIAL_WORKAROUND && NO_OPTIMIZATIONS diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/board.cmake b/boards/arm/nrf5340_audio_dk_nrf5340/board.cmake new file mode 100644 index 00000000000..4c67981c71a --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/board.cmake @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS) + set(TFM_PUBLIC_KEY_FORMAT "full") +endif() + +if(CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS) + board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000") +endif() + +if(CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUNET) + board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000") +endif() + +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/doc/img/nrf5340_audio_dk.jpg b/boards/arm/nrf5340_audio_dk_nrf5340/doc/img/nrf5340_audio_dk.jpg new file mode 100644 index 00000000000..40944f961ef Binary files /dev/null and b/boards/arm/nrf5340_audio_dk_nrf5340/doc/img/nrf5340_audio_dk.jpg differ diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/doc/index.rst b/boards/arm/nrf5340_audio_dk_nrf5340/doc/index.rst new file mode 100644 index 00000000000..db7bf3ad168 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/doc/index.rst @@ -0,0 +1,110 @@ +.. _nrf5340_audio_dk_nrf5340: + +nRF5340 Audio DK +################ + +Overview +******** + +The nRF5340 Audio DK (PCA10121) is designed for showcasing, developing and experimenting +with Bluetooth® LE Audio. + +You can use this board for developing LE-Audio-compatible applications that support Auracast™, +connected isochronous streams (CIS) and broadcast isochronous streams (BIS), +and offer support for acting as a audio source, audio sink and source + sink. + +Zephyr uses the nrf5340_audio_dk_nrf5340 board configuration for building +for the nRF5340 Audio DK. + +Hardware +******** + +The nRF5340 Audio DK comes with the following hardware features: + +* nRF5340 dual-core SoC based on the Arm® Cortex®-M33 architecture +* CS47L63 Low-Power Audio DSP with mono differential headphone driver +* nPM1100 Ultra-small form-factor Power Management IC +* On-board digital microphone +* On-board power measurement +* SD card slot +* Built-in debugger +* Stereo analog input using 3.5 mm jack +* USB soundcard capability + +.. figure:: img/nrf5340_audio_dk.jpg + :align: center + :alt: nRF5340 DK + +More information about the board can be found at the `nRF5340 Audio DK website`_. The `Nordic Semiconductor Infocenter`_ +contains the processor's information and the datasheet. + +nRF5340 SoC +=========== + +The nRF5340 Audio DK is built around the nRF5340 SoC, which has the following characteristics: + +* A full-featured Arm Cortex-M33F core with DSP instructions, + FPU, and Armv8-M Security Extension, running at up to 128 MHz, + referred to as the **application core**. +* A secondary Arm Cortex-M33 core, with a reduced feature set, + running at a fixed 64 MHz, referred to as the **network core**. + +The nrf5340_audio_dk_nrf5340_cpuapp build target provides support for the application +core on the nRF5340 SoC. The nrf5340_audio_dk_nrf5340_cpunet build target provides +support for the network core on the nRF5340 SoC. + + +The `Nordic Semiconductor Infocenter`_ contains the processor's information and +the datasheet. + +Supported Features +================== + +See :ref:`nrf5340dk_nrf5340` and `Nordic Semiconductor Infocenter`_ +for a complete list of nRF5340 Audio DK board hardware features. + + +Programming and Debugging +************************* + +Flashing +======== + +Follow the instructions in the :ref:`nordic_segger` page to install +and configure all the necessary software. Further information can be +found in :ref:`nordic_segger_flashing`. Then you can build and flash +applications as usual (:ref:`build_an_application` and +:ref:`application_run` for more details). + +.. warning:: + + The nRF5340 has a flash read-back protection feature. When flash read-back + protection is active, you will need to recover the chip before reflashing. + If you are flashing with :ref:`west `, run + this command for more details on the related ``--recover`` option: + + .. code-block:: console + + west flash -H -r nrfjprog --skip-rebuild + +.. note:: + + Flashing and debugging applications on the nRF5340 Audio DK requires + upgrading the nRF Command Line Tools to version 10.12.0. Further + information on how to install the nRF Command Line Tools can be + found in :ref:`nordic_segger_flashing`. + +Debugging +========= + +Refer to the :ref:`nordic_segger` page to learn about debugging Nordic +boards with a Segger IC. + +References +********** + +.. target-notes:: + +.. _nRF5340 Audio DK website: + https://www.nordicsemi.com/Products/Development-hardware/nrf5340-audio-dk +.. _Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c new file mode 100644 index 00000000000..2d2dce5d162 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include + +#include + +LOG_MODULE_REGISTER(nrf5340_audio_dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); + +#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) +#include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h> +#else +#define DEBUG_SETUP() +#endif + +static int core_config(void) +{ + nrf_gpiote_latency_t latency; + + latency = nrfx_gpiote_latency_get(); + + if (latency != NRF_GPIOTE_LATENCY_LOWPOWER) { + LOG_DBG("Setting gpiote latency to low power"); + nrfx_gpiote_latency_set(NRF_GPIOTE_LATENCY_LOWPOWER); + } + + return 0; +} + +static void remoteproc_mgr_config(void) +{ +#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) + /* Route Bluetooth Controller Debug Pins */ + DEBUG_SETUP(); +#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */ + +#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) + /* Retain nRF5340 Network MCU in Secure domain (bus + * accesses by Network MCU will have Secure attribute set). + */ + NRF_SPU->EXTDOMAIN[0].PERM = 1 << 4; +#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ +} + +static int remoteproc_mgr_boot(const struct device *dev) +{ + int ret; + + ARG_UNUSED(dev); + + ret = core_config(); + if (ret) { + return ret; + } + + /* Secure domain may configure permissions for the Network MCU. */ + remoteproc_mgr_config(); + +#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE) + /* + * Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies + * building also a Non-Secure image. The Non-Secure image will, in + * this case do the remainder of actions to properly configure and + * boot the Network MCU. + */ + + /* Release the Network MCU, 'Release force off signal' */ + NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release; + + LOG_DBG("Network MCU released."); +#endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ + + return 0; +} + +SYS_INIT(remoteproc_mgr_boot, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp.dts b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp.dts new file mode 100644 index 00000000000..8fe46bdd7a3 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp.dts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi" + +/ { + model = "Nordic nRF5340 Audio DK NRF5340 Application"; + compatible = "nordic,nrf5340-audio-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; + }; +}; diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp.yaml b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp.yaml new file mode 100644 index 00000000000..5d752b69566 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp.yaml @@ -0,0 +1,19 @@ +identifier: nrf5340_audio_dk_nrf5340_cpuapp +name: NRF5340-AUDIO-DK-NRF5340-application-MCU +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 448 +flash: 1024 +supported: + - gpio + - i2s + - spi + - i2c + - pwm + - watchdog + - usb_cdc + - usb_device diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common-pinctrl.dtsi b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common-pinctrl.dtsi new file mode 100644 index 00000000000..65c5880e395 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common-pinctrl.dtsi @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + i2s0_default: i2s0_default { + group1 { + psels = ; + nordic,drive-mode = ; + }; + group2 { + psels = , + , + , + ; + }; + }; + + i2s0_sleep: i2s0_sleep { + group1 { + psels = , + , + , + , + ; + low-power-enable; + }; + }; + + uart0_default: uart0_default { + group1 { + psels = , + ; + }; + group2 { + psels = , + ; + bias-pull-up; + }; + }; + + uart0_sleep: uart0_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + + i2c1_default: i2c1_default { + group1 { + psels = , + ; + }; + }; + + i2c1_sleep: i2c1_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + spi4_default: spi4_default { + group1 { + psels = , + ; + /* Workaround for issue with PCA10121 v0.7.0 + * related to SD-card + */ + nordic,drive-mode = ; + }; + group2 { + psels = ; + }; + }; + + spi4_sleep: spi4_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi new file mode 100644 index 00000000000..ff73f9780b0 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2020-2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf5340_audio_dk_nrf5340_cpuapp_common-pinctrl.dtsi" +#include + +/ { + 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-rpmsg-ipc = &ipc0; + watchdog0 = &wdt0; + }; + + gpio_fwd: nrf-gpio-forwarder { + compatible = "nordic,nrf-gpio-forwarder"; + status = "okay"; + uart { + gpios = <&gpio1 9 0>, <&gpio1 8 0>, <&gpio1 11 0>, <&gpio1 10 0>; + }; + }; + + pmic { + compatible = "nordic,npm1100"; + nordic,iset-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2s0 { + compatible = "nordic,nrf-i2s"; + status = "okay"; + pinctrl-0 = <&i2s0_default>; + pinctrl-1 = <&i2s0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-1 = <&uart0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&i2c1 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c1_default>; + pinctrl-1 = <&i2c1_sleep>; + pinctrl-names = "default", "sleep"; + + vbat_sensor: ina231@44 { + compatible = "ti,ina230"; + reg = <0x44>; + config = ; + current-lsb-microamps = <1>; + rshunt-milliohms = <510>; + }; + + vdd1_codec_sensor: ina231@45 { + compatible = "ti,ina230"; + reg = <0x45>; + config = ; + current-lsb-microamps = <1>; + rshunt-milliohms = <2200>; + }; + + vdd2_codec_sensor: ina231@41 { + compatible = "ti,ina230"; + reg = <0x41>; + config = ; + current-lsb-microamps = <1>; + rshunt-milliohms = <2200>; + }; + + vdd2_nrf_sensor: ina231@40 { + compatible = "ti,ina230"; + reg = <0x40>; + config = ; + current-lsb-microamps = <1>; + rshunt-milliohms = <1000>; + }; +}; + +&spi4 { + compatible = "nordic,nrf-spim"; + status = "okay"; + cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>, <&gpio0 17 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi4_default>; + pinctrl-1 = <&spi4_sleep>; + pinctrl-names = "default", "sleep"; + sdhc0: sdhc@0 { + compatible = "zephyr,sdhc-spi-slot"; + reg = <0>; + status = "okay"; + sdmmc { + compatible = "zephyr,sdmmc-disk"; + status = "okay"; + }; + + spi-max-frequency = <8000000>; + }; + cs47l63: cs47l63@1 { + reg = <1>; + }; +}; + +&pwm0 { + status = "okay"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&timer2 { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x00010000>; + }; + slot0_partition: partition@10000 { + label = "image-0"; + }; + slot0_ns_partition: partition@50000 { + label = "image-0-nonsecure"; + }; + slot1_partition: partition@80000 { + label = "image-1"; + }; + slot1_ns_partition: partition@c0000 { + label = "image-1-nonsecure"; + }; + storage_partition: partition@fa000 { + label = "storage"; + reg = <0x000fa000 0x00006000>; + }; + }; +}; + +/ { + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram0_image: image@20000000 { + /* Zephyr image(s) memory */ + }; + + sram0_s: image_s@20000000 { + /* Secure image memory */ + }; + + sram0_ns: image_ns@20040000 { + /* Non-Secure image memory */ + }; + }; +}; + +zephyr_udc0: &usbd { + compatible = "nordic,nrf-usbd"; + status = "okay"; + + hs_0: hs_0 { + compatible = "usb-audio-hs"; + mic-feature-mute; + mic-channel-l; + mic-channel-r; + + hp-feature-mute; + hp-channel-l; + hp-channel-r; + }; +}; + +/* Include partition configuration file */ +#include "nrf5340_audio_dk_nrf5340_cpuapp_partition_conf.dtsi" +#include "nrf5340_audio_dk_nrf5340_shared.dtsi" diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_defconfig b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_defconfig new file mode 100644 index 00000000000..0f5f1991b6d --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_defconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2020 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF53X=y +CONFIG_SOC_NRF5340_CPUAPP_QKAA=y +CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP=y + +CONFIG_ARM_MPU=y + +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_ARM_TRUSTZONE_M=y + +CONFIG_GPIO=y +CONFIG_NFCT_PINS_AS_GPIOS=y + +CONFIG_SERIAL=y + +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_PINCTRL=y + +CONFIG_REGULATOR=y diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns.dts b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns.dts new file mode 100644 index 00000000000..74b120d452b --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns.dts @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi" + +/ { + model = "Nordic nRF5340 Audio DK NRF5340 Application"; + compatible = "nordic,nrf5340-audio-dk-nrf5340-cpuapp"; + + chosen { + zephyr,sram = &sram0_ns; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_ns_partition; + }; +}; diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns.yaml b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns.yaml new file mode 100644 index 00000000000..a094083158b --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns.yaml @@ -0,0 +1,18 @@ +identifier: nrf5340_audio_dk_nrf5340_cpuapp_ns +name: NRF5340-AUDIO-DK-NRF5340-application-MCU-Non-Secure +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 192 +flash: 192 +supported: + - i2c + - i2s + - spi + - pwm + - watchdog + - usb_cdc + - usb_device diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig new file mode 100644 index 00000000000..f0d723ad450 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_ns_defconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2020 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF53X=y +CONFIG_SOC_NRF5340_CPUAPP_QKAA=y +CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUAPP_NS=y + +CONFIG_ARM_MPU=y + +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +CONFIG_GPIO=y + +CONFIG_SERIAL=y + +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_PINCTRL=y + +CONFIG_REGULATOR=y diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_partition_conf.dtsi b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_partition_conf.dtsi new file mode 100644 index 00000000000..d2d81e728fc --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_partition_conf.dtsi @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Default Flash planning for nrf5340_audio_dk_nrf5340 CPUAPP (Application MCU). + * + * Zephyr build for nRF5340 with ARM TrustZone-M support, + * implies building Secure and Non-Secure Zephyr images. + * + * Secure image will be placed, by default, in flash0 + * (or in slot0, if MCUboot is present). + * Secure image will use sram0 for system memory. + * + * Non-Secure image will be placed in slot0_ns, and use + * sram0_ns for system memory. + * + * Note that the Secure image only requires knowledge of + * the beginning of the Non-Secure image (not its size). + */ + +&slot0_partition { + reg = <0x00010000 0x40000>; +}; + +&slot0_ns_partition { + reg = <0x00050000 0x30000>; +}; + +&slot1_partition { + reg = <0x00080000 0x40000>; +}; + +&slot1_ns_partition { + reg = <0x000c0000 0x30000>; +}; + +/* Default SRAM planning when building for nRF5340 with + * ARM TrustZone-M support + * - Lowest 256 kB SRAM allocated to Secure image (sram0_s) + * - Middle 192 kB allocated to Non-Secure image (sram0_ns) + * - Upper 64 kB SRAM allocated as Shared memory (sram0_shared) + * (see nrf5340_audio_dk_nrf5340_shared_sram_planning_conf.dtsi) + */ +&sram0_image { + reg = <0x20000000 DT_SIZE_K(448)>; +}; + +&sram0_s { + reg = <0x20000000 0x40000>; +}; + +&sram0_ns { + reg = <0x20040000 0x30000>; +}; + +/* Include shared RAM configuration file */ +#include "nrf5340_audio_dk_nrf5340_shared_sram_planning_conf.dtsi" diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi new file mode 100644 index 00000000000..ada32e709ac --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + uart0_default: uart0_default { + group1 { + psels = , + ; + }; + group2 { + psels = , + ; + bias-pull-up; + }; + }; + + uart0_sleep: uart0_sleep { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.dts b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.dts new file mode 100644 index 00000000000..100216f1a43 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.dts @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "nrf5340_audio_dk_nrf5340_cpunet-pinctrl.dtsi" + +/ { + model = "Nordic nRF5340 Audio DK NRF5340 Network"; + compatible = "nordic,nrf5340-audio-dk-nrf5340-cpunet"; + + 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-rpmsg-ipc = &ipc0; + zephyr,sram = &sram1; + zephyr,flash = &flash1; + zephyr,code-partition = &slot0_partition; + watchdog0 = &wdt0; + }; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-1 = <&uart0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&timer2 { + status = "okay"; +}; + +&flash1 { + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0xc000>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 0x12000>; + }; + slot1_partition: partition@1e000 { + label = "image-1"; + reg = <0x0001E000 0x12000>; + }; + storage_partition: partition@3a000 { + label = "storage"; + reg = <0x0003a000 0x6000>; + }; + }; +}; + +/* Include shared RAM configuration file */ +#include "nrf5340_audio_dk_nrf5340_shared_sram_planning_conf.dtsi" +#include "nrf5340_audio_dk_nrf5340_shared.dtsi" diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.yaml b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.yaml new file mode 100644 index 00000000000..7a28066f0a1 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet.yaml @@ -0,0 +1,12 @@ +identifier: nrf5340_audio_dk_nrf5340_cpunet +name: NRF5340-AUDIO-DK-NRF5340-network-MCU +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +ram: 64 +flash: 256 +supported: + - watchdog diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet_defconfig b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet_defconfig new file mode 100644 index 00000000000..0450bb97797 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpunet_defconfig @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF53X=y +CONFIG_SOC_NRF5340_CPUNET_QKAA=y +CONFIG_BOARD_NRF5340_AUDIO_DK_NRF5340_CPUNET=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable PINCTRL +CONFIG_PINCTRL=y + +# enable GPIO +CONFIG_GPIO=y + +# Enable uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_shared.dtsi b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_shared.dtsi new file mode 100644 index 00000000000..7a363d58700 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_shared.dtsi @@ -0,0 +1,84 @@ +/ { + leds: leds { + compatible = "gpio-leds"; + rgb1_red: led_0 { + gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + label = "0 LED_RGB_RED"; + }; + rgb1_green: led_1 { + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; + label = "0 LED_RGB_GREEN"; + }; + rgb1_blue: led_2 { + gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; + label = "0 LED_RGB_BLUE"; + }; + rgb2_red: led_3 { + gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; + label = "1 LED_RGB_RED"; + }; + rgb2_green: led_4 { + gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; + label = "1 LED_RGB_GREEN"; + }; + rgb2_blue: led_5 { + gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; + label = "1 LED_RGB_BLUE"; + }; + led1_blue: led_6 { + gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; + label = "2 LED_MONO_BLUE"; + }; + led2_green: led_7 { + gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>; + label = "3 LED_MONO_GREEN"; + }; + led3_green: led_8 { + gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + label = "4 LED_MONO_GREEN"; + }; + + }; + + buttons { + compatible = "gpio-keys"; + button_1_vol_dn: button_1_vol_dn { + gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 1"; + }; + button_2_vol_up: button_2_vol_up { + gpios = <&gpio0 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 2"; + }; + button3: button_3 { + gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 3"; + }; + button4: button_4 { + gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 4"; + }; + button5: button_5 { + gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button 5"; + }; + }; + + aliases { + led0 = &rgb1_red; + led1 = &rgb1_green; + led2 = &rgb1_blue; + led3 = &rgb2_red; + led4 = &rgb2_green; + led5 = &rgb2_blue; + led6 = &led1_blue; + led7 = &led2_green; + led8 = &led3_green; + sw0 = &button_1_vol_dn; + sw1 = &button_2_vol_up; + sw2 = &button3; + sw3 = &button4; + sw4 = &button5; + watchdog0 = &wdt0; + }; +}; diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_shared_sram_planning_conf.dtsi b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_shared_sram_planning_conf.dtsi new file mode 100644 index 00000000000..2a96677a9dc --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_shared_sram_planning_conf.dtsi @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Default shared SRAM planning when building for nRF5340. + * This file is included by both nRF5340 CPUAPP (Application MCU) + * and nRF5340 CPUNET (Network MCU). + * - 64 kB SRAM allocated as Shared memory (sram0_shared) + * - Region defined after the image SRAM of Application MCU + */ + +/ { + chosen { + /* shared memory reserved for the inter-processor communication */ + zephyr,ipc_shm = &sram0_shared; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram0_shared: memory@20070000 { + /* SRAM allocated to shared memory */ + reg = <0x20070000 0x10000>; + }; + }; +}; diff --git a/boards/arm/nrf5340_audio_dk_nrf5340/pre_dt_board.cmake b/boards/arm/nrf5340_audio_dk_nrf5340/pre_dt_board.cmake new file mode 100644 index 00000000000..fb045e38545 --- /dev/null +++ b/boards/arm/nrf5340_audio_dk_nrf5340/pre_dt_board.cmake @@ -0,0 +1,8 @@ +# Copyright (c) 2021 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +# Suppress "unique_unit_address_if_enabled" to handle the following overlaps: +# - flash-controller@39000 & kmu@39000 +# - power@5000 & clock@5000 +# - /reserved-memory/image@20000000 & /reserved-memory/image_s@20000000 +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") diff --git a/samples/bluetooth/hci_rpmsg/sample.yaml b/samples/bluetooth/hci_rpmsg/sample.yaml index 48334b8e395..634aded259e 100644 --- a/samples/bluetooth/hci_rpmsg/sample.yaml +++ b/samples/bluetooth/hci_rpmsg/sample.yaml @@ -9,6 +9,7 @@ tests: tags: bluetooth integration_platforms: - nrf5340dk_nrf5340_cpunet + - nrf5340_audio_dk_nrf5340_cpunet sample.bluetooth.hci_rpmsg.iso_broadcast.bt_ll_sw_split: harness: bluetooth extra_args: CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf" @@ -16,6 +17,7 @@ tests: tags: bluetooth integration_platforms: - nrf5340dk_nrf5340_cpunet + - nrf5340_audio_dk_nrf5340_cpunet sample.bluetooth.hci_rpmsg.iso_receive.bt_ll_sw_split: harness: bluetooth extra_args: CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf" @@ -23,3 +25,4 @@ tests: tags: bluetooth integration_platforms: - nrf5340dk_nrf5340_cpunet + - nrf5340_audio_dk_nrf5340_cpunet diff --git a/samples/bluetooth/iso_broadcast_benchmark/sample.yaml b/samples/bluetooth/iso_broadcast_benchmark/sample.yaml index fb8674604db..945b30f681f 100644 --- a/samples/bluetooth/iso_broadcast_benchmark/sample.yaml +++ b/samples/bluetooth/iso_broadcast_benchmark/sample.yaml @@ -4,7 +4,7 @@ sample: tests: sample.bluetooth.iso_broadcast_benchmark: build_only: true - platform_allow: nrf52840dk_nrf52840 nrf5340dk_nrf5340_cpuapp + platform_allow: nrf52840dk_nrf52840 nrf5340dk_nrf5340_cpuapp nrf5340_audio_dk_nrf5340_cpuapp integration_platforms: - nrf52840dk_nrf52840 tags: bluetooth diff --git a/samples/bluetooth/iso_connected_benchmark/sample.yaml b/samples/bluetooth/iso_connected_benchmark/sample.yaml index c3c35d74c62..0dc19828259 100644 --- a/samples/bluetooth/iso_connected_benchmark/sample.yaml +++ b/samples/bluetooth/iso_connected_benchmark/sample.yaml @@ -4,5 +4,5 @@ sample: tests: sample.bluetooth.iso_connected_benchmark: build_only: true - platform_allow: nrf5340dk_nrf5340_cpuapp + platform_allow: nrf5340dk_nrf5340_cpuapp nrf5340_audio_dk_nrf5340_cpuapp tags: bluetooth