<?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>S32KのトピックRe: S32K312 Nvic subpriority issue</title>
    <link>https://community.nxp.com/t5/S32K/S32K312-Nvic-subpriority-issue/m-p/1917250#M38229</link>
    <description>&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;Could you help me understand if setting the value 5 in the AIRCR[PRIGROUP] register effectively gives me 2 bits for group priority and 2 bits for sub-priority?&lt;/P&gt;&lt;P&gt;Regarding your previous response, I understand that there will be no preemption between interrupts of the same group priority, and this is not what I am looking for. What I need is for the system to handle the next interrupt based on its sub-priority once the highest priority interrupt has finished, since they all belong to the same group priority.&lt;/P&gt;&lt;P&gt;To simplify my scenario: while handling an interrupt with the highest possible priority, if 2 additional interrupts of the same group but different sub-priority are generated, the system does not respect handling the interrupt with sub-priority 0 and sometimes handles the one with sub-priority 1. The solution I found was to change the sub-priority from 1 to 2, which works correctly, but I do not understand if I am misconfiguring the AIRCR[PRIGROUP] register and the bits I believe to have configured are not doing what I expect.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jul 2024 14:12:03 GMT</pubDate>
    <dc:creator>arielcolombo</dc:creator>
    <dc:date>2024-07-25T14:12:03Z</dc:date>
    <item>
      <title>S32K312 Nvic subpriority issue</title>
      <link>https://community.nxp.com/t5/S32K/S32K312-Nvic-subpriority-issue/m-p/1916798#M38211</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am facing an issue with the interrupt priority configuration on the S32K312. I have set the registers to have 2 groups and 2 subpriorities. However, I am observing unexpected behavior:&lt;/P&gt;&lt;P&gt;An interrupt with group priority 0 and subpriority 1 sometimes executes before another interrupt with group priority 0 and subpriority 0. If I change the subpriority from 1 to 2 in the first interrupt, everything works correctly, but I do not understand why this happens.&lt;/P&gt;&lt;P&gt;Specifically, the problematic interrupt is a SAOC (ADC Channel 9) that competes with an MC (Counter Channel 23) which handles the counter bus. The MC is configured to generate an interrupt on "Internal Counter Match End" when the register reaches 65535, setting the flag in 0 ticks.&lt;/P&gt;&lt;P&gt;Additionally, I have observed that the SAOC detects the issue when the match occurs very close to the overflow, and it might be waiting while the SAIC (Channel 0), which has group priority 0 and subpriority 0, is being serviced. This SAIC seems to work correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Example simplification

__NVIC_SetPriorityGrouping(5u);

// SAOC priority 0, subpriotity 0 CH9
// SAIC priority 0, subpriotity 0 CH0
// MC priority 0, subpriotity 1  CH23 EMIOS MODE FOR MC 0b0010010
prio = NVIC_EncodePriority(5, priority, subpriority);

__NVIC_SetPriority(irq, prio);
__NVIC_EnableIRQ(irq);&lt;/LI-CODE&gt;&lt;P&gt;Could someone help me understand why this behavior occurs and how to fix it?&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#S32K312&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 03:48:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K312-Nvic-subpriority-issue/m-p/1916798#M38211</guid>
      <dc:creator>arielcolombo</dc:creator>
      <dc:date>2024-07-25T03:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: S32K312 Nvic subpriority issue</title>
      <link>https://community.nxp.com/t5/S32K/S32K312-Nvic-subpriority-issue/m-p/1917227#M38228</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="group_priority.png" style="width: 581px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/290359iA1C0BECAC2959253/image-dimensions/581x244?v=v2" width="581" height="244" role="button" title="group_priority.png" alt="group_priority.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="group_priority_2.png" style="width: 573px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/290360iC52585CB43CE1BED/image-dimensions/573x470?v=v2" width="573" height="470" role="button" title="group_priority_2.png" alt="group_priority_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;Preemption defines behavior of “nesting”.&lt;/P&gt;
&lt;P&gt;It means if two interrupt sources belongs to same group priority, they are not interrupting each other during interrupt processing of one of this interrupt source (they are not nested). If they have different group priority, they will be nested.&lt;/P&gt;
&lt;P&gt;Check setting in the core register AIRCR[PRIGROUP], to check which bits defines priority and which sub-priority.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 13:36:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K312-Nvic-subpriority-issue/m-p/1917227#M38228</guid>
      <dc:creator>davidtosenovjan</dc:creator>
      <dc:date>2024-07-25T13:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: S32K312 Nvic subpriority issue</title>
      <link>https://community.nxp.com/t5/S32K/S32K312-Nvic-subpriority-issue/m-p/1917250#M38229</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;Could you help me understand if setting the value 5 in the AIRCR[PRIGROUP] register effectively gives me 2 bits for group priority and 2 bits for sub-priority?&lt;/P&gt;&lt;P&gt;Regarding your previous response, I understand that there will be no preemption between interrupts of the same group priority, and this is not what I am looking for. What I need is for the system to handle the next interrupt based on its sub-priority once the highest priority interrupt has finished, since they all belong to the same group priority.&lt;/P&gt;&lt;P&gt;To simplify my scenario: while handling an interrupt with the highest possible priority, if 2 additional interrupts of the same group but different sub-priority are generated, the system does not respect handling the interrupt with sub-priority 0 and sometimes handles the one with sub-priority 1. The solution I found was to change the sub-priority from 1 to 2, which works correctly, but I do not understand if I am misconfiguring the AIRCR[PRIGROUP] register and the bits I believe to have configured are not doing what I expect.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 14:12:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K312-Nvic-subpriority-issue/m-p/1917250#M38229</guid>
      <dc:creator>arielcolombo</dc:creator>
      <dc:date>2024-07-25T14:12:03Z</dc:date>
    </item>
  </channel>
</rss>

