Issues in Modifying an nRF52840-based Peripheral UART Program to Host_Only

I wanted to change the Peripheral UART program in the nrf samples to the host_only version, and I made some attempts. I added the following code to the prj.conf file:

CONFIG_BT_HCI=y
CONFIG_BT_CTLR=n
CONFIG_BT_H4=y

In the app.overlay file I added the following code:

/ {
	chosen {
		nordic,nus-uart = &uart0;
	};
};

&uart0 {
	current-speed = <115200>;
	// hw-flow-control;
};
&uart1 {
    compatible = "nordic,nrf-uarte";
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart1_default>;
    pinctrl-1 = <&uart1_sleep>;
    pinctrl-names = "default", "sleep";
};
/ {
    chosen {
        // zephyr,console = &uart0;
        // zephyr,shell-uart = &uart0;
        zephyr,bt-uart = &uart0;
        zephyr,bt-c2h-uart = &uart0;
    };
 };

After build and flash, the program doesn't seem to run correctly. After debug, I find that the program enters an endless loop in the uart_init() function, specifically "err = uart_callback_set(uart, uart_cb, NULL);" this line produced an error.

Related