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

Parents
  • Hi Ever,

    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?

    I would first try to run the application in the debugger for a while and halt/pause the debugger to understand the context of the current execution in your application. It might give us some hints if the application is running properly on the application core or if it has asserted. Unable to get any logs can be a different issue with the device tree but we can come to that later.

    Have you tried running the compiled binary with your custom board device tree on the nRF53DK in the debugger? Just a quick look at your device files does not obviously show that binary for your custom board should not run on nRF53DK. The reason I am asking to do this is because it is easy to run the debugger on the DK.

  • When I try to Debug with JLink it shows this in gdb-server:

    Starting target CPU...
    ...Target halted (DBGRQ, PC = 0xEFFFFFFE)

    Debug console shows:

    Thread
    2 received signal SIGTRAP, Trace/breakpoint trap.
    [Switching to Remote target]
    0xeffffffe in ?? ()

    This is just with CONFIG_BT=y and CONFIG_BOARD_ENABLE_CPUNET=y.

    I am seeing this log when building, No install step for hci_ipc_subimage:

    [460/471] Linking C static library app/libapp.a
    [462/471] No install step for 'hci_ipc_subimage'
    [463/471] Completed 'hci_ipc_subimage'
    [464/471] Linking C executable zephyr/zephyr_pre0.elf
    [465/471] Generating linker.cmd
    [466/471] Generating isr_tables.c, isr_tables_vt.ld, isr_tables_swi.ld
    [467/471] Building C object zephyr/CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj
    [468/471] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
    [469/471] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      415204 B       944 KB     42.95%
                 RAM:      307932 B       448 KB     67.12%
            IDT_LIST:          0 GB        32 KB      0.00%
    [470/471] Generating zephyr/merged.hex
    [471/471] Generating zephyr/merged_domains.hex
     *  Terminal will be reused by tasks, press any key to close it. 

    Does that mean its not actually installing anything on the network core and that is why its not responding? I also don't see anything network core related in the Memory Report. I suspect something is wrong with how the network core or hci_ipc subimage is configured, although we tried to maintain everything close to the nrf5340 DK default configurations...

Reply
  • When I try to Debug with JLink it shows this in gdb-server:

    Starting target CPU...
    ...Target halted (DBGRQ, PC = 0xEFFFFFFE)

    Debug console shows:

    Thread
    2 received signal SIGTRAP, Trace/breakpoint trap.
    [Switching to Remote target]
    0xeffffffe in ?? ()

    This is just with CONFIG_BT=y and CONFIG_BOARD_ENABLE_CPUNET=y.

    I am seeing this log when building, No install step for hci_ipc_subimage:

    [460/471] Linking C static library app/libapp.a
    [462/471] No install step for 'hci_ipc_subimage'
    [463/471] Completed 'hci_ipc_subimage'
    [464/471] Linking C executable zephyr/zephyr_pre0.elf
    [465/471] Generating linker.cmd
    [466/471] Generating isr_tables.c, isr_tables_vt.ld, isr_tables_swi.ld
    [467/471] Building C object zephyr/CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj
    [468/471] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
    [469/471] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      415204 B       944 KB     42.95%
                 RAM:      307932 B       448 KB     67.12%
            IDT_LIST:          0 GB        32 KB      0.00%
    [470/471] Generating zephyr/merged.hex
    [471/471] Generating zephyr/merged_domains.hex
     *  Terminal will be reused by tasks, press any key to close it. 

    Does that mean its not actually installing anything on the network core and that is why its not responding? I also don't see anything network core related in the Memory Report. I suspect something is wrong with how the network core or hci_ipc subimage is configured, although we tried to maintain everything close to the nrf5340 DK default configurations...

Children
Related