<?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: Difference between nvic and pin interrupt in S32K</title>
    <link>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1738605#M27798</link>
    <description>&lt;P&gt;Hello, thank you for your response.&lt;BR /&gt;So, both of them are actually needed (configuration using PCR register, AND NVIC)&lt;BR /&gt;1. nvic is some how the responsible for interrupt registering and enabling, right ?&lt;BR /&gt;2. I have another question, is it mandatory to disable watchdog before we enable interrupt than enable it again ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2023 11:23:17 GMT</pubDate>
    <dc:creator>elb1</dc:creator>
    <dc:date>2023-10-12T11:23:17Z</dc:date>
    <item>
      <title>Difference between nvic and pin interrupt</title>
      <link>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1737555#M27763</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am using s32k142 MCU, and I want to implment a gpio interrupt on one of the MCU pins, So I am getting rising edges from another device and i need to count the number of rising edges received.&lt;BR /&gt;So each time i am receiving rising edge i generate an interrupt and i increment a counter variable.&lt;BR /&gt;&lt;BR /&gt;To do this i have used a simple interrupt logic which consist of:&lt;BR /&gt;1. Configure IRQC in PCR register for the appropriate pin:&lt;BR /&gt;port-&amp;gt;PCR[pin] |= PORT_PCR_IRQC_MASK &amp;amp; PORT_PCR_IRQC(interrupt);&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;2. Register and enable interrupt on&amp;nbsp;PORTC_IRQn (because the interrupt pin is PTC7.&lt;BR /&gt;&lt;BR /&gt;3. Once i am in the isr i clear ISF flag from PCR register:&amp;nbsp;PORT_PCR_ISF(1U)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My question here is:&lt;BR /&gt;1. Is this logic i implemented sufficient and correct ?&lt;BR /&gt;2. I have seen in some examples the usage of "S323_NVIC,&amp;nbsp;&lt;SPAN&gt;ISER, ICER, etc...&lt;/SPAN&gt;&lt;SPAN&gt;", Is this another way to do interrupts ? or it should go with the one that i already have, or what is the difference.&lt;BR /&gt;&lt;BR /&gt;Thank you in advance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 13:49:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1737555#M27763</guid>
      <dc:creator>elb1</dc:creator>
      <dc:date>2023-10-11T13:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between nvic and pin interrupt</title>
      <link>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1738320#M27779</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@elb1" target="_blank"&gt;Hi@elb1&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Q1.Yes and&amp;nbsp; you can refer to the demo below.&lt;/P&gt;
&lt;P&gt;Q2.hard to explain to you, you need to read the S32K-RM for detail:&lt;/P&gt;
&lt;P&gt;chapter :7.2 Nested Vectored Interrupt Controller (NVIC) Configuration&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;#include "device_registers.h"

/*! Port PTC12, bit 12: FRDM EVB input from BTN0 [SW2]*/
#define PTC12 12
int counter = 0;

void WDOG_disable (void)
{
  WDOG-&amp;gt;CNT=0xD928C520;     /* Unlock watchdog 		*/
  WDOG-&amp;gt;TOVAL=0x0000FFFF;   /* Maximum timeout value 	*/
  WDOG-&amp;gt;CS = 0x00002100;    /* Disable watchdog 		*/
}

void S32_NVIC_EnableIRQ(IRQn_Type IRQn, int Priority)
{
	/* enable interrupt */
	S32_NVIC-&amp;gt;ISER[(uint32_t)((int32_t)IRQn) &amp;gt;&amp;gt; 5] = (uint32_t)(1 &amp;lt;&amp;lt; ((uint32_t)((int32_t)IRQn) &amp;amp; (uint32_t)0x1F));
	S32_NVIC-&amp;gt;IP[IRQn] = Priority;
}


void PORTC_IRQHandler(void)
{
	counter++;
	PORTC-&amp;gt;PCR[PTC12] |= PORT_PCR_ISF_MASK;
}

int main(void)
{
	/* Disable Watchdog in case it is not done in startup code */
	WDOG_disable();

	/* Enable clocks to peripherals (PORT modules) *//* Enable clock to PORT D*/
	PCC-&amp;gt; PCCn[PCC_PORTC_INDEX] = PCC_PCCn_CGC_MASK;

	/* Configure port C12 as GPIO input (BTN 0 [SW2] on EVB) */
	PTC-&amp;gt;PDDR &amp;amp;= ~(1&amp;lt;&amp;lt;PTC12);
	PORTC-&amp;gt;PCR[12] = PORT_PCR_MUX(1)|PORT_PCR_PFE_MASK|PORT_PCR_IRQC(0x9); /* Port C12: MUX = GPIO, input filter enabled */

	S32_NVIC_EnableIRQ(PORTC_IRQn,9);

	for(;;)
	{
		;
	}
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 06:49:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1738320#M27779</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2023-10-12T06:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between nvic and pin interrupt</title>
      <link>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1738605#M27798</link>
      <description>&lt;P&gt;Hello, thank you for your response.&lt;BR /&gt;So, both of them are actually needed (configuration using PCR register, AND NVIC)&lt;BR /&gt;1. nvic is some how the responsible for interrupt registering and enabling, right ?&lt;BR /&gt;2. I have another question, is it mandatory to disable watchdog before we enable interrupt than enable it again ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 11:23:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1738605#M27798</guid>
      <dc:creator>elb1</dc:creator>
      <dc:date>2023-10-12T11:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between nvic and pin interrupt</title>
      <link>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1739043#M27811</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@elb1" target="_blank"&gt;Hi@elb1&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;1.yes, enable,disable,clean interrupt like this..&lt;/P&gt;
&lt;P&gt;2.This is not required, just make sure the watchdog is turned off when you are not using it&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 02:34:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Difference-between-nvic-and-pin-interrupt/m-p/1739043#M27811</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2023-10-13T02:34:15Z</dc:date>
    </item>
  </channel>
</rss>

