<?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>Kinetis MicrocontrollersのトピックRe: Interrupt Priority</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupt-Priority/m-p/479954#M29352</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis K22 product using ARM Cortex-M4 core. The interrupt priority setting at NVIC_IPRx register.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-04-05_14-34-59.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/27730iC101F747CF7DA670/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-04-05_14-34-59.jpg" alt="2016-04-05_14-34-59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please refer below code to set interrupt priority:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*ARM Cortex M4 implementation for interrupt priority shift*/&lt;/P&gt;&lt;P&gt;#define ARM_INTERRUPT_LEVEL_BITS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;/***********************************************************************/&lt;/P&gt;&lt;P&gt;/*&lt;/P&gt;&lt;P&gt; * Initialize the NVIC to set specified IRQ priority.&lt;/P&gt;&lt;P&gt; * &lt;/P&gt;&lt;P&gt; * NOTE: The function only initializes the NVIC to set a single IRQ priority. &lt;/P&gt;&lt;P&gt; * Interrupts will also need to be enabled in the ARM core. This can be &lt;/P&gt;&lt;P&gt; * done using the EnableInterrupts macro.&lt;/P&gt;&lt;P&gt; *&lt;/P&gt;&lt;P&gt; * Parameters:&lt;/P&gt;&lt;P&gt; * irq&amp;nbsp;&amp;nbsp;&amp;nbsp; irq number to be enabled (the irq number NOT the vector number)&lt;/P&gt;&lt;P&gt; * prio&amp;nbsp;&amp;nbsp; irq priority. 0-15 levels. 0 max priority&lt;/P&gt;&lt;P&gt; */&lt;/P&gt;&lt;P&gt;void set_irq_priority (int irq, int prio)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*irq priority pointer*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8 *prio_reg;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Make sure that the IRQ is an allowable number. Right now up to 105 is &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (irq &amp;gt; 105)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nERR! Invalid IRQ value passed to priority irq function!\n");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (prio &amp;gt; 15)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nERR! Invalid priority value passed to priority irq function!\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Determine which of the NVICIPx corresponds to the irq */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; prio_reg = (uint8 *)(((uint32)&amp;amp;NVICIP0) + irq);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Assign priority to IRQ */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *prio_reg = ( (prio&amp;amp;0xF) &amp;lt;&amp;lt; (8 - ARM_INTERRUPT_LEVEL_BITS) );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/***********************************************************************/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Ma Hui&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Apr 2016 06:39:03 GMT</pubDate>
    <dc:creator>Hui_Ma</dc:creator>
    <dc:date>2016-04-05T06:39:03Z</dc:date>
    <item>
      <title>Interrupt Priority</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupt-Priority/m-p/479953#M29351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where can i find the default interrupt priority for the&amp;nbsp; dspi, i2c, and gpio drivers for the freedom k22f board.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 21:22:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupt-Priority/m-p/479953#M29351</guid>
      <dc:creator>anbui</dc:creator>
      <dc:date>2016-04-04T21:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt Priority</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupt-Priority/m-p/479954#M29352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis K22 product using ARM Cortex-M4 core. The interrupt priority setting at NVIC_IPRx register.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-04-05_14-34-59.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/27730iC101F747CF7DA670/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-04-05_14-34-59.jpg" alt="2016-04-05_14-34-59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please refer below code to set interrupt priority:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*ARM Cortex M4 implementation for interrupt priority shift*/&lt;/P&gt;&lt;P&gt;#define ARM_INTERRUPT_LEVEL_BITS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;/***********************************************************************/&lt;/P&gt;&lt;P&gt;/*&lt;/P&gt;&lt;P&gt; * Initialize the NVIC to set specified IRQ priority.&lt;/P&gt;&lt;P&gt; * &lt;/P&gt;&lt;P&gt; * NOTE: The function only initializes the NVIC to set a single IRQ priority. &lt;/P&gt;&lt;P&gt; * Interrupts will also need to be enabled in the ARM core. This can be &lt;/P&gt;&lt;P&gt; * done using the EnableInterrupts macro.&lt;/P&gt;&lt;P&gt; *&lt;/P&gt;&lt;P&gt; * Parameters:&lt;/P&gt;&lt;P&gt; * irq&amp;nbsp;&amp;nbsp;&amp;nbsp; irq number to be enabled (the irq number NOT the vector number)&lt;/P&gt;&lt;P&gt; * prio&amp;nbsp;&amp;nbsp; irq priority. 0-15 levels. 0 max priority&lt;/P&gt;&lt;P&gt; */&lt;/P&gt;&lt;P&gt;void set_irq_priority (int irq, int prio)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*irq priority pointer*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8 *prio_reg;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Make sure that the IRQ is an allowable number. Right now up to 105 is &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (irq &amp;gt; 105)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nERR! Invalid IRQ value passed to priority irq function!\n");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (prio &amp;gt; 15)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nERR! Invalid priority value passed to priority irq function!\n");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Determine which of the NVICIPx corresponds to the irq */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; prio_reg = (uint8 *)(((uint32)&amp;amp;NVICIP0) + irq);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Assign priority to IRQ */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *prio_reg = ( (prio&amp;amp;0xF) &amp;lt;&amp;lt; (8 - ARM_INTERRUPT_LEVEL_BITS) );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/***********************************************************************/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Wish it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Ma Hui&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 06:39:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupt-Priority/m-p/479954#M29352</guid>
      <dc:creator>Hui_Ma</dc:creator>
      <dc:date>2016-04-05T06:39:03Z</dc:date>
    </item>
  </channel>
</rss>

