<?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>topic How to Debug Unimplemented ISR in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136143#M4223</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My Code is locking up and when I stop the code, I am sitting in the Unimplemented ISR, does anyone have any strategy for handling this? there isn't a full out clear all Interrupt flags I'm sure.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Nov 2006 21:32:11 GMT</pubDate>
    <dc:creator>mjcoury</dc:creator>
    <dc:date>2006-11-10T21:32:11Z</dc:date>
    <item>
      <title>How to Debug Unimplemented ISR</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136143#M4223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My Code is locking up and when I stop the code, I am sitting in the Unimplemented ISR, does anyone have any strategy for handling this? there isn't a full out clear all Interrupt flags I'm sure.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2006 21:32:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136143#M4223</guid>
      <dc:creator>mjcoury</dc:creator>
      <dc:date>2006-11-10T21:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to Debug Unimplemented ISR</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136144#M4224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi MJ,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;To avoid being stuck or unwanted Reset, it's good practise to declare ALL interrupt vectors and have a proper function handling them.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You could have a generic function like:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;#pragma TRAP_PROCvoid _dummyISR( void ){      ErrorCode = 1;}&lt;/PRE&gt;&lt;DIV&gt;&lt;BR /&gt;That function would just report it to your system.&lt;/DIV&gt;&lt;DIV&gt;Or you consider having an unexpected interrupt is serious and therefore do something like:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;#pragma TRAP_PROCvoid _dummyISR( void ){                                    /* endless cycle */    for(;;){    }}&lt;/PRE&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;If the COP is activated, it will generate a Reset.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;By analyzing the stack when you stop the execution, you will be able to see the Return address.&lt;/DIV&gt;&lt;DIV&gt;This return address will tell you when the ISR was called and could help you find the source.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you put a different function for each ISR (even if do the same thing), you will be able to get which interrupt occured by looking at the address of the current ISR being executed.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Hope this&amp;nbsp;will help,&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;Alban.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2006 21:56:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136144#M4224</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2006-11-10T21:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to Debug Unimplemented ISR</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136145#M4225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello mjcoury,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Your situation is not entirely clear to me.&amp;nbsp; Does the "Unimplemented ISR" that you refer to consist of code that you have written, and&amp;nbsp;does not&amp;nbsp;exit?&amp;nbsp; Or,&amp;nbsp;after a break occurs, is the program counter set to an address within the &lt;U&gt;interrupt vector&lt;/U&gt; block in flash, perhaps due to runaway code elsewhere?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Are you observing this problem during simulation, or with operation of the actual hardware?&amp;nbsp; If the latter, are you actually setting a breakpoint to "stop the code"?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The method that Alban outlined will handle spurious interrupts that may occur, and is recommended, but I am unsure whether this is the cause of your current lockup problem.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 11:21:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136145#M4225</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-11-11T11:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to Debug Unimplemented ISR</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136146#M4226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;You aren't necessarily sitting in your "Unimplemeted ISR". Every time you stop the code it will look like you haven't budged... although you did, for a VERY SHORT while.&lt;BR /&gt;&lt;BR /&gt;Since you don't know the cause of the INT you are not servicing/clearing the source. The ISR will exit normally (unless your routine looks like ALBAN's second variant) and then come right back in a few cycles. A casdcade, an avalanche... and no stack crash to help you out!!&lt;BR /&gt;&lt;BR /&gt;Al&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Nov 2006 12:01:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136146#M4226</guid>
      <dc:creator>Geezer</dc:creator>
      <dc:date>2006-11-11T12:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Debug Unimplemented ISR</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136147#M4227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I'm not sure I get what you're implying right, but I can list what I do when I have problems like this.&lt;BR /&gt;&lt;BR /&gt;First, I write a different vector handler for EVERY interrupt. Even if it does nothing but set a flag and then jump to a common handler. That way you can figure out what is really going on.&lt;BR /&gt;&lt;BR /&gt;Secondly, I write all the stuff I put in my ISRs so that they are callable routines from foreground tasks. Once I have them working THEN I make them 'called' from the interrupt vector.&lt;BR /&gt;&lt;BR /&gt;One thing to watch for is saving everything. Even if you don't think you're useing it, save every register. Once it's working THEN start looking for how to save space and compact things. I got burnt once on not saving the high byte of an index pointer that wasn't automatically saved by the hardware. Turned out it was 'assumed' that it would always be pointed to the base. If you touch it, save and restore it. If you use it, don't depend on a default.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Nov 2006 02:11:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136147#M4227</guid>
      <dc:creator>mke_et</dc:creator>
      <dc:date>2006-11-12T02:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to Debug Unimplemented ISR</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136148#M4228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;the demo code i was using had a UnimpletementIsr()function that was solely&lt;BR /&gt;&lt;BR /&gt;UnimplementedIsr(){&lt;BR /&gt;for(;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;{&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;When I added the FLL loop, I did not handle the ISR that could happen. So when I had a out lock condition, the code would get dropped into the loop. Only after I made a interrupt function for every interrupt case was I able to determine that it was indeed the FLL out of lock ISR.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:49:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/How-to-Debug-Unimplemented-ISR/m-p/136148#M4228</guid>
      <dc:creator>mjcoury</dc:creator>
      <dc:date>2006-11-16T07:49:47Z</dc:date>
    </item>
  </channel>
</rss>

