NUVOTON Nu-Link Debug Adapter User Manual
- June 4, 2024
- nuvoTon
Table of Contents
NUVOTON Nu-Link Debug Adapter
Introduction
Nuvoton’s Nu-Link Debug Adapter is an USB debugger and programmer based on the
SWD (Serial Wire Debug) signal interface and can be applied to the development
of Nuvoton NuMicro® Family chips. As shown in Table 2-1, there are four types
of the Nu-Link Debug Adapter in accordance with different specifications,
including Nu-Link-Pro, Nu-Link, Nu-Link-Me and Nu-Link2-Me. The four types are
called “Nu-Link Adapter” in general if no specific conditions are mentioned.
The Nu-Link Adapter supports ICP (In-Circuit Programming) based on the SWD
(Serial Wire Debug) signal interface. The user can employ the NuMicro® ICP
Programming Tool to update chip firmware for mass production. The Nu-Link
Adapter also supports the third-party development tools, such as Keil MDK, IAR
EWARM, and NuEclipse GCC.
For simplicity and clarity, parts of specific terms in this user manual are
contracted or abbreviated, as listed in the following table.
Short Name | Full Name |
---|---|
Nu-Link Adapter | Nuvoton Nu-Link Debug Adapter |
NuMicro® Family | Nuvoton NuMicro® Family |
ICP Tool | Nuvoton NuMicro® ICP Programming Tool |
Keil MDK | Keil ARM RealView Microcontroller Development Kit (MDK-ARM®) |
IAR EWARM | IAR Embedded Workbench for ARM |
NuEclipse GCC | NuEclipse Integrated Development Environment |
SWD | Serial Wire Debug |
ICP | In-Circuit Programming |
Hardware Specifications
The Nu-Link Adapter provides an USB connector and a SWD signal interface for connecting to the target chip. The user can connect the Nu-Link Adapter to an USB port of a PC to debug and program target chips through the development software tools. As shown in Table 2-1, there are three specifications for the Nu-Link Adapter, in which debugging, Online/Offline Programming, and SWD I/O voltage settings may be supported depending on the specifications (refer to the +Appendix for details).
Table 2-1 Nu-Link Adapter Function Comparison
- Adjusted by resistor JPR1.
- Adjusted by resistor ICEJPR1.
- The input supports 1.8V~5V, and the output only supports 1.8V~3.3V.
- The Nu-Link2-Me can be connected to a automatic IC programming system through the control bus. Control Bus for IC Programmer(Start, Busy, Pass, Fail) .
- Virtual COM is supported in versions later than V3.0.
Nu-Link-Pro
The Nu-Link-Pro is a full-functional debugger and programmer with debugging, online/offline programming, and SWD I/O voltage setting functions. As shown in Figure 2-1, the Nu-Link-Pro includes an USB port that can be connected to a computer host, a set of Status LEDs, an offline programming button, a SWD port that can be connected to a target chip for debugging and programming (the voltage level of the SWD port can be adjusted through software as 1.8V, 2.5V, 3.3V, or 5.0V), a set of SWD I/O voltage LEDs and SWD Power Output LEDs.
Nu-Link
The Nu-Link is a basic debugger and programmer with debugging and online/offline programming functions. As shown in Figure 2-2, the Nu-Link includes an USB port that can be connected to a computer host, a set of Status LEDs, an offline programming button, and a SWD port that can be connected to a target chip for debugging and programming (the default voltage of the SWD port as 5.0V).
Nu-Link-Me
The Nu-Link-Me is a simple debugger and programmer with debugging and online programming functions, which is only shipped with the NuTiny-SDK kits and can be used stand-alone for developing the customized NuMicro® Family system. As shown in Figure 2-3, the Nu-Link-Me includes an USB port that can be connected to a computer host, a set of Status LEDs, a Power Switch to switch the voltage of Nu-Link-Me between 3.3V and 5.0V (the default as 3.3V), a SWD port that can be connected to a target chip for debugging and programming (whose voltage is adjustable with the Nu-Link-Me).
Nu-Link2-Me
The Nu-Link2-Me is a simple debugger and programmer with debugging and online programming functions, which is only shipped with the Nu-Maker kits and can be used stand-alone for developing the customized NuMicro® Family system, that supports on-line programming and debugging through SWD interface. The on-board 16 Mbit SPI Flash allows it able to off-line programming the target microcontroller. Nu-Link2-Me provides virtual COM port (VCOM) function to print out messages on PC. Nu-Link2-Me can be separated from NuMaker, allowing user to use as a mass production programming tool. Figure 2-4 shows the main components and connectors from the front side and Figure 2-5 from the rear side of Nu-Link2-Me.
Nu-Link Adapter Hardware Specifications
The Nu-Link Adapter hardware comparison is shown in Table 2-2.
- Only supported in parts of the version( Support 5V and 3.3V can be adjusted through resistor JPR1).
- Nu-Link2-Me.
Main Functions
The Nu-Link Adapter provides complete debugging and programming functions for NuMicro® Family and supports a number of third-party development tools. The detailed function support is listed in Table 3-1.
- Core registers view is supported; peripherals view is not supported.
- Supported for Nu-Link, Nu-Link-Pro and Nu-Link2-Me.
- Supported for Nu-Link-Pro.
Debugging
This section briefly describes the debugging function supported by the Nu-Link
Adapter. For more details, please refer to the related user manuals.
-
Debug Mode
The Nu-Link Adapter supports debugging for the NuMicro® Family chips based on the SWD signal interface. The third-party tools that support using the Nu-Link Adapter for chip debugging include Keil MDK, IAR EWARM, and NuEclipse GCC. Some more functions supported in Debug mode are described as follows. -
Breakpoints
In Debug mode, the user can add breakpoints in the code for debugging. During the real-time simulation of the Nu-Link Adapter, the chip simulation will be stopped at a specific breakpoint. Figure 3-1 shows the breakpoint settings in Keil MDK Debug mode. The red labels on lines 052 and 059 indicate the breakpoints inserted; the yellow arrow refers to the code to be executed next and shows the register value of Program Counter (PC) (i.e. “R15(PC)=0x00000D04” in the Registers pane in Figure 3-1). -
Direct Register Control Interface
The Direct Register Control Interface can be used to display the register content in a target chip and manipulate the registers. Take Keil MDK Debug mode for example, invoke the Debug command and select a register from the “function register list” (e.g. ADC, CAN, CLK, etc.) to open the Direct Register Control Interface of the selected register, as shown in Figure 3-2.
The Direct Register Control Interface for CLK is shown in the left part of Figure 3-3, where the left column shows the register address, the middle column shows the register name, and the right column shows the register value. The Direct Register Control Interface for PWRCON is shown in the right part of the Figure 3-3, where the left column shows the function bit(s), the middle column shows the function name, and the right column shows the function value.
Detailed Operation:
Double-clicking a “register value” will open the register control details, as shown in the right part of Figure 3-3.
Moving the cursor over a “register name” or “control value” will show the tip. The “register value” or “control value” can be modified directly. The Nu-Link Adapter will then modify the content of the target chip. -
Semihost
When using the Semihost function, the message of the NuMicro® Family microcontroller can be output through UART to the debug window by the Nu-Link Adapter. That is, the message is output without the GPIO. Figure 3-4 shows the debug messages in the “UART #1” form, which are the messages output by the Nu- Link Adapter.
Follow the steps below to use the Semihost (taking the Keil MDK and M031AE series as example).
Step 1: Modify the strings in the “startup_NUC1xx.s” as follows. Step 2: Modify the strings in the “system_NUC1xx.h” as follows. Step 3: Invoke Rebuild to rebuild a project and enter Debug mode.
Step 4: In Debug mode, invoke View → Serial Windows → UART #1, as shown in Figure 3-4.
Step 5: Press F5 to program the target chip, and the debug messages are output to the UART #1 form.
Programming
This section will briefly describe the programming function supported by the
Nu-Link Adapter. For more details, please refer to the related user manuals.
-
Online Programming
Online Programming means that the Nu-Link Adapter can download the firmware of the NuMicro® Family single chip to the target chip through software programs, as shown in Figure 3-5. -
Offline Programming
Offline Programming means that the Nu-Link Adapter can update the firmware of the NuMicro® Family single chip directly without accessing software programs (as shown in Figure 3-6). Offline programming is useful for mass production since the original code or firmware file does not need to be delivered and only the Nu-Link Adapter is needed for mass production. In addition, the Nu- Link Adapter supports “Limited Offline Programming,” which can effectively control the authorized number of the firmware. For details, please refer to the ICP Tool User Manual. -
Software Serial Number (SN)
The Software Serial Number (SN) function provided by the ICP Tool enables users to specify the value in the “Increase SN from” and “Write address in flash” fields for the target chip during online/offline programming. Take the NUC140VE3CN chip for example, the user can specify a set of “Increased Serial Number (SN)” and “Write Address” to any of APROM, LDROM, and Data Flash, and the written Serial Number (SN) will be automatically incremented (as shown in Figure 3-7).
Wide Voltage Programming
The Nu-Link-Pro supports the wide voltage programming function, by which the
development software tool can adjust the SWD port voltage as 1.8V, 2.5V, 3.3V,
or 5.0V. As shown in Figure 4-2, the pins that can be controlled include VCC,
ICE_DAT, ICE_CLK, and /RESET.
Also, as shown in Figure 2-1, the Nu-Link-Pro provides a set of SWD I/O
Voltage LEDs and SWD Power Output LEDs for checking the SWD port voltage.
Refer to Table 2-3 for more details about the LED status,
The Nu-Link-Me supports the wide voltage programming function, by which the
resistor JPR1 can adjust the SWD port voltage as 3.3V or 5.0V. As shown in
Figure 4-2, the pins that can be controlled include VCC, ICE_DAT, ICE_CLK,
/RESET, ICE_RX and ICE_TX.
The Nu-Link2-Me supports the wide voltage programming function, by which the
resistor ICEJPR1 can adjust the SWD port voltage as 1.8V, 3.3V or 5.0V. As
shown in Figure 4-2, the pins that can be controlled include VCC, ICE_DAT,
ICE_CLK, /RESET, ICE_RX/PASS, ICE_TX/Fail, BUSY and START.
Installing the Nu-Link Adapter Driver
The Nu-Link Adapter supports a variety of functions and third-party software tools (e.g. Keil MDK and IAR EWARM). After the software programs are installed, the drivers are also required. You can use the following links: Nu- Link Adapter Driver for Keil MDK and Nu-Link Adapter Driver for IAR EWARM to install the latest version. For details about software setup, please refer to section 4.2.
Installation and Setup
This chapter introduces how to connect the Nu-Link Adapter to a computer, and how to set the third-party tool to use the Nu-Link Adapter as a debugger and a programmer.
Connecting to the Nu-Link Adapter
As shown in Figure 4-1, the Nu-Link Adapter is a bridge between an USB and the
SWD interface, by which software tools can debug and program the target chip
through an USB. The user can plug the Nu-Link Adapter into an USB port of a PC
directly or connect using the USB connector.
Through a SWD port, the Nu-Link Adapter can supply power (1.8V, 2.5V, 3.3V, or
5.0V) to a target circuit board. The maximum is 5V/500mA. Refer to Table 2-1
for detailed specifications.
SWD Connector:
The SWD connector, which can be applied to all of the NuMicro® development
tools and evaluation boards, is a 100 mil (2×5) female header, as shown in the
left of
Figure 4-2.
Software Setup
This section briefly describes required software settings for connecting to
the Nu-Link Adapter. For detailed software operation, refer to the related
user manuals.
-
ICP Tool
Step 1: Download and install Nuvoton NuMicro® ICP Programming Tool.
Step 2: Open the ICP Tool, specify the UI language and target chip, and then click Continue, as shown in Figure 4-3.
Step 3: In the ICP Tool window, the connection status is shown as “Disconnected” since the ICP tool has not been connected with the Nu-Link Adapter, as shown in Figure 4-4.
Step 4: Click Option in the Program section of the ICP Tool Window to open the Program Option form, as shown in Figure 4-5.
Step 5: In the Nu-Link Pro IO Voltage section, specify the power voltage of the SWD port for the target chip, and then click OK. To use the offline programming function, the Offline Programming mode option needs to be selected, as shown in Figure 4-5.
Step 4: Return to the ICP Tool window, and then click the Connect button. Go to Step 5 if more than two Nu-Link Adapters are connected with the host. Go to Step 6 if only one Nu-Link Adapter is connected with the host.
Step 5: If two Nu-Link Adapters have been connected with the computer, a message appears and asks to select one from the two adapters. Clicking OK will connect the selected adapter with the host, as shown in Figure 4-6. When a Nu- Link Adapter is selected for connection, the Status LED starts blinking. For the blinking details, refer to the Status LED description of the “Select a Nu- Link Adapter to connect with the host” in Table 2-4.
Step 6a: After the Connect button is clicked, the ICP Tool will be connected with the Nu-Link Adapter, and a SWD port will be detected. Figure 4-7 shows that the ICP Tool has been connected with the Nu-Link Adapter and a target chip is detected. At this time, the user can start programming the target chip.
Step 6b: Figure 4-8 shows that the ICP Tool has been connected with the Nu-Link Adapter with no target chip detected. The ICP tool will continue detecting the target chip until the Stop Check button is clicked. At this time, the user cannot program any chip, but can use the offline programming to save the offline programming information in the Nu-Link Adapter.
Step 7: Click the Disconnect button if programming is not needed (as shown in Figure 4-7). Or click the Stop Check button to disconnect the ICP Tool with the Nu-Link Adapter and leave the Nu-Link Adapter unused (as shown in Figure 4-8). As such, the Nu-Link Adapter can be connected with another tool. -
Keil MDK
Step 1: Install Keil MDK. Before setting the Nu-Link Adapter, make sure the Nu-Link Adapter Driver for Keil MDK has been downloaded and installed such that the Keil MDK can recognize the Nu-Link Adapter.
Step 2: Open the Keil MDK and open the project to be set.
Debugger Settings:
Step 3: Invoke Project → Options for Target → Output , and enable the Debug Information option, as shown in Figure 4-9. Step 4: Invoke Project → Options for Target → Debug , and make sure the Use:「Nuvoton Nu-Link M0 Debugger option is checked, as shown in Figure 4-10. Step 5: Click the Settings button to open the Debug form, as shown in Figure 4-11. Refer to Table 4-1 for each setting description. The setting options shown in the Debug form may vary depending on the type of the Nu-Link Adapter used.
Table 4-1 Debugger Function Settings Description Debug Function| Description
---|---
Driver Version| Display the Nu-Link Adapter driver version in the host
Chip Type| Specify the Target chip type
Reset| Select Auto detect to reset the target chip
IO Voltage| Specify the SWD port I/O voltage for the target chip; options include 1.8V, 2.5V, 3.3V, and 5V
Programmer Settings:
Step 6: Invoke Project → Options for Target → Utilities , select
“Nuvoton Nu-Link M0 Debugger” when the Use Target Driver for Flash Programming
option is enabled, and then select the Update Target before Debugging option,
as shown in Figure 4-12. Step 7: Click the Settings
button to open the Flash Download form, as shown in Figure 4-13 where the user
can specify the options before or after programming with the Nu-Link Adapter.
IAR EWARM
Step 1: Install IAR EWARM. Make sure that Nu-Link Adapter Driver
for IAR EWARM has been downloaded and installed before setting the Nu-Link
Adapter such that the IAR EWARM can recognize the Nu-Link Adapter.
Step 2: Open IAR EWARM, and open the project to be set.
Step 3: In the Target tab of the General Options page (through invoking
Project → Options), click the button in the right of the Device option (make
sure the Device option is enabled), and select “Nuvoton → Nuvoton M031AE
series” as the target chip (M031AE series is this case), as shown in Figure
4-14 and Figure 4-15.
Debugger and Programmer Settings:
Step 4: In the Setup tab of the Debugger page, select Third-Party Driver as the driver, as shown in Figure 4-16.
Step 5: In the Download tab of the Debugger page, make sure that the Use flash loader(s) option is selected, as shown in Figure 4-17.
Step 6: In the Download tab of the Debugger page, select the Override default .board file option if you want the firmware to be downloaded to APROM or LDROM, and then specify the NUC100_APROM.board or NUC100_LDROM.board file (NUC100 series is used in this case). If no file is founded, specify the following path “$TOOLKIT_DIR$\config\flashloader\ Nuvoton\”, as shown in Figure 4-18.
Driver Plugin File Settings:
Step 7: In the Third-Party Driver page, specify the path of the IAR
debugger driver plugin “C:\Program Files\Nuvoton Tools\Nu-Link_IAR\Nu-
Link_IAR.dll”, as shown in Figure 4-19.
Step 8: Click OK to save the settings and return to the IAR EWARM main
window.
Step 9: Invoke Nu-Link to open the Nu-Link form, select SWD as the Port,
and specify the Nu-Link-Pro I/O Voltage in the Target power control section
(3.3V in this case), as shown in Figure 4-20.
NuEclipse GCC
Step 1: Install NuEclipse GCC, which does not require any driver
installation.
Step 2: Open NuEclipse GCC and open the project to be set.
Please also refer to the UM_NuEclipse_EN.
Debugger Settings:
Step 3: Into the debug mode, we have to prepare a debug configuration, which contains all the necessary information about the debug mode. Click **Run
Debug Configuration…** to open the debug configuration dialog. Double click on the GDB Nuvoton NuLink Debugging group. The Nuvoton Nu-Link debug configuration appears on the right-hand side. In the Main tab, the name of Project should coincide with the project name. The C/C++ Application should point to the .elf application generated by the build process. As shown in Figure 4-21. If the project name or C/C++ Application is incorrect, please select the expected project first in the project view, build the project to generate the executable, and expand the tree to make sure the existence of the generated executable. Then repeat the former operations again.
Programmer Settings:
Step 4: The Debugger tab is used to provide the OpenOCD and GDB Client setup. OpenOCD requires correct configuration files to know how to work with adapters and target chips. The configuration files are specified in the Config options field. Nuvoton’s adapter is Nu-Link, which uses the interface configuration file named nulink.cfg. In addition, Nuvoton has three different ARM families, such as M0, M4, and M23. The corresponding target configuration files are numicroM0.cfg, numicroM4.cfg, and numicroM23.cfg. For M0 2nd development, the target configuration file would be numicroM0_NS.cfg, as shown in Figure 4-22.
Step 5: As the first step, we should choose the right Chip Series in the Startup tab. When done, the corresponding target configuration file will be automatically written in the Config options field of the Debugger tab. To load executable to flash, we need to select the Load executable to flash checkbox. To load executable to RAM, we need to select the Load executable to SRAM checkbox. When all the settings are done, click the Apply button to take effect. To launch the application into the debug mode, click the Debug button.
Step 6: At last, click Apply to save the settings, as shown in Figure 4-23.
Appendix
Nu-Link Adapter Operating Current
When power is supplied via an USB during online programming, the operating
current of Nu-Link Adapter is shown in the table below.
Table 5-1 Nu-Link Adapter Operating Current (Online Programming)
Type
Parameter
|
Nu-Link-Pro
|
Nu- Link
|
Nu-Link-Me
|
Nu-Link2-Me
---|---|---|---|---
SWD I/O Mode Settings| 5.0V| 3.3V| 2.5V| 1.8V| –| 5.0V| 3.3V| 5.0V| 3.3V| 1.8V
USB Input Voltage (V)| 5.0| 5.0| 5.0| 5.0| 5.0| 5.0| 5.0| 5.0| 5.0| 5.0
SWD I/O Voltage (V)| 5.06| 3.34| 2.54| 1.83| 4.77| 4.79| 3.37| 5.06| 3.34| 1.8
USB Input Current (mA)| 101| 92| 88| 84| 110| 74| 60| 101| 99| 91
When power is supplied from a target board (SWD VCC pin) during offline programming, the operating current of Nu-Link Adapter is shown in the table below.
Table 5-2 Nu-Link Adapter Operating Current (Offline Programming)
Type
Parameter
|
Nu-Link-Pro
|
Nu- Link
---|---|---
Power Supplied from a Target Board| 5.0V| 3.3V| 2.5V| 1.8V| 5.0V| 3.3V| 2.5V
Power Supplied via an USB| Off| Off| Off| Off| Off| Off| Off
SWD VCC Input Voltage (V)| 5.00| 3.30| 2.50| 1.80| 5.00| 3.30| 2.50
SWD VCC Input Current (mA)| 64| 86| 117| 171| 100| 77| 62
Automatic IC Programming System
The automatic IC programming system through individual slot and the control bus as Figure 5-1.
Operation sequence and Waveform
- The Nu-Link2-ME power on. START, BUSY, PASS, and FAIL are set to logic.
- To start programming, START needs to be set to logic 0 for TSTART,
- Programming start-up. BUSY is set to logic 0, and might toggle during programming.
- When finish programming, BUSY is set to logic 1, and PASS or FAIL is set to logic 0.
- When BUSY is set to logic 1, and PASS is set to logic 0, means “PASS”.
- When BUSY is set to logic 1, and FAIL is set to logic 0, means “FAIL”.
Revision History
Revision | Description | Date |
---|---|---|
V1.00 | Preliminary version | 2012/07/16 |
V1.01 | Delete Nu-Link-Me (On-board Version), Add Nu-Link2-Me. | 2019/10/24 |
References
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>