How to use both uart0 and uart1 on nrf5340

I'm trying to use both uart0 and uart1 on nrf5340 (only App core) but I get this message: UART_RX_BUF_REQUEST event, but not the error. I have also tried to pass another buffer but it keeps sending that message.

This is my overlay file.

&pinctrl {
	spi4_default: spi4_default {
		group1 {
			nordic,drive-mode = <NRF_DRIVE_H0H1>;
			psels = <NRF_PSEL(SPIM_MOSI, 0, 9)>, 
					<NRF_PSEL(SPIM_SCK, 0, 8)>, 
					<NRF_PSEL(SPIM_MISO, 0, 12)>;
		};
	};
	spi4_sleep: spi4_sleep {
		group1 {
			nordic,drive-mode = <NRF_DRIVE_H0H1>;
			psels = <NRF_PSEL(SPIM_MOSI, 0, 9)>, 
					<NRF_PSEL(SPIM_SCK, 0, 8)>, 
					<NRF_PSEL(SPIM_MISO, 0, 12)>;
			low-power-enable;
		};
	};
	spi2_default: spi2_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,					 
                    <NRF_PSEL(SPIM_MOSI, 0, 5)>,
                    <NRF_PSEL(SPIM_MISO, 0, 26)>;
        };
    };
    spi2_sleep: spi2_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 5)>,
                    <NRF_PSEL(SPIM_MISO, 0, 26)>;
            low-power-enable;
        };
    };
	
	uart0_default: uart0_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 20)>,
				<NRF_PSEL(UART_RTS, 0, 19)>;
		};
		group2 {
			psels = <NRF_PSEL(UART_RX, 0, 22)>,
				<NRF_PSEL(UART_CTS, 0, 21)>;
			bias-pull-up;
		};
	};

		uart0_sleep: uart0_sleep {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 20)>,
				<NRF_PSEL(UART_RX, 0, 22)>,
				<NRF_PSEL(UART_RTS, 0, 19)>,
				<NRF_PSEL(UART_CTS, 0, 21)>;
			low-power-enable;
		};
	};
	
	
		uart1_default: uart1_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 1, 1)>;
		};
		group2 {
			psels = <NRF_PSEL(UART_RX, 1, 0)>;
			bias-pull-up;
		};
	};

	uart1_sleep: uart1_sleep {
		group1 {
			psels = <NRF_PSEL(UART_TX, 1, 1)>,
				<NRF_PSEL(UART_RX, 1, 0)>;
			low-power-enable;
		};
	};

};

&spi4 {
    cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
	compatible = "nordic,nrf-spim";
	max-frequency = <DT_FREQ_M(16)>;
	#address-cells = <1>;
	#size-cells = <0>;
	rx-delay-supported;
	rx-delay = <0>;
	status = "okay";
	pinctrl-0 = <&spi4_default>;
	pinctrl-1 = <&spi4_sleep>;
    pinctrl-names = "default", "sleep";
};

&spi2 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    pinctrl-0 = <&spi2_default>;
    pinctrl-1 = <&spi2_sleep>;
	interrupts = <43 NRF_DEFAULT_IRQ_PRIORITY>;  // 9 for spi1
	max-frequency = <DT_FREQ_M(8)>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
	sdhc0: sdhc@0 {
		compatible = "zephyr,sdhc-spi-slot";
		reg = <0>;
		status = "okay";
		spi-max-frequency = <25000000>;
		mmc {
			compatible = "zephyr,sdmmc-disk";
			status = "okay";
		};
	};
	
};


&uart0 {
	status = "okay";
	compatible = "nordic,nrf-uarte";
	current-speed = <115200>; //921600 //112500
	pinctrl-0 = <&uart0_default>;
	pinctrl-1 = <&uart0_sleep>;
	pinctrl-names = "default", "sleep";
};


&button2 {
	//gpios = <&gpio0 7 0>;
	status = "disabled";
};

&button3 {
	gpios = <&gpio0 27 0>;
	status = "disabled";
};

&timer0 {
	status = "okay";
};
&timer1 {
	status ="okay";
};

&timer2 {
	status ="okay";
};


&i2c0 {	status = "disabled";};
&spi0 {	status = "disabled";};
&i2c1 {	status = "disabled";};
&adc { status = "disabled";};
&qspi { status = "disabled";};


&gpio_fwd {
	uart {
		gpios = <&gpio1 0 0>, <&gpio1 1 0>, <&gpio1 2 0>, <&gpio1 3 0>;
	};
	status = "okay";
};


 &uart1 {
 	status = "okay";
 	compatible = "nordic,nrf-uarte";
 	current-speed = <115200>; //921600 //112500
 	pinctrl-0 = <&uart1_default>;
 	pinctrl-1 = <&uart1_sleep>;
 	pinctrl-names = "default", "sleep";
 };

 / {
    chosen {
		zephyr,shell-uart = &uart1;
    };
	aliases {
		led0 = &led0;
		sw0  = &button0;
	};
};

This is the prj.conf file.

CONFIG_GPIO=y

# VCOM display
CONFIG_UART_NRFX=y
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_PRINTK=y
CONFIG_BOOT_BANNER=n
CONFIG_UART_CONSOLE=y

CONFIG_NRFX_SPIM4=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_LOG=y
#CONFIG_ASSERT=y
CONFIG_MAIN_STACK_SIZE=200000
CONFIG_SPI=y
CONFIG_NRF_APPROTECT_LOCK=y

#CONFIG_UART_0_ASYNC=y
#CONFIG_UART_0_INTERRUPT_DRIVEN=n
#CONFIG_NRFX_UARTE0=y

CONFIG_UART_1_ASYNC=y
CONFIG_UART_1_INTERRUPT_DRIVEN=n
CONFIG_NRFX_UARTE1=y

CONFIG_UART_MUX_DEVICE_NAME="uart1"

This is how I have defined the uart1 callback function.

const struct device *uart_user = DEVICE_DT_GET(DT_NODELABEL(uart1));
static void uart_user_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
        switch (evt->type) {
                case UART_RX_RDY:
                printk("UART_RX_RDY event\n");
            
                break;

                case UART_RX_DISABLED:
                printk("UART_RX_DISABLED event\n");
                break;
        
            case UART_RX_BUF_REQUEST:
                printk("UART_RX_BUF_REQUEST event\n");
                int err = uart_rx_buf_rsp(uart_user, rx_buf2, sizeof(rx_buf2));
		if (err) {
			printk("uart_rx_buf_rsp errored with code %d.\n", err);
		}
                break;
        

            default:
                printk("Evento UART inatteso: %d\n", evt->type);
                break;
  
            }
}

Related