I wrote a while ago about not being to drive some I/O ports on the LPC-P1. Now I’m trying to drive P0.26 but somehow I can’t control the port but I can drive the LED on P0.7 with no problem. I’m using the LPC-P1 and I added another LED on P0.26. Here’s my code:
int main()
{
UInt32 * pinsel0 = (UInt32 *)0xE002C000;
UInt32 * pinsel1 = (UInt32 *)0xE002C004;
UInt32 * gpioset = (UInt32 *)0xE0028004;
UInt32 * gpioclr = (UInt32 *)0xE002800C;
UInt32 * gpiodir = (UInt32 *)0xE0028008;
*pinsel1 = 0x0;
*pinsel0 = 0x0;
*gpiodir = 0xFFFFFFFF;
while(1)
{
*gpioset = 0xFFFFFFFF;
for(UInt32 delay = 0; delay < 100000; delay++) {}
*gpioclr = 0xFFFFFFFF;
for(UInt32 delay = 0; delay < 100000; delay++) {}
}
return 0;
}
As you can see, I set the PIN CONNECT BLOCK to all GPIO, set the direction to all output then in the loop set all I/O, delay, clear all I/O, delay and so on. Only the LED on P0.7 blinks, the one on P0.26 just stays on all the time. Here is the behaviour on each port with the code above:
When you have the JTAG enabled (DBGSEL = LOW) you have also enabled the ETM interface. The ETM interface simply overrides the IO and you can not use these pins (P0.22 - P0.31) while debugging. Try it by starting your board with DBGSEL = HIGH, you will most likely see that the pin is doing what it is supposed to do.
The only way to retrieve the ETM pins is by using the secondary JTAG port, but that requires that you first download some piece of code into the device (using the philips flash loader) that enables the secondary JTAG.
Yup, P0.3 is not shorted to GND and to any other port. P0.14 is pulled high with resistor and with a jumper to pull it to GND. Right now P0.3 is floating and P0.14 is without the jumper. Since P0.3 is shared with SDA (IIC), this might need a pull up if it is configured for SDA but at the start of my code I set all ports to I/O (PINSELx = 0). P0.14 I have the jumper off. I thinking right now the these two lines might have been zapped.