<?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: K64 NVIC interrupt priorities in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411619#M23299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It depends how you rotate them, of course. Values 0-15 will need to be rotated 4 bits more than values 0-16,32,etc...The interrupt priority is given by a 4 bit field register. For me it would be more intuitive to write values 0-15 and then rotate them as needed by each register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Santiago&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 May 2015 14:35:12 GMT</pubDate>
    <dc:creator>santiago_gonzal</dc:creator>
    <dc:date>2015-05-29T14:35:12Z</dc:date>
    <item>
      <title>K64 NVIC interrupt priorities</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411616#M23296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am reading conflicting information on what valid values are for NVIC interrupt priorities.&amp;nbsp; Some resources say only 4 bits (0-15), others say 0-256.&amp;nbsp; I am using the K64 processor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Example usage: NVIC_SetPriority(PORTB_IRQn, 16);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;I am using values: 0, 8, 16, 32, 64,&amp;nbsp; and 128 for different interrupts.&amp;nbsp; I am not getting errors, but I also cannot tell if the priorities are actually working correctly either.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Any insight would be helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;John Baker&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;AVG&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 13:27:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411616#M23296</guid>
      <dc:creator>johnbaker</dc:creator>
      <dc:date>2015-05-29T13:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: K64 NVIC interrupt priorities</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411617#M23297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ARM has designed the NVIC controller to allow up to 256 levels of priority in the interrupts. Is up to the chip manufacturer to implement the whole 256 levels or to reduce it to save silicon space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case of K64 devices, they support 16 levels of interrupts. You have all the details in the chapter 3.2.2 of the Reference Manual of the device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Santiago&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 14:06:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411617#M23297</guid>
      <dc:creator>santiago_gonzal</dc:creator>
      <dc:date>2015-05-29T14:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: K64 NVIC interrupt priorities</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411618#M23298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Santiago,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So would valid values be 0-15 or would they be 0,16,32,48,64,80,96,112,128,,, etc. ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 14:23:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411618#M23298</guid>
      <dc:creator>johnbaker</dc:creator>
      <dc:date>2015-05-29T14:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: K64 NVIC interrupt priorities</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411619#M23299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It depends how you rotate them, of course. Values 0-15 will need to be rotated 4 bits more than values 0-16,32,etc...The interrupt priority is given by a 4 bit field register. For me it would be more intuitive to write values 0-15 and then rotate them as needed by each register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Santiago&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 14:35:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411619#M23299</guid>
      <dc:creator>santiago_gonzal</dc:creator>
      <dc:date>2015-05-29T14:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: K64 NVIC interrupt priorities</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411620#M23300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;What Santiago tries to tell you is that for each IRQn vector, there are 4 bits reserved to set the priority (0000 - 1111 value for each IRQ), so it is easier to set them as 0 to 15 instead of all decimal value (0,16,32,48, ..., etc), for example, for first 4 IRQ vectors, it would be easier to set their priority as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Interrupt Priority Levels.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/28340iB5895CD1B9EEA28C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Interrupt Priority Levels.jpg" alt="Interrupt Priority Levels.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you can see, the first value indicates the priority level and it is easier to understand which priority level you are setting instead of using 32, 64, 128, ... values.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Isaac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 20:33:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411620#M23300</guid>
      <dc:creator>isaacavila</dc:creator>
      <dc:date>2015-05-29T20:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: K64 NVIC interrupt priorities</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411621#M23301</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;&lt;STRONG&gt;&lt;SPAN style="font-size: 11pt; font-family: 'Calibri','sans-serif';"&gt;void NVIC_SetPriority&lt;/SPAN&gt;(int iInterruptID, unsigned char ucPriority)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char *ptrPriority = IRQ0_3_PRIORITY_REGISTER_ADD;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptrPriority += iInterruptID;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *ptrPriority = (ucPriority &amp;lt;&amp;lt; __NVIC_PRIORITY_SHIFT);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ucPriority 0..15 for K devices - #define __NVIC_PRIORITY_SHIFT&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;ucPriority 0..6 for KL and KE devices #define __NVIC_PRIORITY_SHIFT&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;K64: &lt;A href="http://www.utasker.com/kinetis/FRDM-K64F.html" title="http://www.utasker.com/kinetis/FRDM-K64F.html"&gt;µTasker Kinetis FRDM-K64F support&lt;/A&gt;&amp;nbsp; / &lt;A href="http://www.utasker.com/kinetis/TWR-K64F120M.html" title="http://www.utasker.com/kinetis/TWR-K64F120M.html"&gt;µTasker Kinetis TWR-K64F120M support&lt;/A&gt;&amp;nbsp; / &lt;A href="http://www.utasker.com/kinetis/TWR-K65F180M.html" title="http://www.utasker.com/kinetis/TWR-K65F180M.html"&gt;µTasker Kinetis TWR-K65F180M support&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 21:04:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411621#M23301</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-05-29T21:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: K64 NVIC interrupt priorities</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411622#M23302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I find the supplied 'arm_cm4.h' contains the a proper #define for the device-in-use.&amp;nbsp; For the MK20 I see:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;#define ARM_INTERRUPT_LEVEL_BITS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;The code in arm_cm4.c that uses it to take an integer (0-15 in this case) into the 'proper' place:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;*prio_reg = ( (prio&amp;amp;((1&amp;lt;&amp;lt;ARM_INTERRUPT_LEVEL_BITS)-1)) &amp;lt;&amp;lt; (8 - ARM_INTERRUPT_LEVEL_BITS) );&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As long as we are talking about arm_cm4.c, I will reiterate here that the original enable_irq (and disable_irq) code from Freescale contained |= operations into NVICICPRx, which is blatently INAPPROPRIATE, and MUST just be '=' to avoid killing other pending interrupts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 18:52:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K64-NVIC-interrupt-priorities/m-p/411622#M23302</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2015-06-10T18:52:59Z</dc:date>
    </item>
  </channel>
</rss>

