LPC111 SWD pins as GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC111 SWD pins as GPIO

354 Views
lpcware
NXP Employee
NXP Employee
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();
}
}
Labels (1)
0 Kudos
1 Reply

315 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Fri Mar 06 12:11:26 MST 2015

Quote: adam.bw
This is the code we are using, please advise on this.

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



:quest:

Could be useful to enable 'Digital functional mode', at least if you don't want to use this pin as ADC   :)
0 Kudos