<?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>TrustedZone, options to access internal flash asynchronously</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116121/trustedzone-options-to-access-internal-flash-asynchronously</link><description>I am currently working w/ a project that utilizes TrustedZone and PSA Protected Storage to read/write to internal flash that&amp;#39;s accessible only in the secure partition (I&amp;#39;m using the flash to store data like states, configurations of peripherals, etc)</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Mar 2025 17:33:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116121/trustedzone-options-to-access-internal-flash-asynchronously" /><item><title>RE: TrustedZone, options to access internal flash asynchronously</title><link>https://devzone.nordicsemi.com/thread/527719?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2025 17:33:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad04a765-e51d-4324-84a0-423050a06879</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;PSA PS write calls take quite a lot of time. The effect of using partial erase is that interrupt latency can drop close to configured erase duration, but psa_ps_set duration is probably going to be somewhat higher than in case without partial erase.&amp;nbsp;&lt;span&gt;TF-M could probably do n partial erases instead in which case it is expected that each&amp;nbsp;&lt;/span&gt;psa_ps_set call becomes even slower.&lt;br /&gt;&lt;span&gt;Whether or not you are using PSA PS, there is still page erase time to be dealt with, which is max 87.5 ms, according to the flash programming section (chapter 7.21.9.1) of the nrf5340 product specification.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TrustedZone, options to access internal flash asynchronously</title><link>https://devzone.nordicsemi.com/thread/527288?ContentTypeID=1</link><pubDate>Fri, 14 Mar 2025 00:47:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62aa83ca-290c-4a9f-998d-a53bca0912dc</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Hello, and sorry for the late reply. My company is beginning to revisit this topic again.&lt;/p&gt;
&lt;p&gt;To recap, it seems like PSA PS would be the only option for my use case (using it in TrustedZone and for putting general types of encrypted data), and PSA PS does not support asynchronous operations as-is. Is this correct?&amp;#39;&lt;/p&gt;
&lt;p&gt;If so, then perhaps there are some options for reducing the time spent during those operations? For example, is the partial page erase you mentioned something available in PSA PS? What about KConfig options and/or flags (like &lt;span&gt;TFM_PARTITION_INTERNAL_TRUSTED_STORAGE&lt;/span&gt;)? Could these potentially offer faster reads/writes?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TrustedZone, options to access internal flash asynchronously</title><link>https://devzone.nordicsemi.com/thread/509417?ContentTypeID=1</link><pubDate>Thu, 07 Nov 2024 10:57:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:525c4863-4340-4a73-9e60-d0e2a35c2728</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="esmart-engineering"]I found the blog earlier as well but it seems to imply PSA PS as the only option for &lt;span style="text-decoration:underline;"&gt;what can be used in TrustedZone&lt;/span&gt; (i.e., the only one &lt;span style="text-decoration:underline;"&gt;providing isolation and encryption&lt;/span&gt;). I wanted to ask if this was accurate. Also, the post is over a year old, so I wanted to see if there have been any updates since then.[/quote]
&lt;p&gt;PSA Crypto persistent keys should be used for key material. Otherwise, PSA PS should be used. There is also PSA ITS, but it is not recommended to be used directly.&lt;br /&gt;&lt;br /&gt;There does not seem to be a way for prioritizing other activities every 2-3 ms over flash read/write operations. It can be expected that there is always some PS/ITS operations that would require more than several ms. Reducing interrupt latency during flash writes would require some changes to the flash driver code in TF-M.&lt;br /&gt;&lt;br /&gt;For potential flash page erase, page erase time should also be taken into account.&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/nvmc.html"&gt;nRF5340 product specification&lt;/a&gt;&amp;nbsp;provides information on&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/nvmc.html#ariaid-title3"&gt;erasing secure page in flash&lt;/a&gt;. You can look at&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/ip/nvmc/doc/partial_erase.html#concept_partial_erase"&gt;partial page erase&lt;/a&gt;&amp;nbsp;in flash.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TrustedZone, options to access internal flash asynchronously</title><link>https://devzone.nordicsemi.com/thread/509348?ContentTypeID=1</link><pubDate>Thu, 07 Nov 2024 04:58:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:673d5f27-c44c-4db8-b8d8-bb2bdab89b5f</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;I&amp;#39;m using an nRF5340DK, Windows 10 machine, VS Code IDE, and NCS v2.5.0. The examples I based my code off of are located at&amp;nbsp;&lt;span&gt;&lt;span style="text-decoration:underline;"&gt;nrf/samples/tfm/tfm_secure_peripheral&lt;/span&gt; and at&amp;nbsp;&lt;span style="text-decoration:underline;"&gt;zephyr/samples/tfm_integration/psa_protected_storage&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Time measurements were very rough, but I have a part of the project that writes about 10-15 default values at the very beginning (some are 1-2 bytes, others maybe 100 bytes). It took roughly 30 seconds for all of them to finish, so I estimated roughly 1-2 seconds per write. Still working on&amp;nbsp;getting a logic analyzer hooked up for more detailed timing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I believe the write calls, psa_ps_set(), are doing the blocking. Seems like the read calls, psa_ps_get(), do this as well? Not 100% sure yet;&amp;nbsp;still confirming it w/ logic analyzer, though I&amp;#39;m pretty certain it&amp;#39;s the flash reads/writes.&lt;/li&gt;
&lt;li&gt;It&amp;#39;s not that I cannot use PSA PS at all. PSA PS has been used as described above, and works fine, all except for the timing. I&amp;#39;m asking if there are Kconfig options and such to fix my timing issue; otherwise&amp;nbsp;I would be&amp;nbsp;forced to find another library/API.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;As I tried to explained in my original post, I&amp;#39;m calling PSA functions from within the secure partition, so that I can read/write to the secure partition.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I found the blog earlier as well but it seems to imply PSA PS as the only option for &lt;span style="text-decoration:underline;"&gt;what can be used in TrustedZone&lt;/span&gt; (i.e., the only one &lt;span style="text-decoration:underline;"&gt;providing isolation and encryption&lt;/span&gt;). I wanted to ask if this was accurate. Also, the post is over a year old, so I wanted to see if there have been any updates since then.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TrustedZone, options to access internal flash asynchronously</title><link>https://devzone.nordicsemi.com/thread/509293?ContentTypeID=1</link><pubDate>Wed, 06 Nov 2024 15:19:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ac8c1de-18fb-48a2-92d6-3cf00deee1e5</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Which board and which NCS version do you use?&lt;br /&gt;&lt;br /&gt;How did you measure that 1-2 seconds are required for writing to the flash?&lt;br /&gt;&lt;br /&gt;Which calls get blocked?&lt;/p&gt;
[quote user=""]Are there any Kconfig options, flags during function calls, etc. that can fix this issue and allow me to continue using PSA PS?[/quote]
&lt;p&gt;Are you not able to use it at all? Can you elaborate how you tried to use PSA PS and why you are not able to use it?&lt;/p&gt;
[quote user=""]Does PSA PS handle timeslots i.e., MPSL? Is there anything related to timeslots that I can try on my project to prioritize the &amp;#39;every 2-3ms activity&amp;#39; over flash reads/writes?[/quote]
&lt;p&gt;It does not look like that MPSL (i.e. having PSA calls inside timeslots) could help in this case. MPSL is running on network core which does not have secure/non-secure split. Where are you calling PSA functions from?&lt;/p&gt;
[quote user=""]Would NVS be accessible in TrustedZone?
&lt;ol&gt;
&lt;li&gt;We used NVS in a prototype, before we introduced TrustedZone. It would be ideal to&amp;nbsp;reuse this.&lt;/li&gt;&lt;/ol&gt;[/quote]
&lt;p&gt;There is a blog which lists&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/persistent-storage-of-keys-and-data-using-the-nrf-connect-sdk"&gt;storage alternatives for data&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>