Using LPCXpresso V2/V3 Boards to Debug an External Board
Using LPCXpresso V2/V3 Boards to Debug an External Board
The LPCXpresso V2/V3 boards can be used to debug external custom boards. This guide walks through the setup and procedure using the LPCXpresso's LPC-Link-2 circuit.
Join the DZone community and get the full member experience.Join For Free
The MCUXpresso IDE (see MCUXpresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers) has one great feature: It includes debug support for the popular LPC-Link2 debug probes. That way, I have yet another powerful debug probe with extra features for ARM-based boards. That LPC-Link2 circuit is present on many LPCXpresso boards from NXP. So why not use it to debug it my custom hardware?
This article describes how to use an LPCXpresso V2/V3 board to debug another board using the LPCXpresso board's LPC-Link-2 circuit. You need:
- LPCXpresso V2/V3 board, e.g. LPCXpresso54102
- 10pin SWD/JTAG cable
- 1 jumper
- Target board with a Kinetis or LPC microcontroller on it
- Needed USB cables to power the two boards
- Debugger and IDE, e.g. MCUXpresso IDE
Unfortunately (as for Freescale/NXP for the Tower/Freedom boards) the documentation about how to use the board to debug another board is nearly non-existent and hard to find.
The LPC-Link2 debug probe from NXP is an inexpensive debug probe. I love it because of its cost (around $20).
With the MCUXpresso IDE, I can use it to debug both the LPC and Kinetis microcontroller:
There are several features in MCUXpresso IDE that are only available with using an LPC-Link (or LinkServer) debug probe, such as the ‘LinkServer GUI Flash programmer’. This is a ‘standalone’ flash programmer that I can use to flash/program any binary file (.elf, .axf, .bin) to a board:
But here is my problem: I only have a single LPC-Link2 debug probe/board. And I left it on my desk at the university. What can I do? Take a two-hour commute back to the university to get it? Luckily, I read somewhere that it should be possible to use an LPCXpresso board as an LPC-Link2 debug probe to debug another board. And I was lucky to have one at home from my multicore debugging experiments!
I have used the NXP Freedom boards already to debug another board (see Using the Freescale Freedom (FRDM-KL43Z) to Debug other Boards), so this should be possible with the LPCXpresso boards too, right?
There are several LPCXpresso boards available, and only the V2 and V3 boards have the LPC-Link2 debug probe on it. I have the LPCXpresso54102 (Evaluation board OM13077), which is a V3:
The board has an LPC4322JET100 on it, which acts as debug probe:
The board has a 10pin SWD debug header (upper left corner in above picture) to use a normal external debug probe to debug the target processor on the LPCXpresso board. Similar to the Freedom boards, it should be possible to use that header to debug an external board, yes?
The schematics have the needed information:
The following shows the DEFAULT setting:
To use the SWD debug header (U2), there are two jumpers to control the settings:
- JP1: This jumper isolates the debug lines (SWDCLK, RESET and SWO) between the LPC-Link2 and the onboard microcontroller. Put a jumper on JP1 to debug an external processor.
- JP2 controls the power to the ‘buffers’ plus the power on the pin 1 to the SWD connector. The buffers (74LVC1T45GW) are in fact level shifters, translating the levels for the SWD/JTAG signals between the LPC-Link2 (3.3V) and the debug target/microcontroller. The location of the jumper of the JP2 can be used in two positions:
- 1-2 (default): VDD_LPC54102 (default 3.3V, but can be 1.8V too, see JP7) powers the buffers/level shifter, plus providing power to pin 1 of the SWD header. They are between the onboard LPC device and the SWD header pins. Around 100mA of power can be provided. Have jumper on 1-2 to power the external board, if the external board is using same voltage as VDD_LPC54102.
- 2-3 (recommended): In this position, the target board power is used to power the level shifter through pin 1 of the SWD header. Have jumpers on 2-3 if the target board has a different voltage level than the LPCXpresso board, or if the target board is powered separately.
My recommendation is to put a jumper on JP1 and use JP2 on 2-3 (or remove the JP2 jumper and use JP1). That way, power is *not* provided to the external board. Instead, the target board voltage level is used to safely do the level shifting. Connect a standard SWD cable to U2 (pay attention to pin 1):
Connection to Target Board
Connect the SWD/JTAG cable to the target board SWD/JTAG, and power the target board:
If the other board (in my example, the NXP FRDM-K64F) has a debug circuit like OpenSDA or another LPC-Link2 on it, make sure it does not use the SWD/JTAG lines at the same time. That depends on the debug firmware running on that circuit, too. So in the above case, I’m powering the board on the target USB connector, not on the OpenSDA one.
Now I’m able to debug the other board using the LPC-Link2 on the LPCXpresso board:
I can use the debug circuit on an LPCXpresso V2/V3 board, which is basically the same as the ‘external’ LPC-Link2 debug probe. All that I need are two jumper settings and an SWD/JTAG cable. Compared to the NXP Freedom/Tower boards, this is much simpler (no soldering required) but it's barely documented. I hope, with this guide, you can now enable the LPCXpresso board to debug your custom Kinetis or LPC board.
It is possible to load the Segger J-Link firmware on the LPC-Link2 circuit (see https://www.segger.com/lpc-link-2.html). But with this, only LPC (not Kinetis) devices are supported. And the legal terms only allow to use it with evaluation boards, not for custom boards.
Published at DZone with permission of Erich Styger , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.