<?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 Cannot configure GPIO for input in LPC1769 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577204#M19564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lucasmf004 on Thu Sep 10 21:11:14 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi! I'm writting you because I can't configure the GPIO&amp;nbsp; function for LPC1769 with LPCOpen. I only want to have as input the pins number 15,16,17,18,23,24,26,26 to use a matrix board, so I need to have them in high state when nothing is connected. My configuration code is the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#definePIN_PortLPC_GPIO&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#defineTECLADO_Mask0x7878000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Pin_Init(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_Init(PIN_Port);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPortMask(PIN_Port, 0, TECLADO_Mask);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetDir(PIN_Port, 0, TECLADO_Mask, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//This function is to know if the port is well configured. When I ground the pin number 15, for example, it should take change. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Lee_Pin(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uint32_tLectura = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lectura = Chip_GPIO_ReadValue(PIN_Port, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope you could help me with this. Any one has an example of how configure the GPIO port (not the one that comes with LPCExpresso)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pd: Sorry for miy english, I'm not a native speaker, I'm from Argentina.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:19:35 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:19:35Z</dc:date>
    <item>
      <title>Cannot configure GPIO for input in LPC1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577204#M19564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lucasmf004 on Thu Sep 10 21:11:14 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi! I'm writting you because I can't configure the GPIO&amp;nbsp; function for LPC1769 with LPCOpen. I only want to have as input the pins number 15,16,17,18,23,24,26,26 to use a matrix board, so I need to have them in high state when nothing is connected. My configuration code is the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#definePIN_PortLPC_GPIO&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#defineTECLADO_Mask0x7878000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Pin_Init(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_Init(PIN_Port);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPortMask(PIN_Port, 0, TECLADO_Mask);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetDir(PIN_Port, 0, TECLADO_Mask, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//This function is to know if the port is well configured. When I ground the pin number 15, for example, it should take change. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Lee_Pin(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uint32_tLectura = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lectura = Chip_GPIO_ReadValue(PIN_Port, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope you could help me with this. Any one has an example of how configure the GPIO port (not the one that comes with LPCExpresso)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pd: Sorry for miy english, I'm not a native speaker, I'm from Argentina.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:19:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577204#M19564</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot configure GPIO for input in LPC1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577205#M19565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Fri Sep 11 00:08:18 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Probably you don't want to set pin 126320640 of Port 0 as input&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;&lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you shouldn't use the pin function &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_GPIO_SetDir()&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;which is setting pin (1 &amp;lt;&amp;lt; 0x7878000)...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's a port function, which is doing what you want:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt; Chip_GPIO_SetPortDIR(PIN_Port, 0, INPUT_Mask, 0);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:19:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577205#M19565</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot configure GPIO for input in LPC1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577206#M19566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lucasmf004 on Fri Sep 11 12:27:46 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks R2D2 for your help I followed your suggestion and it worked, but the pin value is not 3.3 and when I read it is equal to 0, do you know how can I set it to Pull-Up ?? My new configuration function is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Pin_Init(void) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;uint32_t PortDir_State = 0, Lectura=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uint32_t TECLADO_NO_Mask;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TECLADO_NO_Mask = ~TECLADO_Mask;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* ESTA CONFIGURACION ESTÁ BIEN!!&amp;nbsp; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_Init(PIN_Port);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPortDIR(PIN_Port, 0, TECLADO_Mask,false);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_GPIO_SetPortDIR(PIN_Port, 0, TECLADO_NO_Mask,true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lectura = Chip_GPIO_ReadValue(PIN_Port, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PortDir_State = Chip_GPIO_GetPortDIR(PIN_Port, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:19:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577206#M19566</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot configure GPIO for input in LPC1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577207#M19567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Fri Sep 11 12:34:51 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: lucasmf004&lt;/STRONG&gt;&lt;BR /&gt;... do you know how can I set it to Pull-Up ??&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Change PINSEL and PINMODE register with Chip_IOCON_PinMux()&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
#include "board.h"
#include &amp;lt;cr_section_macros.h&amp;gt;

//input pins
#define INPUT_PINS((1&amp;lt;&amp;lt;15)|(1&amp;lt;&amp;lt;16)|(1&amp;lt;&amp;lt;17)|(1&amp;lt;&amp;lt;18)|(1&amp;lt;&amp;lt;23)|(1&amp;lt;&amp;lt;24)|(1&amp;lt;&amp;lt;25)|(1&amp;lt;&amp;lt;26))

//input
volatile uint32_t input, input_old;

//init
void app_init(void)
{
 Chip_GPIO_Init(LPC_GPIO);
 //set P0[23] and P0[26] to GPIO (all other pins are GPIO &amp;amp; pullup already)
 [color=#f00]Chip_IOCON_PinMux(LPC_IOCON, 0, 23, IOCON_MODE_PULLUP, IOCON_FUNC0);[/color]
 Chip_IOCON_PinMux(LPC_IOCON, 0, 26, IOCON_MODE_PULLUP, IOCON_FUNC0);
 //set mask
 Chip_GPIO_SetPortMask(LPC_GPIO, 0, ~INPUT_PINS);//enable mask bits with 0
 //set to input
 Chip_GPIO_SetPortDIR(LPC_GPIO, 0, INPUT_PINS, 0);//set to input
}

int main(void)
{
 SystemCoreClockUpdate();
 Board_Init();
 Board_LED_Set(0, true);
 app_init();//app init
 input = Chip_GPIO_GetMaskedPortValue(LPC_GPIO, 0);//get masked port
 input_old = input;//store it
 volatile static int i = 0 ;
 while(1)//endless loop
 {
&amp;nbsp; i++;
&amp;nbsp; input = Chip_GPIO_GetMaskedPortValue(LPC_GPIO, 0);//get masked port
&amp;nbsp; if(input != input_old)//inputs changed
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; input_old = input;//store changed inputs
&amp;nbsp;&amp;nbsp; LPC_GPIO[0].MASK &amp;amp;= ~(1&amp;lt;&amp;lt;22);//add LED mask bit
&amp;nbsp;&amp;nbsp; Board_LED_Toggle(0);
&amp;nbsp;&amp;nbsp; LPC_GPIO[0].MASK |= (1&amp;lt;&amp;lt;22);//remove LED mask bit
&amp;nbsp; }//end inputs changed
 }//end endless loop
 return 0 ;
}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:19:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577207#M19567</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot configure GPIO for input in LPC1769</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577208#M19568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lucasmf004 on Sat Sep 12 16:14:51 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much R2D2!! I'm testing it and by the moment it's working fine, I was understanding some functions from de iocon_17xx_40xx.h file when I saw your reply. It helped me a lot!.. I'll tell you how worked the matrix board in an few days!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:19:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Cannot-configure-GPIO-for-input-in-LPC1769/m-p/577208#M19568</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:19:38Z</dc:date>
    </item>
  </channel>
</rss>

