Unable to configure GPIO0_4/5 etc as input

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to configure GPIO0_4/5 etc as input

793 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Scribe on Wed Oct 10 07:21:13 MST 2012
Hi guys,

We've built a little widget based around the LPC1224/101 and have several buttons on GPIO1 running merrily, however GPIO0_4 refuses to respond to level changes.

We would greatly appreciate if some kind soul could post some sample code for configuring pin GPIO0_4 as an input as we've checked config registers over and over and can't see why this isn't working - Direction bit is 0, there's a clock to GPIO0, we've disabled the pull-up for our configuration (circuit proven on GPIO1) and everything else is set correctly by default.

Many thanks
Labels (1)
0 Kudos
5 Replies

690 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Scribe on Fri Oct 12 00:55:10 MST 2012
I will create an empty project today and run it on the hardware either later on or sometime tomorrow to confirm then I'll rar it up no problem.
0 Kudos

690 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Paul on Thu Oct 11 08:56:27 MST 2012
Can you post your Keil project?  The parts I have do not have the problem with reserved bit 7, so I would like to look at your project.
0 Kudos

690 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Scribe on Thu Oct 11 03:36:18 MST 2012
Hi pboogaards,

The issue was that the reserved bit 7 was set to 0 by default.

Even in a fresh program (ensuring there's no LPC_IOCON->PIO0_4 = 0;) I find this to be the case and so unless Keil's start-up code is doing something odd, then the chip stock I have is not behaving as it should.
0 Kudos

690 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Paul on Wed Oct 10 14:04:33 MST 2012
There shouldn't be any difference between the configuration of GPIO0_4 and other GPIO pins.  The clock to GPIO0 is enabled by default, and the default configuration for this pin is a GPIO with internal pull-up. So the configuration to get this working is minimal:
LPC_IOCON->PIO0_4 &= ~(1<<4); // disable internal pull-up
Make sure you don't set IOCON using:
LPC_IOCON->PIO0_4 = 0;
or else this bit will always read back as a '0' when reading the PIN register (reserved bit 7 must remain 1).
0 Kudos

690 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tha on Wed Oct 10 12:19:42 MST 2012
Can you try using the GPIO API from the code bundle and see it that works?
0 Kudos