As noticed in “First Steps with the NXP i.MX RT1064-EVK Board” there is a new LPC4322 based debug interface on the RT1064-EVK board.
Freelink aka OpenSDA aka DAP-link aka DAPlink
The NXP data sheet names it ‘Freelink Interface’, although the board manual still uses the ‘OpenSDA’ or ‘DAP-link’ (or DAPlink) naming.
The LPC4322JET100 is a ARM Cortex-M4 with a ARM Cortex-M0 coprocessor, both running up to 204 MHz, 512 KByte FLASH and 104 KByte SRAM. Compared to the original OpenSDA with K20DX128 (M4 without FPU, running at 50 MHz) this is a much more powerful processor.
Below is an overview about the most important debug circuit components and jumpers:
To isolate the onboard circuit and to to use an external debug probe, the jumpers J47 and J48 have to be removed. To completely disconnect the debug circuit, there are J49, J50 and J44 which can be removed too. J45 and J46 are used for the UART connection between the debug interface and the target microcontroller.
With Jumper J43 it can be configured if the SW9 directly sends the reset signal to the target MCU or to the debug circuit:
By default the on-board debug circuit shows up as DAPLink CMSIS-DAP device:
The board comes shipped with the following ‘DAPLink’ firmware:
# DAPLink Firmware - see https://mbed.com/daplink Unique ID: 02320000070a5e4100000000000000000000000097969905 HIC ID: 97969905 Auto Reset: 0 Automation allowed: 0 Overflow detection: 0 Daplink Mode: Interface Interface Version: 0246 Bootloader Version: 0244 Git SHA: 475c6729c42c688ae33af3af4ea4dbbfe1c35351 Local Mods: 1 USB Interfaces: MSD, CDC, HID, WebUSB Bootloader CRC: 0xe493996b Interface CRC: 0x3eb53105 Remount count: 0
The listed USB MSD is used for drag&drop programming: I could copy a (.bin?) file to the MSD device to program the MCU. To me feature does not have a practical usage: while this could be used as a kind of bootloader, production boards won’t have the OpenSDA circuit on it. Additionally, downloading with the debugger is much faster than using that slow MSD interface, so to me this MSD loader does not make any sense.
More relevant is the USB CDC interface as it provides a ‘UART-2-USB’ connection. And definitely the USB HID interface which is used as debug protocol (so it is not the HID keyboard or mouse, the HID protocol is used by the debugger).
An interesting one is the WebUSB one (https://en.wikipedia.org/wiki/WebUSB). This seems to be a way to securely connect from a web page to the device over USB. I have found an example web page for this https://devanlai.github.io/webdfu/mbed-download/ and seems to be used to use the board with the mbed environment. Sounds like a nice-to-have, or a way to program the board from web based development tools (which don’t make sense for real development anyway). Currently there is a driver for it missing in the Windows Device Manager:
OpenSDA Firmware Files
The good thing with OpenSDA as found on many Freescale/NXP boards is that I can load a different firmware to the debug circuit:
- default CMSIS-DAP firmware (DAP-Link)
- firmware from P&E (acting as a P&E Multilink)
- firmware from SEGGER (acting as a SEGGER J-Link)
Each firmware has its own advantages, and I usually switch the firmware depending on my needs (performance, features). Using the MCUXpresso IDE makes it easy to use any of the different debug probe firmware.
NXP hosts bootloader and firmware files on http://www.nxp.com/opensda. For the other DAPLink/OpenSDA based on Kinetis K20DX128 both P&E (http://www.pemicro.com/opensda/) and SEGGER (https://www.segger.com/downloads/jlink/#JLinkOpenSDABoardSpecificFirmwares) provide firmware files which emulate either a P&E Multilink or SEGGER J-Link on the debug circuit.
💡 At the time of this writing there are no P&E or SEGGER firmware files for the i.MX RT1064 circuit yet.
There is currently no new firmware for the DAPLink available, but if it would be in the future, these are the steps to load a new firmware:
- Power the board with SW09 pressed and hold with a USB cable connected to the debug port:
- The board should enumerate as MAINTENANCE device:
- copy the new firmware file to that device.
- Power off and power on the board again, it should have now the new firmware loaded.
Changing the DAPLink into a LPC-Link2
The DAPLink is nice, but slow compared to the LPC-Link2. But most important the DAPLink does not support SWO (Single Wire Output, see “New NXP MCUXpresso IDE V10.3.0 Release“) and SWO trace.
The good news is that with putting a jumper on J42, the MCUXpresso IDE will softload the LPC-Link2 firmware on the LPC4322 and then it will be a LPC-Link2:
- Have the board powered with an external 5V power supply
- Install a jumper on J42
With this, the LPC4322 is running the LPC-Link2 firmware and I can enjoy SWO and 3-4 times faster debugging :-):
💡 There would be a way to permanently change the firmware using LPCScrypt (https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpc-microcontroller-utilities/lpcscrypt-v2.0.0:LPCSCRYPT?&tid=vanLPCSCRYPT). As I did not find a way to reprogram the DAPlink (just in case) using the debug header on the board, I have to wait until the bootloader and DAPLink files coming with the board are available. I will update this post at that time.
I feel that new debug circuit based on LPC4322 is a big step forward compared to the ‘legacy’ K20 OpenSDA one, and a better match for the higher performance processors. The biggest plus is that I can load a LPC-Link2 firmware. The DAPLink (ARM mbed) firmware is nice, but the LPC-Link2 firmware is much more powerful and really shines in combination with the Eclipse based MCUXpresso IDE.
Happy Linking 🙂
- NXP i.MX RT1064 EVK: https://www.nxp.com/support/developer-resources/run-time-software/i.mx-developer-resources/mimxrt1064-evk-i.mx-rt1064-evaluation-kit:MIMXRT1064-EVK?&tid=vanMIMXRT1064-EVK
- LPC4322JET100: https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc4300-cortex-m4-m0/high-performance-32-bit-microcontroller-mcu-based-on-arm-cortex-m4-m0-cores:LPC4322JET100
- NXP OpenSDA Files: http://www.nxp.com/opensda
- ARM DAPLink: https://github.com/ARMmbed/DAPLink