<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89941/using-4-uarts-of-nrf5340-at-the-same-time</link><description>Hi 
 I am using NRF5340 chip in my custom designed board and I want to use all the 4 UARTs available in this chip at the same time. 
 The interesting problem which I am confronting is that three of these UARTs work properly and answer to their interrupts</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Jul 2022 10:16:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89941/using-4-uarts-of-nrf5340-at-the-same-time" /><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377577?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2022 10:16:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a44c1d3-e829-4857-bf14-ea607f2499ec</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Saeed,&lt;/p&gt;
&lt;p&gt;Good job with fixing this!&lt;/p&gt;
&lt;p&gt;I were still working on a test for 4 uarts on my end, but met some bugs myself and was had not been able to complete it yet.&lt;/p&gt;
&lt;p&gt;I will mark your answer as the answer then. &lt;br /&gt;Good luck with your project&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377541?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2022 08:24:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48d83d6a-2686-46ef-af22-bce74695d30e</guid><dc:creator>saeed mahvis</dc:creator><description>&lt;p&gt;Hi Sigurd&lt;/p&gt;
&lt;p&gt;I want to inform you by changing the uart_init() functions as below the fourth uart also beccomes&lt;/p&gt;
&lt;p&gt;functional.&lt;pre class="ui-code" data-mode="text"&gt;static int uart3_init(void)
{
	uart_irq_rx_enable(uart3);
	int err;
	struct uart3_data_t *rx3;
	uart3 = device_get_binding(DT_LABEL(DT_NODELABEL(uart3)));
	
	rx3 = k_malloc(256);       //k_malloc(sizeof(*rx3));
	if (rx3)
	{
		rx3-&amp;gt;len3 = 0;
	}
	else
	{
		return -ENOMEM;
	}
	
	k_work_init_delayable(&amp;amp;uart3_work, uart3_work_handler);
	
        err = uart_callback_set(uart3, uart3_cb, NULL);
	if (err)
	{
		return err;
	}
	
	return uart_rx_enable(uart3, rx3-&amp;gt;data3, sizeof(rx3-&amp;gt;data3), 10);
	
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Actually by allocating memory statically ( rx3 = k_malloc(256) ) the problem was solved.&lt;/p&gt;
&lt;p&gt;The maximum number of bytes in my application will never exceed 250 .&lt;/p&gt;
&lt;p&gt;Any how ,I am so thankful for your paying attention.&lt;/p&gt;
&lt;p&gt;B.S.&lt;/p&gt;
&lt;p&gt;Saeed Mahvis&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377384?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 10:29:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51dbe628-269f-45f9-a7ff-73e5d25fd75c</guid><dc:creator>saeed mahvis</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;

&amp;amp;uart0 {
				compatible = &amp;quot;nordic,nrf-uarte&amp;quot;;
				reg = &amp;lt; 0x8000 0x1000 &amp;gt;;
				interrupts = &amp;lt; 0x8 0x1 &amp;gt;;
				status = &amp;quot;okay&amp;quot;;
				label = &amp;quot;UART_0&amp;quot;;
				current-speed = &amp;lt; 9600 &amp;gt;;
				tx-pin = &amp;lt; 0x14 &amp;gt;;
				rx-pin = &amp;lt; 0x16 &amp;gt;;
				
			};


&amp;amp;uart1 {
				compatible = &amp;quot;nordic,nrf-uarte&amp;quot;;
				reg = &amp;lt; 0x9000 0x1000 &amp;gt;;
				interrupts = &amp;lt; 0x9 0x1 &amp;gt;;
				status = &amp;quot;okay&amp;quot;;
				label = &amp;quot;UART_1&amp;quot;;
				current-speed = &amp;lt; 9600 &amp;gt;;
				tx-pin = &amp;lt; 0x21 &amp;gt;;
				rx-pin = &amp;lt; 0x20 &amp;gt;;
				rx-pull-up;
			};


&amp;amp;uart2 {
				compatible = &amp;quot;nordic,nrf-uarte&amp;quot;;
				reg = &amp;lt; 0xb000 0x1000 &amp;gt;;
				interrupts = &amp;lt; 0xb 0x1 &amp;gt;;
				status = &amp;quot;okay&amp;quot;;
				label = &amp;quot;UART_2&amp;quot;;
				current-speed = &amp;lt; 9600 &amp;gt;;
				tx-pin = &amp;lt; 0x1F &amp;gt;;
				rx-pin = &amp;lt; 0x0B &amp;gt;;
				rx-pull-up;
			};


&amp;amp;uart3 {
				compatible = &amp;quot;nordic,nrf-uarte&amp;quot;;
				reg = &amp;lt; 0xc000 0x1000 &amp;gt;;
				interrupts = &amp;lt; 0xc 0x1 &amp;gt;;
				status = &amp;quot;okay&amp;quot;;
				label = &amp;quot;UART_3&amp;quot;;
				current-speed = &amp;lt; 9600 &amp;gt;;
				tx-pin = &amp;lt; 0x2E &amp;gt;;
				rx-pin = &amp;lt; 0x2D &amp;gt;;
				rx-pull-up;
			};



&amp;amp;led0  {
			gpios = &amp;lt; &amp;amp;gpio0 0x1d 0x1 &amp;gt;;
			label = &amp;quot;Green LED 0&amp;quot;;
		};
&amp;amp;led1  {
			gpios = &amp;lt; &amp;amp;gpio0 0x1e 0x1 &amp;gt;;
			label = &amp;quot;Green LED 1&amp;quot;;
		};		
&amp;amp;led2  {
			gpios = &amp;lt; &amp;amp;gpio0 0x11 0x1 &amp;gt;;
			label = &amp;quot;Green LED 2&amp;quot;;
		};         

&amp;amp;led3  {
			gpios = &amp;lt; &amp;amp;gpio0 0x12 0x1 &amp;gt;;
			label = &amp;quot;Green LED 3&amp;quot;;
		};



&amp;amp;adc {
	compatible = &amp;quot;nordic,nrf-saadc&amp;quot;;
	reg = &amp;lt; 0xe000 0x1000 &amp;gt;;
	interrupts = &amp;lt; 0xe 0x1 &amp;gt;;
	status = &amp;quot;disabled&amp;quot;;
	label = &amp;quot;ADC_0&amp;quot;;
	#io-channel-cells = &amp;lt; 0x1 &amp;gt;;
	phandle = &amp;lt; 0x6 &amp;gt;;
};



&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hi again&lt;/p&gt;
&lt;p&gt;Its my overlay file too. I think it might be useful too.&lt;/p&gt;
&lt;p&gt;B.S.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377368?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 09:06:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4dd18c0-32d4-40a4-83d4-cae17eb9f23f</guid><dc:creator>saeed mahvis</dc:creator><description>&lt;p&gt;Hi Sigurd&lt;/p&gt;
&lt;p&gt;This is my prl.conf&lt;/p&gt;
&lt;p&gt;I&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# CONFIG_PM_DEVICE=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_BT_SMP=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

# Enable the UART driver
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y

CONFIG_GPIO=y

# Make sure printk is not printing to the UART console
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n

CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;KMS&amp;quot;
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_NUS_UART_BUFFER_SIZE=512
# Enable the NUS service
CONFIG_BT_NUS=y

# Enable bonding
# CONFIG_BT_SETTINGS=y
# CONFIG_FLASH=y
# CONFIG_FLASH_PAGE_LAYOUT=y
# CONFIG_FLASH_MAP=y
# CONFIG_NVS=y
# CONFIG_SETTINGS=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Config logger
CONFIG_LOG=n
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_ASSERT=y

CONFIG_ADC=y
# CONFIG_CBPRINTF_FP_SUPPORT=y&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377363?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 08:53:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c97bcce-00c0-4270-bcaa-3c605b2ef57c</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;I can see your code yes, thanks for the sample!&lt;/p&gt;
&lt;p&gt;When I run the code in a sample project of mine, it crashes. Could you add the prj.conf you used as well?&lt;/p&gt;
&lt;p&gt;Regard,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377248?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 17:24:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:567196fb-7032-4e43-ae06-238dfd8dfacd</guid><dc:creator>saeed mahvis</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

/** @file
 *  @brief Nordic UART Bridge Service (NUS) sample
 */

#include &amp;lt;zephyr/types.h&amp;gt;
#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;drivers/uart.h&amp;gt;
#include &amp;lt;drivers/gpio.h&amp;gt;

#include &amp;lt;device.h&amp;gt;
#include &amp;lt;soc.h&amp;gt;

#include &amp;lt;bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;bluetooth/uuid.h&amp;gt;
#include &amp;lt;bluetooth/gatt.h&amp;gt;
#include &amp;lt;bluetooth/hci.h&amp;gt;

#include &amp;lt;bluetooth/services/nus.h&amp;gt;

#include &amp;lt;dk_buttons_and_leds.h&amp;gt;

#include &amp;lt;settings/settings.h&amp;gt;

#include &amp;lt;stdio.h&amp;gt;

#include &amp;lt;logging/log.h&amp;gt;

#include &amp;lt;stdlib.h&amp;gt;

#include &amp;lt;kernel.h&amp;gt;
#include &amp;lt;devicetree.h&amp;gt;
// #include &amp;lt;pm/device.h&amp;gt;

#define LOG_MODULE_NAME peripheral_uart
LOG_MODULE_REGISTER(LOG_MODULE_NAME);

#define STACKSIZE CONFIG_BT_NUS_THREAD_STACK_SIZE
#define PRIORITY 7

#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)

#define RUN_STATUS_LED1 DK_LED1
#define RUN_STATUS_LED2 DK_LED2
#define RUN_STATUS_LED3 DK_LED3
#define RUN_STATUS_LED4 DK_LED4

static uint8_t led1flg;
static uint8_t led2flg;
static uint8_t led3flg;
static uint8_t led4flg;

#define led5 28	  // pin number for led5
#define rscon 12  // pin number for rscon
#define rscon1 27 // pin number for rscon1
#define rscon2 26 // pin number for rscon2
#define rscon3 25 // pin number for rscon3

#define rs0_connect_led DK_LED1
#define rs1_connect_led DK_LED2
#define rs2_connect_led DK_LED3
#define rs3_connect_led DK_LED4

#define UART_BUF_SIZE CONFIG_BT_NUS_UART_BUFFER_SIZE

#define UART_WAIT_FOR_BUF_DELAY K_MSEC(50)
#define UART_WAIT_FOR_RX CONFIG_BT_NUS_UART_RX_WAIT_TIME

#define baudrate38400 NRF_UARTE0-&amp;gt;BAUDRATE = UARTE_BAUDRATE_BAUDRATE_Baud38400
#define baudrate9600 NRF_UARTE0-&amp;gt;BAUDRATE = UARTE_BAUDRATE_BAUDRATE_Baud9600
#define baudrate115200 NRF_UARTE0-&amp;gt;BAUDRATE = UARTE_BAUDRATE_BAUDRATE_Baud115200

static const struct device *uart;
static uint8_t datarx0[250];
static uint8_t rxupdate0 = 0;
static uint8_t rxdatalen0;
static struct k_work_delayable uart_work;

struct uart_data_t
{
	void *fifo_reserved;
	uint8_t data[UART_BUF_SIZE];
	uint16_t len;
};


static const struct device *uart1;
static uint8_t datarx1[250];
static uint8_t rxupdate1 = 0;
static uint8_t rxdatalen1;
static struct k_work_delayable uart1_work;

struct uart1_data_t
{
	void *fifo_reserved;
	uint8_t data1[UART_BUF_SIZE];
	uint16_t len1;
};

static const struct device *uart2;
static uint8_t datarx2[250];
static uint8_t rxupdate2 = 0;
static uint8_t rxdatalen2;
static struct k_work_delayable uart2_work;

struct uart2_data_t
{
	void *fifo_reserved;
	uint8_t data2[UART_BUF_SIZE];
	uint16_t len2;
};

static const struct device *uart3;
static uint8_t datarx3[250];
static uint8_t rxupdate3 = 0;
static uint8_t rxdatalen3;
static struct k_work_delayable uart3_work;

struct uart3_data_t
{
	void *fifo_reserved;
	uint8_t data3[UART_BUF_SIZE];
	uint16_t len3;
};

// static K_FIFO_DEFINE(fifo_uart_tx_data);
// static K_FIFO_DEFINE(fifo_uart_rx_data);

static void uart_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
	int k;
	ARG_UNUSED(dev);
	//    static uint8_t *current_buf;
	//    static size_t aborted_len;
	static bool buf_release;
	struct uart_data_t *buf;
	//    static uint8_t *aborted_buf;

	switch (evt-&amp;gt;type)
	{
	case UART_RX_RDY:
		buf = CONTAINER_OF(evt-&amp;gt;data.rx.buf, struct uart_data_t, data);
		buf-&amp;gt;len += evt-&amp;gt;data.rx.len;
		buf_release = false;
		if (led1flg == 0)
		{
			led1flg = 1;
			dk_set_led_on(rs0_connect_led);
		}
		else
		{
			led1flg = 0;
			dk_set_led_off(rs0_connect_led);
		}

		// dk_set_led_on(rs0_connect_led);
		rxdatalen0 = buf-&amp;gt;len;
		for (k = 0; k &amp;lt; buf-&amp;gt;len; k++)
		{
			datarx0[k] = buf-&amp;gt;data[k]; // buf-&amp;gt;data[k];
		}

		// k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
		buf-&amp;gt;len = 0;
		buf_release = true;
		// uart_rx_disable(uart);
		uart_rx_enable(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data), 10);
		rxupdate0 = 1;
		break;
	}
}
static void uart_work_handler(struct k_work *item)
{
	// dk_set_led_on(rs0_connect_led);
	struct uart_data_t *buf;
	buf = k_malloc(sizeof(*buf));
	if (buf)
	{
		buf-&amp;gt;len = 0;
	}
	else
	{
		LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		k_work_reschedule(&amp;amp;uart_work, UART_WAIT_FOR_BUF_DELAY);
		return;
	}
	uart_rx_enable(uart, buf-&amp;gt;data, sizeof(buf-&amp;gt;data), 10);
}


