<?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: PORT_SetPinConfig for green LED on FRDM-K64F crashes in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505264#M4967</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the issue that you're seeing is the attempt to write to a peripheral that doesn't have the clock enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The green GPIO on FRDM-K64F is located on PortE. Try adding this line above your pin initialization:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Enable the clock to the PORT module that the LED is on. */&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLOCK_EnableClock(kCLOCK_PortE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Feb 2016 11:56:51 GMT</pubDate>
    <dc:creator>Jmart</dc:creator>
    <dc:date>2016-02-12T11:56:51Z</dc:date>
    <item>
      <title>PORT_SetPinConfig for green LED on FRDM-K64F crashes</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505263#M4966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Installed KDS 3.1, and SDK 2.0 for the FRDM-K64F board. I wanted to light the red, green, and blue LEDs just to start. I added this code to &lt;SPAN style="font-family: 'courier new', courier;"&gt;BOARD_InitPins&lt;/SPAN&gt;:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialize LED pins&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port_pin_config_t ledConfig = {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .pullSelect = kPORT_PullDisable,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .slewRate = kPORT_SlowSlewRate,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .passiveFilterEnable = kPORT_PassiveFilterDisable,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .openDrainEnable = kPORT_OpenDrainDisable,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .driveStrength = kPORT_LowDriveStrength,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .mux = kPORT_MuxAsGpio,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .lockRegister = kPORT_UnlockRegister,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_SetPinConfig(BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, &amp;amp;ledConfig);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_SetPinConfig(BOARD_LED_GREEN_GPIO_PORT, BOARD_LED_GREEN_GPIO_PIN, &amp;amp;ledConfig);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_SetPinConfig(BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, &amp;amp;ledConfig);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Then in &lt;SPAN style="font-family: 'courier new', courier;"&gt;main.c&lt;/SPAN&gt;, I added:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LED_RED_INIT(LOGIC_LED_ON);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LED_GREEN_INIT(LOGIC_LED_ON);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LED_BLUE_INIT(LOGIC_LED_ON);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;I ran it in debug mode, and found that the &lt;SPAN style="font-family: 'courier new', courier;"&gt;PORT_SetPinConfig&lt;/SPAN&gt; for the green LED crashed the board. Commenting out that line worked, although of course only the red and blue LEDs lit.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;What's going on?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 04:36:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505263#M4966</guid>
      <dc:creator>robertbaruch</dc:creator>
      <dc:date>2016-02-12T04:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: PORT_SetPinConfig for green LED on FRDM-K64F crashes</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505264#M4967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the issue that you're seeing is the attempt to write to a peripheral that doesn't have the clock enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The green GPIO on FRDM-K64F is located on PortE. Try adding this line above your pin initialization:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Enable the clock to the PORT module that the LED is on. */&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLOCK_EnableClock(kCLOCK_PortE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Feb 2016 11:56:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505264#M4967</guid>
      <dc:creator>Jmart</dc:creator>
      <dc:date>2016-02-12T11:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: PORT_SetPinConfig for green LED on FRDM-K64F crashes</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505265#M4968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. Do you know of a document that shows a schematic of how each (or a typical) pin functions? Because honestly, I looked through the K64 reference manual, read the chapters on the PORT module and CLOCK modules, and I still don't understand how the clock interacts with the ports. I did see in the GPIO module section that in output mode, the pin is set to 0 or 1 on the rising edge of the system clock, but I don't quite know why the board would have crashed just because I didn't enable the clock for port E.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Feb 2016 04:48:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505265#M4968</guid>
      <dc:creator>robertbaruch</dc:creator>
      <dc:date>2016-02-13T04:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: PORT_SetPinConfig for green LED on FRDM-K64F crashes</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505266#M4969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reference manuals will contain the most information for how a port / gpio functions. Each pin (for the most part) can support many different functions, so it's best to always refer to the SoC reference manual for what's the correct setting for your board. Given that, I've not seen a publicly available FRDM-K64F schematic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue that you've encountered is related to the clocking of the port E peripheral. In order to maintain the lowest possible power, the SoC 'gates' clocks until you're ready to use them, in which case, you must ungate the clock to enable the peripheral. When the clock for a peripheral is gated, it's not possible to read or write to the addresses owned by that peripheral, because they don't 'exist' until you ungate the clock. Access to those memory locations prior to ungating the clock will cause a hard fault. You can find a blurb about clock gating in the K64 reference manual rev 2 from January 2014 (section 5.6 - Clock Gating).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Feb 2016 14:15:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505266#M4969</guid>
      <dc:creator>Jmart</dc:creator>
      <dc:date>2016-02-13T14:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: PORT_SetPinConfig for green LED on FRDM-K64F crashes</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505267#M4970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent explanation, thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Feb 2016 18:29:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/PORT-SetPinConfig-for-green-LED-on-FRDM-K64F-crashes/m-p/505267#M4970</guid>
      <dc:creator>robertbaruch</dc:creator>
      <dc:date>2016-02-13T18:29:21Z</dc:date>
    </item>
  </channel>
</rss>

