Target: NXP LPC1347FBD48I am trying to use TDO_PIO0_13 as an input to detect a switch closure. A push button switch will pull this pin to ground when pressed.I have tried two ways to configure the pin.//set GPIO_3 to inputLPC_IOCON->TDO_PIO0_13 &= ~0x07; // Set FUNC = 0. Leave MODE=2 (Pull-up), ADMODE=1 defaultLPC_IOCON->TDO_PIO0_13 |= 0x01; // Set FUNC = PIO0_13GPIOSetDir( PORT0, 13, 0 ); // Set as INPUT.and LPC_IOCON->TDO_PIO0_13 = 0x0091; // Set ADMODE=Digital, MODE=Pull-up, FUNC=PIO0_13. // 0000 0000 0000 0000 0000 0000 100 10 001GPIOSetDir( PORT0, 13, 0 ); // Set as INPUT.
//set GPIO_3 to input
LPC_IOCON->TDO_PIO0_13 &= ~0x07; // Set FUNC = 0. Leave MODE=2 (Pull-up), ADMODE=1 default
LPC_IOCON->TDO_PIO0_13 |= 0x01; // Set FUNC = PIO0_13
GPIOSetDir( PORT0, 13, 0 ); // Set as INPUT.
LPC_IOCON->TDO_PIO0_13 = 0x0091; // Set ADMODE=Digital, MODE=Pull-up, FUNC=PIO0_13.
// 0000 0000 0000 0000 0000 0000 100 10 001
In both cases, gpio.c GPIOGetPinValue(PORT0, 13) always returns a 0 even though the pin is at 3.3v and will go to 0v when the button is pressed.Other lines work fine as inputs; PIO0_11, PIO0_12, PIO0_22, and PIO1_15.I have done a "Find in Files" for PIO0_13 and no other code is configuring the line.Could a TDO function be interfering with the read? I do not find any CT32B0 timer configuration code in the other files.Any suggestions other than using a different I/O line?
gpio.c GPIOGetPinValue(PORT0, 13)
PIO0_11, PIO0_12, PIO0_22, and PIO1_15.