lpcware

LPC111 SWD pins as GPIO

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by adam.bw on Fri Mar 06 09:23:22 MST 2015
We are trying to use SWD pins on the LPC1111 as GPIO. We cannot manage to read valid data from SWDIO_PIO1_3, when configure to PIO1_3 in the IOCON_SWDIO_PIO1_3 register.
We managed to use the other SWD pin successfully in this mode (SWCLK_PIO0_10). This is the code we are using, please advise on this.


#define BT_A_PIN 10
#define BT_B_PIN 3

#define BT_A_PORT PORT0
#define BT_B_PORT PORT1

  LPC_IOCON->PIO0_6  |= (0x01<<5);
  LPC_IOCON->PIO0_7  |= (0x01<<5);
  LPC_IOCON->PIO0_8  |= (0x01<<5);

LPC_IOCON->SWCLK_PIO0_10 = 1|(0x01<<5);//  |= (0x01<<5);
  LPC_IOCON->SWDIO_PIO1_3 = 1|(0x01<<5);//  |= (0x01<<5);

  LPC_IOCON->R_PIO1_0|= (0x01<<5);
  LPC_IOCON->R_PIO1_1|= (0x01<<5);
  LPC_IOCON->R_PIO1_2|= (0x01<<5);
  LPC_IOCON->PIO1_9  |= (0x01<<5);
  LPC_IOCON->PIO3_4  |= (0x01<<5);
  LPC_IOCON->PIO3_5  |= (0x01<<5);

GPIOSetDir(BT_A_PORT, BT_A_PIN, 0 );

GPIOSetDir(BT_B_PORT, BT_B_PIN, 0 );

while(1)
{
if(GPIOGetValue(BT_B_PORT, BT_B_PIN))
{
LED0_SET();
LED1_SET();
}
else
{
LED0_RESET();
LED1_RESET();
}
}

Outcomes