static void uart1_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
	int k;
	ARG_UNUSED(dev);
	//    static uint8_t *current_buf;
	//    static size_t aborted_len;
	static bool buf_release;
	struct uart1_data_t *buf;
	//    static uint8_t *aborted_buf;

	switch (evt-&amp;gt;type)
	{
	case UART_RX_RDY:
		buf = CONTAINER_OF(evt-&amp;gt;data.rx.buf, struct uart1_data_t, data1);
		buf-&amp;gt;len1 += evt-&amp;gt;data.rx.len;
		buf_release = false;
		if (led2flg == 0)
		{
			led2flg = 1;
			dk_set_led_on(rs1_connect_led);
		}
		else
		{
			led2flg = 0;
			dk_set_led_off(rs1_connect_led);
		}

		// dk_set_led_on(rs0_connect_led);
		rxdatalen1 = buf-&amp;gt;len1;
		for (k = 0; k &amp;lt; buf-&amp;gt;len1; k++)
		{
			datarx1[k] = buf-&amp;gt;data1[k]; // buf-&amp;gt;data[k];
		}

		// k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
		buf-&amp;gt;len1 = 0;
		buf_release = true;
		// uart_rx_disable(uart);
		uart_rx_enable(uart1, buf-&amp;gt;data1, sizeof(buf-&amp;gt;data1), 10);
		rxupdate1 = 1;
		break;
	}
}
static void uart1_work_handler(struct k_work *item)
{
	// dk_set_led_on(rs0_connect_led);
	struct uart1_data_t *buf;
	buf = k_malloc(sizeof(*buf));
	if (buf)
	{
		buf-&amp;gt;len1 = 0;
	}
	else
	{
		LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		k_work_reschedule(&amp;amp;uart1_work, UART_WAIT_FOR_BUF_DELAY);
		return;
	}
	uart_rx_enable(uart1, buf-&amp;gt;data1, sizeof(buf-&amp;gt;data1), 10);
}


