LPC2148 cannot write to P1[16..23] ?

Hopefully I’ve overlooked something simple…

I’ve tried enabling the port-1 pins P1.[16…23] as GPIO pins (through clearing PINSEL2 bit 3 and by either pulling P1.20 high OR low on boot - no difference); but cannot seem to set the state of the port-1 pins. Relevant setup code:

PINSEL2 &= ~(1<<3);

SCS = 0x03;

FIO0DIR= WRITE_BITS_0;

FIO1DIR= 0x0f00;

The brain-dead loop:

while (1)

{ FIO1CLR= 0x0f00;

FIO0CLR= WRITE_BITS_0;

FIO0SET= WRITE_BITS_0;

FIO1SET= 0x0f00;

}

toggles the selected bits in port-0, but not port 1. Stepping through the code using openocd shows the same thing. P0.31 is weakly held high, as is P1.31. Oh yes, this is on the Olimex LPC-P2148 board.

Anyone see the stupid thing that I am [not] doing? Thanks!

-f

Have you run Jim Lynch’s example code? I think it’s written for the exact same board you’re working on (I modified it to work with an LPCH-2148 board). Unless you’re doing some other stuff with pins, all pins default to GPIO on the LPC2148, so you don’t need to worry about PINSELx.

Not sure which code you are referring to. The only code I’ve found (e.g. like the blinky-LED code) uses port-0. That code works - it’s port-1 that is the problem. If I’ve overlooked something - by all means please point more specifically to the relevant code!

If I had a brain I’d be dangerous…

Ah… those ‘0x0f00’? They should have been ‘0x0ff0000’. Works much better!

Clearly from someone who’s spent 'way too much time with 8-bit CPUs… these numbers are so big they seem wrong!