Page 1 of 1

toggling GPIO on LPC2148

Posted: Fri Feb 24, 2012 5:09 am
by sagar
Hi,
I intend to use P0.7 of LPC2148 as chip select for one of my pheripherals on board hence I am trying to toggle GPIO P0.7 but it stays latched to high state. I have tried to use following APIs to program the pad mode but still it does not help.

palSetPadMode(IOPORT1,7,PAL_MODE_OUTPUT_PUSHPULL);

I can change values of other GPIOs (P1.16~1.23 and P29) on board using palSetPort and palClearPort APIs but P0.7 is exception to this. I am using default board config for Olimex LPC2148 board and have not changed it much. Am I missing something?

Regards,
Sagar

Re: toggling GPIO on LPC2148

Posted: Fri Feb 24, 2012 9:39 am
by Giovanni
Hi Sagar,

That pin is programmed as SSEL0 in board.h, the function palSetPadMode() is not able to change its mode to GPIO. If you need to use that pin as GPIO then modify board.h (see #define VAL_PINSEL0).

Usually it is a good idea to "clone" the board directory and make your custom settings in the clone then you can edit the Makefile to point to the clone.

Giovanni

Re: toggling GPIO on LPC2148

Posted: Fri Feb 24, 2012 7:34 pm
by sagar
Thanks Giovanni. It works for me. :)