static void uart2_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
	int k;
	ARG_UNUSED(dev);
	//    static uint8_t *current_buf;
	//    static size_t aborted_len;
	static bool buf_release;
	struct uart2_data_t *buf;
	//    static uint8_t *aborted_buf;

	switch (evt-&amp;gt;type)
	{
	case UART_RX_RDY:
		buf = CONTAINER_OF(evt-&amp;gt;data.rx.buf, struct uart2_data_t, data2);
		buf-&amp;gt;len2 += evt-&amp;gt;data.rx.len;
		buf_release = false;
		if (led3flg == 0)
		{
			led3flg = 1;
			dk_set_led_on(rs2_connect_led);
		}
		else
		{
			led3flg = 0;
			dk_set_led_off(rs2_connect_led);
		}

		// dk_set_led_on(rs0_connect_led);
		rxdatalen2 = buf-&amp;gt;len2;
		for (k = 0; k &amp;lt; buf-&amp;gt;len2; k++)
		{
			datarx2[k] = buf-&amp;gt;data2[k]; // buf-&amp;gt;data[k];
		}

		// k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
		buf-&amp;gt;len2 = 0;
		buf_release = true;
		// uart_rx_disable(uart);
		uart_rx_enable(uart2, buf-&amp;gt;data2, sizeof(buf-&amp;gt;data2), 10);
		rxupdate2 = 1;
		break;
	}
}
static void uart2_work_handler(struct k_work *item)
{
	// dk_set_led_on(rs0_connect_led);
	struct uart2_data_t *buf;
	buf = k_malloc(sizeof(*buf));
	if (buf)
	{
		buf-&amp;gt;len2 = 0;
	}
	else
	{
		LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		k_work_reschedule(&amp;amp;uart2_work, UART_WAIT_FOR_BUF_DELAY);
		return;
	}
	uart_rx_enable(uart2, buf-&amp;gt;data2, sizeof(buf-&amp;gt;data2), 10);
}

