<?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 does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/125052/how-does-tf-m-select-uart1-pins</link><description>Hello DevZone, 
 I have a confusing question about TF-M. Need help from a TF-M expert. 
 In this document , it says that we must disable uart1 in non-secure application, because TF-M use it as secure peripheral. 
 My question is: how does TF-M select</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Oct 2025 06:21:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/125052/how-does-tf-m-select-uart1-pins" /><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/552013?ContentTypeID=1</link><pubDate>Tue, 21 Oct 2025 06:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:355e1930-5b10-4431-9fb7-1db5d4abd041</guid><dc:creator>Jayant Tang</dc:creator><description>&lt;p&gt;I have confirmed that:&lt;/p&gt;
&lt;p&gt;1. TF-M doesn&amp;#39;t have a stand alone sysbuild configuration, it is a part of the Application&lt;/p&gt;
&lt;p&gt;2. TF-M will use application&amp;#39;s non-secure uart1 pinctrl, even if uart1 is disabled.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SERIAL=y
CONFIG_TFM_LOG_LEVEL_SILENCE=n&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;uart1 {
    status = &amp;quot;disabled&amp;quot;;
};

&amp;amp;pinctrl{
	uart1_default: uart1_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_TX, 0, 16)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_RTS, 0, 14)&amp;gt;;
		};
		group2 {
			psels = &amp;lt;NRF_PSEL(UART_RX, 0, 17)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_CTS, 0, 15)&amp;gt;;
			bias-pull-up;
		};
	};

	uart1_sleep: uart1_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(UART_TX, 0, 16)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_RX, 0, 17)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_RTS, 0, 14)&amp;gt;,
				&amp;lt;NRF_PSEL(UART_CTS, 0, 15)&amp;gt;;
			low-power-enable;
		};
	};
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:331px;max-width:248px;" height="331" src="https://devzone.nordicsemi.com/resized-image/__size/496x662/__key/communityserver-discussions-components-files/4/pastedimage1761027535431v1.jpeg" width="248" alt=" " /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1761027643061v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551973?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 15:18:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f81e4fd-26a5-4dd5-9b22-a211af252ad7</guid><dc:creator>Jayant Tang</dc:creator><description>&lt;p&gt;I understand that sysbuild is used for multi-image building.&lt;/p&gt;
&lt;p&gt;But TF-M seems to be special. There is no way in sysbuild to configure the TF-M overlay.&lt;/p&gt;
&lt;p&gt;More preciously, TF-M is more like a part of application, rather than an independent image:&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760970713592v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;After many&amp;nbsp;times searching, I finally found that TF-M never use Zephyr serial driver.&lt;/p&gt;
&lt;p&gt;All the answers are in these header files:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760972976414v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In `device_cfg.h` we have:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760973030462v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In `RTE_device.h` we have:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760973086708v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760973102665v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760973116490v5.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In `tfm_peripherals_config.h`, we have:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760973191554v6.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, that means TF-M can directly read the non-secure Application&amp;#39;s final `zephyr.dts`, and read the pin-ctrl of uart1, even if uart1 is disabled.&lt;/p&gt;
&lt;p&gt;And this question:&lt;/p&gt;
[quote userid="121165" url="~/f/nordic-q-a/125052/how-does-tf-m-select-uart1-pins"]how can I choose a peripheral as secure or non-secure in NCS? Should I configure this in Devicetree or Kconfig?[/quote]
&lt;p&gt;The answer is to set CONFIG_NRF_XXXX_SECURE.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So everything seems to be clear now. And this&amp;nbsp;&lt;/p&gt;
[quote userid="121165" url="~/f/nordic-q-a/125052/how-does-tf-m-select-uart1-pins/551927"]You mean when I select `nrf9160dk/nrf9160/ns` for my application, the TF-M will use `nrf9160dk/nrf9160` automatically. Because they are in the same board folder.[/quote]
&lt;p&gt;seems&amp;nbsp;not to be correct.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;I will test this tomorrow&amp;nbsp;and get back here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551928?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 11:54:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6eab31ea-7b29-4e5c-92e2-79a0252170ec</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;I believe the way to do it now is to add an overlay file for it to a sysbuild directory;&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/build/sysbuild/index.html#zephyr_application_configuration"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/build/sysbuild/index.html#zephyr_application_configuration&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551927?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 11:34:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:083a783c-7404-4a63-981d-d9437ca10561</guid><dc:creator>Jayant Tang</dc:creator><description>&lt;p&gt;Wow, that is more clear for me.&lt;/p&gt;
&lt;p&gt;You mean when I select `nrf9160dk/nrf9160/ns` for my application, the TF-M will use `nrf9160dk/nrf9160` automatically. Because they are in the same board folder.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;But when I choose the ns for my application, it seems that there is no way to set a `.overlay` devicetree file in sysbuild subfolder to modify the pins of TF-M. Is that correct?&lt;/p&gt;
&lt;p&gt;I remember when in NCS v2.2.0, I can set overlay of SPM in &amp;quot;child_image&amp;quot; subfolder.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551906?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 09:23:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf256fbd-c874-4db2-b75c-92feff576631</guid><dc:creator>Hakon</dc:creator><description>[quote user="Jayant Tang"]In this case, when building a non-secure firmware with TF-M, which device tree file will TF-M use?[/quote]
&lt;p&gt;TFM itself will be built with the secure version of the dts file. For the application, the non-secure dts file will be used.&lt;/p&gt;
[quote user="Jayant Tang"]If TF-M, as a secure firmware, relies on pin configurations from a non-secure device tree, that seems inconsistent. Isn’t that correct?[/quote]
&lt;p&gt;Yeah, but it does not. TFM does not use a non-secure device tree file at all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551892?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 07:53:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e76eafb-558d-4fe5-bcd4-66c115970db5</guid><dc:creator>Jayant Tang</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Let me describe a scenario: I am creating a custom board in Zephyr with two separate device tree files (.dts) &amp;mdash; one for secure world (&amp;quot;board_s.dts&amp;quot;) and one for non-secure world (&amp;quot;board_ns.dts&amp;quot;). Instead of using a common pin-control configuration, I define different pin-control settings in each of these files.&lt;/p&gt;
&lt;p&gt;In this case, when building a non-secure firmware with TF-M, which device tree file will TF-M use?&lt;/p&gt;
&lt;p&gt;I assume it should use &amp;quot;board_ns.dts&amp;quot;, as that aligns with the build process for non-secure firmware. However, considering the address mapping of peripherals on the AHB/APB bus, all peripherals described in the non-secure device tree are located in the non-secure domain.&lt;/p&gt;
&lt;p&gt;This leads to a conceptual distinction. For example:&lt;/p&gt;
&lt;p&gt;- Including `&amp;lt;nordic/nrf9160ns_sica.dtsi&amp;gt;` (non-secure) &lt;br /&gt;- vs. including `&amp;lt;nordic/nrf9160_sica.dtsi&amp;gt;` (secure)&lt;/p&gt;
&lt;p&gt;If TF-M, as a secure firmware, relies on pin configurations from a non-secure device tree, that seems inconsistent. Isn&amp;rsquo;t that correct?&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;em&gt;&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551890?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 07:33:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:decae5ad-2975-4d02-afb8-6eef690af5a8</guid><dc:creator>Hakon</dc:creator><description>[quote user="Jayant Tang"]If it use the same dts as the application, does that means the TF-M only refer to the pin-ctrl part of &lt;strong&gt;non-secure&lt;/strong&gt; `zephyr.dts` ?&amp;nbsp;[/quote]
&lt;p&gt;I&amp;#39;m not sure if I understand this question correctly. The&amp;nbsp;nrf9160dk_nrf9160_common-pinctrl.dtsi file is included in non-secure and secure dts file as you mentioned. So that part is common. Other than that, the files use different dts settings entirely. That&amp;#39;s why there are two files to begin with.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551817?ContentTypeID=1</link><pubDate>Fri, 17 Oct 2025 12:51:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84aa2a40-acb8-47bb-a187-1bfcc623dbef</guid><dc:creator>Jayant Tang</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote userid="73166" url="~/f/nordic-q-a/125052/how-does-tf-m-select-uart1-pins/551810"]I would assume the pins used are the ones you find in&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_common-pinctrl.dtsi"&gt;nrf9160dk_nrf9160_common-pinctrl.dtsi file&lt;/a&gt;.[/quote]
&lt;p&gt;Yes. But I want to get it more precisely.&lt;/p&gt;
&lt;p&gt;Since `nrf9160dk_nrf9160_common-pinctrl.dtsi` is included both in 9160 secure dts and 9160 non-secure dts, which one is the original dts file that be selected by TF-M?&lt;br /&gt;If it use the same dts as the application, does that means the TF-M only refer to the pin-ctrl part of &lt;strong&gt;non-secure&lt;/strong&gt; `zephyr.dts` ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How does TF-M select UART1 pins?</title><link>https://devzone.nordicsemi.com/thread/551810?ContentTypeID=1</link><pubDate>Fri, 17 Oct 2025 12:16:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26325de4-a2d6-4ac2-aa6b-44ad836596e6</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]My question is: how does TF-M select the pins used by uart1_secure?[/quote]
&lt;p&gt;I would assume the pins used are the ones you find in&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_common-pinctrl.dtsi"&gt;nrf9160dk_nrf9160_common-pinctrl.dtsi file&lt;/a&gt;.&lt;/p&gt;
[quote user=""]More general question: how can I choose a peripheral as secure or non-secure in NCS? Should I configure this in Devicetree or Kconfig?[/quote]
&lt;p&gt;You should use kconfig for this. Check out this document;&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/tfm/tfm_secure_peripheral/README.html#enabling_secure_peripheral"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/tfm/tfm_secure_peripheral/README.html#enabling_secure_peripheral&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>