<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>S12 / MagniV MicrocontrollersのトピックRe: Detecting debug mode at run-time</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Detecting-debug-mode-at-run-time/m-p/215656#M9017</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless you are using hotplug debugging, almost every debug session happens in special single chip mode. To distinct special from normal mode, you can use&amp;nbsp;MODE register MODC bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if( MODE &amp;amp; MODE_MODC_MASK )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //normal mode detected, BKGD pin wasn't pulled low on reset&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Sep 2009 11:17:30 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2009-09-11T11:17:30Z</dc:date>
    <item>
      <title>Detecting debug mode at run-time</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Detecting-debug-mode-at-run-time/m-p/215655#M9016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MC9S12XDT256&lt;/P&gt;&lt;P&gt;P&amp;amp;E USB ML12 and True-Time debugger&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to determine at run-time if my debugger is in control.&amp;nbsp;I have an external watchdog that resets the CPU&amp;nbsp;when&amp;nbsp;it hits a breakpoint but&amp;nbsp;the external watchdog can be disabled during initialization if the firmware can reliably determine when it is in debug mode. So, I need to determine if the debuger MIGHT stop the CPU later and disable the watchdog in my powerup code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a solution that reads the DBGC1 register to determine the mode. I found that this register is either 0x00 when not debugging or 0xB0 or 0xBC when the debugger is connected. I have read the ref manual on the Debug module but I'm not sure I understand it very well. It doesn't look like I can rely on more than three bits to be in a known state in all debug modes. So right now this is my solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if((DBGC1 &amp;amp; 0xB0) == 0xB0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the reliability of this watchdog is critical, I need to make sure that the solution is foolproof.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone can confirm my findings or suggest a better solution to my problem, I would appreciate it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2009 08:05:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Detecting-debug-mode-at-run-time/m-p/215655#M9016</guid>
      <dc:creator>dwhite</dc:creator>
      <dc:date>2009-09-11T08:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting debug mode at run-time</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Detecting-debug-mode-at-run-time/m-p/215656#M9017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless you are using hotplug debugging, almost every debug session happens in special single chip mode. To distinct special from normal mode, you can use&amp;nbsp;MODE register MODC bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if( MODE &amp;amp; MODE_MODC_MASK )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //normal mode detected, BKGD pin wasn't pulled low on reset&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2009 11:17:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Detecting-debug-mode-at-run-time/m-p/215656#M9017</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2009-09-11T11:17:30Z</dc:date>
    </item>
  </channel>
</rss>