static void uart3_cb(const struct device *dev, struct uart_event *evt, void *user_data)
{
	int k;
	ARG_UNUSED(dev);
	//    static uint8_t *current_buf;
	//    static size_t aborted_len;
	static bool buf_release;
	struct uart3_data_t *buf;
	//    static uint8_t *aborted_buf;

	switch (evt-&amp;gt;type)
	{
	case UART_RX_RDY:
		buf = CONTAINER_OF(evt-&amp;gt;data.rx.buf, struct uart3_data_t, data3);
		buf-&amp;gt;len3 += evt-&amp;gt;data.rx.len;
		buf_release = false;
		if (led4flg == 0)
		{
			led4flg = 1;
			dk_set_led_on(rs3_connect_led);
		}
		else
		{
			led4flg = 0;
			dk_set_led_off(rs3_connect_led);
		}

		// dk_set_led_on(rs0_connect_led);
		rxdatalen3 = buf-&amp;gt;len3;
		for (k = 0; k &amp;lt; buf-&amp;gt;len3; k++)
		{
			datarx3[k] = buf-&amp;gt;data3[k]; // buf-&amp;gt;data[k];
		}

		// k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
		buf-&amp;gt;len3 = 0;
		buf_release = true;
		// uart_rx_disable(uart);
		uart_rx_enable(uart3, buf-&amp;gt;data3, sizeof(buf-&amp;gt;data3), 10);
		rxupdate3 = 1;
		break;
	}
}
static void uart3_work_handler(struct k_work *item)
{
	// dk_set_led_on(rs0_connect_led);
	struct uart3_data_t *buf;
	buf = k_malloc(sizeof(*buf));
	if (buf)
	{
		buf-&amp;gt;len3 = 0;
	}
	else
	{
		LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);
		k_work_reschedule(&amp;amp;uart3_work, UART_WAIT_FOR_BUF_DELAY);
		return;
	}
	uart_rx_enable(uart3, buf-&amp;gt;data3, sizeof(buf-&amp;gt;data3), 10);
}


