<?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 Using MCUXpresso Config Tools to specify input pin in MCUXpresso Config Tools</title>
    <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793061#M482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having trouble using the Pins Config Tools to make GPIO pin working in input mode.&lt;/P&gt;&lt;P&gt;The board I use is FRDM-K22F.&lt;/P&gt;&lt;P&gt;Here is what I did:&lt;/P&gt;&lt;P&gt;1) I&amp;nbsp;created&amp;nbsp; a simple "Hello World" project by following the MCUXpresso_IDE_User_Guide.pdf.&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; Use the Pins config tools to configure PTA4 as an input pin and PTC3 as an output pin. I gave am identifier 'TestIn' to PTA4, and 'TestOut' to PTC3.&amp;nbsp; The tools generated the following code in the&amp;nbsp; BOARD_initPins(void) (inside the pin_mux.h), which seem to be correct:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void BOARD_InitPins(void)&lt;BR /&gt;{&lt;BR /&gt; /* Port A Clock Gate Control: Clock enabled */&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_PortA);&lt;BR /&gt; /* Port C Clock Gate Control: Clock enabled */&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_PortC);&lt;/P&gt;&lt;P&gt;gpio_pin_config_t TestIn_config = {&lt;BR /&gt; .pinDirection = kGPIO_DigitalInput,&lt;BR /&gt; .outputLogic = 0U&lt;BR /&gt; };&lt;BR /&gt; /* Initialize GPIO functionality on pin PTA4 (pin 26) */&lt;BR /&gt; GPIO_PinInit(BOARD_TestIn_GPIO, BOARD_TestIn_PIN, &amp;amp;TestIn_config);&lt;/P&gt;&lt;P&gt;gpio_pin_config_t TestOut_config = {&lt;BR /&gt; .pinDirection = kGPIO_DigitalOutput,&lt;BR /&gt; .outputLogic = 0U&lt;BR /&gt; };&lt;BR /&gt; /* Initialize GPIO functionality on pin PTC3 (pin 46) */&lt;BR /&gt; GPIO_PinInit(BOARD_TestOut_GPIO, BOARD_TestOut_PIN, &amp;amp;TestOut_config);&lt;/P&gt;&lt;P&gt;/* PORTA4 (pin 26) is configured as PTA4 */&lt;BR /&gt; PORT_SetPinMux(BOARD_TestIn_PORT, BOARD_TestIn_PIN, kPORT_MuxAsGpio);&lt;/P&gt;&lt;P&gt;/* PORTC3 (pin 46) is configured as PTC3 */&lt;BR /&gt; PORT_SetPinMux(BOARD_TestOut_PORT, BOARD_TestOut_PIN, kPORT_MuxAsGpio);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; &amp;nbsp;I added the following code to the board.h file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define TestOut_ON() \&lt;BR /&gt; GPIO_PortSet(BOARD_TestOut_GPIO, 1U &amp;lt;&amp;lt; BOARD_TestOut_PIN) /*!&amp;lt; Set TestOut pin */&lt;BR /&gt;#define TestOut_OFF() \&lt;BR /&gt; GPIO_PortClear(BOARD_TestOut_GPIO, 1U &amp;lt;&amp;lt; BOARD_TestOut_PIN) /*!&amp;lt; Clear TestOut pin */&lt;BR /&gt;#define Read_TestIn() \&lt;BR /&gt; GPIO_ReadPinInput(BOARD_TestIn_GPIO, 1U &amp;lt;&amp;lt; BOARD_TestIn_PIN) /*!&amp;lt; Read TestIn pin */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; I added a few test lines in the main() procedure. The main() looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void) {&lt;/P&gt;&lt;P&gt;uint32_t test_val;&lt;/P&gt;&lt;P&gt;/* Init board hardware. */&lt;BR /&gt;BOARD_InitBootPins();&lt;BR /&gt; BOARD_InitBootClocks();&lt;BR /&gt; BOARD_InitBootPeripherals();&lt;BR /&gt; /* Init FSL debug console. */&lt;BR /&gt; BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;PRINTF("Hello World\n");&lt;/P&gt;&lt;P&gt;/* Force the counter to be placed into memory. */&lt;BR /&gt; volatile static int i = 0 ;&lt;BR /&gt; /* Enter an infinite loop, just incrementing a counter. */&lt;/P&gt;&lt;P&gt;TestOut_ON();&lt;BR /&gt; TestOut_OFF();&lt;/P&gt;&lt;P&gt;test_val = Read_TestIn();&lt;BR /&gt; PRINTF("input: %d\n",test_val);&lt;/P&gt;&lt;P&gt;while(1) {&lt;BR /&gt; i++ ;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt; return 0 ;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) I compiled the project and stepped through the code using the debug mode.&amp;nbsp; Before running the code, I had PTA4 connected to a 3.3V input.&amp;nbsp; I can see the output pin PTC3 worked correctly by switching to HIGH and LOW as it stepped through the TestOut_ON() and TestOUT_OFF(), but when I stepped through the "test_val = Read_TestIn()", the test_val returned is always 0.&amp;nbsp; &amp;nbsp; I tried to use different pins, but no success.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone see anything wrong I did, please leave a message.&amp;nbsp; Thank you very much for your help.&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Jun 2018 17:07:00 GMT</pubDate>
    <dc:creator>gangfeng</dc:creator>
    <dc:date>2018-06-18T17:07:00Z</dc:date>
    <item>
      <title>Using MCUXpresso Config Tools to specify input pin</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793061#M482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having trouble using the Pins Config Tools to make GPIO pin working in input mode.&lt;/P&gt;&lt;P&gt;The board I use is FRDM-K22F.&lt;/P&gt;&lt;P&gt;Here is what I did:&lt;/P&gt;&lt;P&gt;1) I&amp;nbsp;created&amp;nbsp; a simple "Hello World" project by following the MCUXpresso_IDE_User_Guide.pdf.&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; Use the Pins config tools to configure PTA4 as an input pin and PTC3 as an output pin. I gave am identifier 'TestIn' to PTA4, and 'TestOut' to PTC3.&amp;nbsp; The tools generated the following code in the&amp;nbsp; BOARD_initPins(void) (inside the pin_mux.h), which seem to be correct:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void BOARD_InitPins(void)&lt;BR /&gt;{&lt;BR /&gt; /* Port A Clock Gate Control: Clock enabled */&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_PortA);&lt;BR /&gt; /* Port C Clock Gate Control: Clock enabled */&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_PortC);&lt;/P&gt;&lt;P&gt;gpio_pin_config_t TestIn_config = {&lt;BR /&gt; .pinDirection = kGPIO_DigitalInput,&lt;BR /&gt; .outputLogic = 0U&lt;BR /&gt; };&lt;BR /&gt; /* Initialize GPIO functionality on pin PTA4 (pin 26) */&lt;BR /&gt; GPIO_PinInit(BOARD_TestIn_GPIO, BOARD_TestIn_PIN, &amp;amp;TestIn_config);&lt;/P&gt;&lt;P&gt;gpio_pin_config_t TestOut_config = {&lt;BR /&gt; .pinDirection = kGPIO_DigitalOutput,&lt;BR /&gt; .outputLogic = 0U&lt;BR /&gt; };&lt;BR /&gt; /* Initialize GPIO functionality on pin PTC3 (pin 46) */&lt;BR /&gt; GPIO_PinInit(BOARD_TestOut_GPIO, BOARD_TestOut_PIN, &amp;amp;TestOut_config);&lt;/P&gt;&lt;P&gt;/* PORTA4 (pin 26) is configured as PTA4 */&lt;BR /&gt; PORT_SetPinMux(BOARD_TestIn_PORT, BOARD_TestIn_PIN, kPORT_MuxAsGpio);&lt;/P&gt;&lt;P&gt;/* PORTC3 (pin 46) is configured as PTC3 */&lt;BR /&gt; PORT_SetPinMux(BOARD_TestOut_PORT, BOARD_TestOut_PIN, kPORT_MuxAsGpio);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; &amp;nbsp;I added the following code to the board.h file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define TestOut_ON() \&lt;BR /&gt; GPIO_PortSet(BOARD_TestOut_GPIO, 1U &amp;lt;&amp;lt; BOARD_TestOut_PIN) /*!&amp;lt; Set TestOut pin */&lt;BR /&gt;#define TestOut_OFF() \&lt;BR /&gt; GPIO_PortClear(BOARD_TestOut_GPIO, 1U &amp;lt;&amp;lt; BOARD_TestOut_PIN) /*!&amp;lt; Clear TestOut pin */&lt;BR /&gt;#define Read_TestIn() \&lt;BR /&gt; GPIO_ReadPinInput(BOARD_TestIn_GPIO, 1U &amp;lt;&amp;lt; BOARD_TestIn_PIN) /*!&amp;lt; Read TestIn pin */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; I added a few test lines in the main() procedure. The main() looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(void) {&lt;/P&gt;&lt;P&gt;uint32_t test_val;&lt;/P&gt;&lt;P&gt;/* Init board hardware. */&lt;BR /&gt;BOARD_InitBootPins();&lt;BR /&gt; BOARD_InitBootClocks();&lt;BR /&gt; BOARD_InitBootPeripherals();&lt;BR /&gt; /* Init FSL debug console. */&lt;BR /&gt; BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;PRINTF("Hello World\n");&lt;/P&gt;&lt;P&gt;/* Force the counter to be placed into memory. */&lt;BR /&gt; volatile static int i = 0 ;&lt;BR /&gt; /* Enter an infinite loop, just incrementing a counter. */&lt;/P&gt;&lt;P&gt;TestOut_ON();&lt;BR /&gt; TestOut_OFF();&lt;/P&gt;&lt;P&gt;test_val = Read_TestIn();&lt;BR /&gt; PRINTF("input: %d\n",test_val);&lt;/P&gt;&lt;P&gt;while(1) {&lt;BR /&gt; i++ ;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt; return 0 ;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) I compiled the project and stepped through the code using the debug mode.&amp;nbsp; Before running the code, I had PTA4 connected to a 3.3V input.&amp;nbsp; I can see the output pin PTC3 worked correctly by switching to HIGH and LOW as it stepped through the TestOut_ON() and TestOUT_OFF(), but when I stepped through the "test_val = Read_TestIn()", the test_val returned is always 0.&amp;nbsp; &amp;nbsp; I tried to use different pins, but no success.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone see anything wrong I did, please leave a message.&amp;nbsp; Thank you very much for your help.&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2018 17:07:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793061#M482</guid>
      <dc:creator>gangfeng</dc:creator>
      <dc:date>2018-06-18T17:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using MCUXpresso Config Tools to specify input pin</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793062#M483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" class="" data-content-finding="Community" data-userid="320676" data-username="gangfeng" href="https://community.nxp.com/people/gangfeng"&gt;GANG FENG&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Do you choose the right pin on FRDM-K22 board ?&lt;/P&gt;&lt;P&gt;PTA4 is J1-10 pin on board. The pin is high by defult even if we connet nothing signal with it.&lt;/P&gt;&lt;P&gt;I test on my side with MCUXpresso IDE, it can work well .&lt;/P&gt;&lt;P&gt;Which IDE do you used ? You can send your whole project to me , I will check it on my side .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&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>Tue, 19 Jun 2018 08:57:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793062#M483</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2018-06-19T08:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using MCUXpresso Config Tools to specify input pin</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793063#M484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Attached please find the whole project.&lt;/P&gt;&lt;P&gt;  Please step through and see if you can get test_val = 1 after executing the line test_val = Read_TestIn();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2018 15:07:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793063#M484</guid>
      <dc:creator>gangfeng</dc:creator>
      <dc:date>2018-06-19T15:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using MCUXpresso Config Tools to specify input pin</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793064#M485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gang,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked your code , I'm confused why does it left shift one bit at below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/62038i3098FB908C39572D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you change it to the below code , this meaning&amp;nbsp; read the PTA4 input pin :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#define Read_TestIn() \&lt;/P&gt;&lt;P&gt;&amp;nbsp;GPIO_ReadPinInput(BOARD_TestIn_GPIO,&amp;nbsp; BOARD_TestIn_PIN) /*!&amp;lt; Read TestIn pin */&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;the result is :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/62039iF7C3CE989902674F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_4.png" alt="pastedImage_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&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>Wed, 20 Jun 2018 06:30:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Using-MCUXpresso-Config-Tools-to-specify-input-pin/m-p/793064#M485</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2018-06-20T06:30:11Z</dc:date>
    </item>
  </channel>
</rss>

