<?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 Toggling a Port Pin on MK20DN64 in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883901#M52379</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made a KDS project for the MK20DN64 using Processor Expert.&amp;nbsp; I'm simply trying to configure&amp;nbsp;PTD4/LLWU_P14 as a GPIO and toggle the pin.&amp;nbsp; I am able to debug the project, but I do not see the pin being driven.&amp;nbsp; The pin just floats.&amp;nbsp; What is missing?&amp;nbsp; I'm using &lt;SPAN&gt;GPIO_PDD_SetPortOutputDirectionMask and&amp;nbsp;GPIO_PDD_SetPortDataOutput.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Here is my main function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void)&lt;BR /&gt;/*lint -restore Enable MISRA rule (6.3) checking. */&lt;BR /&gt;{&lt;BR /&gt; /* Write your local variable definition here */&lt;BR /&gt; long int test;&lt;BR /&gt; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&lt;BR /&gt; PE_low_level_init();&lt;BR /&gt; /*** End of Processor Expert internal initialization. ***/&lt;/P&gt;&lt;P&gt;/* Write your code here */&lt;BR /&gt; /* For example: for(;;) { } */&lt;BR /&gt; GPIO_PDD_SetPortOutputDirectionMask((GPIO_MemMapPtr)0x4004C000u, 0x4000);&lt;BR /&gt; GPIO_PDD_SetPortDataOutput((GPIO_MemMapPtr)0x4004C000u, 0x4000);&lt;BR /&gt; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/&lt;BR /&gt; /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; #ifdef PEX_RTOS_START&lt;BR /&gt; PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt; #endif&lt;BR /&gt; /*** End of RTOS startup code. ***/&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; for(;;){}&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/&lt;BR /&gt;} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Apr 2019 16:26:22 GMT</pubDate>
    <dc:creator>ryan_pearson</dc:creator>
    <dc:date>2019-04-05T16:26:22Z</dc:date>
    <item>
      <title>Toggling a Port Pin on MK20DN64</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883901#M52379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made a KDS project for the MK20DN64 using Processor Expert.&amp;nbsp; I'm simply trying to configure&amp;nbsp;PTD4/LLWU_P14 as a GPIO and toggle the pin.&amp;nbsp; I am able to debug the project, but I do not see the pin being driven.&amp;nbsp; The pin just floats.&amp;nbsp; What is missing?&amp;nbsp; I'm using &lt;SPAN&gt;GPIO_PDD_SetPortOutputDirectionMask and&amp;nbsp;GPIO_PDD_SetPortDataOutput.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Here is my main function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void)&lt;BR /&gt;/*lint -restore Enable MISRA rule (6.3) checking. */&lt;BR /&gt;{&lt;BR /&gt; /* Write your local variable definition here */&lt;BR /&gt; long int test;&lt;BR /&gt; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&lt;BR /&gt; PE_low_level_init();&lt;BR /&gt; /*** End of Processor Expert internal initialization. ***/&lt;/P&gt;&lt;P&gt;/* Write your code here */&lt;BR /&gt; /* For example: for(;;) { } */&lt;BR /&gt; GPIO_PDD_SetPortOutputDirectionMask((GPIO_MemMapPtr)0x4004C000u, 0x4000);&lt;BR /&gt; GPIO_PDD_SetPortDataOutput((GPIO_MemMapPtr)0x4004C000u, 0x4000);&lt;BR /&gt; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/&lt;BR /&gt; /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; #ifdef PEX_RTOS_START&lt;BR /&gt; PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt; #endif&lt;BR /&gt; /*** End of RTOS startup code. ***/&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; for(;;){}&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/&lt;BR /&gt;} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2019 16:26:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883901#M52379</guid>
      <dc:creator>ryan_pearson</dc:creator>
      <dc:date>2019-04-05T16:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling a Port Pin on MK20DN64</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883902#M52380</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;There could be two things going wrong:&lt;/P&gt;&lt;P&gt;- PTD4 is disabled by default and so needs to be configured to a GPIO function (with specific drive current and slew rate characteristics) before it can be used (its clocks also need to be enabled to it but I assume that the project generate just enables all port clocks as default somewhere)&lt;/P&gt;&lt;P&gt;- PTD4 is probably referenced to as 0x0010 and not 0x4000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to do it easier and more efficiently download the uTasker project from GITHUB which has a K20DN target and allows you to simulate the chip (to avoid needing to debug on the target).&lt;BR /&gt;To configure the port and drive it to '1' you just do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_CONFIG_DRIVE_PORT_OUTPUT_VALUE(D, (PORTD_BIT4), (PORTD_BIT4), (PORT_SRE_SLOW | PORT_DSE_HIGH));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The port macros (compatible across all parts) are here:&lt;BR /&gt;&lt;A href="http://www.utasker.com/forum/index.php?topic=1875.0" target="test_blank"&gt;http://www.utasker.com/forum/index.php?topic=1875.0&lt;/A&gt;&lt;/P&gt;&lt;P&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>Sat, 06 Apr 2019 01:32:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883902#M52380</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-04-06T01:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling a Port Pin on MK20DN64</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883903#M52381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ryan Pearson,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try the codes show below:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;nbsp; /* Enable clock gate for ports to enable pin routing */&lt;BR /&gt;&amp;nbsp; SIM_PDD_SetClockGate(SIM_BASE_PTR, SIM_PDD_CLOCK_GATE_PORTD, PDD_ENABLE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Configure pin as output */&lt;BR /&gt;&amp;nbsp; GPIO_PDD_SetPortDirection(&lt;SPAN style="text-decoration: line-through; color: #ff0000;"&gt;PTA_BASE_PTR&lt;/SPAN&gt;PTD_BASE_PTR,GPIO_PDD_PIN_4);&lt;BR /&gt;&amp;nbsp; /* Set initialization value */&lt;BR /&gt;&amp;nbsp; GPIO_PDD_SetPortDataOutput(&lt;SPAN style="text-decoration: line-through; color: #ff0000;"&gt;PTA_BASE_PTR&lt;/SPAN&gt;PTD_BASE_PTR, GPIO_PDD_PIN_4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Initialization of Port Control register */&lt;BR /&gt;&amp;nbsp; PORT_PDD_SetPinMuxControl(PORTD_BASE_PTR, 4, PORT_PDD_MUX_CONTROL_ALT1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Toggle the output of PTD4 */&lt;BR /&gt;&amp;nbsp; GPIO_PDD_TogglePortDataOutputMask(&lt;SPAN style="text-decoration: line-through; color: #ff0000;"&gt;PTA_BASE_PTR&lt;/SPAN&gt;PTD_BASE_PTR,GPIO_PDD_PIN_4);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also use other components, for example: BitIO_LDD&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="BitIO_LDD PTD4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/79174i2C08EC5FCE71341D/image-size/large?v=v2&amp;amp;px=999" role="button" title="BitIO_LDD PTD4.png" alt="BitIO_LDD PTD4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Help on Component.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/79213i81B23AB36EFC3B99/image-size/large?v=v2&amp;amp;px=999" role="button" title="Help on Component.png" alt="Help on Component.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&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>Mon, 08 Apr 2019 01:59:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883903#M52381</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2019-04-08T01:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling a Port Pin on MK20DN64</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883904#M52382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robin!&amp;nbsp; It worked after I changed "&lt;SPAN style="color: #51626f; background-color: #f6f6f6;"&gt;PTA_BASE_PTR" to "&lt;SPAN&gt;PTD_BASE_PTR".&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2019 22:23:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883904#M52382</guid>
      <dc:creator>ryan_pearson</dc:creator>
      <dc:date>2019-04-08T22:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling a Port Pin on MK20DN64</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883905#M52383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reminding!&lt;/P&gt;&lt;P&gt;fixed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2019 01:12:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Toggling-a-Port-Pin-on-MK20DN64/m-p/883905#M52383</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2019-04-09T01:12:17Z</dc:date>
    </item>
  </channel>
</rss>