static int uart_init(void)
{
	uart_irq_rx_enable(uart);
	int err;
	struct uart_data_t *rx;
	uart = device_get_binding(DT_LABEL(DT_NODELABEL(uart0)));
	
	rx = k_malloc(sizeof(*rx));
	if (rx)
	{
		rx-&amp;gt;len = 0;
	}
	else
	{
		return -ENOMEM;
	}
	
	k_work_init_delayable(&amp;amp;uart_work, uart_work_handler);
	
        err = uart_callback_set(uart, uart_cb, NULL);
	if (err)
	{
		return err;
	}
	
	return uart_rx_enable(uart, rx-&amp;gt;data, sizeof(rx-&amp;gt;data), 10);
	
}

static int uart1_init(void)
{
	uart_irq_rx_enable(uart1);
	int err;
	struct uart1_data_t *rx1;
	uart1 = device_get_binding(DT_LABEL(DT_NODELABEL(uart1)));
	
	rx1 = k_malloc(sizeof(*rx1));
	if (rx1)
	{
		rx1-&amp;gt;len1 = 0;
	}
	else
	{
		return -ENOMEM;
	}
	
	k_work_init_delayable(&amp;amp;uart1_work, uart1_work_handler);
	
        err = uart_callback_set(uart1, uart1_cb, NULL);
	if (err)
	{
		return err;
	}
	
	return uart_rx_enable(uart1, rx1-&amp;gt;data1, sizeof(rx1-&amp;gt;data1), 10);
	
}


