<?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: 9S12DP512 SCI Interrupts hang MCU in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155357#M4646</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;#pragma interrupt_handler &lt;FONT color="#ff0000"&gt;SCI1&lt;BR /&gt;&lt;/FONT&gt;void &lt;FONT color="#ff0000"&gt;SCI1_Handler&lt;/FONT&gt;(void)&lt;BR /&gt;{&lt;BR /&gt;...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;names don't match. You could check&amp;nbsp;listing files and find that SCI1_Handler ends not with RTI.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 May 2008 10:58:59 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2008-05-12T10:58:59Z</dc:date>
    <item>
      <title>9S12DP512 SCI Interrupts hang MCU</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155356#M4645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;I am trying to get an SCI Tx/Rx driver interrupt driven. I got stuck when my program kept hanging up every time I got a TX-Interrupt, so I am going down to the very basics and start from there. Before I dump the code on you, some info about what I'm using.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MCU : MC9S12DP512 (4L00M)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Board: Elmicro CARDS12&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Monitor: Twinpeeks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Debugging: none, can only work with the monitor &lt;/SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank"&gt;&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Compiler: ICC12&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The simple code I am trying to get to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#pragma interrupt_handler SCI1void SCI1_Handler(void){
 int dummy;
 dummy = SCI1SR1;
 SCI1DRL = 0x55;
 SCI1CR2 &amp;amp;= ~SCI_TIE;
 printf("SCICR2 = %x\n\r",SCI1CR2);}void main(){
 // Clockspeed = 24Mhz
 CLKSEL &amp;amp;= ~BM_PLLSEL;&amp;nbsp; // make sure PLL is *not* in use
 PLLCTL |= BM_PLLON+BM_AUTO; // enable PLL module, Auto Mode
 REFDV = S12_REFDV;&amp;nbsp; // set up Reference Divider
 SYNR = S12_SYNR;&amp;nbsp; // set up Synthesizer Multiplier
 while((CRGFLG &amp;amp; BM_LOCK) == 0) ;// wait until PLL is locked
 CLKSEL |= BM_PLLSEL;&amp;nbsp; // switch over to PLL clock

 // SCI0 = Twinpeeks Monitor
 SCI0BD&amp;nbsp; = 78; // 19200Bd at 24MHz ECLK
 SCI0CR1 = 0; // mode = 8N1
 SCI0CR2 = 0x0c; // Transmitter + Receiver enable

 // SCI1 = Port we're testing on
 SCI1BD = 52; // 9600Bd at 24Mhz ECLK
 SCI1CR1 = 0x80; // mode = 8N1, LOOP OFF
 SCI1CR2 = 0x0c; // Tx enable, Rx enable, no interrupts yet

 // SCI1 Interrupt for Twinpeeks (redirected vectors)
 *((unsigned char *)0x3FC1) = 0x06; // JMP opcode
 *((void (**)(void))0x3FC2) = SCI1_Handler;&amp;nbsp; Enable_Interrupts;&amp;nbsp; while(1) {&amp;nbsp; printf("Test\n\r");&amp;nbsp; SCI1CR2 |= SCI_TIE; }}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;So, that's very basic I'd say. The only thing I am trying to test is if the program will jump into the interrupt routine, and back out of it. What I expect the code to do:&lt;BR /&gt;- print "Test" to my monitor. --&amp;gt; This works&lt;BR /&gt;- Enable the TX Interrupt, and immediately trigger on TDRE --&amp;gt; This works&lt;BR /&gt;- Jump to the ISR, and print "SCICR2 = &amp;lt;CR2status&amp;gt;" to my monitor. --&amp;gt; This works, CR2 = 0x0C (TIE was turned off)&lt;BR /&gt;- Jump back to my main program, and start over again. --&amp;gt; This fails!&lt;BR /&gt;&lt;BR /&gt;The MCU hangs, never prints anything to my monitor again. In my original program (including the whole SCI driver), the MCU would also hang on each TIE, and dump a load of garbage on my monitor (real garbage, just weird characters, nothing distinguishable). It doesn't reset, so I don't get back to my monitor unless I do a hard reset.&lt;BR /&gt;&lt;BR /&gt;So... where am I going wrong? Is my thought that simply disabling the Tx Interrupt should be enough to return from the routine? Reading SR1 and then writing to DRL should be enough to clear the TDRE flag, and after that, the TIE gets disabled, so when the ISR is done, it should jump back to my normal routine, right?&lt;BR /&gt;&lt;BR /&gt;Where am I going wrong? &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" rel="nofollow noopener noreferrer noopener noreferrer" target="_blank"&gt;&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:59:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155356#M4645</guid>
      <dc:creator>Whuzz</dc:creator>
      <dc:date>2020-10-29T08:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: 9S12DP512 SCI Interrupts hang MCU</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155357#M4646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;#pragma interrupt_handler &lt;FONT color="#ff0000"&gt;SCI1&lt;BR /&gt;&lt;/FONT&gt;void &lt;FONT color="#ff0000"&gt;SCI1_Handler&lt;/FONT&gt;(void)&lt;BR /&gt;{&lt;BR /&gt;...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;names don't match. You could check&amp;nbsp;listing files and find that SCI1_Handler ends not with RTI.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 10:58:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155357#M4646</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2008-05-12T10:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: 9S12DP512 SCI Interrupts hang MCU</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155358#M4647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Oh my... Can't believe I didn't think of that. I'll go test it, and if it works, bang my head against a wall for a bit, before I come back here to shamefully thank you &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;Edit:&lt;BR /&gt;Ok, my head hurts now, but it's much better hurting from a wall, than hurting from not figuring out why my code doesn't work.&lt;BR /&gt;All working like a charm now! Thanks a lot &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;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by Whuzz on &lt;SPAN class="date_text"&gt;2008-05-12&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:41 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 14:29:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155358#M4647</guid>
      <dc:creator>Whuzz</dc:creator>
      <dc:date>2008-05-12T14:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: 9S12DP512 SCI Interrupts hang MCU</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155359#M4648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Glad to hear your problems are solved.&amp;nbsp; Just one another comment - I would avoid printf in an ISR. It is going to greatly increase latency to servicing other ISRs that you might have in your system, and I am pretty sure it is not guaranteed interrupt safe. It looks like it is just debug code - but then again you should want your debug code to be just as reliable as your application!&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2008 04:23:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155359#M4648</guid>
      <dc:creator>colinh</dc:creator>
      <dc:date>2008-05-13T04:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: 9S12DP512 SCI Interrupts hang MCU</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155360#M4649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Yes, it's just debug code. Since I'm stuck without a DBM, the only option I have is the Twinpeeks monitor and stuff like toggling ports or printf's &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;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2008 03:11:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/9S12DP512-SCI-Interrupts-hang-MCU/m-p/155360#M4649</guid>
      <dc:creator>Whuzz</dc:creator>
      <dc:date>2008-05-21T03:11:55Z</dc:date>
    </item>
  </channel>
</rss>

