<?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>vscode启动debug失败！</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119352/vscode-debug</link><description>我尝试使用vscode进行debug，芯片型号为NRF52840，建立了一个空的工程，尝试编译烧录，这是成功的，但是debug失败</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Feb 2025 03:19:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119352/vscode-debug" /><item><title>RE: vscode启动debug失败！</title><link>https://devzone.nordicsemi.com/thread/524955?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2025 03:19:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9708b19-70f3-4343-8d2b-e5cde21ce5f9</guid><dc:creator>wildseyes</dc:creator><description>&lt;p data-start="67" data-end="111"&gt;&lt;strong data-start="67" data-end="109"&gt;Final Update: Root Cause Identified!&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/2705.svg" title="White check mark"&gt;&amp;#x2705;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p data-start="113" data-end="185"&gt;The real issue was not related to VS Code or J-Link GDB Server itself.&lt;/p&gt;
&lt;p data-start="187" data-end="405"&gt;I have an &lt;strong data-start="197" data-end="238"&gt;isolation module on the SWD interface&lt;/strong&gt; because I frequently debug motor drivers. This setup works well in &lt;strong data-start="306" data-end="340"&gt;STM32 development environments&lt;/strong&gt;, but it caused issues with the &lt;strong data-start="372" data-end="402"&gt;nRF52840 debugging process&lt;/strong&gt;.&lt;/p&gt;
&lt;p data-start="407" data-end="705"&gt;Earlier, I mistakenly assumed that manually starting the GDB Server fixed the issue. In reality, it just happened that I &lt;strong data-start="528" data-end="560"&gt;removed the isolation module&lt;/strong&gt; at the same time I manually started the server. This led to a &lt;strong data-start="623" data-end="644"&gt;false correlation&lt;/strong&gt;, making it seem like the external GDB Server was required.&lt;/p&gt;
&lt;h3 id="mcetoc_1il2mj2iq0" data-start="707" data-end="730"&gt;&lt;strong data-start="711" data-end="730"&gt;Final Solution:&lt;/strong&gt;&lt;/h3&gt;
&lt;ul data-start="731" data-end="919"&gt;
&lt;li data-start="731" data-end="806"&gt;&lt;strong data-start="733" data-end="770"&gt;Removing the SWD isolation module&lt;/strong&gt; allowed debugging to work normally.&lt;/li&gt;
&lt;li data-start="807" data-end="919"&gt;&lt;strong data-start="809" data-end="868"&gt;Now, VS Code automatically starts the J-Link GDB Server&lt;/strong&gt;, and everything works without manual intervention.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="921" data-end="1024"&gt;Lesson learned! Hopefully, this helps others who might run into similar hardware-related issues.&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f680.svg" title="Rocket"&gt;&amp;#x1f680;&lt;/span&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f525.svg" title="Fire"&gt;&amp;#x1f525;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: vscode启动debug失败！</title><link>https://devzone.nordicsemi.com/thread/524953?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2025 03:06:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5615642b-9760-4dc9-bed6-ee1ac30dd020</guid><dc:creator>wildseyes</dc:creator><description>&lt;p data-start="68" data-end="89"&gt;&lt;strong data-start="68" data-end="89"&gt;gdp translat:&lt;br /&gt;Solution Found!&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/2705.svg" title="White check mark"&gt;&amp;#x2705;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p data-start="91" data-end="252"&gt;I have resolved the debugging issue in &lt;strong data-start="130" data-end="141"&gt;VS Code&lt;/strong&gt; for &lt;strong data-start="146" data-end="158"&gt;nRF52840&lt;/strong&gt;.&lt;br data-start="159" data-end="162" /&gt;The key solution is to &lt;strong data-start="185" data-end="251"&gt;manually start J-Link GDB Server before launching the debugger&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 data-start="254" data-end="275"&gt;&lt;strong data-start="258" data-end="275"&gt;Steps to Fix:&lt;/strong&gt;&lt;/h3&gt;
&lt;ol data-start="276" data-end="579"&gt;
&lt;li data-start="276" data-end="430"&gt;&lt;strong data-start="279" data-end="315"&gt;Manually start J-Link GDB Server&lt;/strong&gt; before launching VS Code:
&lt;div&gt;
&lt;div&gt;bash&lt;/div&gt;
&lt;div&gt;
&lt;div class="absolute bottom-0 right-2 flex h-9 items-center"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="overflow-y-auto p-4" dir="ltr"&gt;&lt;code class="!whitespace-pre language-bash"&gt;&lt;span&gt;JLinkGDBServer -device NRF52840_XXAA -&lt;span class="hljs-keyword"&gt;if&lt;/span&gt; SWD -speed 4000 -port 2331
&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li data-start="431" data-end="579"&gt;&lt;strong data-start="434" data-end="480"&gt;Open VS Code and start debugging as usual.&lt;/strong&gt;&lt;br data-start="480" data-end="483" /&gt;No need to modify &lt;code data-start="504" data-end="517"&gt;launch.json&lt;/code&gt;&amp;mdash;VS Code will automatically connect to the running GDB Server.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 data-start="581" data-end="604"&gt;&lt;strong data-start="585" data-end="604"&gt;Why This Works?&lt;/strong&gt;&lt;/h3&gt;
&lt;ul data-start="605" data-end="830"&gt;
&lt;li data-start="605" data-end="735"&gt;Sometimes, VS Code tries to start its own GDB Server, which may use a different port (e.g., &lt;code data-start="699" data-end="706"&gt;46191&lt;/code&gt;), causing connection errors.&lt;/li&gt;
&lt;li data-start="736" data-end="830"&gt;Manually starting &lt;code data-start="756" data-end="772"&gt;JLinkGDBServer&lt;/code&gt; ensures the debugger connects correctly to &lt;strong data-start="816" data-end="829"&gt;port 2331&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="832" data-end="920"&gt;Thanks to everyone who contributed! Hope this helps others facing the same issue.&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f680.svg" title="Rocket"&gt;&amp;#x1f680;&lt;/span&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f525.svg" title="Fire"&gt;&amp;#x1f525;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: vscode启动debug失败！</title><link>https://devzone.nordicsemi.com/thread/524814?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2025 13:20:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46d080aa-abee-4c38-b3ae-992feacb72b3</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You need to write in English on this forum. To get familiar with developing and debugging with the nRF52, nRF53, and nRF54 family, do check out:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://academy.nordicsemi.com/"&gt;https://academy.nordicsemi.com/&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>