<?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>How to read data coming from an external board via UART with nrF5340?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96077/how-to-read-data-coming-from-an-external-board-via-uart-with-nrf5340</link><description>Hi, I am new to the nordic world. I am interested in developing an application that allows me to send data via UART from an X board and read that data with the nordic nRF5340. 
 I am trying to follow the base explained in academy.nordicsemi.com/.../ however</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Jan 2023 17:48:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96077/how-to-read-data-coming-from-an-external-board-via-uart-with-nrf5340" /><item><title>RE: How to read data coming from an external board via UART with nrF5340?</title><link>https://devzone.nordicsemi.com/thread/406929?ContentTypeID=1</link><pubDate>Fri, 27 Jan 2023 17:48:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:611a8e4a-872a-4ae0-add0-03b53fc17f46</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi Miguel,&lt;br /&gt;&lt;br /&gt;Welcome to the Nordic world. Regarding UART, there is&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/zephyr/samples/drivers/uart/echo_bot/README.html"&gt;echo_bot&lt;/a&gt; sample which can help you to get started with Nordic development. When building the sample for nRF52840dk_nrf52840 in VS Code, you can see UART configuration in nrf52840dk_nrf52840-pinctrl.dtsi and nrf52840dk_nrf52840.dts files: Here is relevant application part in VS Code:&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/3252.echo_5F00_bot-sample.PNG" /&gt;&lt;br /&gt;&lt;br /&gt;Similar to Sandro&amp;#39;s answer, relevant (UART) configuration from&amp;nbsp;&lt;span&gt;nrf52840dk_nrf52840-pinctrl.dtsi file&lt;/span&gt;&amp;nbsp;is shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2022 Nordic Semiconductor
 * SPDX-License-Identifier: Apache-2.0
 */

&amp;amp;pinctrl {
	uart0_default: uart0_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_TX, 0, 6)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_RTS, 0, 5)&amp;gt;;
		};
		group2 {
			psels = &amp;lt;NRF_PSEL(UART_RX, 0, 8)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_CTS, 0, 7)&amp;gt;;
			bias-pull-up;
		};
	};

	uart0_sleep: uart0_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_TX, 0, 6)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_RX, 0, 8)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_RTS, 0, 5)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_CTS, 0, 7)&amp;gt;;
			low-power-enable;
		};
	};

	uart1_default: uart1_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_RX, 1, 1)&amp;gt;;
			bias-pull-up;
		};
		group2 {
			psels = &amp;lt;NRF_PSEL(UART_TX, 1, 2)&amp;gt;;
		};
	};

	uart1_sleep: uart1_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_RX, 1, 1)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_TX, 1, 2)&amp;gt;;
			low-power-enable;
		};
	};
...
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the same echo_bot sample, there is a file called&amp;nbsp;&lt;span&gt;nrf52840dk_nrf52840.dts with UART&amp;nbsp;&lt;/span&gt;configuration shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;uart0 {
	compatible = &amp;quot;nordic,nrf-uarte&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
	current-speed = &amp;lt;115200&amp;gt;;
	pinctrl-0 = &amp;lt;&amp;amp;uart0_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;uart0_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When building for nRF52840-DK board, both above-mentioned files are taken from &amp;lt;your_ncs_installation_folder&amp;gt;\zephyr\boards\arm\nrf52840dk_nrf52840 folder.&lt;br /&gt;&lt;br /&gt;You can read more about&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/howtos.html#devicetree-howtos"&gt;devicetree&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_pinctrl.html"&gt;pin control&lt;/a&gt;&amp;nbsp;in the documentation.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read data coming from an external board via UART with nrF5340?</title><link>https://devzone.nordicsemi.com/thread/406773?ContentTypeID=1</link><pubDate>Fri, 27 Jan 2023 06:49:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6def9544-2773-4ee4-8ee1-618e419a2054</guid><dc:creator>Sandro_r</dc:creator><description>&lt;p&gt;Hello Miguel,&lt;/p&gt;
&lt;p&gt;If you followed this base example closely and it does not work, a likely problem is that the devicetree-overlay is not complete.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&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;8 NRF_DEFAULT_IRQ_PRIORITY&amp;gt;;
		status = &amp;quot;okay&amp;quot;;
		current-speed = &amp;lt;115200&amp;gt;;
		pinctrl-0 = &amp;lt;&amp;amp;uart0_default&amp;gt;;
		pinctrl-1 = &amp;lt;&amp;amp;uart0_sleep&amp;gt;;
		pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};

&amp;amp;uart0_default {
		group1 {
				psels = &amp;lt;NRF_PSEL(UART_TX, 0, 29)&amp;gt;,
						&amp;lt;NRF_PSEL(UART_RTS, 0, 27)&amp;gt;;
		};
		group2 {
				psels = &amp;lt;NRF_PSEL(UART_RX, 0, 28)&amp;gt;,
						&amp;lt;NRF_PSEL(UART_CTS, 0, 26)&amp;gt;;
				bias-pull-up;
		};
};
&amp;amp;uart0_sleep {
		group1 {
				psels = &amp;lt;NRF_PSEL(UART_TX, 0, 29)&amp;gt;,
						&amp;lt;NRF_PSEL(UART_RX, 0, 28)&amp;gt;,
						&amp;lt;NRF_PSEL(UART_RTS, 0, 27)&amp;gt;,
						&amp;lt;NRF_PSEL(UART_CTS, 0, 26)&amp;gt;;
				low-power-enable;
		};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It should look something like that. You can choose the UART-GPIOs with the &amp;lsquo;psels&amp;rsquo; properties in the &amp;lsquo;uartX_default&amp;rsquo; and the &amp;lsquo;uartX_sleep&amp;rsquo; nodes which are referenced in the &amp;lsquo;uart0&amp;rsquo; node. To activate the UART driver the &amp;lsquo;status&amp;rsquo; property in the &amp;lsquo;uart0&amp;rsquo; node must be set to &amp;ldquo;okay&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;My process of creating the overlay is by looking up the needed nodes in the &amp;lsquo;Compiled devicetree output&amp;rsquo; (which can be opened in the SDK) and referencing them in the overlay with &amp;lsquo;&amp;amp;LABEL&amp;rsquo;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Sandro&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>