Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: AW: [lpc2100] Re: GPIO - Pins

2004-02-03 by Robert Adsett

A few questions and observations:
At 05:42 PM 2/3/04 +0100, you wrote:

>Hi,
>
>I have a similar problem. I want to use p0.2 and p0.3 as standard GPIO
>Output Pins.
>For this use I need a Pull up resistor.

Yes, that's to be expected.  They are the IIC pins and need pullups.


>If I use another Pin like P0.30 the level not changes on wire, not with
>pull up not with pull down and not without anything.
>What can be wrong?
>
>Here is my code: I think it's not the Problem, I hope
>
>     REG(PCB_PINSEL1) &= ~(0xF0000000);

First, what is REG defined as?  And also PCB_PINSEL etc...  That's an 
unusual looking construct.

>     REG(PCB_PINSEL0) &= ~(0xF0);
>     REG(GPIO_IODIR) |= 0xC00000C; //Output direction for P0.30/31/2/3
>     REG(GPIO_IOCLR) |= 0xC00000C; //Set Port P0.30/31/2/3 low
>//P0.2/3 OK with Pull-up
>     REG(GPIO_IOSET) |= 0xC00000C; //Set Port P0.30/31/2/3 high



I don't believe These lines do what you think they do.  You want something 
more like.

IOCLR = 0xC00000C;
IOSET = 0xC00000C;

And 0xC00000C should be 0xC000000C;

You're off by a couple of pins.

IOCLR |= 0xC00000C;

will clear (at least) pins 2, 3, 26, 27.  IOCLR is a write only register.

IOSET |= 0xC00000C;

will set pins 2, 3, 26, 27 AND any other pins that had previously been set 
(a little redundant but not harmful).

>//P0.2/3 OK with Pull-up
>     b_sleep(0xffff);
>     REG(GPIO_IOCLR) |= 0xC00000C; //Set Port P0.30/31/2/3 low
>//P0.2/3 OK with Pull-up

Check pins 26 & 27 and see if they are toggling.


" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.