static int uart2_init(void)
{
	uart_irq_rx_enable(uart2);
	int err;
	struct uart2_data_t *rx2;
	uart2 = device_get_binding(DT_LABEL(DT_NODELABEL(uart2)));
	
	rx2 = k_malloc(sizeof(*rx2));
	if (rx2)
	{
		rx2-&amp;gt;len2 = 0;
	}
	else
	{
		return -ENOMEM;
	}
	
	k_work_init_delayable(&amp;amp;uart2_work, uart2_work_handler);
	
        err = uart_callback_set(uart2, uart2_cb, NULL);
	if (err)
	{
		return err;
	}
	
	return uart_rx_enable(uart2, rx2-&amp;gt;data2, sizeof(rx2-&amp;gt;data2), 10);
	
}
static int uart3_init(void)
{
	uart_irq_rx_enable(uart3);
	int err;
	struct uart3_data_t *rx3;
	uart3 = device_get_binding(DT_LABEL(DT_NODELABEL(uart3)));
	
	rx3 = k_malloc(sizeof(*rx3));
	if (rx3)
	{
		rx3-&amp;gt;len3 = 0;
	}
	else
	{
		return -ENOMEM;
	}
	
	k_work_init_delayable(&amp;amp;uart3_work, uart3_work_handler);
	
        err = uart_callback_set(uart3, uart3_cb, NULL);
	if (err)
	{
		return err;
	}
	
	return uart_rx_enable(uart3, rx3-&amp;gt;data3, sizeof(rx3-&amp;gt;data3), 10);
	
}

static K_SEM_DEFINE(ble_init_ok, 0, 1);
static uint8_t adv_array[29] = {0};
// static uint8_t sdv_array[29] = {0};
//  Set advertise Response data //
static struct bt_data ad[] = {
	//        BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
	BT_DATA(BT_DATA_MANUFACTURER_DATA, adv_array, sizeof(adv_array)),

};
// Set Scan Response data //
/*static  struct bt_data sd[] = {
	//BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
		BT_DATA(BT_DATA_BROADCAST_CODE, sdv_array, sizeof(sdv_array)),

};*/
static uint8_t adv_array1[29];
// static uint8_t sdv_array1[29];

void bluetoothupdate(void)
{
	struct bt_data ad[] = {
		// BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
		BT_DATA(BT_DATA_MANUFACTURER_DATA, adv_array1, sizeof(adv_array1)),
	};
	//    struct bt_data sd[] = {
	// BT_DATA(BT_DATA_BROADCAST_CODE, sdv_array1, sizeof(sdv_array1)),
	// };

	bt_le_adv_update_data(ad, ARRAY_SIZE(ad), 0, 0); // sd, ARRAY_SIZE(sd));
}

uint8_t carrier1[13] = {0x30, 0x00, 0xEF, 0x00, 0x03, 0x00, 0x00,
						0x0B, 0x00, 0x07, 0x09, 0x84, 0x26}; // sensor command
uint8_t carrier2[13] = {0x30, 0x00, 0xEF, 0x00, 0x03, 0x00, 0x00,
						0x0B, 0x00, 0x0F, 0x02, 0xC2, 0x21}; // set point
uint8_t carrier3[13] = {0x30, 0x00, 0xEF, 0x00, 0x03, 0x00, 0x00,
						0x0B, 0x00, 0x05, 0x01, 0x84, 0x80}; // container ID
