- Tue May 04, 2004 11:22 am
#975
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:
Port Behavior
0-2 Toggles
3 Low
4-13 Toggles
14 Low
15-16 Toggles
17-21 N/A
22-25 High
26-29 Low
30-31 High
Any ideas?
-John G-
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:
Port Behavior
0-2 Toggles
3 Low
4-13 Toggles
14 Low
15-16 Toggles
17-21 N/A
22-25 High
26-29 Low
30-31 High
Any ideas?
-John G-