<?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: Hard Fault when disabling GPIO pin with interrupt configuration in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-when-disabling-GPIO-pin-with-interrupt-configuration/m-p/613509#M36374</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Geoff Sokoll,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Did you add the port interrupt service function(IRQ function)?&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you didn't add it, when the interrupt happens, the code will enter in the hardfault.&lt;/P&gt;&lt;P&gt;&amp;nbsp; So, please add the interrupt service function, then try it again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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>Thu, 09 Feb 2017 09:22:38 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2017-02-09T09:22:38Z</dc:date>
    <item>
      <title>Hard Fault when disabling GPIO pin with interrupt configuration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-when-disabling-GPIO-pin-with-interrupt-configuration/m-p/613508#M36373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an application where I wanted to initially configure a pin as a GPIO input, with an interrupt triggered on a falling edge, and then re-mux the pin to an alternative function. &amp;nbsp;It has been causing hard faults which I couldn't understand, so I have managed to recreate the issue with a very basic program on a FRDM-KL26Z board. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below code snippet which sets up Port A pin 13 as a GPIO input, configures it to generate an interrupt on a falling edge, enables interrupts for Port A, then attempts to re-mux the pin to disabled state. &amp;nbsp;A hard fault occurs at this point in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;CLOCK_EnableClock(kCLOCK_PortA);
PORT_SetPinMux(PORTA, 13U, kPORT_MuxAsGpio);
PORT_SetPinInterruptConfig(&lt;SPAN&gt;PORTA&lt;/SPAN&gt;, 13U, kPORT_InterruptFallingEdge);
EnableIRQ(PORTA_IRQn); // this enable IRQ on all of Port A
PORT_SetPinMux(&lt;SPAN&gt;PORTA&lt;/SPAN&gt;, &lt;SPAN&gt;13U&lt;/SPAN&gt;, kPORT_PinDisabledOrAnalog);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code uses KSDK v2 commands for clarity, but the same fault occurs if the SDK function calls are replaced with the equivalent register read/write commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the example above, the final re-mux was to disable the GPIO pin, but a hard fault occurs if it is re-muxed to other functions (Alt2, Alt3 etc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is anyone else able to replicate this behaviour ? &amp;nbsp;Is this expected behaviour ? &amp;nbsp;I haven't seen anything to suggest it is, but perhaps there is something buried in the ARM reference manuals which says not to change pin muxes when a pin is configured with interrupts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is expected behaviour: what are the other options for either disabling or re-configuring the GPIO pin for alternative functions ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 06:35:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-when-disabling-GPIO-pin-with-interrupt-configuration/m-p/613508#M36373</guid>
      <dc:creator>geoffs</dc:creator>
      <dc:date>2017-02-08T06:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault when disabling GPIO pin with interrupt configuration</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-when-disabling-GPIO-pin-with-interrupt-configuration/m-p/613509#M36374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Geoff Sokoll,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Did you add the port interrupt service function(IRQ function)?&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you didn't add it, when the interrupt happens, the code will enter in the hardfault.&lt;/P&gt;&lt;P&gt;&amp;nbsp; So, please add the interrupt service function, then try it again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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>Thu, 09 Feb 2017 09:22:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-when-disabling-GPIO-pin-with-interrupt-configuration/m-p/613509#M36374</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-02-09T09:22:38Z</dc:date>
    </item>
  </channel>
</rss>

