<?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: SCI recieve interrupt problem in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/SCI-recieve-interrupt-problem/m-p/188845#M6705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;#pragma CODE_SEG __NEAR_SEG NON_BANKEDinterrupt 20 void SCI0_ISR(void){      /*i'm assuming that we are here due to RDRF.Check for other flags if you want to*/    (void)SCI0SR1;  //dummy read to clear interruput    if(index&amp;gt;24)index=0; //my static variable for buffer index    BufferRx[index++]=SCI0DRL;//copy byte    return;}#pragma CODE_SEG DEFAULT&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This seems to work fine for me.May be you need to place the ISR in the non banked segment like i did. Also, try using&amp;nbsp; pre define macros&amp;nbsp; in your initsciint(). Makes it more readable. Example:&lt;/P&gt;&lt;PRE&gt;SCI0CR2 |= (SCI0CR2_TE_MASK | SCI0CR2_RE_MASK | SCI0CR2_RIE_MASK); /* Enable transmitter, Enable receiver, Enable receiver interrupt */&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These macros can be found in the header file of your MCU derivative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:40:06 GMT</pubDate>
    <dc:creator>itisravi</dc:creator>
    <dc:date>2020-10-29T09:40:06Z</dc:date>
    <item>
      <title>SCI recieve interrupt problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/SCI-recieve-interrupt-problem/m-p/188844#M6704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am currently using a minidragon board with a MC9S12DG256 chip (HCS12).&amp;nbsp; I am trying to get an interrupt executed when some other unit sends anything through the serial port.&amp;nbsp; I have set the interrupt to take what information was recieved and send it back but I get three outputs instead.&amp;nbsp; Here&amp;nbsp;the hex input is the 0x34 and the output is the following 6 hex numbers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{34}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;&lt;SPAN style="font-size: 2;"&gt;{E1}&lt;/SPAN&gt;&lt;SPAN style=": ; font-size: 2;"&gt;{01}&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;{3E}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;The Following is the code I used and is shortened for simplicity.&amp;nbsp; Be aware that I have set up the clock and the baud rate to 9600 and they both work because without interrupts they work beautifully.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;#include &amp;lt;hidef.h&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* common defines and macros */&lt;BR /&gt;#include &amp;lt;mc9s12dg256.h&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* derivative information */&lt;BR /&gt;#include &amp;lt;math.h&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;#pragma LINK_INFO DERIVATIVE "mc9s12dg256b"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;void interrupt 20 handler(){&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; perint();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;void main(void) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clkinit();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initsciint();&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EnableInterrupts;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;while(1){}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;void perint(void){&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; datain = inchar0();&lt;BR /&gt;&amp;nbsp; outchar0(datain);&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;void initsciint(void){&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCI0CR1 = 0x40;&amp;nbsp; //setup sci port0&amp;nbsp; interrupts&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCI0CR2 = 0x2C;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCI0BDH = 0x00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCI0BDL = 0x9C;&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;void clkinit(void){&amp;nbsp; //set up eclock 24MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SYNR = 0x02;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REFDV = 0x01;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLKSEL = 0x00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLLCTL = 0xF1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLKSEL = 0x80;&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #888888;"&gt;Thanks for any help!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 23:19:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/SCI-recieve-interrupt-problem/m-p/188844#M6704</guid>
      <dc:creator>bassplayer142</dc:creator>
      <dc:date>2010-04-05T23:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: SCI recieve interrupt problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/SCI-recieve-interrupt-problem/m-p/188845#M6705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;#pragma CODE_SEG __NEAR_SEG NON_BANKEDinterrupt 20 void SCI0_ISR(void){      /*i'm assuming that we are here due to RDRF.Check for other flags if you want to*/    (void)SCI0SR1;  //dummy read to clear interruput    if(index&amp;gt;24)index=0; //my static variable for buffer index    BufferRx[index++]=SCI0DRL;//copy byte    return;}#pragma CODE_SEG DEFAULT&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This seems to work fine for me.May be you need to place the ISR in the non banked segment like i did. Also, try using&amp;nbsp; pre define macros&amp;nbsp; in your initsciint(). Makes it more readable. Example:&lt;/P&gt;&lt;PRE&gt;SCI0CR2 |= (SCI0CR2_TE_MASK | SCI0CR2_RE_MASK | SCI0CR2_RIE_MASK); /* Enable transmitter, Enable receiver, Enable receiver interrupt */&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These macros can be found in the header file of your MCU derivative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:40:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/SCI-recieve-interrupt-problem/m-p/188845#M6705</guid>
      <dc:creator>itisravi</dc:creator>
      <dc:date>2020-10-29T09:40:06Z</dc:date>
    </item>
  </channel>
</rss>

