Getting debug access to target chip
It is possible to download an image into the flash on the target that will then prevent further debug connections. The classic cases of this are
- The image contains code that sets the MCU clocks up "incorrectly".
- The image contains code that enables a watchdog timer.
- The image contains code that "switches off" some, or all of the multiplexed debug pins (JTAG/SWD).
If you do this, then there are a couple of possible ways to try to recover debug access to the MCU (depending upon the MCU being used).
Once you have managed to recover debug access to the MCU, the first thing that you should do is overwrite the image in flash with one that sets the system up in a safe manner, so that future debug connections will be successful without the need to recover debug access again. You would normally use the in-built flash programmer to erase the flash.
NXP LPCxxxx ISP
The first thing to try with NXP LPC MCU's to recover debug access is to boot into the ISP bootloader. That is, GND the ISP pin, assert RST, then remove the GND to ISP pin. Once in the ISP bootloader, the target clock configuration is stable, and the debug pins are in their default state - you should be able to connect.
Note: The ISP pin is:
- P0.1 - for LPC11xx and LPC13xx
- P2.10 - for LPC17xx
- For other MCU's, please check the user manual.
Note for RDB1768 users
The LPC1768 on the RDB1768 board can be placed into ISP by
- Press and hold the ISP button
- Press and release the RST button
- Release the ISP button
Vector catch
"Vector catch" is an option in the Code Red IDE which changes the way that the tools handle reset when connecting to a target. It can sometimes allow the debugger to regain control over the target.
To enable "vector catch" for the currently selected build configuration...
- Right click on the project in the Project Explorer view
Select "Launch Configurations -> Open current launch configuration" from the context senstive menu.
- Click on the "Debugger" tab, then set the "Vector catch" entry to true.
Warning about vector catch
Note that once you have recovered debug access to your MCU, then in most cases you should then modify your Debug Configuration to turn vector catch off again. If this is not done, then this can cause problems in some circumstances with some versions of the Code Red IDE. For example with NXP LPC13xx parts, connecting more than once to the MCU with vector catch enabled can lead to the part ID being incorrectly read - which can again cause debug connections to fail:
Invalid LPC1343 Part ID: 0x3000002B Known LPC1343 ID(s): 0x3D00002B 03: Failed on chip setup: Ec(01). Invalid, mismatched, or unknown part
