<?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>Programmatic reset of ARM Cortex-M4 through J-Link Plus</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114820/programmatic-reset-of-arm-cortex-m4-through-j-link-plus</link><description>I&amp;#39;ve written a custom manufacturing programming tool for ARM Cortex-M4 nRF52832 and nRF52810 devices. It uses a J-Link Plus USB programmer (J-Link V7.98g) and is implemented in Python using the Pylink package. The program configures J-Link to use SWD</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Sep 2024 13:33:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114820/programmatic-reset-of-arm-cortex-m4-through-j-link-plus" /><item><title>RE: Programmatic reset of ARM Cortex-M4 through J-Link Plus</title><link>https://devzone.nordicsemi.com/thread/503415?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2024 13:33:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7093aeef-98a6-4f15-99af-1cc79040f026</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="jonestn"]&lt;p&gt;​I&amp;#39;ve confirmed that I can work around the issue using&amp;nbsp;Pylink&amp;#39;s&lt;span&gt;&amp;nbsp;&lt;/span&gt;open(), connect(), read(),&lt;span&gt;&amp;nbsp;&lt;/span&gt;close() operations each time I need to use the J-Link API. In hindsight, the lack of a J-Link disconnect() operation should have been a red flag as well as the target_connected() call only returning the true state immediately after connect().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My program can now poll the J-Link interface to determine if a target device is connected or not, and to read the device details and&lt;span&gt;&amp;nbsp;&lt;/span&gt;FICR identity. After close() the device returns to the expected low power state.&lt;/p&gt;[/quote]
&lt;p&gt;Great to hear that you were able to work around the issue. Hope you have a wonderful day!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Programmatic reset of ARM Cortex-M4 through J-Link Plus</title><link>https://devzone.nordicsemi.com/thread/503406?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2024 13:10:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a770c2f-0579-4fad-8f8f-6ca0092669a8</guid><dc:creator>jonestn</dc:creator><description>&lt;p&gt;​I&amp;#39;ve confirmed that I can work around the issue using&amp;nbsp;Pylink&amp;#39;s&lt;span&gt;&amp;nbsp;&lt;/span&gt;open(), connect(), read(),&lt;span&gt;&amp;nbsp;&lt;/span&gt;close() operations each time I need to use the J-Link API. In hindsight, the lack of a J-Link disconnect() operation should have been a red flag as well as the target_connected() call only returning the true state immediately after connect().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My program can now poll the J-Link interface to determine if a target device is connected or not, and to read the device details and&lt;span&gt;&amp;nbsp;&lt;/span&gt;FICR identity. After close() the device returns to the expected low power state.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Programmatic reset of ARM Cortex-M4 through J-Link Plus</title><link>https://devzone.nordicsemi.com/thread/503219?ContentTypeID=1</link><pubDate>Fri, 20 Sep 2024 08:26:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd8c51a8-b57e-4450-85ad-b88082402702</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Reset and halt will stop the CPU, thus causing a higher current consumption.&lt;/p&gt;
&lt;p&gt;However; a debug reset / soft reset / pin-reset will cause the cpu to run, so the current consumption heavily depends on what is actually programmed into the nRF itself.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Another scenario can be that the debugger interface is kept on, which causes a &amp;gt;1.2 mA floor current, and it highly depends on what the debugger is doing at this point in time. Having the probe actively connected (ie. not close the connection) will likely keep the debugger IF active.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Since you mention 3 mA, it can also be caused by the firmware running on your device, provided that the debug IF is indeed closed at this point in time.&lt;/p&gt;
&lt;p&gt;Try attaching a debug session to the currently active solution to see if the nRF is stuck on executing a certain function/loop, like explained here:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/105508/how-can-i-attaching-to-a-running-target-52832-with-j-link/454970"&gt;RE: How Can I  Attaching to a Running Target(52832) with  J-Link&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Programmatic reset of ARM Cortex-M4 through J-Link Plus</title><link>https://devzone.nordicsemi.com/thread/503152?ContentTypeID=1</link><pubDate>Thu, 19 Sep 2024 14:36:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce1f7247-1ab4-47ef-a379-c693cb771d64</guid><dc:creator>jonestn</dc:creator><description>&lt;p&gt;Thank you for the quick response and suggestions&amp;nbsp;H&amp;aring;kon. After further investigation, I&amp;#39;ve confirmed that &amp;quot;nrfjprog --reset&amp;quot; is doing the same reset as J-Flash. I&amp;#39;m looking for the device to go&amp;nbsp;into low power mode after programming (~2uA at 3v). It does after J-Flash (F9) but not after my programmatic reset.&lt;/p&gt;
&lt;p&gt;The difference seems to be&amp;nbsp;that my application has the J-Link DLL open (&lt;a href="https://pylink.readthedocs.io/en/latest/pylink.html#pylink.jlink.JLink.open)"&gt;pylink.readthedocs.io/.../pylink.html&lt;/a&gt; while performing the reset. The reset occurs, but the J-Link DLL then forces the device back to a higher power state (~3mA at 3v). If the program closes the DLL before reset, the low power state is achieved. If I close my Python application while the J-Link probe is connected, the device is automatically reset and drops into the low power state.&lt;/p&gt;
&lt;p&gt;I do not think this is a Pylink issue. I can recreate the same effect using J-Flash and J-Link. I think the J-Link DLL behaviour is the root cause, but that J-Flash operates in such a way as to avoid or workaround the behaviour.&lt;/p&gt;
&lt;p&gt;Please let me know if you have any further comments.&amp;nbsp;I believe I can now refactor my Python application to work around the J-Link DLL behaviour. I&amp;#39;ll post here with the outcome once I&amp;#39;ve confirmed that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Programmatic reset of ARM Cortex-M4 through J-Link Plus</title><link>https://devzone.nordicsemi.com/thread/503117?ContentTypeID=1</link><pubDate>Thu, 19 Sep 2024 12:12:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec204a39-2d77-4398-9385-cf451d4bf408</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;p&gt;I&amp;#39;m &lt;span&gt;exec()&amp;#39;ing&amp;nbsp;&lt;/span&gt;nrfjprog to program the application code and UICR. I tried using --reset, --pinreset and --hardreset to reset the processor, but these do not perform the same reset as J-Flash. The&amp;nbsp;board pulls the nRF52 Reset pin high, so perhaps none of these methods can work.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve seen that the J-Flash Start Application (F9) function performs a correct reset of the Cortex-M4 target processor, logging;&lt;br /&gt; - Reset: Halt core after reset via DEMCR.VC_CORERESET.&lt;br /&gt; - Reset: Reset device via AIRCR.SYSRESETREQ.&lt;/p&gt;[/quote]
&lt;p&gt;reset via AIRCR is a so-called softreset, and can be triggered via &amp;quot;--debugreset&amp;quot; to nrfjprog. Could you try this one and see if that works better?&lt;/p&gt;
&lt;p&gt;That should be equal to this reset type:&amp;nbsp;&lt;a href="https://wiki.segger.com/J-Link_Reset_Strategies#Type_0:_Normal"&gt;https://wiki.segger.com/J-Link_Reset_Strategies#Type_0:_Normal&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>