EmbeddedRelated.com
Forums
Memfault Beyond the Launch

LPC2214 doesn't run if IODIR1 = 0x00010000

Started by dave workman January 27, 2005
I'm running an LPC2214.
I'm using P2.29 as an output to flash an LED, so I
know that the processor is exacuting my program.
If I include a line to set P1.16 as output, the
processor does not run.
If I change that line so that P1.16 remains an input,
or delete that line, the program runs fine.
On my board, P1.16 is not connected to anything.
I have a 10k pullup resistor on P1.20 so as I
understand it, the P1 pins should be GPIO, not Trace
port.
If I bring P0.14 low while the processor is frozen,
the bootloader immediately runs without my having to
reset the processor, and Philips' flash utility can
program the chip.
If I leave P0.14 high while the processor is frozen,
the bootloader doesn't run and Philips' flash utility
can't program the chip.
I'm using the Keil demo version compiler.
Can anyone see something I'm doing wrong? #define IODIR1 (*((volatile unsigned long *)
0xE0028018))
#define IOSET2 (*((volatile unsigned long *)
0xE0028024))
#define IODIR2 (*((volatile unsigned long *)
0xE0028028))
#define IOCLR2 (*((volatile unsigned long *)
0xE002802C)) int main (void)
{
unsigned long i;

IODIR2 = 0x20000000; //P2.29=output
IODIR1 = 0x00010000; //P1.16=output. This line
causes the problem.
while (1)
{
IOSET2 = 0x20000000; //P2.29 on

i = 2000000; //delay
while (--i);

IOCLR2 = 0x20000000; //P2.29 off

i = 2000000; //delay
while (--i);

}
}



An Engineer's Guide to the LPC2100 Series

I had very similar problems (I think) on the 2294. You have to be very careful
how you set the PINSEL bits. I assume, when you say the processor doesn't
run, the debug function doesn't work?

I'm not sure of the exact differences between the 2294 and the 2214, but with
the 94 I had to initialise PINSEL2 as below for it to not disable the debug
interface.

// Now PINSEL2 which configures debug lines and address and data lines
temp = PINSEL2;
temp |= 0x0F814920;
temp &= ~0x08; // Take it out of trace mode...
PINSEL2 = temp;

Hope this is of some help.

Cheers,

Rob

--------------------------
I'm running an LPC2214.
I'm using P2.29 as an output to flash an LED, so I
know that the processor is exacuting my program.
If I include a line to set P1.16 as output, the
processor does not run.
If I change that line so that P1.16 remains an input,
or delete that line, the program runs fine.
On my board, P1.16 is not connected to anything.
I have a 10k pullup resistor on P1.20 so as I
understand it, the P1 pins should be GPIO, not Trace
port.
If I bring P0.14 low while the processor is frozen,
the bootloader immediately runs without my having to
reset the processor, and Philips' flash utility can
program the chip.
If I leave P0.14 high while the processor is frozen,
the bootloader doesn't run and Philips' flash utility
can't program the chip.
I'm using the Keil demo version compiler.
Can anyone see something I'm doing wrong? #define IODIR1 (*((volatile unsigned long *)
0xE0028018))
#define IOSET2 (*((volatile unsigned long *)
0xE0028024))
#define IODIR2 (*((volatile unsigned long *)
0xE0028028))
#define IOCLR2 (*((volatile unsigned long *)
0xE002802C)) int main (void)
{
unsigned long i;

IODIR2 = 0x20000000; //P2.29=output
IODIR1 = 0x00010000; //P1.16=output. This line
causes the problem.
while (1)
{
IOSET2 = 0x20000000; //P2.29 on

i = 2000000; //delay
while (--i);

IOCLR2 = 0x20000000; //P2.29 off

i = 2000000; //delay
while (--i);

}
}

Yahoo! Groups Links



Thanks, Robert:
The problem occurs though I'm not touching PINSEL2 or
the Debug port.
The processor seems to go back to some kind of altered
state, since my simple program which blinks an LED on
P2.29 doesn't run, but the bootloader still runs if I
bring P0.14 low.
Normally the bootloader only runs on reset, and
bringin P0.14 low after that won't re-start the
bootloader.

--- Robert Wood <> wrote:

> I had very similar problems (I think) on the 2294.
> You have to be very careful
> how you set the PINSEL bits. I assume, when you say
> the processor doesn't
> run, the debug function doesn't work?
>
> I'm not sure of the exact differences between the
> 2294 and the 2214, but with
> the 94 I had to initialise PINSEL2 as below for it
> to not disable the debug
> interface.
>
> // Now PINSEL2 which configures debug lines and
> address and data lines
> temp = PINSEL2;
> temp |= 0x0F814920;
> temp &= ~0x08; // Take it out of trace mode...
> PINSEL2 = temp;
>
> Hope this is of some help.
>
> Cheers,
>
> Rob
--------------------------
> I'm running an LPC2214.
> I'm using P2.29 as an output to flash an LED, so I
> know that the processor is exacuting my program.
> If I include a line to set P1.16 as output, the
> processor does not run.
> If I change that line so that P1.16 remains an
> input,
> or delete that line, the program runs fine.
> On my board, P1.16 is not connected to anything.
> I have a 10k pullup resistor on P1.20 so as I
> understand it, the P1 pins should be GPIO, not Trace
> port.
> If I bring P0.14 low while the processor is frozen,
> the bootloader immediately runs without my having to
> reset the processor, and Philips' flash utility can
> program the chip.
> If I leave P0.14 high while the processor is frozen,
> the bootloader doesn't run and Philips' flash
> utility
> can't program the chip.
> I'm using the Keil demo version compiler.
> Can anyone see something I'm doing wrong? > #define IODIR1 (*((volatile unsigned long *)
> 0xE0028018))
> #define IOSET2 (*((volatile unsigned long *)
> 0xE0028024))
> #define IODIR2 (*((volatile unsigned long *)
> 0xE0028028))
> #define IOCLR2 (*((volatile unsigned long *)
> 0xE002802C)) > int main (void)
> {
> unsigned long i;
>
> IODIR2 = 0x20000000; //P2.29=output
> IODIR1 = 0x00010000; //P1.16=output. This line
> causes the problem.
> while (1)
> {
> IOSET2 = 0x20000000; //P2.29 on
>
> i = 2000000; //delay
> while (--i);
>
> IOCLR2 = 0x20000000; //P2.29 off
>
> i = 2000000; //delay
> while (--i);
>
> }
> } >
>
> Yahoo! Groups Links





Hi Dave,

>> The problem occurs though I'm not touching PINSEL2 or
the Debug port.
The processor seems to go back to some kind of altered
state, since my simple program which blinks an LED on
P2.29 doesn't run, but the bootloader still runs if I
bring P0.14 low.
Normally the bootloader only runs on reset, and
bringin P0.14 low after that won't re-start the
bootloader. <<

I have my head inside a DSP at the moment, so I may be wrong, but I would
suggest you double check those PINSEL registers just to be absolutely sure.
If I wasn't struggling with interrupts on this damn DSP, I might realise I
was talking b*llocks! ;-)

I had no end of problems with these pins and registers! Good luck. :-)

Cheers,

Rob




Memfault Beyond the Launch