LPC2214 doesn't run if IODIR1 = 0x00010000
2005-01-27 by dave workman
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);
}
}