<?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 Re: CPU stops working after EnableInterrupts; in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130134#M1292</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Write a separate ISR for every vector? So you can see what is causing the interrupt.&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Sep 2006 15:42:30 GMT</pubDate>
    <dc:creator>Lundin</dc:creator>
    <dc:date>2006-09-14T15:42:30Z</dc:date>
    <item>
      <title>XAGTE CPU stops working after EnableInterrupts;</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130131#M1289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;I'm using MC9S12XDT256, but can't get it to work with interrupts. I'm trying to use the CAN module and want the receiver interrupt to work with this function&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 CODE_SEG NON_BANKEDvoid interrupt CAN4RxISR(void) {&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char length, index;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char rxdata[8];&amp;nbsp;&amp;nbsp;&amp;nbsp; length = (CAN4RXDLR &amp;amp; 0x0F); for (index=0; index&amp;lt;length; index++)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rxdata[index] = *(&amp;amp;CAN4RXDSR0 + index); /* Get received data */&amp;nbsp;&amp;nbsp;&amp;nbsp; CAN4RFLG = 0x01;&amp;nbsp;&amp;nbsp; /* Clear RXF */}#pragma CODE_SEG DEFAULT&lt;/PRE&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;I added the row VECTOR ADDRESS 0xFF92 CAN4RxISR in my .prm file (right address??). In main I added:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&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;void main(){CanInit();while(!(CAN4CTL0&amp;amp;0x10));&amp;nbsp; /* Wait for Synchronization */&amp;nbsp;&amp;nbsp; CAN4RFLG = 0xC3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Reset Receiver FlagsCAN4RIER = 0x01;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable Receive Buffer Full InterruptEnableInterrupts;for(;;)&lt;/PRE&gt;&lt;PRE&gt;...}&lt;/PRE&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;After executing the "EnableInterrupts;" row the processor&amp;nbsp;freaks out and no other&amp;nbsp;code executes.&amp;nbsp;What's wrong? I'm not using the XGATE functions nor have I written any code to disable it (do I have to)?&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 23:35:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130131#M1289</guid>
      <dc:creator>Peder</dc:creator>
      <dc:date>2006-09-13T23:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: CPU stops working after EnableInterrupts;</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130132#M1290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You need to make sure all other interrupt vectors are assigned to some code and vectors not left empty.&lt;/DIV&gt;&lt;DIV&gt;The probable scenario is you have another interrupt pending when you enable interrupt globablly and its vector is fetched.&lt;/DIV&gt;&lt;DIV&gt;If the vector fetched is not initialized, it causes troubles with the execution.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Also need to precise some language mistake.&lt;/DIV&gt;&lt;DIV&gt;XGATE CPU is not a term used. IT is either the CPU or the XGATE.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The XGATE works on event and is stopped otherwise. If you didn't give the XGATE any thread to execute it does not do anything.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alvin.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 23:46:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130132#M1290</guid>
      <dc:creator>Nabla69</dc:creator>
      <dc:date>2006-09-13T23:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: CPU stops working after EnableInterrupts;</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130133#M1291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Is there a way to see&amp;nbsp;which vector is beeing fetched? Maybe I can disable those interrupts that are running.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Right now I have made a _dummyISR function and added all interrupt vectors in my .prm file like this:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&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 CODE_SEG NON_BANKED#pragma TRAP_PROCvoid _dummyISR( void ){    for(;;)   {;}                                 }#pragma CODE_SEG DEFAULT&lt;/PRE&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;VECTOR  0   _Startup   /* reset vector: this is the default entry point for a C/C++ application. */VECTOR 1  _dummyISR  // 0xFFFC  Clock Monitor fail resetVECTOR 2  _dummyISR  // 0xFFFA  COP failure resetVECTOR 3  _dummyISR  // 0xFFF8  Illegal opcode...&lt;/PRE&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Still no code after EnableInterrupts; executes. When I stop the program I'm in the _dummyISR function and not in my main for-loop. &lt;IMG alt=":smileymad:" class="emoticon emoticon-smileymad" id="smileymad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-mad.gif" title="Smiley Mad" /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2006 01:31:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130133#M1291</guid>
      <dc:creator>Peder</dc:creator>
      <dc:date>2006-09-14T01:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: CPU stops working after EnableInterrupts;</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130134#M1292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Write a separate ISR for every vector? So you can see what is causing the interrupt.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2006 15:42:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130134#M1292</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2006-09-14T15:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: CPU stops working after EnableInterrupts;</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130135#M1293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I like this idea as you can even display on LED the vector number. I use it &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Otherwise, if you don't want to update the code, put a breakpoint inside the ISR&lt;/DIV&gt;&lt;DIV&gt;and look which interrupt flag is set. &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;That could be a little fastidious though.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'd advise to use a different ISR code for interrupt vectors linked to a Reset like Clock Minitor, COP and so on. This way you know straight away that somthing is bad !&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;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alvin.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2006 16:46:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130135#M1293</guid>
      <dc:creator>Nabla69</dc:creator>
      <dc:date>2006-09-14T16:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: CPU stops working after EnableInterrupts;</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130136#M1294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The solution is found. One extra friday beer for me&amp;nbsp;&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I did separate interrupt functions for a couple of interrupts and found that the IRQ interrupt was on by default. IRQCR = 0x00; did the thing! IRQCR was 0x40 at start and trigged on my grounded IRQ pin all the time after EnableInterrupts; was executed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Better head back to my CAN-repeater project. Thanks for all help!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;IMG src="http://www.hd.chalmers.se/~pa/img/freescale/CAN01.jpg" /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 18:06:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/XAGTE-CPU-stops-working-after-EnableInterrupts/m-p/130136#M1294</guid>
      <dc:creator>Peder</dc:creator>
      <dc:date>2006-09-15T18:06:06Z</dc:date>
    </item>
  </channel>
</rss>

