nrf5340 custom board not running after enabling Bluetooth (CONFIG_BT)

Hello,

As mentioned we have a custom board and we are now enabling bluetooth. Given that we are using the nRF5340 we have a custom CPUNET board defined (we just took the nrf5340dk_cpunet_defconfignrf5340dk_cpunet_pinctrl.dtsi, and nrf5340dk_cpunet.dts files and adjusted them for our board). 

Here are the files

device_cpunet.dts:

/dts-v1/;
#include <nordic/nrf5340_cpunet_qkaa.dtsi>
#include "pendant_cpunet-pinctrl.dtsi"

/ {
	model = "Pendant Network";
	compatible = "limitless,pendant-cpunet";

	chosen {
		zephyr,bt-hci-ipc = &ipc0;
		nordic,802154-spinel-ipc = &ipc0;
		zephyr,sram = &sram1;
		zephyr,flash = &flash1;
		zephyr,code-partition = &slot0_partition;
		zephyr,ieee802154 = &ieee802154;
	};
};

&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 0x17000>;
		};
		slot1_partition: partition@23000 {
			label = "image-1";
			reg = <0x00023000 0x17000>;
		};
		storage_partition: partition@3a000 {
			label = "storage";
			reg = <0x0003a000 0x6000>;
		};
	};
};

// Can only enable UART if disabled in cpuapp
//
// &uart0 {
// 	status = "okay";
// 	current-speed = <115200>;
// 	pinctrl-0 = <&uart0_default>;
// 	pinctrl-1 = <&uart0_sleep>;
// 	pinctrl-names = "default", "sleep";
// };

/* Include shared RAM configuration file */
#include "nrf5340_shared_sram_planning_conf.dts"

device_cpunet_pinctrl.dtsi:

&pinctrl {
    // To enable uart, must disable in cpuapp first
    // See comment in pendant_cpunet.dts
    //
    // uart0_default: uart0_default {
    //     group1 {
    //         psels = <NRF_PSEL(UART_TX, 0, 11)>;
    //     };
    //     group2 {
    //         psels = <NRF_PSEL(UART_RX, 0, 9)>;
    //         bias-pull-up;
    //     };
    // };

    // uart0_sleep: uart0_sleep {
    //     group1 {
    //         psels = <NRF_PSEL(UART_RX, 0, 9)>,
    //                 <NRF_PSEL(UART_TX, 0, 11)>;
    //         low-power-enable;
    //     };
    // };

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

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

	spi0_default: spi0_default {
		group1 {
				psels = <NRF_PSEL(SPIM_MISO, 1, 10)>,
								<NRF_PSEL(SPIM_MOSI, 1, 9)>,
								<NRF_PSEL(SPIM_SCK, 1, 8)>;
		};
	};

	spi0_sleep: spi0_sleep {
		group1 {
				psels = <NRF_PSEL(SPIM_MISO, 1, 10)>,
								<NRF_PSEL(SPIM_MOSI, 1, 9)>,
								<NRF_PSEL(SPIM_SCK, 1, 8)>;
				low-power-enable;
		};
	};
};

device_defconfig:

CONFIG_SOC_SERIES_NRF53X=y
CONFIG_SOC_NRF5340_CPUNET_QKAA=y
CONFIG_BOARD_PENDANT_CPUNET=y

# Enable MPU
CONFIG_ARM_MPU=y

# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y

# In order to use cpunet logging we need to reassign NRF_SWO to cpunet
# by disabling uart0 in cpuapp and enabling in pendant_cpunet.dts.
# We should only do this for development purposes.
CONFIG_SERIAL=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n

#  Must be equal to the maximum number of connections supported by the peer app
CONFIG_BT_MAX_CONN=1

We want to get started with just the HCI_IPC bluetooth sample on the network core and try to run bt_enable and bt_le_adv_start on the app core to get started. So we have these config options in the main CPUAPP prj.conf:

# Main bluetooth options
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME="Bluetooth Test"
CONFIG_BT_DEVICE_APPEARANCE=962
CONFIG_BOARD_ENABLE_CPUNET=y
CONFIG_HEAP_MEM_POOL_SIZE=10000
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_BT_HCI_IPC=y # Use HCI IPC project
CONFIG_BT_MAX_CONN=1
 

These config options in the child_image/hci_ipc.conf:

CONFIG_BT_MAX_CONN=1

Our project builds and flashes however as soon as the app starts the device seems unresponsive. It can be connected to in Serial Terminal but we are unable to run any shell commands or even turn on the device's LED within main(). This usually happens when we run out of RAM but we are currently at 86% usage so there seems to be enough margin...

Any thoughts on what might be going on? For context, we are using an NRF7002 for Wifi but tried disabling the Wifi stack to see if that did anything. We also only have one UART available which we use for the app core and so do not have one available to forward to the network core. 

On a side note, there is a bit of confusion in defining the CPUNET options vs the hci_ipc.conf options. Does hci_ipc.conf inherit those options in the _defconfig? One confusion is what options should be defined in device_cpunet_defconfig versus the child_image/hci_ipc.conf

Related