SWD: How to use them in alternate pins

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

SWD: How to use them in alternate pins

196 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Thu Sep 27 17:55:47 MST 2012
Hi

Most NXP Cortex-M microcontrollers have the SWD mapped in more than one location. For example, in the LPC1227 there are to groups of pins for that purpose:

PIO0_25, PIO0_26: Native SWD location
PIO0_18, PIO1_2: Alternate location

My question is: how can I debug using the alternate locations? Suposse that for some reason I need to use the native SWD's location, so I still have the chance to debug using the alternate location, how do I do that?

I figure out that I must upload the binary through ISP. And in such a code is coded the remapping. Then I need to "attach" my debugger to the running code, is that correct?

Thank you!!
0 Kudos
2 Replies

185 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Fri Sep 28 00:30:04 MST 2012
And that simple code is uploaded just once?

This solution is better than to attach the running code to the debugger. I'll try it ASAP.

Thank you!! =)
0 Kudos

185 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by daniel.widyanto on Fri Sep 28 00:15:37 MST 2012
Hi,

You are correct. You need to upload simple code from ISP to remap the SWDIO from PIO0_25 to PIO1_2. For example

int main(void) {
  LPC_IOCON->PIO1_2 &= 0x07;
  LPC_IOCON->PIO1_2 |= 0x01;

  while(1) {
    /* Waiting for JTAG connection */
    __NOP(); /* Use NOP while waiting so 
                it's easier for the JTAG to 
                stop the MCU */
  }
}
0 Kudos