<?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: Enabling interrupt on a pin in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287587#M11222</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cris&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The global interrupt control is in the ARM procesor.&lt;/P&gt;&lt;P&gt;Using Codewarrior it can be enabled with &lt;STRONG&gt;asm("cpsie&amp;nbsp;&amp;nbsp; i");&lt;/STRONG&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 May 2014 15:45:15 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2014-05-29T15:45:15Z</dc:date>
    <item>
      <title>Enabling interrupt on a pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287581#M11216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am a complete newbie to Freescale microcontrollers and the Freedom KL25Z development board, but I have watched all of Eli Hughes' excellent introductory videos. I'm trying to build on his examples by writing a simple program that toggles an LED on or off by watching for an interrupt on a pin driven by a simple pushbutton switch. I want to configure this pin to use the internal pullup resistor so that when the switch is pushed, the pin is pulled low; correspondingly, I want the interrupt to fire on a falling edge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code below outlines my basic approach to this, and I think I have enabled interrupts for both Port A Pin 20 (where the switch is connected) and also Port A on the NVIC. However, when I push the button, the code seems to exit immediately and I see the message "Suspended: Signal 'Halt' received..." from the CodeWarrior debug view. What am I doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_13709783433997656 jive_text_macro jive_macro_code" jivemacro_uid="_13709783433997656"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;#include "derivative.h" /* include peripheral declarations */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;int fired = 0;&lt;/P&gt;
&lt;P&gt;void PORTA_IRQHandler() {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; fired = 1;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;int main(void)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; PORTA_PCR20 = PORT_PCR_MUX(1) | PORT_PCR_IRQC(6) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;&amp;nbsp; // Interrupt on falling edge.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // enable IRQ on Port A, pin 20&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int irq_num = INT_PORTA - 16;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; NVIC_ICPR |= 1 &amp;lt;&amp;lt; irq_num;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; NVIC_ISER |= 1 &amp;lt;&amp;lt; irq_num;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; for (;;) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (fired == 1) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // toggle LED&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fired = 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return 0;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a breakpoint set within the ISR which is never reached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2013 19:16:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287581#M11216</guid>
      <dc:creator>indraastra</dc:creator>
      <dc:date>2013-06-11T19:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling interrupt on a pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287582#M11217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see that I made a mistake and should have set PORT_PCR_IRQC(0xA) instead, but the code still terminates prematurely.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 00:17:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287582#M11217</guid>
      <dc:creator>indraastra</dc:creator>
      <dc:date>2013-06-12T00:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling interrupt on a pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287583#M11218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like I had the misfortune of picking the RESET pin to test interrupts on! Switching to another pin on port A did the trick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 18:22:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287583#M11218</guid>
      <dc:creator>indraastra</dc:creator>
      <dc:date>2013-06-12T18:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling interrupt on a pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287584#M11219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am also trying to program an interrupt on a falling edge but with the Freedom KL05Z development board. I have followed the previous example and I have tried different pins but it's not working. I don't know what am I missing, in the reference manual of the KL05Z the configuration do not seem to be different...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance! :smileyhappy:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 15:23:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287584#M11219</guid>
      <dc:creator>cris</dc:creator>
      <dc:date>2014-05-28T15:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling interrupt on a pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287585#M11220</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;Have you enabled the "global interrupt" as well as configuring the NVIC&amp;nbsp; and the port interrupt itself?&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 16:58:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287585#M11220</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-28T16:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling interrupt on a pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287586#M11221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sorry, I am very new to Freescale microcontrollers and I don't know how to enable the global interrupt. I have been looking for it in the reference manual and this is in section &lt;EM&gt;11.6.2. Global pin control&lt;/EM&gt;: "However, the interrupt functions cannot be configured using the global pin control registers". I must be mistaking parameters...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 09:41:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287586#M11221</guid>
      <dc:creator>cris</dc:creator>
      <dc:date>2014-05-29T09:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling interrupt on a pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287587#M11222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cris&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The global interrupt control is in the ARM procesor.&lt;/P&gt;&lt;P&gt;Using Codewarrior it can be enabled with &lt;STRONG&gt;asm("cpsie&amp;nbsp;&amp;nbsp; i");&lt;/STRONG&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 15:45:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Enabling-interrupt-on-a-pin/m-p/287587#M11222</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-29T15:45:15Z</dc:date>
    </item>
  </channel>
</rss>