uint8_t carrier4[13] = {0x30, 0x00, 0xEF, 0x00, 0x03, 0x00, 0x00,
						0x0B, 0x00, 0x07, 0x08, 0x45, 0xE6}; // alarm&amp;amp;inrange

uint8_t daikin1[9] = {
	0x16, 0x16, 0x76, 0x60, 0xFF, 0xFF, 0xFF, 0xE6, 0x4B};					 // container ID command
uint8_t daikin2[9] = {0x16, 0x16, 0x07, 0x0C, 0xFF, 0xFF, 0xFF, 0x87, 0x10}; // sensors command

static uint8_t index0p0[29], index1p0[29], index2p0[29], index3p0[29];
static uint8_t index0p1[29], index1p1[29], index2p1[29], index3p1[29];
static uint8_t index0p2[29], index1p2[29], index2p2[29], index3p2[29];
static uint8_t index0p3[29], index1p3[29], index2p3[29], index3p3[29];

static uint8_t thread0flg = 0, thread1flg = 0,thread2flg = 0,thread3flg = 0;

const struct uart_config uart_cfg9600 = {.baudrate = 9600,
										 .parity = UART_CFG_PARITY_NONE,
										 .stop_bits = UART_CFG_STOP_BITS_1,
										 .data_bits = UART_CFG_DATA_BITS_8,
										 .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};

const struct uart_config uart_cfg38400 = {.baudrate = 38400,
										  .parity = UART_CFG_PARITY_NONE,
										  .stop_bits = UART_CFG_STOP_BITS_1,
										  .data_bits = UART_CFG_DATA_BITS_8,
										  .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};

const struct uart_config uart1_cfg9600 = {.baudrate = 9600,
										  .parity = UART_CFG_PARITY_NONE,
										  .stop_bits = UART_CFG_STOP_BITS_1,
										  .data_bits = UART_CFG_DATA_BITS_8,
										  .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};

const struct uart_config uart1_cfg38400 = {.baudrate = 38400,
										   .parity = UART_CFG_PARITY_NONE,
										   .stop_bits = UART_CFG_STOP_BITS_1,
										   .data_bits = UART_CFG_DATA_BITS_8,
										   .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};

const struct uart_config uart2_cfg9600 = {.baudrate = 9600,
										  .parity = UART_CFG_PARITY_NONE,
										  .stop_bits = UART_CFG_STOP_BITS_1,
										  .data_bits = UART_CFG_DATA_BITS_8,
										  .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};

const struct uart_config uart2_cfg38400 = {.baudrate = 38400,
										   .parity = UART_CFG_PARITY_NONE,
										   .stop_bits = UART_CFG_STOP_BITS_1,
										   .data_bits = UART_CFG_DATA_BITS_8,
										   .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};
													   
const struct uart_config uart3_cfg9600 = {.baudrate = 9600,
										  .parity = UART_CFG_PARITY_NONE,
										  .stop_bits = UART_CFG_STOP_BITS_1,
										  .data_bits = UART_CFG_DATA_BITS_8,
										  .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};

const struct uart_config uart3_cfg38400 = {.baudrate = 38400,
										   .parity = UART_CFG_PARITY_NONE,
										   .stop_bits = UART_CFG_STOP_BITS_1,
										   .data_bits = UART_CFG_DATA_BITS_8,
										   .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};
			
////////////////////////////////////////////////////////////////////////

