<?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>8-bit MicrocontrollersのトピックRe: lost interrupts and/or priority inversion</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137974#M4837</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;STRONG&gt;&lt;EM&gt;Also, you could disable lower priority interrupts prior to re-enabling interrupts in the ISR, and re-enable them prior to exiting the ISR (after disabling interrupts globally again, to prevent them from nesting).&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;&lt;STRONG&gt;Bingo.&amp;nbsp; This is what I was looking for.&amp;nbsp; I want to be able to make an ISR interruptable, but only by higher-priority interrupts.&amp;nbsp; This sounds like a straightforward and bulletproof way to do it.&amp;nbsp; My only concern is this: I assume that if one of these disabled interrupts occurs while it is disabled, then&amp;nbsp;the interrupt flag will still be set, and it will interrupt as soon as the interrupt is re-enabled.&amp;nbsp; In other words, I won't drop interrupts this way.&amp;nbsp; Correct?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Nov 2006 12:22:22 GMT</pubDate>
    <dc:creator>EtherJones</dc:creator>
    <dc:date>2006-11-26T12:22:22Z</dc:date>
    <item>
      <title>lost interrupts and/or priority inversion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137972#M4835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Can someone please review this and offer opinion on whether my understanding is correct?&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;First I need to set up the problem before I can ask the question:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1) MC9S08DZ60&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;2) two active interrupts, call them Int1 and Int2, one occurring approximately 10 times faster than the other (Int1 faster than Int2)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;3) Int1 is serviced by ISR1, and Int2 is serviced by ISR2&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Question:&amp;nbsp; Are the following statements true?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;ISR2 worst-case&lt;/STRONG&gt; &lt;STRONG style="text-decoration: underline;"&gt;execution time&lt;/STRONG&gt;&lt;/EM&gt; must never exceed the &lt;STRONG&gt;&lt;EM&gt;Int1 &lt;SPAN style="text-decoration: underline;"&gt;period&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;, or else Int1 interrupts will be lost.&amp;nbsp;&amp;nbsp; This is because more than one Int1 will occur while ISR2 is executing.&amp;nbsp; The first Int1 will be pending (waiting for ISR2 to complete), but there is no provision in this chip to queue the second one - it will be effectively lost.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This problem could be solved by coding ISR2 to enable interrupts at the beginning.&amp;nbsp; But the problem with this is that not only would Int1 be allowed to interrupt, but also any other slower or lower-priority interrupt - resulting in priority inversion.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 05:43:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137972#M4835</guid>
      <dc:creator>EtherJones</dc:creator>
      <dc:date>2006-11-26T05:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: lost interrupts and/or priority inversion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137973#M4836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi, Ether:&lt;BR /&gt;&lt;BR /&gt;Yes, both statements are true. But it should not be a big deal.&lt;BR /&gt;&lt;BR /&gt;The nested-interrupt approach may be a little more complicated, but should work. I would not worry about a lower priority interrupt, as long as its ISR was short.&lt;BR /&gt;&lt;BR /&gt;Also, you could disable lower priority interrupts prior to re-enabling interrupts in the ISR, and re-enable them prior to exiting the ISR (after disabling interrupts globally again, to prevent them from nesting).&lt;BR /&gt;&lt;BR /&gt;But my approach is to keep all ISRs under 5 microseconds (a somewhat arbitrary number, based on running the SCI at 500 kBaud). If additional processing is necessary, I schedule a subroutine do execute after the ISR exits. I can assign priorities to those subroutines, and code them to process the data from multiple interrupts, if need be (like parsing an entire line of data from the SCI).&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 09:22:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137973#M4836</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-11-26T09:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: lost interrupts and/or priority inversion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137974#M4837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;STRONG&gt;&lt;EM&gt;Also, you could disable lower priority interrupts prior to re-enabling interrupts in the ISR, and re-enable them prior to exiting the ISR (after disabling interrupts globally again, to prevent them from nesting).&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#ff0000" face="Courier New" size="2"&gt;&lt;STRONG&gt;Bingo.&amp;nbsp; This is what I was looking for.&amp;nbsp; I want to be able to make an ISR interruptable, but only by higher-priority interrupts.&amp;nbsp; This sounds like a straightforward and bulletproof way to do it.&amp;nbsp; My only concern is this: I assume that if one of these disabled interrupts occurs while it is disabled, then&amp;nbsp;the interrupt flag will still be set, and it will interrupt as soon as the interrupt is re-enabled.&amp;nbsp; In other words, I won't drop interrupts this way.&amp;nbsp; Correct?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 12:22:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137974#M4837</guid>
      <dc:creator>EtherJones</dc:creator>
      <dc:date>2006-11-26T12:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: lost interrupts and/or priority inversion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137975#M4838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Ether,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Yes the flag will remain set and the ISR will occur as soon as you enable it.&lt;/DIV&gt;&lt;DIV&gt;You just have to be careful the disabled ISR only gets triggered once while it is disabled.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;DIV&gt;Peg&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 14:47:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137975#M4838</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-11-26T14:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: lost interrupts and/or priority inversion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137976#M4839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;One problem to be watchful for with nested interrupts is stack overflow. This is especially critical if you are running an OS in which each task has a dedicated stack space. An easy method to monitor for this condition is to initialize the stack space(s) to a known value, run the program with the debugger and then display the stack space to view worst-case usage. A more thorough technique is to include debug code that dynamically monitors usage.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 20:22:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137976#M4839</guid>
      <dc:creator>thisobj</dc:creator>
      <dc:date>2006-11-26T20:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: lost interrupts and/or priority inversion</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137977#M4840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Ester,&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;Another possibility -&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;Before exiting the ISR in which you have disabled lower priority interrupts, you might test the flag for the lower priority event, and if set, JMP straight to its ISR, without the need to exit and re-enter the interrupt process.&amp;nbsp; This can give some reduction of latency for the lower priority event because there is not the&amp;nbsp;overhead&amp;nbsp;for the&amp;nbsp;exit and entry process.&amp;nbsp; In the second ISR, interrupts can be re-enabled&amp;nbsp;within the same process in which&amp;nbsp;the flag is cleared.&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>Sun, 26 Nov 2006 20:37:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/lost-interrupts-and-or-priority-inversion/m-p/137977#M4840</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-11-26T20:37:15Z</dc:date>
    </item>
  </channel>
</rss>

