|This description should
help to deal with the Secondary JTAG port of the LPC210x and should
allow to use 10 I/O pins more than using the Primary JTAG port.
It's rather easy if you follow the instruction below, no temporary program required:
1. Forget the PHILIPS Application Note AN10255! (it confused me totally).
2. Select the Secondary JTAG Port pin in your C-Program ( special functions of the
upper 5 bit , PINSEL1 P0.27 bis P0.31).
3. Flash your program via ISP (Philips ISP Tool) once in the Flash memory of the device.
This procedure is then normally not needed anymore. One can then flash the device via
the Secondary JTAG port and the debugger.
4. Connect the debugger to the Secondary JATG port.
The DBG pin of the CPU must be log "0"!
Due to the fact that RTCK is not functioning if the Secondary JTAG port mode is used,
the debugger must be able to work without RTCK.
The debugger must be able to work in a mode which allows to initialize the JTAG port
without asserting RESET (usually similar to Attach mode, etc.).
5. Start the debugger.
6. One can forget that a Secondary JTAG port exists, as long as pin configuration of port
P0.27 till P0.31 is not touched. If one reconfigures the Secondary JTAG pins within the
program, he will lose control about the device. A Reset clears up the situation.
If one changes the port configuration after Reset and flashes the program memory, he has
to start with figure 3 again.
Of cause , after Reset has been de-asserted, the user program starts running for some ms or seconds depending on when the debugger has captured the device. If one doesn't want that, a infinite loop must be inserted before reaching the Main() function. The PC must then be set manually to the appropriate start address.
Some of the LPC210x are very stubborn getting into debug mode via the Secondary
Debug port if DBGSEL is "0" and RTCK is "1". This behavior disappeared (in my case) if the DBGSEL Pin has been set to "1" and RTCK has been set to "0" (for RTCK
use a 10K pull-down).