void main()
{
	uint8_t j, data[13];
    const struct device* port1 =device_get_binding(&amp;quot;GPIO_1&amp;quot;); // get the device address of port1
    k_sleep(K_MSEC(100));
    const struct device* port0 =device_get_binding(&amp;quot;GPIO_0&amp;quot;); // get the device address of port0
	k_sleep(K_MSEC(100));
    gpio_pin_configure(port0, led5,	GPIO_OUTPUT); //set the pin for led5 as output high
	k_sleep(K_MSEC(100));
	gpio_pin_configure(port0, rscon, GPIO_INPUT); // set the pin for rscon as input 
	k_sleep(K_MSEC(100));
	gpio_pin_configure(port0, rscon1, GPIO_INPUT); // set the pin for rscon1 as input
	k_sleep(K_MSEC(100));
	gpio_pin_configure(port0, rscon2, GPIO_INPUT); // set the pin for rscon2 as input
	k_sleep(K_MSEC(100));
	gpio_pin_configure(port0, rscon3, GPIO_INPUT); // set the pin for rscon3 as input
	k_sleep(K_MSEC(100));
        
    uart_init();
	uart1_init();
    uart2_init();
    uart3_init();
    dk_leds_init();

	bt_enable(NULL);
	k_sem_give(&amp;amp;ble_init_ok);
	if (IS_ENABLED(CONFIG_SETTINGS))
	{
		settings_load();
	}
	bt_le_adv_start(BT_LE_ADV_NCONN_IDENTITY, ad, ARRAY_SIZE(ad), 0, 0);

	
    uart_configure(uart2, &amp;amp;uart2_cfg9600);
    uart_configure(uart3, &amp;amp;uart3_cfg9600);
    while(1)
	{    
/*  ////////////////////////////////send data test  
	for (int k = 0; k &amp;lt; 13; k++)
	{
	 data[k] = carrier3[k];
	}
    uart_tx(uart2, data, 13, SYS_FOREVER_MS);
*/
    ///////////////////////////////recieve data test
	if(rxupdate3==1)
	{
		rxupdate3 = 0;
		for ( int k =0; k&amp;lt; rxdatalen3 ; ++k)
		{
			data[k] = datarx3[k];
		}
        uart_tx(uart3, data, rxdatalen3, SYS_FOREVER_MS); 
	}
	
	if(rxupdate2==1)
	{
		rxupdate2 = 0;
		for ( int k =0; k&amp;lt; rxdatalen2 ; ++k)
		{
			data[k] = datarx2[k];
		}
        uart_tx(uart2, data, rxdatalen2, SYS_FOREVER_MS); 
	}
    
	k_sleep(K_MSEC(1000));
	gpio_pin_toggle(port0,led5);

	}
}
              &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hi Sigurd&lt;/p&gt;
&lt;p&gt;I tried to insert my sample code at top. I don&amp;#39;t know if you can see it correctly. If you can&amp;#39;t see please guide me how I&lt;/p&gt;
&lt;p&gt;can send it for you. Any how, in this program all four uarts initializations and call backs are present. A terminal program&lt;/p&gt;
&lt;p&gt;( doclight for example) will send some serial data to uarts 2 or 3 and send it back to terminal to test its functionality.&lt;/p&gt;
&lt;p&gt;As I mentioned before when the uart_init() routine sequence in the main routine is changed the forth uart responding&lt;/p&gt;
&lt;p&gt;is changed. All the three other uarts are working perfectly. This is not my actual project. I have just written this to test&lt;/p&gt;
&lt;p&gt;all four uarts functionality.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;B.S.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377231?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 14:27:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b5e72af-9ca4-4511-ac3e-d90392229d51</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;I think you should be able to use all 4 at the same time.&lt;/p&gt;
&lt;p&gt;Do you get any error messages when you do not receive RX from the UART, or is it no callback at all?&lt;/p&gt;
&lt;p&gt;I am trying to change the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0/zephyr/samples/drivers/uart/echo_bot/README.html"&gt;UART Driver Sample&lt;/a&gt; to use all 4 uarts to reproduce your issue.&lt;br /&gt;If you have an minimal example for me, I could start debugging sooner.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377026?ContentTypeID=1</link><pubDate>Thu, 14 Jul 2022 15:45:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4de9619a-4b33-4955-8353-64e31713aa95</guid><dc:creator>saeed mahvis</dc:creator><description>&lt;p&gt;Hi Sigurd&lt;/p&gt;
&lt;p&gt;Is this means only 3 uarts can be used simultaneously?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using 4 uarts of NRF5340 at the same time</title><link>https://devzone.nordicsemi.com/thread/377025?ContentTypeID=1</link><pubDate>Thu, 14 Jul 2022 15:29:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9907052-fb56-4fc7-80cb-89ddcc58c315</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I suspect that the network core is using the last UART. &lt;br /&gt;But I have not been able to find exactly how(and if) yet, so I will continue looking into your case tomorrow.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>