EmbeddedRelated.com
Forums

how to Toggle port 0.26

Started by Philipp Brejcha September 24, 2010
Hi everyone,

we bought a Evalboard from Embedded Artist (LPC2478 and the QVGA baseboard)

http://www.embeddedartists.com/products/kits/lpc2478_kit.php

but we are not able to toggle the port 0.26. There is no jumper, because if
we run the demo application (which is only available as *.hex) the speaker
(connected to P0.26) makes a sound.

I set the PINSEL to 0x0 (GPIO mode)
The PINMODE to 0x0 (Pull up)
and the direction to output:

pllInit();
PINSEL1 = 0x0;
PINMODE1 = (0x2<<20); //0x0 -> pull up; (0x2<<20) - pull down;
FIO0DIR |= (1<<26); // speaker
FIO2DIR |= (1<<10); // led

for(;;)
{
FIO0SET |= (1<<26); // set speaker
FIO2SET |= (1<<10); // set led
delayMs(1);
FIO0CLR |= (1<<26); // reset speaker
FIO2CLR |= (1<<10); // reset led
delayMs(1);
}

has anyone an idea why this does not work?

has anyone a working code for the pin 0.26?

It seems like there are some extra settings necessary for port 0 and port 1,
but i have not found them yet...
does anyone know which?

greetings,

philipp

An Engineer's Guide to the LPC2100 Series

Philipp Brejcha wrote:
> ... but we are not able to toggle the port 0.26...

> It seems like there are some extra settings necessary for port 0...

GPIOM? (3-3.4.1 in User Manual)

--

Timo

That was the mistake!

Thank you very much!

Greetings,

Philipp

On Mon, Sep 27, 2010 at 10:22 AM, wrote:

> Philipp Brejcha wrote:
> > ... but we are not able to toggle the port 0.26...
>
> > It seems like there are some extra settings necessary for port 0...
>
> GPIOM? (3-3.4.1 in User Manual)
>
> --
>
> Timo
>
>
>
Hi Philipp,

Have you set up the SCS to enable fast IO on ports 0 and 1? I don't see it in your code.

The older LPC parts had different performance/timings on these ports, so they can operate in two modes to stay backwards compatible or provide increase performance.

Unless high speed IO is enabled, these ports won't work properly with the FIO0xxx and FIO1xxx registers.

You can either set bit 0 of SCS (0xe01fc1a0) to 1, or use the old IO interface for those ports (IO0xxx and IO1xxx)

You also shouldn't use |= on the FIOxSET and FIOxCLR registers. Have a re-read of chapter 10 of the user manual. For example:

To set the speaker pin high:
FIO0SET = (1 << 26);

To set the speaker pin low:
FIO0CLR = (1 << 26);
Regards,

Nathan.
----- Original Message -----
From: Philipp Brejcha
To: l...
Sent: Saturday, September 25, 2010 2:11 AM
Subject: [lpc2000] how to Toggle port 0.26

Hi everyone,

we bought a Evalboard from Embedded Artist (LPC2478 and the QVGA baseboard)

http://www.embeddedartists.com/products/kits/lpc2478_kit.php

but we are not able to toggle the port 0.26. There is no jumper, because if we run the demo application (which is only available as *.hex) the speaker (connected to P0.26) makes a sound.

I set the PINSEL to 0x0 (GPIO mode)
The PINMODE to 0x0 (Pull up)
and the direction to output:

pllInit();
PINSEL1 = 0x0;
PINMODE1 = (0x2<<20); //0x0 -> pull up; (0x2<<20) - pull down;
FIO0DIR |= (1<<26); // speaker
FIO2DIR |= (1<<10); // led

for(;;)
{
FIO0SET |= (1<<26); // set speaker
FIO2SET |= (1<<10); // set led
delayMs(1);
FIO0CLR |= (1<<26); // reset speaker
FIO2CLR |= (1<<10); // reset led
delayMs(1);
}

has anyone an idea why this does not work?

has anyone a working code for the pin 0.26?

It seems like there are some extra settings necessary for port 0 and port 1, but i have not found them yet...
does anyone know which?

greetings,

philipp
>
> for(;;)
> {
> FIO0SET |= (1<<26); // set speaker
> FIO2SET |= (1<<10); // set led
> delayMs(1);
> FIO0CLR |= (1<<26); // reset speaker
> FIO2CLR |= (1<<10); // reset led
> delayMs(1);
> }
>
> has anyone an idea why this does not work?
>
Blimey, this question comes up nearly every day!!!

FIOxSET and FIOxCLR are read only registers, you can't use |=. You just use =.
If you were using the FIOxPIN registers you'd use |= so you don't affect the other pins but SET and CLR ignore the bits which are 0.

--
Tim Mitchell