<?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中的主题 RTI problem</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/RTI-problem/m-p/125284#M293</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style=": ; FONT-FAMILY: Arial; color: #ff0000; font-size: 2; FONT-SIZE: 9pt;"&gt;This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:00pm&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Subject: RTI problem&lt;BR /&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hi&lt;BR /&gt; I am using real time interrupt to repeat a sequence of routines.&lt;BR /&gt;The sequence repeats for like 20 times and all of a sudden the entire&lt;BR /&gt;microcontroller stops. It kinda hangs. Only a reset gets it out of this&lt;BR /&gt;lock out and then the same thing repeats.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;I am not able to figure out the reason.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;Can somebody help me?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 5:03pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;hi&lt;BR /&gt; I am using real time interrupt to repeat a sequence of routines.&lt;BR /&gt;The sequence repeats for like 20 times and all of a sudden the entire&lt;BR /&gt;microcontroller stops.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;====================&lt;BR /&gt;Bet you are pushing more registers than you are pulling... maybe jumping out&lt;BR /&gt; of a subroutine or interrupt handler by mistake? Stack keeps growing till it&lt;BR /&gt; overwrites something. Make stack bigger, see if it runs longer....&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:06pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thanks for such a quick response&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;may I know how to make the stack bigger?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 5:14pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;===========================&lt;BR /&gt;If writing in assembler, programmer must load stack pointer at a hi address.&lt;BR /&gt; When a subroutine is called, or a register is pushed on to the stack, , the&lt;BR /&gt; stack pointer decrements to point to the next lower address in memory. Maybe&lt;BR /&gt; you forgot to load the stack pointer in the beginning of the program? If&lt;BR /&gt; writing in c, compiler or linker or ide will have a way to specify size of stack.,&lt;BR /&gt; or use some standard default size. Do you use c or assembler?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:19pm&lt;BR /&gt;&lt;/STRONG&gt; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Iam using asembly&lt;BR /&gt;lds $0c00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;shd do the job. Correct me if I am wrong.&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 5:24pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lds $0c00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;====================&lt;BR /&gt;I assume $0c00 is a high ram address. Maybe you should use $0bff, and dont&lt;BR /&gt; forget the immediate sign! LDS #$0BFF... you told it to "load the contens of&lt;BR /&gt; location $0c00" which had who knows what in it.....&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:27pm&lt;/STRONG&gt;&lt;BR /&gt; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thanks a ton&lt;BR /&gt;shall try this tommorrow&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;BR /&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 11:53pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;I tried initializing the STACK, it ran for a longer time.However, when I&lt;BR /&gt;simply commented the psh and pul mnemonics in the code ( just to test) it&lt;BR /&gt;did make much difference , it hanged as previously.&lt;BR /&gt;I do not know wat is going wroong?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;help me!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 1:34am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;Might help if you post some code here, you haven't&lt;BR /&gt;given us much to go on.&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 1:53am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Perhaps the "sequence of routines" you run from the Real Time&lt;BR /&gt; Interrupt cannot complete before the next RTI tries to hit. Also,&lt;BR /&gt; you should probably not call any of the routines used by the RTI from&lt;BR /&gt; the "foreground" code, especially if those routines modify global&lt;BR /&gt; variables or have internal static variables. If you toggle a port&lt;BR /&gt; pin at the start and end of the RTI routine, you can monitor how long&lt;BR /&gt; it's taking with an oscilloscope.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;If you don't have something like NOICE, you can still detect "stack&lt;BR /&gt; creep" by adding some code that monitors the value of the stack&lt;BR /&gt; pointer, and if the stack gets outside a certain range takes some&lt;BR /&gt; action like toggling a port pin or sending an SCI character.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;If you are using C make sure all the variables used by both the RTI&lt;BR /&gt; and for the foreground are of type "volatile". In CodeWarrior you&lt;BR /&gt; can set the stack size by editing the .prm file visible in&lt;BR /&gt; the "Files" tab at screen left. CW defaults to a very small stack&lt;BR /&gt; just past the end of the variable space. A stack creeping down into&lt;BR /&gt; variable space makes for really interesting debugging. Remember that&lt;BR /&gt; all the variables declared inside a function use up stack space while&lt;BR /&gt; the function is executing, so be careful of declaring arrays inside&lt;BR /&gt; functions...an array of ints 128 elements long declared inside a&lt;BR /&gt; function can use up the entire default CW stack space.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;It is probably a good idea not to do too much processing inside the&lt;BR /&gt; RTI. Use the RTI to do just enough checking to detect conditions&lt;BR /&gt; that require attention. But rather than handling these conditions in&lt;BR /&gt; the RTI, just set flags and do the extended processing for these&lt;BR /&gt; conditions in the main event loop. Among other things this prevents&lt;BR /&gt; conflicts for system resources between the RTI and the foreground&lt;BR /&gt; routines. Since the RTI uses up a lot of system time, try inlining&lt;BR /&gt; all the code it needs to execute inside a single function instead of&lt;BR /&gt; spreading the code around in separate functions. This will reduce&lt;BR /&gt; the RTI overhead time and also keep the stack much shallower.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 11:38am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;If you are using assembly, make sure that the interrupt routine ends with RTI and not&lt;BR /&gt; RTS.&lt;BR /&gt;It cause stack overflow.&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG style=": ; font-size: 2;"&gt;Date: Fri, 14 Jan 2005 20:19:13 -0800 (PST)&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;Iam using asembly&lt;BR /&gt;lds $0c00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;shd do the job. Correct me if I am wrong.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 11:53am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;thanks to all&lt;BR /&gt;I fixed the problem. The problem was with SCI initialization which was&lt;BR /&gt;getting messed up in one of the routines.&lt;BR /&gt;thanks again&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by Dietrich on &lt;SPAN class="date_text"&gt;01-29-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;11:24 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jan 2006 00:25:54 GMT</pubDate>
    <dc:creator>Dietrich</dc:creator>
    <dc:date>2006-01-30T00:25:54Z</dc:date>
    <item>
      <title>RTI problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/RTI-problem/m-p/125284#M293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style=": ; FONT-FAMILY: Arial; color: #ff0000; font-size: 2; FONT-SIZE: 9pt;"&gt;This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:00pm&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Subject: RTI problem&lt;BR /&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hi&lt;BR /&gt; I am using real time interrupt to repeat a sequence of routines.&lt;BR /&gt;The sequence repeats for like 20 times and all of a sudden the entire&lt;BR /&gt;microcontroller stops. It kinda hangs. Only a reset gets it out of this&lt;BR /&gt;lock out and then the same thing repeats.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;I am not able to figure out the reason.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;Can somebody help me?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 5:03pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;hi&lt;BR /&gt; I am using real time interrupt to repeat a sequence of routines.&lt;BR /&gt;The sequence repeats for like 20 times and all of a sudden the entire&lt;BR /&gt;microcontroller stops.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;====================&lt;BR /&gt;Bet you are pushing more registers than you are pulling... maybe jumping out&lt;BR /&gt; of a subroutine or interrupt handler by mistake? Stack keeps growing till it&lt;BR /&gt; overwrites something. Make stack bigger, see if it runs longer....&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:06pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thanks for such a quick response&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;may I know how to make the stack bigger?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 5:14pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;===========================&lt;BR /&gt;If writing in assembler, programmer must load stack pointer at a hi address.&lt;BR /&gt; When a subroutine is called, or a register is pushed on to the stack, , the&lt;BR /&gt; stack pointer decrements to point to the next lower address in memory. Maybe&lt;BR /&gt; you forgot to load the stack pointer in the beginning of the program? If&lt;BR /&gt; writing in c, compiler or linker or ide will have a way to specify size of stack.,&lt;BR /&gt; or use some standard default size. Do you use c or assembler?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:19pm&lt;BR /&gt;&lt;/STRONG&gt; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Iam using asembly&lt;BR /&gt;lds $0c00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;shd do the job. Correct me if I am wrong.&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 5:24pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lds $0c00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;====================&lt;BR /&gt;I assume $0c00 is a high ram address. Maybe you should use $0bff, and dont&lt;BR /&gt; forget the immediate sign! LDS #$0BFF... you told it to "load the contens of&lt;BR /&gt; location $0c00" which had who knows what in it.....&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 10:27pm&lt;/STRONG&gt;&lt;BR /&gt; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thanks a ton&lt;BR /&gt;shall try this tommorrow&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;BR /&gt;&lt;STRONG&gt;Date: Fri Jan 14, 2005 11:53pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;I tried initializing the STACK, it ran for a longer time.However, when I&lt;BR /&gt;simply commented the psh and pul mnemonics in the code ( just to test) it&lt;BR /&gt;did make much difference , it hanged as previously.&lt;BR /&gt;I do not know wat is going wroong?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;help me!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 1:34am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;Might help if you post some code here, you haven't&lt;BR /&gt;given us much to go on.&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 1:53am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Perhaps the "sequence of routines" you run from the Real Time&lt;BR /&gt; Interrupt cannot complete before the next RTI tries to hit. Also,&lt;BR /&gt; you should probably not call any of the routines used by the RTI from&lt;BR /&gt; the "foreground" code, especially if those routines modify global&lt;BR /&gt; variables or have internal static variables. If you toggle a port&lt;BR /&gt; pin at the start and end of the RTI routine, you can monitor how long&lt;BR /&gt; it's taking with an oscilloscope.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;If you don't have something like NOICE, you can still detect "stack&lt;BR /&gt; creep" by adding some code that monitors the value of the stack&lt;BR /&gt; pointer, and if the stack gets outside a certain range takes some&lt;BR /&gt; action like toggling a port pin or sending an SCI character.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;If you are using C make sure all the variables used by both the RTI&lt;BR /&gt; and for the foreground are of type "volatile". In CodeWarrior you&lt;BR /&gt; can set the stack size by editing the .prm file visible in&lt;BR /&gt; the "Files" tab at screen left. CW defaults to a very small stack&lt;BR /&gt; just past the end of the variable space. A stack creeping down into&lt;BR /&gt; variable space makes for really interesting debugging. Remember that&lt;BR /&gt; all the variables declared inside a function use up stack space while&lt;BR /&gt; the function is executing, so be careful of declaring arrays inside&lt;BR /&gt; functions...an array of ints 128 elements long declared inside a&lt;BR /&gt; function can use up the entire default CW stack space.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;It is probably a good idea not to do too much processing inside the&lt;BR /&gt; RTI. Use the RTI to do just enough checking to detect conditions&lt;BR /&gt; that require attention. But rather than handling these conditions in&lt;BR /&gt; the RTI, just set flags and do the extended processing for these&lt;BR /&gt; conditions in the main event loop. Among other things this prevents&lt;BR /&gt; conflicts for system resources between the RTI and the foreground&lt;BR /&gt; routines. Since the RTI uses up a lot of system time, try inlining&lt;BR /&gt; all the code it needs to execute inside a single function instead of&lt;BR /&gt; spreading the code around in separate functions. This will reduce&lt;BR /&gt; the RTI overhead time and also keep the stack much shallower.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 11:38am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;If you are using assembly, make sure that the interrupt routine ends with RTI and not&lt;BR /&gt; RTS.&lt;BR /&gt;It cause stack overflow.&lt;BR /&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG style=": ; font-size: 2;"&gt;Date: Fri, 14 Jan 2005 20:19:13 -0800 (PST)&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 2;"&gt;Iam using asembly&lt;BR /&gt;lds $0c00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;shd do the job. Correct me if I am wrong.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;-----------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;Date: Sat Jan 15, 2005 11:53am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 2;"&gt;thanks to all&lt;BR /&gt;I fixed the problem. The problem was with SCI initialization which was&lt;BR /&gt;getting messed up in one of the routines.&lt;BR /&gt;thanks again&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by Dietrich on &lt;SPAN class="date_text"&gt;01-29-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;11:24 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2006 00:25:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/RTI-problem/m-p/125284#M293</guid>
      <dc:creator>Dietrich</dc:creator>
      <dc:date>2006-01-30T00:25:54Z</dc:date>
    </item>
  </channel>
</rss>

