EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2468 GPIO

Started by coli...@arrisi.com January 27, 2011
Hi,
I'm a noob in this group and with LPC micros for forgive me if this sounds a little basic. Have been tearing my hair out trying to set D0-D7 (P3.0 - P3.7) as GPIO inputs on LPC2468. Using keil,

have the following config

PINSEL6 = 0x5555; /*enable D0/
FIO3DIR &= ~((1UL<<7)|(1UL<<6)|(1UL<<5)|(1UL<<4)|(1UL<<3)|(1UL<<2)|(1UL<<1)|(1UL<<0)); /*set direction - Pins0-7*/
FIO3MASK &= ~((1UL<<7)|(1UL<<6)|(1UL<<5)|(1UL<<4)|(1UL<<3)|(1UL<<2)|(1UL<<1)|(1UL<<0)); /*Pins0-7*/

I then thought it was just a manner of reading FIO3PIN0 reg but apparently not. Am getting spurious results

int lower = FIO3PIN0;

would appreciate any help or pointers

An Engineer's Guide to the LPC2100 Series

Hi Colin,

If in doubt read the manual :) (http://www.nxp.com/documents/user_manual/UM10237.pdf).

You'll find under Pinsel6 that it describes the different functions of each pin setting. If you're trying to set up 8 GPIO pins (which is actually the default state for the pins anyway) you'll actually need PINSEL6 = 0; (You're currently setting each pin to function 01 which is data bus).

FIO3DIR only works if you're in GPIO, so I assume that's what you want rather than a data bus.

In Keil btw you can quickly see the state of your Pin block by quickly dropping into debug mode, setting a break point after your pinsel statement and then looking at Peripherals->Pin Connect Block. It's also a very fast way of setting the register up with the correct boot-up settings without having to work them all out manually. Likewise you can also look at Peripherals->GPIO in order to see pin state and direction etc.

Hope that helps.

Andy

From: l... [mailto:l...] On Behalf Of c...@arrisi.com
Sent: 27 January 2011 11:12
To: l...
Subject: [lpc2000] LPC2468 GPIO

Hi,
I'm a noob in this group and with LPC micros for forgive me if this sounds a little basic. Have been tearing my hair out trying to set D0-D7 (P3.0 - P3.7) as GPIO inputs on LPC2468. Using keil,

have the following config

PINSEL6 = 0x5555; /*enable D0/
FIO3DIR &= ~((1UL<<7)|(1UL<<6)|(1UL<<5)|(1UL<<4)|(1UL<<3)|(1UL<<2)|(1UL<<1)|(1UL<<0)); /*set direction - Pins0-7*/
FIO3MASK &= ~((1UL<<7)|(1UL<<6)|(1UL<<5)|(1UL<<4)|(1UL<<3)|(1UL<<2)|(1UL<<1)|(1UL<<0)); /*Pins0-7*/

I then thought it was just a manner of reading FIO3PIN0 reg but apparently not. Am getting spurious results

int lower = FIO3PIN0;

would appreciate any help or pointers
thanks Andy,

apologies again that was bad mistake,
still having same problem though
even when
PINSEL6 = 0x00000000;

also for ease have
FIO3DIR = 0x00000000; //for input
FIO3MASK0 = 0x00; //enabled for read FIO3PIN0

apologies again but just seem to be missing something.I've been scanning
user manual GPIO sections but cant figure it out

regards,

Colin
Hi,
>I'm a noob in this group and with LPC micros for forgive me if this sounds a little basic. Have been tearing my hair out trying to set D0-D7 (P3.0 - P3.7) as GPIO inputs on LPC2468. Using keil,
>
>have the following config
>
>PINSEL6 = 0x5555; /*enable D0/
>FIO3DIR &= ~((1UL <
On 01/27/2011 07:35 PM, c...@arrisi.com wrote:
> [...] still having same problem though [...]

Have you enabled fast I/O?

--

Timo
--- In l..., Timo wrote:
>
> On 01/27/2011 07:35 PM, colin.walsh@... wrote:
> > [...] still having same problem though [...]
>
> Have you enabled fast I/O?
>

That was my first thought as well. However, reading of the manual tells me that you only have to do that for Port 0 and Port 1 on the LPC2468. The Port 3 that Colin is using is 'Fast Only'.

@ Colin: What exactly do you mean by '.... Am getting spurious results'?

What results are you expecting and why?

What results are you getting?

Regards,
Chris

Hi Chris,

thanks for reply,

I'm applying an external byte of eg AA or similar to port 3 pins 0-7 of eval board. I'm reading FIO3PIN0 register and displaying it to an LCD. This reading can be anything from all 1's to 0's to anything in between.
I'm sure the LCD readings are correct but unfortunanely cant seem to read inputs correctly

tnx

colin


The 2024 Embedded Online Conference