<?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>nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115720/nrf5340-uart-interrupt-based-reads-in-secure-partition</link><description>I&amp;#39;m adapting the sample code for TF-M secure peripheral sample (NCS v2.5.0, nrf/samples/tfm/tfm_secure_peripheral ) to also add a UART peripheral. But this sample uses the older API (nrfx) which so far I&amp;#39;ve struggled with finding example code for. I was</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Nov 2024 20:28:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115720/nrf5340-uart-interrupt-based-reads-in-secure-partition" /><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/508854?ContentTypeID=1</link><pubDate>Fri, 01 Nov 2024 20:28:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d04200d5-a173-4370-8e6b-30a0dfd6d925</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;This is a good starting point for me to use, thank you. I&amp;#39;m able to confirm Tx and Rx working, w/ a couple adjustments. I could not get my debugger to work as it wouldn&amp;#39;t stop at any breakpoints I set, but that is fine for the moment.&lt;/p&gt;
&lt;p&gt;Will start testing this out, and will comment again if I run into more issues.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/508837?ContentTypeID=1</link><pubDate>Fri, 01 Nov 2024 15:22:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb6ee291-8a4b-40da-a22a-2cf598457b69</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The nrfx approach (which was used in the project you got yesterday) was not ideal, as interrupts needs to be handled specially in TF-M and that was not the case ther. It turns out that the cleanest is to avoid nrfx and use the lower-level HAL direcly, in th esame way as is allready done for SPIM in the sample. I put together a very simple sample now which does that: &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/tfm_5F00_secure_5F00_peripheral_5F00_uarte_5F00_hal.zip"&gt;devzone.nordicsemi.com/.../tfm_5F00_secure_5F00_peripheral_5F00_uarte_5F00_hal.zip&lt;/a&gt;. This is a minimal change from the existing sample in the SDK, but it does work and demonstrate both Tx and interrupt driven Rx. It sends &amp;quot;Nordic Seminoductor&amp;quot; once, and handles incomming Rx data. It does not process the data in any way, and just re-starts Rx when data is received, so to see that it works you can put a breakpoint in&amp;nbsp;tfm_uarte1_irq_flih() before sending data and see taht the uart_rx_buf is populated with the received data:&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/pastedimage1730474287257v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In addition to the changes in the&amp;nbsp;secure_peripheral_partition.c file and prj.conf, there are also some changes in the&amp;nbsp;tfm_secure_peripheral_partition.yaml needed for the interrupt handling (search for UARTE1 in that file), this is as described under &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/tfm/tfm_secure_peripheral/README.html#secure_interrupt"&gt;Secure interrupt&lt;/a&gt;&amp;nbsp;in the sample documentation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/508733?ContentTypeID=1</link><pubDate>Thu, 31 Oct 2024 21:57:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1572e736-cfad-4a11-996d-8ae177607d47</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;I tried out your code but it is still not working. I&amp;#39;m still seeing the UART (at P0.25) c&lt;span&gt;onstantly outputting &amp;#39;Booting TF-M v1.8.0&amp;#39; (must be constantly restarting I assume).&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;[Sec Thread] Secure image initializing!
Booting TF-M v1.8.0
Nordic Semiconductor[Sec Thread] Secure image initializing!
Booting TF-M v1.8.0
Nordic Semiconductor[Sec Thread] Secure image initializing!
Booting TF-M v1.8.0
Nordic Semiconductor
... (this keeps repeating over and over)&lt;/pre&gt;&lt;br /&gt;I&amp;#39;ve tried doing an &amp;#39;erase &amp;amp; flash&amp;#39;, making sure nothing is running on the network core (flashed the &amp;#39;empty_net_core&amp;#39; project at NCS v2.5.0, &lt;span style="text-decoration:underline;"&gt;nrf/samples/nrf5340/empty_net_core&lt;/span&gt;), etc.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Also recall that my original question is to get UART&amp;nbsp;working&amp;nbsp;&lt;span style="text-decoration:underline;"&gt;specifically with reading (not writing) data.&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;So I&amp;#39;m expecting code that also shows the basics of reading (using interrupts).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/508700?ContentTypeID=1</link><pubDate>Thu, 31 Oct 2024 15:24:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85128a74-df51-487b-9866-160af8d790d4</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am also helping in this ticket, and I am jumping in to give you an answer today, since Einar has gone home for the day. He will be back tomorrow.&lt;/p&gt;
&lt;p&gt;I tried my hand on strapping together the TF-M Secure Peripheral sample and the nrfx UARTE sample. While I would in no words call this test tidy, it at least works.&lt;/p&gt;
&lt;p&gt;Connect an UART reader to P0.25 and P0.26, and you should be able to see the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[Sec Thread] Secure image initializing!
Booting TF-M v1.8.0
Starting nrfx_uarte non-blocking example.
Content of TX buffer: Nordic Semiconductor
Content of RX buffer: 
Nordic Semiconductor
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;Contect&amp;quot; stuff is logging, but the last line &amp;quot;Nordic Semiconductor&amp;quot; is written over UART using nrfx.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/tfm_5F00_secure_5F00_peripheral_5F00_uart1.zip"&gt;devzone.nordicsemi.com/.../tfm_5F00_secure_5F00_peripheral_5F00_uart1.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I hope having code that runs can give you a good starting point to do what you want.&lt;br /&gt;Let us know if this is what you need&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/508599?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2024 23:56:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79d50cff-96a6-45ce-8b67-fe2b0ae6c966</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Hello. So it&amp;#39;s been about a week since I first posted&amp;nbsp;the project files that I&amp;#39;ve been trying. Even though I&amp;#39;ve been getting suggestions, it&amp;#39;s clear that&amp;nbsp;my specific project&amp;nbsp;has not been looked at, tried out on your end, etc.&amp;nbsp;I&amp;#39;d like to ask if this question&amp;#39;s priority could be moved up, and if I could get someone else (i.e., a senior engineer) to help provide more concrete and technical support please.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/508297?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 08:27:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2da118e-e9e2-4386-92b6-b893d57586dc</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Currently looking into integrating code from your colleague&amp;#39;s example into my own.&lt;/p&gt;
&lt;p&gt;However, if you have any thoughts about the following, I&amp;#39;d appreciate your thoughts on what else I can try. I&amp;#39;ve found that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Adding&amp;nbsp;&lt;span&gt;CONFIG_TFM_SECURE_UART1=y puts me back at the board constantly restarting.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Your colleague&amp;#39;s example&amp;nbsp;doesn&amp;#39;t build in SDK 2.5.0. I didn&amp;#39;t expect it to immediately build, but just to document, I&amp;#39;m seeing this build error
&lt;ul&gt;
&lt;li&gt;Traceback (most recent call last):&lt;br /&gt; File &amp;quot;C:/ncs/v2.5.0/modules/tee/tf-m/trusted-firmware-m/tools/tfm_parse_manifest_list.py&amp;quot;, line 723, in &amp;lt;module&amp;gt;&lt;br /&gt; main()&lt;br /&gt; File &amp;quot;C:/ncs/v2.5.0/modules/tee/tf-m/trusted-firmware-m/tools/tfm_parse_manifest_list.py&amp;quot;, line 711, in main&lt;br /&gt; context = process_partition_manifests(manifest_lists,&lt;br /&gt; File &amp;quot;C:/ncs/v2.5.0/modules/tee/tf-m/trusted-firmware-m/tools/tfm_parse_manifest_list.py&amp;quot;, line 303, in process_partition_manifests&lt;br /&gt; logging.info(&amp;quot; {:40s} ON&amp;quot;.format(manifest_item['description']))&lt;br /&gt;KeyError: &amp;#39;description&amp;#39;&lt;br /&gt;CMake Error at tools/CMakeLists.txt:192 (message):&lt;br /&gt; Manifest tool failed to generate files!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/508197?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 14:34:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9de583f9-a78d-4a92-bd2b-d54ef520ba12</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ah&amp;nbsp; yes. When disabling TF-M logging, that also disabled the UART driver etc. Setting&amp;nbsp;CONFIG_TFM_SECURE_UART1=y should fix this.&lt;/p&gt;
&lt;p&gt;A colleague of me made a sample some time ago using UARTE0 via nrfx drivers in a modified secure periperal partision sample that you can&amp;nbsp;refer to:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/tfm_5F00_secure_5F00_peripheral_5F00_uarte0.zip"&gt;devzone.nordicsemi.com/.../tfm_5F00_secure_5F00_peripheral_5F00_uarte0.zip&lt;/a&gt; (This was made for SDK 2.2, but there has not been that many changes since then related to this)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/507815?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2024 17:56:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7c33d60-5c77-4072-befc-d63c67c1f4ce</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;I tried adding&amp;nbsp;&lt;span&gt;CONFIG_TFM_LOG_LEVEL_SILENCE=y to prj.conf and could not build it. I got an error that looks like:&lt;br /&gt;&lt;br /&gt;C:/ncs/v2.5.0/modules/hal/nordic/nrfx/drivers/include/nrfx_uarte.h:70:35: error: &amp;#39;NRFX_UARTE1_INST_IDX&amp;#39; undeclared (first use in this function); did you mean &amp;#39;NRFX_UARTE_INSTANCE&amp;#39;?&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/507786?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2024 14:19:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39478e09-a5cd-48ac-9568-0eec491a8e62</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have not had a chance to test your applicaiton, but looking at it one thing sticks out.&amp;nbsp;UART1 is used by logging in TF-M by default, and you have not disabled it. So here it looks like you are trying to use UART1 for two things at the same time? (both for logging and directly in your&amp;nbsp;secure_peripheral_partition/secure_peripheral_partition.c)? Do you see a difference if you disable logging in TF-M (CONFIG_TFM_LOG_LEVEL_SILENCE)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/507441?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 18:33:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12369f90-febd-48d6-8633-09e22ddf6409</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;I tried adding it to the secure peripheral sample and it builds but the board keeps restarting. Could you help debug this please?&lt;/p&gt;
&lt;p&gt;Attached is the project. For context, I am developing on Windows 10 w/ VS Code (and the nRF Connect extension). I&amp;#39;m also using an &lt;strong&gt;nRF5340DK&lt;/strong&gt;.&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/tfm_5F00_secure_5F00_peripheral_5F00_20241022.zip"&gt;devzone.nordicsemi.com/.../tfm_5F00_secure_5F00_peripheral_5F00_20241022.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Summary of my changes include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Editing &lt;span&gt;secure_peripheral_partition&lt;/span&gt;/&lt;span&gt;secure_peripheral_partition.c, w/ UART init and interrupt handler&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Editing .conf file to add nrfx drivers for UART1&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Editing&amp;nbsp;secure_peripheral_partition/tfm_secure_peripheral_partition.yaml to add UART peripheral alongside timer and SPI&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Creating build config preset for nRF5340DK&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Symptoms of the restarting:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;No output on VCOM0 or VCOM1, even when I use RESET button to restart the board&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Constant output of &amp;#39;Booting TF-M v1.8.0&amp;#39; on secure partition output (nRF5340DK pin P0.25)&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;This next note can be addressed later (priority right now is just getting the above to work) but ideally, I need output from&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/114861/output-from-app-core-network-core-and-tf-m"&gt;app core, network core, and secure partition&lt;/a&gt;. I believe app core and network core will use UART0 and UART1 respectively, so I assume I need a separate one like UART2 for data transfer.&amp;nbsp;&lt;/span&gt;I did try adjusting the code for UART2 but it failed to build with an e&lt;span&gt;rror that looks like &amp;quot;C:/ncs/v2.5.0/modules/hal/nordic/nrfx/drivers/include/nrfx_uarte.h:70:35: error: &amp;#39;NRFX_UARTE2_INST_IDX&amp;#39; undeclared (first use in this function); did you mean &amp;#39;NRFX_UARTE1_INST_IDX&amp;#39;?&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340, UART interrupt-based reads in secure partition</title><link>https://devzone.nordicsemi.com/thread/507334?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 11:48:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c70cdf2-f264-4244-b154-b9e11da67fdc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The SDK includes nrfx UARTE samples under&amp;nbsp;modules/hal/nordic/nrfx/samples/src/nrfx_uarte/, including a non-blocking (interrupt-based) sample. (TF-M is not a Zephyr applicaiton, so you cannot use Zephyr APIS. But low-levle APIs like nrfx or HAL functionality can be used.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>