GPIO - Pins

Started by Thomas Weber February 3, 2004
Could it be, that i have to pull-up all gpio-pins, i want use?

I have a pull-down on a gpio-pin, because the wire is normally on low, but
the wire is never on a high level.

Thomas



An Engineer's Guide to the LPC2100 Series

--- In , "Thomas Weber" <weber@c...> wrote:
> Could it be, that i have to pull-up all gpio-pins, i want use?
>
> I have a pull-down on a gpio-pin, because the wire is normally on
low, but
> the wire is never on a high level.
>
> Thomas

Hello Thomas,

i have noticed that the GPIOs of the LPC2106 on my self-made test-
board after a reset or when they are in input mode have a level of 2
volt. They must be pulled with a resistor (<5k) to reach the desired
low or high state. In output mode everything is ok. Is this correct?

Mathew




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.

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);
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
//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 Regards, Sen
--- In , "Thomas Weber" <weber@c...> wrote:
> Could it be, that i have to pull-up all gpio-pins, i want use?
>
> I have a pull-down on a gpio-pin, because the wire is normally on
low, but
> the wire is never on a high level.
>
> Thomas

Hello Thomas,

i have noticed that the GPIOs of the LPC2106 on my self-made test-
board after a reset or when they are in input mode have a level of 2
volt. They must be pulled with a resistor (<5k) to reach the desired
low or high state. In output mode everything is ok. Is this correct?

Mathew

Yahoo! Groups Links
To



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



The I2C SDA and SCL are on those pins.
It seems disabling the I2C (default) doesn't provide push-pull
instead of opendrain as needed by I2C

-- Kris
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.

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);
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
//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 Regards, Sen
--- In , "Thomas Weber" <weber@c...> wrote:
> Could it be, that i have to pull-up all gpio-pins, i want use?
>
> I have a pull-down on a gpio-pin, because the wire is normally on
low, but
> the wire is never on a high level.
>
> Thomas

Hello Thomas,

i have noticed that the GPIOs of the LPC2106 on my self-made test-
board after a reset or when they are in input mode have a level of 2
volt. They must be pulled with a resistor (<5k) to reach the desired
low or high state. In output mode everything is ok. Is this correct?

Mathew

Yahoo! Groups Links
. To

----
----
Yahoo! Groups Links

a.. To


Thomas Weber wrote:
> Could it be, that i have to pull-up all gpio-pins, i want use?
>
> I have a pull-down on a gpio-pin, because the wire is normally on low, but
> the wire is never on a high level.
>

Is it an input or an output? What's the value of the pull-down? You may
be pulling it down too hard, depending on what is driving the line. This also brings up a new question, what's the proper configuration for
unused GPIO pins? One he MSP430 I set unused pins to outputs with a 0
level on them, is this acceptable practice for the LPC21xx parts? I only
see some of the GPIO pins (associated with the TRACE support) have
internal pullups, so that would lead me to think that leaving the others
as inputs and unconnected wouldn't be a bright idea.

Brian

--
-----------------
Brian C. Lane (W7BCL) Programmer
www.shinemicro.com RF, DSP & Microcontroller Design



--- In , "Brian C. Lane" <brian@s...> wrote:

> Is it an input or an output? What's the value of the pull-down? You may
> be pulling it down too hard, depending on what is driving the line.
>
> This also brings up a new question, what's the proper configuration
for unused GPIO pins? One he MSP430 I set unused pins to outputs with
a 0 level on them, is this acceptable practice for the LPC21xx parts?
I only see some of the GPIO pins (associated with the TRACE support)
have internal pullups, so that would lead me to think that leaving the
others as inputs and unconnected wouldn't be a bright idea.
>
> Brian
>
> --
> -----------------
> Brian C. Lane (W7BCL) Programmer
> www.shinemicro.com RF, DSP & Microcontroller Design

Brian,

it is absolutely proper practice to program unused I/O pins to output
with a given level on the LPC2100. Either low or high is possible.
Having unconnected pins as input is probably not the best idea as you
pointed out.

Bob


At 12:24 PM 2/3/04 +0100, you wrote:
>Could it be, that i have to pull-up all gpio-pins, i want use?

You will have to for the pins that serve as IIC, but the others shouldn't
need a pull up. Not to get an output signal anyway.

Robert

" '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


Hallo,
Thanks for your effort

Its a pity, but it doesnt work
I watched the pins 26 and 27 -> they didnt toggle.
Then I changed the code as I need (0xC00000C to 0xC000000C) and pin 30
and 31 didnt toggle too.

Regards Sen
PS: these two tings are defined in my LPC2100_addr.h. It's a comfortable
way, to access Registers.
// helper macro to write to a memory mapped register
#define REG(addr) (*(volatile unsigned long *)(addr))

#define PCB_PINSEL0 (0xE002C000) /* pin function sel reg 0 */
#define PCB_PINSEL1 (0xE002C004) /* pin function sel reg 1 */

So I can use it like this: REG(PCB_PINSEL1) &= ~(0xF0000000);

>>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



At 12:11 PM 2/4/04 +0100, you wrote:
>Hallo,
>Thanks for your effort
>
>Its a pity, but it doesnt work
>I watched the pins 26 and 27 -> they didnt toggle.

That probably makes sense.

>Then I changed the code as I need (0xC00000C to 0xC000000C) and pin 30
>and 31 didnt toggle too.
>
>Regards Sen >
>PS: these two tings are defined in my LPC2100_addr.h. It's a comfortable
>way, to access Registers.
>// helper macro to write to a memory mapped register
>#define REG(addr) (*(volatile unsigned long *)(addr))
>
>#define PCB_PINSEL0 (0xE002C000) /* pin function sel reg 0 */
>#define PCB_PINSEL1 (0xE002C004) /* pin function sel reg 1 */
>
>So I can use it like this: REG(PCB_PINSEL1) &= ~(0xF0000000);

That looks OK.

(I'm more used to seeing something like

#define PINSEL0 (*(volatile unsigned int *)(0xE002C000))

or

extern unsigned int PINSEL0;

where PINSEL0 in the second case is defined by the compiler, the library or
somewhere else in the link path.) I just tested an an example here and it works just fine, but before I offer
to post it, I have one other thought. Do you, by any chance, have the JTAG
interface turned on? If so that would explain why you weren't seeing any
toggles.

Robert " '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