Using the LPCXpresso V2/V3 Boards to Debug an external Board

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 using it to debug it my custom hardware?

Debugging Custom Hardware with LPCXpresso Board

Debugging Custom Hardware with LPCXpresso Board

Outline

This article describes how to use an LPCXpresso V2/V3 board to debug another board using the LPCXpresso board 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-existing and hard to find.

LPC-Link2

The LPC-Link2 debug probe from NXP is an inexpensive debug probe. I love it because it is inexpensive (around $20).

LPC-Link2 Debug Probe

LPC-Link2 Debug Probe

With the MCUXpresso IDE I can use it to debug both LPC and Kinetis microcontroller:

LPC-Link2 with CMSIS-DAP debugging Robot

LPC-Link2 with CMSIS-DAP debugging Robot with a Kinetis microcontroller)

There are several features in MCUXpresso IDE which are only available with using a LPC-Link (or LinkServer) debug probe, such as the ‘LinkServer GUI Flash programmer’. This is a ‘standalone’ flash programmer which I can use to flash/program any binary file (.elf, .axf, .bin) to a board:

LinkServer GUI Flash Programmer

LinkServer GUI Flash Programmer

But here is my problem: I only have a single LPC-Link2 debug probe/board. And that one I left on my desk at the university, but need now one at home. What can I do? Taking a +2h commute back to the university to get it? Luckily I read somewhere that it should be possible to use a LPCXpresso board as a 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?

LPCXpresso Boards

There are several LPCXpresso boards available (see http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/software-tools/lpcxpresso-boards:LPCXPRESSO-BOARDS), 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:

LPCXpresso54102 Board

LPCXpresso54102 Board

The board has a LPC4322JET100 on it which acts as debug probe:

LPC4322 acting as LPC-Link2

LPC4322 acting as LPC-Link2

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?

The schematics have the needed information:

LPCXpresso54102 Schematics

LPCXpresso54102 Schematics

The following shows the DEFAULT setting:

Default Jumper Position

Default Jumper Position

To use the SWD debug header (U2), there are two jumpers to control the settings:

  • JP1: This jumper isolate 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 shifter, 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 provides power to the pin 1 of the SWD header. are between the on-board LPC device and the SWD header pins. Around 100mA of power can be provided . Have jumper on 1-2 to power external board and if 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 jumper on 2-3 if target board has different voltage level than the LPCXpresso board, or if 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 it 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 standard SWD cable to U2 (pay attention to pin 1):

Debug External Board with Power Sense

Debug External Board with Power Sense

Connection to Target Board

Connect the SWD/JTAG cable to the target board SWD/JTAG and power the target board:

Debugging NXP FRDM-K64F with MCUXpresso Board

Debugging NXP FRDM-K64F with MCUXpresso 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 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 🙂 :

Debugging the FRDM-K64F with the LPCXpresso54102 Board

Debugging the FRDM-K64F with the LPCXpresso54102 Board

Summary

I can use the debug circuit on a LPCXpresso V2/V3 board which is basically the same as the ‘external’ LPC-Link2 debug probe. All what I need are two jumper settings and a SWD/JTAG cable. Compared to the NXP Freedom/Tower boards this is much simpler (no soldering required), but 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, but not for custom boards.

Happy LPCLinking 🙂

Links

5 thoughts on “Using the LPCXpresso V2/V3 Boards to Debug an external Board

  1. Ehi Erich,
    I knew that the LPC-Link was able to debug the NXP devices, and obviously now the Freescale, but I didn’t know that was possible to transform it as as J-Link!

    Thank you!
    Ale

    Like

    • I usually load the J-Link firmware on the LPC debug circuit because it is a) much faster b) Segger has great tools (command line tools, Segger RTT, etc) plus c) they offer unlimited hardware breakpoints.

      Like

  2. Pingback: Using Eclipse to Program Binary Files to an Embedded Target | MCU on Eclipse

  3. Hey Mr Erich,

    I try to debug an LPC54102J256BD64 using my LPCXpresso54102 board, it work! but just when I add a few lines (even a single line) it does not work anymore !!

    NB: i have this error message
    – 15: Target error from Commit Flash write
    Debug port inaccessible after access at location 0x02008568 – verify population of memory and peripherals

    D you have the same problem or can you help me please ?
    Thank you!
    Hocine

    Like

    • Hi Hocine,
      no, I have seen something like this. Can you double check the device settings and linker memory map? It seems that this information is not matching the part you are using.
      I hope this helps,
      Erich

      Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.