<?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>Is SWD (APPROTECT) disable possible programmatically while application is running on nRF5340?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126829/is-swd-approtect-disable-possible-programmatically-while-application-is-running-on-nrf5340</link><description>Hi Team, 
 I am working with nRF5340 and have a few clarifications regarding SWD protection (APPROTECT / ERASEPROTECT). 
 
 
 While the application is running, is it possible to disable SWD APProtect programmatically (for example, using a command in application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Feb 2026 05:10:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126829/is-swd-approtect-disable-possible-programmatically-while-application-is-running-on-nrf5340" /><item><title>RE: Is SWD (APPROTECT) disable possible programmatically while application is running on nRF5340?</title><link>https://devzone.nordicsemi.com/thread/560288?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 05:10:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd8cbb3b-c00a-465e-a969-4cb2b78ec3ce</guid><dc:creator>Nagari Gopal</dc:creator><description>&lt;p class="isSelectedEnd"&gt;&lt;span&gt;Thank you for the clarification.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;This helps clear our understanding of the expected behavior and supported approach.&lt;/span&gt;&lt;/p&gt;
&lt;p class="isSelectedEnd"&gt;&lt;span&gt;We appreciate your support.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;br /&gt;Nagari.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is SWD (APPROTECT) disable possible programmatically while application is running on nRF5340?</title><link>https://devzone.nordicsemi.com/thread/560263?ContentTypeID=1</link><pubDate>Tue, 03 Feb 2026 17:29:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d1dff33-ba8c-4ee4-9490-0370862b0fd3</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]&lt;span&gt;While the application is running, is it possible to &lt;/span&gt;&lt;strong&gt;&lt;span&gt;disable SWD APProtect programmatically&lt;/span&gt;&lt;/strong&gt;&lt;span&gt; (for example, using a command in application-specific shell / UART terminal)?&lt;/span&gt;[/quote]
&lt;p&gt;&lt;span&gt;If&amp;nbsp;&lt;/span&gt;&lt;span&gt;UICR.APPROTECT&lt;/span&gt;&lt;span&gt;&amp;nbsp;has&amp;nbsp;&lt;/span&gt;&lt;span&gt;not&lt;/span&gt;&lt;span&gt;&amp;nbsp;been enabled from UICR, both the debugger and on-chip firmware must write the same non-zero 32-bit KEY value into their respective registers&amp;nbsp;&lt;/span&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/ctrl-ap.html#unique_532153962"&gt;CTRLAP.APPROTECT.DISABLE&lt;/a&gt;&lt;span&gt;&amp;nbsp;(CPU-side) and&amp;nbsp;&lt;/span&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/ctrl-ap.html#register.APPROTECT.DISABLE"&gt;CTRLAP.APPROTECT.DISABLE&lt;/a&gt;&lt;span&gt;&amp;nbsp;(debugger-side) to disable the access port protection.&amp;nbsp;The CTRLAP registers can be accessed from the debugger if you use the Jlink Commander. See&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf5340/page/ctrl-ap.html#ariaid-title6"&gt;Disabling access port protection&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote user=""]&lt;span&gt;If &lt;/span&gt;&lt;strong&gt;&lt;span&gt;APPROTECT is enabled&lt;/span&gt;&lt;/strong&gt;&lt;span&gt;, can it be dynamically disabled from firmware during runtime, or is the &lt;/span&gt;&lt;strong&gt;&lt;span&gt;only supported way&lt;/span&gt;&lt;/strong&gt;&lt;span&gt; to regain debug access via &lt;/span&gt;&lt;strong&gt;&lt;span&gt;CTRL-AP / nrfjprog --recover&lt;/span&gt;&lt;/strong&gt;&lt;span&gt;?&lt;/span&gt;[/quote]
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;If&amp;nbsp;UICR.APPROTECT&amp;nbsp;has been enabled from UICR, the device access port is protected. It needs &lt;span&gt;nrfjprog --recover / CTRL‑AP.ERASEALL&lt;/span&gt;&amp;nbsp;to unlock the device. See&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/nan_042/page/APP/nan_production_programming/only_APPROTECT_enabled.html"&gt;Only APPROTECT is enabled&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;p&gt;&lt;span&gt;What happens if &lt;/span&gt;&lt;strong&gt;&lt;span&gt;both APPROTECT and ERASEPROTECT are enabled&lt;/span&gt;&lt;/strong&gt;&lt;span&gt; on nRF5340:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;span&gt;Is recovery still possible using CTRL-AP or nrfjprog?&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;span&gt;Or does enabling both protections permanently block recovery?&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;[/quote]
&lt;p&gt;If both&amp;nbsp;&lt;a title="A register used to prevent read and write access to all CPU registers and memory-mapped addresses." href="https://docs.nordicsemi.com/bundle/nan_042/page/dita_common/glossary/glossary.html#approtect"&gt;&lt;dfn&gt;APPROTECT&lt;/dfn&gt;&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a title="A register used to block NVMC ERASEALL, RRAMC ERASEALL, and CTRL-AP.ERASEALL functionality." href="https://docs.nordicsemi.com/bundle/nan_042/page/dita_common/glossary/glossary.html#eraseprotect"&gt;&lt;dfn&gt;ERASEPROTECT&lt;/dfn&gt;&lt;/a&gt;&amp;nbsp;are enabled, the access port and the ERASEALL functionality are unavailable. nrfjprog --recover / &lt;span&gt;CTRL-AP&amp;nbsp;ERASEALL command&lt;/span&gt;&amp;nbsp;will&amp;nbsp;not&amp;nbsp;work&lt;span&gt;&amp;nbsp;when ERASEPROTECT is enabled.&amp;nbsp;To unlock the device, it must have compatible firmware that provides a 32-bit non-zero KEY value to ERASEPROTECT.DISABLE. When both the debugger and firmware provide the same 32-bit non-zero KEY value to ERASEPROTECT.DISABLE, the device does a&amp;nbsp;&lt;a title="A custom access port that enables control of the device even if other access ports in the debug access port are disabled by the access port protection." href="https://docs.nordicsemi.com/bundle/nan_042/page/dita_common/glossary/glossary.html#ctrl-ap"&gt;&lt;dfn&gt;Control Access Port (CTRL-AP)&lt;/dfn&gt;&lt;/a&gt;&amp;nbsp;erase all operation. The access port is re-enabled on the next reset once the erase sequence is done.&amp;nbsp;&lt;/span&gt;See&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/nan_042/page/APP/nan_production_programming/approtect_eraseprotect_enabled.html"&gt;APPROTECT and ERASEPROTECT are enabled&lt;/a&gt;&lt;/p&gt;
[quote user=""]&lt;span&gt;In general, is there any &lt;/span&gt;&lt;strong&gt;&lt;span&gt;supported method to toggle APPROTECT at runtime&lt;/span&gt;&lt;/strong&gt;&lt;span&gt;, or is it intentionally designed as a one-way operation that requires external recovery tools to disable?&lt;/span&gt;[/quote]
&lt;p&gt;&lt;span&gt;It is intentionally not a simple runtime toggle. Once protections are enabled, it requires &lt;span&gt;nrfjprog --recover / CTRL‑AP&amp;nbsp;ERASEALL command&lt;/span&gt;&lt;span&gt;&amp;nbsp;to unlock the device. See&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/nan_042/page/APP/nan_production_programming/only_APPROTECT_enabled.html"&gt;Only APPROTECT is enabled&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>