<?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>Kinetis MicrocontrollersのトピックHow to read Status of INPUT GPIO pin?</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-read-Status-of-INPUT-GPIO-pin/m-p/778927#M47385</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;I am using&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: bold; font-size: 14px;"&gt;FRDM-KE04Z dev board with onboard MKE04Z8VFK4 MCU&lt;/STRONG&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;, for developing Bit banging I am able to transmit data through gpio&amp;nbsp;pin but I am&amp;nbsp;unable to receive data from gpio&amp;nbsp;pin, I need to know how to read the status of input GPIO pin?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;below is my sample code: I am configured PTA3 is OUTPUT gpio and PTA2 Input gpio pin&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;unsigned char UART_Receive(void)&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;unsigned char DataValue = 0;&lt;BR /&gt;uint32_t data;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data = GPIO_PinRead(kGPIO_PORTA, 2U);&lt;/P&gt;&lt;P&gt;while((GPIO_PinRead(kGPIO_PORTA, 2U)) == 0);&amp;nbsp; &lt;STRONG&gt;// this is the right way?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT((OneBitDelay/2), PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for ( unsigned char i = 0; i &amp;lt; DataBitCount; i++ )&lt;BR /&gt;{&lt;BR /&gt;if ( (GPIO_PinRead(kGPIO_PORTA, 2U))) &lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;// this is the right way?&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;DataValue += (1&amp;lt;&amp;lt;i);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Check for stop bit&lt;BR /&gt;if ( (GPIO_PinRead(kGPIO_PORTA, 2U))) &lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;// this is the right way?&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT((OneBitDelay/2), PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;return DataValue;&lt;BR /&gt;}&lt;BR /&gt;else //some error occurred !&lt;BR /&gt;{&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT((OneBitDelay/2), PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;//DelayUs(OneBitDelay/2);&lt;BR /&gt;return 0x000;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void UART_Transmit(const char DataValue)&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;/* Basic Logic&lt;/P&gt;&lt;P&gt;TX pin is usually high. A high to low bit is the starting bit and&lt;BR /&gt;a low to high bit is the ending bit. No parity bit. No flow control.&lt;BR /&gt;BitCount is the number of bits to transmit. Data is transmitted LSB first.&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;// Send Start Bit&lt;BR /&gt;//GPIO_PinClear(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 0); ////////////////////////////////////&lt;/P&gt;&lt;P&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;/P&gt;&lt;P&gt;for ( unsigned char i = 0; i &amp;lt; DataBitCount; i++ )&lt;BR /&gt;{&lt;BR /&gt;//Set Data pin according to the DataValue&lt;BR /&gt;if( ((DataValue&amp;gt;&amp;gt;i)&amp;amp;0x1) == 0x1 ) //if Bit is high&lt;BR /&gt;{&lt;BR /&gt;//GPIO_PinSet(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 1); ////////////////////////////////////&lt;BR /&gt;}&lt;BR /&gt;else //if Bit is low&lt;BR /&gt;{&lt;BR /&gt;//GPIO_PinClear(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 0); ////////////////////////////////////&lt;BR /&gt;}&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//Send Stop Bit&lt;BR /&gt;//GPIO_PinSet(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 1); ////////////////////////////////////&lt;/P&gt;&lt;P&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Apr 2018 06:54:30 GMT</pubDate>
    <dc:creator>vikranthnk</dc:creator>
    <dc:date>2018-04-30T06:54:30Z</dc:date>
    <item>
      <title>How to read Status of INPUT GPIO pin?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-read-Status-of-INPUT-GPIO-pin/m-p/778927#M47385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;I am using&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: bold; font-size: 14px;"&gt;FRDM-KE04Z dev board with onboard MKE04Z8VFK4 MCU&lt;/STRONG&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;, for developing Bit banging I am able to transmit data through gpio&amp;nbsp;pin but I am&amp;nbsp;unable to receive data from gpio&amp;nbsp;pin, I need to know how to read the status of input GPIO pin?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;below is my sample code: I am configured PTA3 is OUTPUT gpio and PTA2 Input gpio pin&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;unsigned char UART_Receive(void)&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;unsigned char DataValue = 0;&lt;BR /&gt;uint32_t data;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data = GPIO_PinRead(kGPIO_PORTA, 2U);&lt;/P&gt;&lt;P&gt;while((GPIO_PinRead(kGPIO_PORTA, 2U)) == 0);&amp;nbsp; &lt;STRONG&gt;// this is the right way?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT((OneBitDelay/2), PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for ( unsigned char i = 0; i &amp;lt; DataBitCount; i++ )&lt;BR /&gt;{&lt;BR /&gt;if ( (GPIO_PinRead(kGPIO_PORTA, 2U))) &lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;// this is the right way?&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;DataValue += (1&amp;lt;&amp;lt;i);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Check for stop bit&lt;BR /&gt;if ( (GPIO_PinRead(kGPIO_PORTA, 2U))) &lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;// this is the right way?&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT((OneBitDelay/2), PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;return DataValue;&lt;BR /&gt;}&lt;BR /&gt;else //some error occurred !&lt;BR /&gt;{&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT((OneBitDelay/2), PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;//DelayUs(OneBitDelay/2);&lt;BR /&gt;return 0x000;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void UART_Transmit(const char DataValue)&lt;/STRONG&gt;&lt;BR /&gt;{&lt;BR /&gt;/* Basic Logic&lt;/P&gt;&lt;P&gt;TX pin is usually high. A high to low bit is the starting bit and&lt;BR /&gt;a low to high bit is the ending bit. No parity bit. No flow control.&lt;BR /&gt;BitCount is the number of bits to transmit. Data is transmitted LSB first.&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;// Send Start Bit&lt;BR /&gt;//GPIO_PinClear(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 0); ////////////////////////////////////&lt;/P&gt;&lt;P&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;/P&gt;&lt;P&gt;for ( unsigned char i = 0; i &amp;lt; DataBitCount; i++ )&lt;BR /&gt;{&lt;BR /&gt;//Set Data pin according to the DataValue&lt;BR /&gt;if( ((DataValue&amp;gt;&amp;gt;i)&amp;amp;0x1) == 0x1 ) //if Bit is high&lt;BR /&gt;{&lt;BR /&gt;//GPIO_PinSet(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 1); ////////////////////////////////////&lt;BR /&gt;}&lt;BR /&gt;else //if Bit is low&lt;BR /&gt;{&lt;BR /&gt;//GPIO_PinClear(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 0); ////////////////////////////////////&lt;BR /&gt;}&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//Send Stop Bit&lt;BR /&gt;//GPIO_PinSet(UART_TX);&lt;BR /&gt;GPIO_PinWrite(kGPIO_PORTA, 3U, 1); ////////////////////////////////////&lt;/P&gt;&lt;P&gt;//DelayUs(OneBitDelay);&lt;BR /&gt;PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(OneBitDelay, PIT_SOURCE_CLOCK));&lt;BR /&gt;PIT_StartTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;while(!pitIsrFlag);&lt;BR /&gt;PIT_StopTimer(PIT, kPIT_Chnl_0);&lt;BR /&gt;pitIsrFlag = 0;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2018 06:54:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-read-Status-of-INPUT-GPIO-pin/m-p/778927#M47385</guid>
      <dc:creator>vikranthnk</dc:creator>
      <dc:date>2018-04-30T06:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Status of INPUT GPIO pin?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-read-Status-of-INPUT-GPIO-pin/m-p/778928#M47386</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;I don't know the routine&lt;/P&gt;&lt;P&gt;GPIO_PinRead(kGPIO_PORTA, 2U)&lt;/P&gt;&lt;P&gt;but if it doesn't work as it is (and you have referenced the correct port and bit - PTA2) it may be that it needs to be used as follows instead:&lt;/P&gt;&lt;P&gt;GPIO_PinRead(kGPIO_PORTA,&lt;STRONG&gt; (1 &amp;lt;&amp;lt; 2U)&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;SPAN&gt;Kinetis: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2018 14:51:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-read-Status-of-INPUT-GPIO-pin/m-p/778928#M47386</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-04-30T14:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to read Status of INPUT GPIO pin?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-read-Status-of-INPUT-GPIO-pin/m-p/778929#M47387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Vikranth,&lt;/P&gt;&lt;P&gt;If you want to configure the PTA2 as input, I think you can use the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gpio_pin_config_t input_config = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kGPIO_DigitalInput, 0,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&amp;nbsp;/* Init input GPIO. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PinInit(kGPIO_PORTA, 2, &amp;amp;input_config);&lt;/P&gt;&lt;P&gt;//read PTA2 pin&lt;/P&gt;&lt;P&gt;GPIO_PinRead(kGPIO_PORTA,2); //If PTA2 is high logic, it returns 0x01, if vPTA2 is low logic, it will return 0&lt;/P&gt;&lt;P&gt;Pls have a try&lt;/P&gt;&lt;P&gt;Regarding your code, it seems that you read the uart receiver logic, I suggest you use uart module instead of sampling the logic of uart_rx pin.&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;P&gt;This is the api function in ksdk&lt;/P&gt;&lt;P&gt;uint32_t GPIO_PinRead(gpio_port_num_t port, uint8_t pin)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t instance = (uint8_t)port / PORT_NUMBERS_EACH_GPIO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t shift = (uint8_t)port % PORT_NUMBERS_EACH_GPIO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_Type *base = s_gpioBases[instance];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (((base-&amp;gt;PDIR) &amp;gt;&amp;gt; ((uint32_t)pin + (shift * PIN_NUMBERS_EACH_PORT))) &amp;amp; 0x01U);&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2018 08:15:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-read-Status-of-INPUT-GPIO-pin/m-p/778929#M47387</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2018-05-02T08:15:28Z</dc:date>
    </item>
  </channel>
</rss>

