ULINK2 User's Guide: ULINK2 User's Guide

Keil, An ARM® Company ULINK2 User's Guide

The ULINK2 User's Guide describes the Keil ULINK®2 USB-JTAG Interface Adapter and contains detailed instructions for the hardware and software configuration. ULINK2 is a small hardware adapter that connects the USB port of the PC to the JTAG or OCDS debugging port of the target hardware. Use ULINK2 to:

  • Debug and test programs on target hardware.
  • Program on-chip or external Flash memory of many devices.

This book contains the following chapters:

  • Introduction gives an overview of the ULINK2 USB-JTAG Adapter features, requirements, limitations, supported devices, and CoreSight™ Technology.
  • Hardware Description describes the ULINK2 Adapter components, and the start and reset sequences.
  • Setup ULINK2 shows the ULINK2 connection interfaces, how to install ULINK2, and the configuration settings needed to debug on ARM or Cortex-M devices.
  • Using ULINK2 describes how to download and debug programs on target devices, and explains target chaining.
  • Configure Cortex-M Devices for Tracing explains the settings needed for enabling trace by means of certain devices.
  • µVision Windows shows the trace capturing and displaying capabilities of ULINK2, and the µVision windows used to visualize and analyze data.
  • Troubleshooting Guide a step-by-step guide to locate potential errors.
  • Appendix with information about error messages and a troubleshooting guide.

Copyright © Keil, An ARM Company. All rights reserved.


ULINK2 User's Guide: Appendix

Appendix

This chapter contains the sections:

  • Error Messages - list of errors with possible solutions.
  • Utilities - that can be used to change the boot mode or upgrade the firmware of ULINK2.


ULINK2 User's Guide: Microchip AT91SAM3 Devices

Microchip AT91SAM3 Devices

Microchip AT91SAM3 devices support all standard CoreSight features. ETM trace is not included. No additional target resources are needed for debugging. By default, AT91SAM3 devices debug in JTAG mode, and can be switched to Serial Wire mode. AT91SAM3 devices offer ITM and DWT trace data.

To use the CoreSight trace functionalities, the debugger adapter and connector, as well as µVision have to be configured properly:

  • Enable Serial Wire Trace

For additional information, refer to the AT91 ARM Cortex-M3 based Microcontrollers - SAM3U Series manual.


ULINK2 User's Guide: Enable Serial Wire Trace

Enable Serial Wire Trace

To enable Serial Wire Trace on Atmel AT91SAM3 devices:

  • Use a ULINK2 connector interface that supports Serial Wire, and connect ULINK2 to the board and to the host computer.
  • Configure µVision to capture Serial Wire Trace data.

Configure µVision to capture Serial Wire Trace data

  1. Open the dialog Options for Target — Debug.

    Select the debugger adapter

  2. Enable Use, select ULINK Cortex Debugger, and click Settings to open the Target Driver Setup dialog.

    Configure the Serial Wire Debug mode

  3. Enable SWJ and select SW.
  4. Click the Trace tab.

    Configure Atmel SAM3x devices for Serial Wire Trace

  5. Set Trace Enable and Autodetect.
  6. The Core Clock must correspond to the device configuration.

Start the debugging session and verify the captured trace data with a µVision window.


ULINK2 User's Guide: Boot Mode Utility

Boot Mode Utility

This utility allows configuring the boot mode (CMSIS-DAP or ULINK) of ULINK2.

Starting with the ULINK2 firmware version 2.00, the default boot mode is CMSIS-DAP.

If ULINK2, with firmware 2.00, needs to be operated with MDK-ARM versions prior to 4.70, then ULINK2 needs to be configured to boot up in ULINK mode.

The utility, UL2_Configure.exe, is located in the folder ..\Keil\ARM\ULINK\Utilities.

Run the utility from the command line.

UL2_Configure.exe 〚SN〛{B0|B1}

Where

SN | ULINK2 Serial Number, which can be found through the dialog Options for Target - Debug - Settings - Debug. See ULINK USB-JTAG/SW Adapter. Must be specified if more ULINK2 adapters are connected. Otherwise, the Serial Number is optional.
B0 | Switch to ULINK boot mode.
B1 | Switch to CMSIS-DAP boot mode.

Examples

UL2_Configure B0

Boots the connected ULINK2 in ULINK firmware mode.


ULINK2 User's Guide: ARM Devices

ARM Devices

Configure µVision and ULINK2 to debug applications on ARM7 and ARM9 devices.

  • Debug Driver Configuration explains how to select the debug driver, set the debugging speed, and define the debugging behaviour.
  • Flash Download Configuration describes how to select the appropriate Flash programming algorithm and define the download functions.


ULINK2 User's Guide: Cortex-M Debugging

Cortex-M Debugging

Configure µVision and ULINK2 for debugging and capturing trace on Cortex-M devices.

  • Debug Driver Configuration explains how to select the debug driver, set the debugging speed, and define the debugging behavior.
  • Trace Configuration provides details on how to configure trace port, set trace port speed, ITM stimulus ports, and enable trace events.
  • Pack Options explains how to enable debug descriptions delivered with Software Packs.
  • Flash Download Configuration describes how to select an appropriate Flash programming algorithm and define the download functions.


ULINK2 User's Guide: Configure Cortex-M Devices for Tracing

Configure Cortex-M Devices for Tracing

The examples below explain trace configuration options for selected device families using a Debug Initialization File.

  • Cortex-M0+ and Cortex-M23 MTB Devices
  • NXP MKL25Z Devices
  • NXP LPC17xx Devices
  • STMicroelectronics STM32F10xxx Devices
  • Microchip AT91SAM3 Devices
  • Texas Instruments LM3S Devices
  • Toshiba TMPM330 Devices

Note:

  • Trace Configuration explains the options to control trace output.
  • If the dialog Options for Target — Debug — Settings shows the Pack tab, then enable the trace as explained in Trace Configuration.


ULINK2 User's Guide: Known Limitations

Known Limitations

Connect & Reset Options

The following known issues might arise for the listed Connect & Reset Options types:

without Stop

  • Toolbar buttons will falsely indicate that the CPU enters debug halt before disconnecting from a running target.
  • The debugger cannot find an exact synchronization point for starting trace capture and for initializing the CPU States (cycle count) mechanism. Hence, trace timestamps can diverge from the States variable in the Register window after connecting to a running target. This persists until the CPU is stopped for the first time.


ULINK2 User's Guide: Cortex-M0+/M23 MTB Devices

Cortex-M0+/M23 MTB Devices

Many Cortex-M0+ and Cortex-M23-based devices provide simple instruction trace support by integrating Arm© CoreSightTM Micro Trace Buffer (MTB) technology.

When MTB is enabled, the trace data is stored in a user-configurable circular on-chip trace buffer that is located in device RAM and shares it with the executed application. It is crucial to ensure that MTB area in RAM is not used for the application variables, stack, and heap. Once the program is stopped, the debugger transfers the trace frames currently in the RAM to the Trace Instruction window on the host computer.

The device, the debugger adapter, and µVision have to be configured properly to capture MTB trace on such targets:

  • Enable MTB Trace

Note

  • If an Microcontroller Prototyping System (MPS) is used, then the Cortex-M0 MTB IP image has to be programmed into this unit.
  • Application examples are located in the folder \ARM\Boards\ARM\MPS_CM0MTB. The examples are configured to be used with an MPS.


ULINK2 User's Guide: Enable MTB Trace

Enable MTB Trace

To enable Micro Trace Buffer (MTB) instruction tracing for Cortex-M0+/M23 processor-based devices:

  • Configure µVision project to capture MTB trace data as described below.
  • Make sure that ULINK2 debug unit is connected to the target board and PC, and is properly configured in µVision .
  • Restart the debug session and observe the captured trace in µVision Trace Data Window.

Note:

  • Due to its intrinsic simplicity, MTB doesn't support advanced, trace-based features available in µVision, such as Performance Analyzer, Execution Profiler, Code Coverage, Logic Analyzer.
  • MTB tracing works on all supported debug probes in Serial Wire Debug (SWD) as well as in JTAG Debug modes.

Configure µVision project to capture MTB trace data

µVision uses a debug initialization file that configures and enables the MTB in application projects before the debug session starts. MTB configuration steps described below apply to all supported debug probes.

  1. Create a text *.ini file and enter the code that configures the MTB on the target device.

    Many MDK example applications already contain in the root folder a pre-configured initialization file for MTB setup (DBG_MTB.ini).

    The initialization code is typically annotated for µVision Configuration Wizard support and looks like below:

    /******************************************************************************/
/* DBG_MTB.ini: Initialization Script for Cortex-M0+ MTB(Micro Trace Buffer)  */
/******************************************************************************/
// <<< Use Configuration Wizard in Context Menu >>>                           //
/******************************************************************************/

/*-------------------------------------------------------------------
** Define the function to enable the trace port
**-----------------------------------------------------------------*/
FUNC void MTB_Setup (void) {
  unsigned long position;
  unsigned long master;
  unsigned long watermark;
  unsigned long _flow;
  unsigned long positionRegAddr;

// <e0.31> Trace: MTB (Micro Trace Buffer)
//    <o0.0..4> Buffer Size
//      <4=> 256B
//      <5=> 512B
//      <6=> 1kB
//      <7=> 2kB
//      <8=> 4kB
//      <9=> 8kB
//      <i> Trace buffer size in device RAM. MTB memory shall not be used by application.
//   <o1> Buffer Position
//     <i> Starting address of the trace buffer in RAM. MTB memory shall not be used by application.
//   <o2.0> Stop Trace when buffer is full
//   <o2.1> Stop Target when buffer is full
//   <o3> MTB register address
//     <i> Device-specific address of the MTB position register.
// </e>

/* Parameters linked to the Configuration Wizard */
  master     = 0x80000006;
  position   = 0x20000000;
  _flow      = 0x00000000;
  positionRegAddr = 0x41006000;

/* Preparing values for MTB register */
  position  &= 0xFFFFFFF8; // Mask POSITION.POINTER field
  watermark  = position + ((16 << (master & 0x1F)) - 32);
  _flow     |= watermark;

/* Writing values to the MTB registers on the device */
  _WDWORD(positionRegAddr+4, 0x00000000); // Clear MTB MASTER register
  _WDWORD(positionRegAddr, position);     // Write to MTB POSITION register
  _WDWORD(positionRegAddr+8, _flow);      // Write to MTB FLOW register
  _WDWORD(positionRegAddr+4, master);     // Write to MTB MASTER register to enable MTB
}

/*-------------------------------------------------------------------
** Invoke the function at debugger startup
**-----------------------------------------------------------------*/
MTB_Setup();

    To adapt this code to a custom application project, open the .ini file in µVision and specify following parameters using Configuration Wizard as shown on the figure below:

    • Trace buffer position and size in device RAM. For proper operation, it is critical to ensure that MTB is located in the RAM area that is not used by the executed firmware.

    • Stop Trace and Stop Target flags when trace buffer is full. As MTB is a circular buffer that gets read only when debug is paused, these flags help to ensure that trace data can be read before it gets overwritten.

    • Device-specific address of the MTB position register according to the device datasheet.

    Config Wizard for DBG_MTB.ini file

  2. Open the dialog Options for Target, go to the Debug tab and provide the path to the DBG_MTB.ini file in the Initialization File field.

  3. Enable MTB trace

After restarting the debug session the captured trace data can be now observed in µVision Trace Data Window.

Note:

  • Please also see an example of MTB configuration for Cortex-M0+ based NXP MKL25Z Devices. Application Note 237 further explores MTB configuration and operation on NXP LPC800 devices.


ULINK2 User's Guide: CoreSight Technology

CoreSight Technology

CoreSight™ is an on-chip debugging and tracing technology designed by ARM. The device manufacturer can implement CoreSight features in various combinations.

(Though the red-dotted elements can be part of CoreSight, they are not supported by ULINK2.)

CoreSight features can be accessed through a JTAG or Serial Wire interface. Debugging in JTAG and Serial Wire mode at the same time is not possible. Cortex-M processor-based devices can include a:

Debug Interface

The debug interface offers two modes:

  • JTAG Debug is the industry-standard interface that allows device chaining.
  • Serial Wire Debug is a 2-pin interface with an optional Serial Wire Trace Output. In contrast to JTAG, devices cannot be chained.

The Debug Interface communicates with the following units:

  • Run Control: allows the user to start, stop, and single-step through the source code.
  • Breakpoint Unit: allows the user to set breakpoints even while the processor is running.
  • Memory Access Unit: allows the user to read or write to memory and peripheral registers even while the program is running.

Trace Port Interface

The Trace Port Interface encodes and provides trace information via two possible interfaces:

  • The Serial Wire Trace Output pin (SWO) can be used in Serial Wire Debug mode only.
  • The 4-Pin Trace Output has a greater bandwidth than Serial Wire Trace Output and uses 5 functional pins. It is the only way to output ETM trace data. However, the ULINKpro USB-JTAG/SW debugger adapter is required to use this feature.

The Trace Port Interface communicates with the following units:

  • Embedded Trace Macrocell (ETM): can be used for instruction tracing to debug historical sequences, for software profiling, and code coverage analysis. ETM data are output through an extra 4-bit interface (ULINKpro required).
  • Instrumentation Trace Macrocell (ITM): provides application information like debug printf(), RTOS information, unit test, or UML annotation.
  • Data Watchpoint & Trace Unit (DWT): provides PC sampling, event counters, timing, and interrupt execution information. In addition, it allows Access Breakpoints for up to four memory addresses.

Serial Wire-JTAG Switch (SWJ)

This switch is used to synchronize the debugger adapter and the CoreSight debug interface. ULINK2 uses this option to generate sequences for switching between Serial Wire Debug and JTAG Debug mode.

Note

  • Check the manufacturer's device data sheet to read which CoreSight features have been implemented.


ULINK2 User's Guide: Debug

Debug

The Debug section provides controls for connecting and reseting the device, and caching and downloading the code. The settings are applied each time a debugging session is started.

Target Driver Setup - Connect and Reset Options

Connect & Reset Options

Connect & Reset Options control the instructions executed while connecting to target.

Connect and Reset Options

Connect - controls the operations that are executed when the µVision debugger connects to the target device. The drop-down has the following options:

  • Normal just stops the CPU at the currently executed instruction after connecting.
  • with Pre-reset applies a hardware reset(HW RESET) before connecting to the device.
  • under Reset holds the hardware reset(HW RESET) signal active while connecting to the device. Use this option when the user program disables the JTAG/SW interface by mistake.
  • without Stop connects to and disconnects from the target device without explicitly stopping the CPU. Use this option, for example, to inspect memory or peripheral SFRs.

    To use this Connect type properly, set all the following options:

    • Disable Reset after Connect
    • Disable Options for Target - Debug - Load Application at Startup. Use the following command in an initialization script (refer to Creating Functions) or in the Command window to manually load debug information:
      LOAD %L INCREMENTAL. Refer to LOAD command.
    Refer to Known Limitations - without Stop for further details.

Reset after Connect (if enabled) performs a reset operation as defined in the Reset drop-down list (see below) after connecting to the target. When disabled, the debugger just stops the CPU at the currently executed instruction after connecting the target. Refer also to Start Sequence for details.

Reset controls the reset operations performed by the target device. The available options vary with the selected device and supported debug description that can be enabled in Pack Options.

  • Custom selects a reset method provided by the debug description that is different from the standard reset methods.
  • Autodetect selects the best suitable reset method for the target device. This can be a specialized reset or standard method. If Autodetect finds an unknown device, it uses the SYSRESETREQ method.
  • HW RESET performs a hardware reset by asserting the hardware reset (HW RESET) signal.
  • SYSRESETREQ performs a software reset by setting the SYSRESETREQ bit. The Cortex-M core and on-chip peripherals are reset.
  • VECTRESET performs a software reset by setting the VECTRESET bit. Only the Cortex-M core is reset. On-chip peripherals are not reset. For some Cortex-M devices, VECTRESET is the only way they may be reset. However, VECTRESET is not supported on Cortex-M0, Cortex-M0+, Cortex-M1, and ARMv8-M cores.

Stop after Reset permanently enables the Cortex-M Reset Vector Catch. This stops the CPU when running through the reset vector (e.g. because of pressing the reset button on the board, issuing a reset from uVision while the target is running; reset caused by a watchdog timer).

Stop after Bootloader stops the CPU after executing the bootloader instructions and is available only for some devices.

Log Debug Accesses writes target debug accesses and information about debug components detected in the device ROM table into a text file. The following accesses are logged:

  • MEM: Target Memory Access
  • AP: Access Port Register Access
  • DP: Debug Port Register Access

Note

  • Logging of memory block accesses are indicated as such, all read or written items of such a block access are logged.
  • Not all debug accesses are logged in detail to keep the output readable. For example, DP and AP register accesses that form a target memory access are not logged, but abstracted as a memory access.

The text file ULINK2_DebugLog_xxxx.log is created in the current project folder, where xxxx is a sequential number. The file limit is 100MB. If this limit is reached during a single debug session, then a new file is created.

Cache Options

Cache Options improve the µVision debugger performance during target debugging by caching target memory areas into the PC memory. By default, caching options are enabled to get maximum performance.

Cache Code informs the debugger that the downloaded program code will not change. When this option is set, µVision never reads the program code from the target system. Disable this option when the application includes self-modifying code or the program code might get overwritten.

Cache Memory determines whether memory displays are updated during a program stop. When this option is set, the debugger does not update memory displays until the execution of the next single step, procedure step, or go command. Disable this option to display the actual memory content (for example, the content of memory mapped peripherals) when the debugger is halted.

Download Options

Download Options control the downloading of code to the target system when starting a debugging session.

Verify Code Download compares the content of the target memory with the application program loaded in the debugger for each new debug session. Enable this option to ensure program correlation between the image loaded in target system and the image loaded in the µVision debugger. This prevents debugging the wrong code when working with various targets or more instances of µVision.

Download to Flash downloads code to all memory regions. When disabled, the debugger does not download code to the memory Address Range defined in the dialog Target Driver Settings - Programming Algorithm. Enable the option if the application is loaded into RAM and the Flash algorithm is defined for the same address range. By default, this option is disabled. Refer to the knowledgebase article µVision Debugger: Error 57: Illegal Address in Debugger Output Window.


ULINK2 User's Guide: Debug Driver Configuration

Debug Driver Configuration

µVision uses a target driver to connect to the debugging unit of the target hardware.

  1. Options for Target Button Open the dialog Options for Target - Debug to define the driver and debugging behaviour.

    Set Use: and select ULINK2/ME Cortex Debugger from the drop-down list.

    Select Target Driver

    • Starting with the Firmware version 2.01, ULINK2 can be used as a CMSIS-DAP compliant debugger. Refer to CMSIS-DAP Debugger User's Guide for setup details. To change the firmware boot mode, refer to Boot Mode Utility.

  2. Click the button Settings to display the dialog Target Driver Setup, which consists of three groups of information and configuration settings:

    • ULINK USB-JTAG/SW Adapter
    • SW Device or JTAG Device Chain
    • Debug

    Target Driver Setup


ULINK2 User's Guide: SW Device

SW Device

The SW Device section displays one or more debug targets connected through the Serial Wire interface. The IDCODE and Device Name are displayed automatically for each device.

Target Driver Setup - SW Device

  • AP specifies the identifier of the Access Port in multi-core devices with a single Debug Port.
    • The AP value range is 0 to 255.
    • For single core devices, set AP to 0 (default).
    • For a multi-core device, core 0 is expected to have AP=0 and core 1 AP=1. However, the port identifiers are specified by the device manufacturer.

    If AP contains an invalid identifier, the error message "Invalid ROM Table" is shown whenever a debuging session is started.

Note

  • This part of the screen changes with the value of the field Port. For JTAG refer to the description in JTAG Device Chain.


ULINK2 User's Guide: ULINK USB-JTAG/SW Adapter

ULINK USB-JTAG/SW Adapter

Target Driver Setup - ULINK2 Adapter The section ULINK2 USB-JTAG/SWD Adapter displays driver, device, and firmware information about ULINK2.

Serial No displays the serial number of the ULINK2 adapter. When more ULINK2 adapters are connected, use the drop-down list to select the adapter that should be used.

  • Starting with the Firmware version 2.01, ULINK2 can be used as a CMSIS-DAP compliant debugger. Refer to CMSIS-DAP Debugger User's Guide for setup details. To change the firmware boot mode, refer to Boot Mode Utility.

SWJ enables ULINK2 to switch between JTAG and Serial Wire (SW) mode automatically. Enable SWJ on devices with a combined Serial Wire/JTAG interface. Disable SWJ on devices that only have the Serial Wire interface mode.

Port sets the debugging interface: JTAG or SW. With SW, ULINK2 uses only two pins for communication, as described in CoreSight Technology.

Max Clock sets the clock rate used to communicate to the target board.


ULINK2 User's Guide: JTAG Device Chain

JTAG Device Chain

The JTAG Device Chain section displays one or more debug targets connected through the JTAG interface. The IDCODE, Device Name, and IR Length are displayed automatically for each device.

Target Driver Setup - JTAG Device Chain

Manual Configuration allows identifying undetected JTAG devices. Specify the instruction register length (IR len) of each device in the JTAG device chain.

AP specifies the identifier of the Access Port in multi-core devices with a single Debug Port.

  • The AP value range is 0 to 255.
  • For single core devices, set AP to 0 (default).
  • For a multi-core device, core 0 is expected to have AP=0 and core 1 AP=1. However, the port identifiers are specified by the device manufacturer.

If AP contains an invalid identifier, the error message "Invalid ROM Table" is shown whenever a debuging session is started.

Note

  • If the Port drop-down list is set to SW, the SW Device group is active.
  • Refer to Chaining Multiple Targets for additional information.


ULINK2 User's Guide: Pack Options

Pack Options

Pack options are available for devices that have been delivered with a CMSIS Pack debug description. Software Pack vendors can define debug descriptions for development tools to connect the debugger to a device for debugging, tracing, or flash programming. Default values defined in the debug description are applied to the options in Debug Driver, Trace Configuration, and Flash Download. Options in the screens mentioned above can be changed manually.

To configure ULINK2 for using the debug description:

  1. Target Options Open the dialog Options for Target ... — Debug.
  2. Enable Use and select ULINK2/ME Cortex Debugger.

  3. Click Settings to open the Target Driver Setup dialog. Next click on Pack (only for some devices).

    Target Driver Setup - Trace

    Pack | Displays the Software Pack that contains the debug description.
    Enable | Enable the debug description.
    Log Sequence | Enable logging of the Debug Access Sequence execution. The next box shows the base name for the generated files. The '*'-wildcard at the end is replaced by a four digit decimal index when generating the files. Each file has a size limit of 100 MByte. New indexes are started if the device changes, if the build target changes, or if a new project is loaded. Otherwise, logs are appended to the currently opened file.
    Configuration | Path to the Debug Configuration (dbgconf) file. The project folder is the root folder. This file is an optional part of the debug description and might not exist.
    Edit | Open the debug configuration file to modify device specific debug settings for this target.

Configuring debug settings

The dbgconf file usually contains Configuration Wizard annotations that make it easy to change the debug configuration:

Target Driver Setup - Trace

Notes

While configuring debug settings is optional in most cases, it is essential for complex devices with Arm Cortex-M23 or M33 cores that require correct setup before Flash downloading. Consult the device user manual for more information.


ULINK2 User's Guide: Trace Configuration

Trace Configuration

The Trace dialog defines generation and capturing of trace events via the Serial Wire Trace Output (SWO) pin. ULINK2 delivers trace information in real-time to the host PC.

Note

  • While the debugger is running the Status Bar indicates the trace capturing operation.

Cortex-M Target Driver Setup - Trace Tab

General settings define system clock frequency and overall trace capturing.

Core Clock
Specify the processor core clock frequency here. The debugger uses this value to calculate timings for trace capturing and displays (such as current and voltage for example), even when trace is disabled. It also configures the debug unit's trace capture UART device. It should be be set to the system clock frequency that your target application uses in active state. If your device's trace clock does not run as fast as the system core clock, specify a separate Trace Clock.
Trace Enable
Enable this option to capture trace via the SWO pin.
Trace Clock
Specify the trace clock frequency here, if it differs from the Core Clock.
Use Core Clock
Enable this option to use the core clock frequency for trace. If your trace clock differs, uncheck and enter the correct trace clock in the Trace Clock box.

The sections below determine the trace ports and the captured information:

  • Trace Port configures the channel used for capturing trace.
  • ITM Stimulus Ports activates various ports, which can be used from the program code, to obtain debugging or program-specific information.
  • Timestamps sends time information along with trace events.
  • PC Sampling enables PC information indicating the program location that triggered a trace event.
  • Trace Events report specific CPU events.

Note

  • Configuring Devices for Tracing explains the settings for various targets.


ULINK2 User's Guide: Component Viewer

Component Viewer

The Component Viewer shows information about:

  • Software components that are provided in static memory variables or structures.
  • Objects that are addressed by an object handle.
  • Events and time information generated by event annotations in a software component using the Event Recorder.

The picture below is an example showing debug information for an USB Device object:

Refer to Component Viewer documentation for more information.


ULINK2 User's Guide: Event Recorder

Event Recorder

The Event Recorder shows execution status and event information, and helps to analyze the operation of software components.

The Event Recorder:

  • Increases the visibility to the dynamic execution of application program.
  • Provides filter capabilities for event types (Errors, API Calls, Operation, Details).
  • Allows unrestricted calls to Event Recorder functions from Threads, RTOS kernel, and ISRs.
  • Implements recording functions that do not disable ISR on ARMv7M (Cortex-M3, Cortex-M4, Cortex-M7).
  • Supplies fast time-deterministic execution of Event Recorder functions with minimal code and timing overhead. Thus, event annotations can remain in production code without the need to create a debug or release build.

Analysis Window Button Open the Event Recorder from View – Analysis Windows - Event Recorder.

Event Recorder Window

For more information, refer to the Event Recorder documentation.


ULINK2 User's Guide: Error Messages

Error Messages

This list identifies errors that might occur when using ULINK2/ME. The messages are sorted in groups to identify the error cause easily. If you are experiencing difficulties, contact our support group.

ULINK2/ME

Firmware Download Failed
ULINK2/ME firmware cannot be downloaded. Firmware is corrupted or cannot be downloaded due to hardware problems.
Cannot read ULINK2/ME Firmware version number
Communication is lost or ULINK2/ME is not working. Unplug ULINK2/ME from the USB port and plug it back in.
Cannot read ULINK2/ME Firmware serial number
Communication is lost or ULINK2/ME is not working. Unplug ULINK2/ME from the USB port and plug it back in.
No ULINK2/ME device found
No ULINK2/ME detected. ULINK2/ME is not connected to the USB port, or the USB driver is not installed properly, or ULINK2/ME is not working properly. Reconnect or connect ULINK2/ME to the USB port of the PC.
No ULINK2/ME is selected
No ULINK2/ME adapter has been selected for debugging. Occurs when more ULINK2/ME adapters have been detected, but none has been selected. Select one ULINK2/ME from the Serial No drop-down list in the Target Driver Setup dialog. Use Options for Target - Debug - Settings.
ULINK2/ME Communication Timeout
Communication is lost or corrupted. Unplug ULINK2/ME from the USB port and plug it back in.
ULINK2/ME Macro Buffer overflow
Internal driver error. Please report it to our support group.
USB Communication Failure
USB communication is lost or corrupted. Unplug ULINK2/ME from the USB port and plug it back in.
DR Communication Sequence Error
Internal driver error. Please report it to our support group.
Macro Execution Error
Internal driver error. Please report it to our support group.
Macro Sequence Error
Internal driver error. Please report it to our support group.
Macro Sequence too long
Internal driver error. Please report it to our support group.
Parameter Error
Internal driver error. Please report it to our support group.

JTAG

JTAG Communication Failure
JTAG communication is corrupted. Target JTAG interface is not working properly. Mainly caused by the target: debug block not powered or clocked properly. Avoid Deep-Sleep modes while debugging. Lower the Max Clock frequency in the Target Driver Setup - Debug dialog.
JTAG Device Chain Error
Devices on the JTAG chain do not meet the requirements, or the JTAG chain is not configured properly. Refer to Chaining Multiple Targets.
No Cortex-M Device found in JTAG chain
No Cortex-M processor-based device detected (using JTAG). Device is not connected, not powered, or the debug interface is not working. Enable the SWJ switch in the ULINK USB-JTAG/SWD Adapter section of the Target Driver Setup - Debug dialog.
No JTAG Devices Found
No JTAG device has been detected. Target not connected or not powered, or JTAG interface is not working.
Too Many JTAG Devices in Chain
Either too many JTAG devices have been detected in the chain (maximum 64 devices are allowed), or the JTAG communication is corrupted and it behaves as if too many devices are present. Check if the target is powered. Check if the JTAG interface is working properly. Lower the Max Clock frequency in the Target Driver Setup - Debug dialog.
No ARM Device found in JTAG chain
No ARM7/ARM9 processor-based device detected (using JTAG). Device is not connected, not powered, or the debug interface is not working. Check the connections, or try a manual RESET.

Serial Wire Debug

No Cortex-M SW Device Found
No Cortex-M processor-based device detected (using Serial Wire). Device is not connected, or not powered, or the debug interface is not working. Enable the SWJ switch in the ULINK USB-JTAG/SWD Adapter section of the Target Driver Setup - Debug dialog.
SWD Communication Failure
Serial Wire Debug communication is corrupted. The target SWD interface is not working properly. Mainly caused by the target: debug block not powered or clocked properly. Avoid Deep-Sleep modes while debugging. Lower the Max Clock frequency in the ULINK USB-JTAG/SWD Adapter section.

Debug

Cannot access Memory
Memory on the target cannot be accessed by the debugger. Avoid accessing invalid memory areas on the target system. This message can also be displayed due to the target's debug block being improperly powered or clocked (for example in deep-sleep mode). A lower Max Clock frequency in the Target Driver Setup - Debug dialog might help.
Cannot enter Debug Mode
Debug Interface on the target cannot be accessed. The target debug interface is not working properly. Mainly caused by target problems: debug block not powered or clocked properly. Avoid Deep-Sleep modes while debugging. Lower the Max Clock frequency in the Target Driver Setup - Debug dialog.
Could not stop Cortex-M device
The debugger tries to stop the target. This attempt can be made after initializing the connection, or while resetting the target, or through a stop/step command while debugging. In some cases, the target's debug block not functioning properly raises this error.
Device could not be powered up
Debug block on the device could not be powered. Debug block on the target is not working properly. Mainly caused by target problems: debug block not powered and clocked properly.
Memory Mismatch
Memory mismatch detected while downloading the code to target. Appears when the option Verify Code Download is enabled and when a debugging session is started. Then the code in the target is compared against the load image. The message is raised when the target's Flash was not programmed with the code being debugged. Download the program to Flash.
Could not stop ARM device
The debugger tries to stop the target. This attempt can be made after initializing the connection, or while resetting the target, or through a stop/step command while debugging. In some cases, the target's debug block not functioning properly raises this error.

Trace

Selected SWO Clock is not supported
Selected SWO clock frequency is not supported (too high). Select a lower frequency from the drop-down list.
Selected Trace Port available only with SW Debug Port
Serial Wire trace Output can only be used when Serial Wire is selected as the debug interface. Select the SW port in the ULINK USB-JTAG/SWD Adapter section of the Target Driver Setup - Debug dialog.
Trace HW not present
Tracing has been enabled in µVision, but the hardware does not have the requested trace resources. For example, ETM trace is selected but the device has no ETM. Execute a Power-on-Reset. Check whether the hardware has been configured properly, for example through an *.ini file.

Breakpoints (General)

Cannot set breakpoint(s)
- HW Breakpoint: no support for this address.
- SW breakpoint: cannot write to memory.
Occurs when breakpoints are set for an external memory. This is not supported. Remove the breakpoints.

Breakpoints (Cortex-M)

It was not possible to disable all breakpoints
Occurs when breakpoints cannot be disabled while the target is running. Stop the target to perform this operation.
Not possible while target is executing
This operation is not possible or failed while the target is running. Occurs in situations where breakpoints cannot be enabled or disabled while the target is running.
This target device does not support all the defined breakpoints
Too many breakpoints have been defined. Reduce the number of breakpoints.
This target device does not support all the defined watchpoints
Too many watchpoints have been defined. Reduce the number of watchpoints.
This target device does not support conditional breakpoints
Remove all conditional breakpoints.
This target device supports only the following watchpoints:
size = 2^n; n = 0..15
start must be 2^n aligned
with optional value match
Change the watchpoint definition.

Breakpoints (ARM7/ARM9)

This target device does not support all the defined breakpoints
Too many breakpoints have been defined. Reduce the number of breakpoints. The following breakpoint combinations are supported:
  • When executing from volatile (RAM) memory:
    • unlimited address breakpoints and one data access breakpoint
    • two data access breakpoints
  • When executing from non-volatile memory, for example Flash:
    • two address breakpoints
    • two data access breakpoints
    • one address breakpoint and one data access breakpoint
This target device only supports one complex range breakpoint
Too many complex range breakpoints have been defined. Reduce the number of these breakpoints.
This target device only supports two simple range breakpoints
Too many simple range breakpoints have been defined. Reduce the number of these breakpoints.
This target device only supports two data access breakpoints
Too many data access breakpoints have been defined. Reduce the number of these breakpoints.
This target device does not support any other breakpoints when:
— one complex range breakpoint is defined.
— two simple range breakpoints are defined.
— two data access breakpoints are defined.
— simple range and data access breakpoint is defined.
Reduce the number of breakpoints.
Operation not possible while the target device is executing
This operation failed or is not possible while the target is running. Stop the target to perform this operation.
It was not possible to kill all breakpoints
Usually occurs when breakpoints cannot be killed while the target is running. Stop the target to perform this operation.
This target device does not support conditional breakpoints
Remove all conditional breakpoints.
This target device supports only the following range breakpoints:
simple include range and complex exclude range:
size = 2^n; n = 0..31
start and end+1 must be 2^n aligned
complex include range:
size = 2^n - 2^m; n = 0..31; m = 0..n-1
start or end+1 must be 2^n aligned
Change the breakpoint definition.
This target device supports only data access breakpoints with range:
size = 2^n; n = 0..31
start must be 2^n aligned
Change the breakpoint definition.

Flashing

Cannot Load Flash Device Description
Flash description cannot be loaded from the built algorithm (corrupted). Rewrite the Flash algorithm.
Cannot Load Flash Programming Algorithm
The Flash algorithm cannot be loaded due to one of the following reasons.
  • Missing Flash Algorithms.
    Mandatory algorithm functions are missing. Rewrite the programming algorithm.
  • Flash Algorithms not in Thumb Code.
  • Insufficient RAM for Flash Algorithms.
    Increase the RAM for Algorithm size in Configure Flash Download.
  • Cannot Write to RAM for Flash Algorithms.
    Check Configure Flash Download whether the RAM for Algorithm address is valid.
Flash Timeout. Reset the Target and try it again.
The Flash algorithm executed on the target did not respond in time (Flash algorithm code doesn't work as expected). Timeouts are defined in the Flash algorithm.
Missing Flash Sectors Description
Flash sectors are not defined in the Flash algorithm. Rewrite the Flash algorithm.
No Algorithm found for: ...
This is a warning (not an error), which occurs when no Flash algorithm has been found for a certain address range. Configure Flash Download and add or alter a Programming Algorithm.
Overlapping of Algorithms at Address ...
Occurs when more Flash algorithm are defined for an address range. Configure Flash Download and check the Programming Algorithm settings. Correct the address ranges and ensure they are discrete.
Zero Device Size
Occurs when the device size is defined as 0 in the Flash algorithm. Alter the Flash algorithm code.


ULINK2 User's Guide: NXP MKL25Z Devices

NXP MKL25Z Devices

NXP MKL25Z devices support MTB tracing. No additional target resources are needed for debugging. By default, MKL25Z devices debug in JTAG mode and can be switched to Serial Wire Debug mode.

To use the trace functionalities configure the device, the debugger adapter, and µVision:

  • Enable Micro Trace Buffer (MTB)


ULINK2 User's Guide: Hardware Description

Hardware Description

The following illustration shows the important interface and hardware components of the ULINK2 Adapter.

ULINK2 Adapter Components

ULINK Adapter (cover off)

In general, there is very little you must do to configure ULINK for your target system. However, you may be required to:

  • Set the ULINK Configuration Jumpers.
  • Connect the appropriate cable to the Target Connectors.


ULINK2 User's Guide: Target Connectors

Target Connectors

The ULINK2 provides five JTAG connectors that support the various cable types needed for debugging different targets:

  • 20-pin connector, a narrow 0.079" (2.0 mm) pitch connector for ARM targets
  • 20-pin connector, a 0.10" (2.54 mm) pitch connector for ARM targets
  • 16-pin connector for Infineon OCDS (JTAG) targets
  • 14-pin connector for STMicroelectronics µPSD targets
  • 10-pin connector for ARM targets (Mfgr: Don Connex P/N: C42 or Samtec P/N: FTSH-105-01-L-DV-007-K). The Samtec part is available with different options for plating, tail, shroud, and lead style.

A cable for each connector is shipped with the ULINK2 Standard Product. If you must change cables, then make sure to line up the marker stripe on the cable with pin 1 of the connector. Pin 1 is labeled on the board.

ULINK2 Adapter Target Cables

ULINK2 Adapter Connectors (cover off)

ULINK2 supports both JTAG and Serial Wire Mode interfaces. Refer to the appropriate pinout diagram for the ULINK2 adapter connectors to make sure they match your target hardware.

JTAG Interface

ULINK2 JTAG Pinout Diagrams

Signal | Connects to...
TMS | Test Mode State pin — Use 100K Ohm pull-up resistor to VCC.
TDO | Test Data Out pin.
RTCK | JTAG Return Test ClocK. (see Note below)
TDI | Test Data In pin — Use 100K Ohm pull-up resistor to VCC.
TRST | Test ReSeT/ pin — Use 100K Ohm pull-up resistor to VCC. TRST is optional and not available on some devices. You may leave it unconnected. This is an open-collector/open-drain output.
TCLK | Test CLocK pin — Use 100K Ohm pull-down resistor to GND.
VCC | Positive Supply Voltage — Power supply for JTAG interface drivers.
GND | Digital ground.
RESET | RSTIN/ pin — Connect this pin to the (active low) reset input of the target CPU. This is an open-collector/open-drain output.
CPUCLK | CPU clock (according IEEE Standard 1149.1).
OCDSE | Enable/Disable OCDS interface (Infineon-specific).
TRAP | Trap condition (Infineon-specific).
BRKIN | Hardware break in (Infineon-specific).
BRKOUT | Hardware break out (Infineon-specific).
/JEN | JTAG Enable (STMicroelectronics specific).
TSTAT | JTAG ISP Status (STMicroelectronics specific) (optional).
/RST | Chip reset (STMicroelectronics specific).
/TERR | JTAG ISP Error (STMicroelectronics specific) (optional).

Serial Wire Mode Interface

The Serial Wire (SW) mode is a different operating mode for the JTAG port where only two pins, TCLK and TMS, are used for the communication. A third pin can be use optionally to trace data. JTAG pins and SW pins are shared.

  • TCLK is SWCLK (Serial Wire Clock)
  • TMS is SWDIO (Serial Wire debug Data Input/Output)
  • TDO is SWO (Serial Wire trace Output)

ULINK2 Serial Wire Mode Pinouts

Signal | Connects to...
SWDIO | Data I/O pin. Use 100K Ohm pull-up resistor to VCC.
SWO | Optional trace output pin.
SWCLK | Clock pin. Use 100K Ohm pull-down resistor to GND.
VCC | Positive Supply Voltage — Power supply for JTAG interface drivers.
GND | Digital ground.
RESET | RSTIN/ pin — Connect this pin to the (active low) reset input of the target CPU. This is an open-collector/open-drain output.

Additional ARM 10-pin cables with connectors are available directly from Samtec:

  • 6" Cable (Samtec P/N: FFSD-05-D-06.00-01-N)
  • 12" Cable (Samtec P/N: FFSD-05-D-12.00-01-N)

Note

  • ULINK2 is powered through the USB connection.
  • ULINK2 operates at 3.3V. All JTAG pins are 5V tolerant.
  • Usually, devices do not include pull-up or pull-down resistors on JTAG nor SW pins. Resistors should be added externally onto the board. However, do not add resistors when the device includes them already.
  • Some NXP LPC2000 Devices have special pins (RTCK, DBGSEL) that enable the JTAG interface. For example, on the NXP LPC2129 the signal RTCK must be driven low during RESET to enable the JTAG interface. You may want to add jumpers to your hardware to accomplish this.


ULINK2 User's Guide: Jumpers

Jumpers

ULINK2 has only one set of jumpers: VCC.

ULINK2 Adapter Board Jumper
ULINK2 Adapter - Jumper (cover off)

The VCC jumper determines the source of VCC power for the JTAG interface.

  • If the target hardware provides VCC to the JTAG interface, set the jumper at VCC to the ARM position.
  • If the target hardware does not provide VCC to the JTAG interface, set the jumper at VCC to the 3.3V position.


ULINK2 User's Guide: LED Indicators

LED Indicators

The ULINK2 Adapter has the following indicator LEDs.

  • The RUN LED indicates that the target board is executing the program.
  • The COM LED indicates that there is active communication between the debugger and the target board.
  • The USB LED indicates that power is present on ULINK.

ULINK2 Adapter LEDs

ULINK2 Adapter - LEDs (cover off)


ULINK2 User's Guide: Reset Sequence

Reset Sequence

The reset sequence is device-specific. To reset most devices, ULINK2 asserts the JTAG RESET signal (pin 15 on the ARM 20-pin; pin 10 on the ARM 10-pin; pin 8 on the OCDS and ST JTAG Interface), then attempts to immediately stop the device.

Some ARM devices do not support an immediate stop after a reset and instruction execution happens before ULINK2 can issue a stop command. For these devices, when ULINK2 gets control, it stops the CPU, and then sets the MCU's program counter (PC) and stack register (CSPR) to simulate an immediate stop after reset.

Side-Effects for ARM Devices

Resetting an ARM device may generate unexpected side-effects. The following Knowledgebase Articles describe these side effects in more detail:

  • ULINK: RESET BEHAVIOUR
  • ULINK: SINGLE STEP AT RESET APPEARS TO FAIL
  • ULINK: ARM DEVICE DOES NOT REACT
  • ULINK: RECOVER STR71X WHEN JTAG DISABLE


ULINK2 User's Guide: JTAG Interface Schematics

JTAG Interface Schematics

The following schematics show the JTAG interface circuits that are part of ULINK2. The schematics may help you to analyze potential problems with your target hardware.

Signal Interface Schematics — IC2

ULINK2 IC2 Diagram

Signal Interface Schematics — IC4

ULINK2 IC4 Diagram

Signal Interface Schematics — IC5

ULINK2 IC5 Diagram

Signal Interface Schematics — IC6

ULINK2 IC6 Diagram


ULINK2 User's Guide: Start Sequence

Start Sequence

ULINK2 performs a number of operations to begin debugging on a target system. The sequence of these operations depends on the target device and the configuration settings in the µVision IDE.

For OCDS and 8051 Devices:

  1. ULINK2 initializes the JTAG interface and detects the Chip ID.
  2. Some JTAG registers are programmed to Halt after Reset. In this case, ULINK2 drives the JTAG RESET output low for 2 mSec (pin 8 on the OCDS and ST JTAG Interface).
  3. ULINK2 stops the device.
  4. If Project — Options — Debug — Load Application at Startup is enabled, then ULINK2 downloads the code to the target and performs a Reset Sequence.
  5. If the text box Project — Options — Debug — Initialization File contains an initialization script, then the debug commands in this script file are processed.

For ARM Devices:

  1. If Use Reset at Startup is enabled, then ULINK2 drives the JTAG RESET output pin low for 50mSec (pin 15 on the ARM 20-pin; pin 10 on ARM 10-pin; pin 8 on the OCDS and ST JTAG Interface).
  2. ULINK2 initializes the JTAG interface and detects the Chip ID.
  3. If Use Reset at Startup is enabled, then ULINK2 performs a Reset Sequence.
  4. ULINK2 stops the device.
  5. If Project — Options — Debug — Load Application at Startup is enabled, then ULINK2 downloads the code to the target and performs a Reset Sequence.
  6. If the Project — Options — Debug — Initialization File text box contains an initialization script, then the debug commands in this script file are processed.

For Cortex-M Devices:

  1. ULINK2 initializes the JTAG/SW interface and detects the Chip ID. The HW RESET signal may be activated depending on the Connect option selected in Options — Debug — Settings.
  2. If Reset after Connect is enabled, then ULINK2 performs a reset as defined by the Reset option selected in Options — Debug — Settings.
  3. ULINK2 stops the device.
  4. If Project — Options — Debug — Load Application at Startup is enabled, then ULINK2 downloads the code to the target and performs a reset as defined by the Reset option selected in Options — Debug — Settings.
  5. If the Project — Options — Debug — Initialization File text box contains an initialization script, then the debug commands in this script file are processed.


ULINK2 User's Guide: USB Interface

USB Interface

The ULINK2 USB Interface uses a standard USB connector to connect to your PC. ULINK2 is a USB-powered device.

ULINK2 USB Connector

ULINK2 Adapter USB Interface


ULINK2 User's Guide: Kit Contents

Kit Contents

The ULINK2 USB-JTAG Adapter is distributed in two distinct configurations:

Standard Product
The standard distribution of ULINK2 available from Keil includes the:
  1. ULINK2 USB-JTAG Adapter.
  2. Adapter cables for:
    • ARM devices.
    • µPSD devices.
    • C16x devices.
    • XC16x devices
    • C8xx devices.
    • Cortex-M 10-pin connector.
    • Cortex-M 10-to-20 pin connector.
  3. USB cable.
Chip-Specific Product
This customized distribution package is provided with many vendor-specific evaluation boards. Additional adapter cables are excluded.


ULINK2 User's Guide: Supported Devices

Supported Devices

ULINK2 supports a wide variety of devices from several companies. The most current list of Cortex-M processor-based devices that are supported by Software Packs and the MDK Version 5 can be found on the page MDK5 Device List. This link guides you also to devices that are not yet supported by Software Packs or that are used for maintaining existing MDK Version 4 projects.


ULINK2 User's Guide: Features

Features

The ULINK2 Adapter has the following features:

  • Flash programming via the on-chip debug interface.
  • Real-time in-circuit emulation using an on-chip debug interface.
  • Supports debugging on multi-core devices based on Cortex-M microcontrollers.
  • Three LEDs that display the RUN, COM, and USB status.
  • A USB interface that provides power and fast PC communication.

Note

  • ULINK Debug and Trace Adapters provides a comprehensive feature comparison of the ULINK family.


ULINK2 User's Guide: Limitations

Limitations

There are a number of limitations when debugging target programs with ULINK2. Many of these are actually limitations of the architecture of the on-chip debugger.

  • ARM7 and ARM9 Devices: The Embedded ICE on these devices supports at most two (2) hardware breakpoints in Flash memory. Breakpoints in RAM are unlimited.
  • ARM Cortex-M3 Devices: The Embedded ICE on these devices supports at most eight (8) hardware breakpoints in Flash memory. Breakpoints in RAM are unlimited.

For the complete list of features and limitations, refer to the web page ULINK Debugger Comparison.


ULINK2 User's Guide: Supported Protocols

Supported Protocols

ULINK2 supports a wide variety of devices and communication protocols.

  • ARM7 and ARM9 Devices: These devices provide JTAG programming and debugging signals (known as Embedded ICE) that are brought out to a 20-pin connector.
  • ARM Cortex-M3 Devices: These devices provide JTAG programming and debugging signals (known as Embedded ICE) that are brought out to a 20-pin connector.
  • Infineon C16x Devices: These devices (C161U, C165H, and C165UTAH) provide programming and debugging signals (known as OCDS or On-Chip Debugging System) that are brought out to a 16-pin connector.
  • Infineon XC16x Devices: These devices (XC161, XC164, and XC167) provide programming and debugging signals (known as OCDS or On-Chip Debugging System) that are brought out to a 16-pin connector.
  • Infineon XC8xx Devices: These devices (XC866, XC886, and XC888) provide programming and debugging signals (known as OCDS or On-Chip Debugging System) that are brought out to a 16-pin connector.
  • STMicroelectronics µPSD Devices: These devices (µPSD33xx and µPSD34xx) provide JTAG programming and debugging signals that are brought out to a 14-pin connector.

Depending on your device and target hardware configuration, you may be required to connect the one of the supplied target cables to the appropriate Target Connectors.


ULINK2 User's Guide: Software Requirements

Software Requirements

ULINK2 requires the following software versions (or later) be installed on the computer:

  • MDK-ARM — V3.04
  • C166 — V6.06
  • C51 — V8.06


ULINK2 User's Guide: Technical Data

Technical Data

Parameter | Description
Supply Voltage | Provided by the USB bus of a PC
I/O Voltage Range1 | 2.7V .. 5.5V
Peripherals | 1 × USB Interface 1 × JTAG Interface 3 × LEDs (RUN, COM, USB)
Overall Dimensions | 107mm x 57mm x 25mm (4.25" x 2.25" x 1.0").

Notes

  1. 5V operation requires jumper setting VCC-ARM, and power via Debug Connector.


ULINK2 User's Guide: Introduction

Introduction

The Keil ULINK2 USB-JTAG Adapter connects your PC's USB port to your target hardware (via JTAG, OCDS or Serial Wire) and allows you to:

  • Download programs and test them on your target hardware.
  • Program the on-chip FLASH memory of many devices.
  • Program external FLASH memory of many target systems.

ULINK2
ULINK2 Adapter

The Keil µVision® IDE/Debugger is the front-end you use with ULINK2 to create, download, and test embedded applications on target hardware.


ULINK2 User's Guide: TI LM3Sx Devices

TI LM3Sx Devices

Texas Instruments Stellaris® LM3Sx devices support all standard CoreSight features. ETM trace is not included. No additional target resources are needed for debugging. By default, LM3Sx devices debug in JTAG mode, and can be switched to Serial Wire mode. LM3Sx devices offer ITM and DWT trace data.

To use the CoreSight trace functionalities, the debugger adapter, µVision, and the target system have to be configured:

  • Enable Serial Wire Trace

For additional information, refer to the Stellaris data sheets.


ULINK2 User's Guide: Enable Serial Wire Trace

Enable Serial Wire Trace

To enable Serial Wire Trace on Luminary LM3Sx devices:

  • Use a ULINK2 connector interface that supports Serial Wire, and connect ULINK2 to the board and to the host computer.
  • Configure µVision to capture Serial Wire Trace data.

Configure µVision to capture Serial Wire Trace data

  1. Open the dialog Options for Target — Debug.
  2. Enable Use, select ULINK Cortex Debugger, and click Settings to open the Target Driver Setup dialog.

    Select the debugger adapter

  3. Enable SWJ and select SW.

    Configure the Serial Wire Debug mode

  4. Click the Trace tab.

    Configure Luminary devices for Serial Wire Trace

  5. Set Trace Enable and Autodetect.
  6. The Core Clock must correspond to the device configuration.

Start the debugging session and verify the captured trace data with a µVision window.

Note

  • Use the examples delivered with the Luminary board ek-lm3s6965 as a reference.


ULINK2 User's Guide: NXP LPC17xx Devices

NXP LPC17xx Devices

NXP LPC17xx devices support all CoreSight features including ETM trace. No additional target resources are needed for debugging. By default, LPC17xx devices debug in JTAG mode, and can be switched to Serial Wire mode. LPC17xx devices offer ETM, ITM, and DWT trace data. However, to capture ETM trace data, a ULINKpro debugger adapter is needed instead of ULINK2.

To use the CoreSight trace functionalities, the LPC17xx device, the debugger adapter and connector, as well as µVision have to be configured properly:

  • Enable Serial Wire Trace

Note

  • While debugging, the LPC17xx cannot wake up in the usual way from deep-sleep and power-down modes. Preferably avoid to use these modes during debugging.
  • Also, while debugging, the SYSTICK timer and the Repetitive Interrupt Timer (RIT) are stopped automatically whenever the CPU is stopped. Other peripherals are not affected.
  • If the Repetitive Interrupt Timers is configured such that its PLCK is lower than the CPU clock rate, it might not increment predictably during single-stepping operations.
  • Debugging is disabled when Code Read Protection (CRP) is enabled.


ULINK2 User's Guide: Enable Serial Wire Trace

Enable Serial Wire Trace

To enable Serial Wire Trace on an NXP LPC17xx device:

  • Use a ULINK2 connector interface that supports Serial Wire, and connect ULINK2 to the board and to the host computer.
  • Configure µVision to capture Serial Wire Trace data.

Configure µVision to capture Serial Wire Trace data

  1. Open the dialog Options for Target — Debug.

    Enable trace on LPC17xx

  2. Enable Use, select ULINK Cortex Debugger, and click Settings to open the Target Driver Setup dialog.

    Configure LPC17xx for Serial Wire Trace

  3. Enable SWJ and select SW.
  4. Click the Trace tab.

    Configure LPC17xx for Serial Wire Trace

  5. Set Trace Enable and Autodetect.
  6. The Core Clock must correspond to the device configuration.

Start the debugging session and verify the captured trace data with a µVision window.

Note

  • Use the examples delivered with the Keil board MCB1700 as a reference.


ULINK2 User's Guide: Enable Micro Trace Buffer (MTB)

Enable Micro Trace Buffer (MTB)

To enable CoreSight MTB tracing on Freescale MKL25Z devices:

  • Connect ULINK2 to the board's ARM 10-Pin Connector and to the host computer.
  • Configure µVision to capture MTB trace data.

Configure µVision to capture MTB trace data.

  1. Create a text file, for example DBG_MTB.ini, and enter the following code:
    /*-------------------------------------------------------------------
** Define the function to enable the trace port
**-----------------------------------------------------------------*/
FUNC void MTB_Setup (void) {
  unsigned long position;
  unsigned long master;
  unsigned long watermark;
  unsigned long _flow;

  master     = 0x80000008;
  position   = 0x20000000;
  _flow      = 0x00000000;

  position  &= 0xFFFFFFF8;              // Mask POSITION.POINTER field
  watermark  = position + ((16 << (master & 0x1F)) - 32);
  _flow     |= watermark;

  _WDWORD(0xF0000004, 0x00000000);      // MASTER
  _WDWORD(0xF0000000, position);        // POSITION
  _WDWORD(0xF0000008, _flow);           // FLOW
  _WDWORD(0xF0000004, master);          // MASTER
}

/*-------------------------------------------------------------------
** Invoke the function at debugger startup
**-----------------------------------------------------------------*/
MTB_Setup();

    Use the _WDWORD command to configure the device.

  2. Open the dialog Options for Target — Debug and insert DBG_MTB.ini into the field Initialization File.

    Configure the device for tracing

Start the debugging session and verify the captured trace data with a µVision window.

Note

  • Use the examples delivered with the Freescale board FRDM-KL25Z as a reference.
  • MTB tracing works in Serial Wire Debug as well as in JTAG Debug mode.


ULINK2 User's Guide: Setup ULINK2

Setup ULINK2

Just a few steps are needed to configure µVision to use ULINK2 for downloading, debugging, and tracing programs on target hardware:

  • Connecting ULINK2 explains how to connect a ULINK2 to the PC and target hardware.
  • Installing Drivers guides through ULINK2 driver installation and shows how to verify the connection status.
  • Configure µVision for Debugging describes how to setup µVision to use ULINK2 for debugging applications on target systems.
  • Flash Download Configuration describes how to configure ULINK2 for Flash programming.


ULINK2 User's Guide: STMicroelectronics STM32F10xxx Devices

STMicroelectronics STM32F10xxx Devices

STMicroelectronics STM32F10xxx devices support all CoreSight features including ETM trace. No additional target resources are needed for debugging. By default, STM32F10xxx devices debug in JTAG mode, and can be switched to Serial Wire Debug mode. STM32F10xxx devices offer ETM, ITM, and DWT trace data. However, to capture ETM trace data, a ULINKpro debugger adapter is needed instead of ULINK2.

To use CoreSight trace functionalities, the STM32F10xxx device, the debugger adapter and connector, as well as µVision have to be configured properly:

  • Enable Serial Wire Trace

Note

  • When debugging in low-power modes, configure the DBG_SLEEP or DBG_STOP bit of the DBGMCU_CR register first. Otherwise, the debug connection is lost.


ULINK2 User's Guide: Enable Serial Wire Trace

Enable Serial Wire Trace

To enable Serial Wire Trace on STMicroelectronics STM32F10xxx devices:

  • Use a ULINK2 connector interface that supports Serial Wire, and connect ULINK2 to the board and to the host computer.
  • Enable the Trace Port Interface as described in the STM32F103xx Reference Manual, chapters Pinout and Debug Port Pins and TRACE Pin Assignment.
  • Configure µVision to capture trace data.

Enable the Trace Port Interface

  1. Create a text file, for example conf_STM32F10_SWO.ini, and enter the following code:
    /*-------------------------------------------------------------------
** Define the function to enable the trace port
**-----------------------------------------------------------------*/
FUNC void EnableTPIU(void) {

  _WDWORD(0xE0042004, 0x00000020);    // Set asynchronuous communication via DBGMCU_CR
}

/*-------------------------------------------------------------------
** Invoke the function at debugger startup
**-----------------------------------------------------------------*/
EnableTPIU();

    Use the _WDWORD command to configure the TRACE_IOEN and TRACE_MODE bits of the DBGMCU_CR register: _WDWORD(0xE0042004, 0x00000020);

  2. Open the dialog Options for Target — Debug and insert conf_STM32F10xxx.ini into the Initialization File field.

    Configure the device for tracing

Configure µVision to capture trace data

  1. Open the dialog Options for Target — Debug.

    Select as the debugger adapter

  2. Enable Use, select ULINK Cortex Debugger, and click Settings to open the Target Driver Setup dialog.

    Configure the Serial Wire Debug mode

  3. Enable SWJ and select SW.
  4. Click the Trace tab.

    Set the Serial Wire Trace options

  5. Set Trace Enable and Autodetect.
  6. The Core Clock must correspond to the device configuration.

Start the debugging session and verify the captured trace data with a µVision window.

Note

  • Always synchronize the settings in the *.ini file with the settings in the Target Driver Setup—Trace Port dialog.
  • Use the examples delivered with the Keil board MCBSTM32E as a reference.


ULINK2 User's Guide: Chaining Multiple Targets

Chaining Multiple Targets

Chaining multiple targets, or target chaining, refers to the ability to attach multiple target systems to one single JTAG bus. In this configuration, ULINK2 can access one target at a time.

In order to chain targets, the devices must support the following:

  • BYPASS register.
  • The IDCODE instruction must immediately follow a reset of the Test Access Port (TAP).
  • Bit 0 of ID Code must be 1.
  • In CAPTURE-IR state, the fixed value 1 must be loaded into the IR.

Setting Up Multiple Targets

ULINK2 scans for an IDCODE, a device name, and an IR length for each target, and sets up targets automatically. The results of this scan are displayed in the JTAG Device Chain section of the ARM Target Driver Setup dialog (Project — Options for Target — Debug — Settings).

JTAG Device Chain display

If the automatic setup fails, you may use Manual Configuration to setup the attributes of each device. To use Manual Configuration, the target device must have BYPASS register support. See JTAG Device Chain for more information about Manual Configuration.

Connecting Targets

To connect multiple targets:

  • Connect the control signals (TMS and TCLK) connect in parallel.
  • Connect the data signals (TDI and TDO) in series.

The data output from one target (TDO) should be the input to the next target (TDI) in the chain.

Multiple Target Chaining Diagram

Note

  • Target chaining is possible in JTAG mode only.


ULINK2 User's Guide: Connecting ULINK2

Connecting ULINK2

Connecting ULINK2 to the target system is easy.

  1. Simply plug the ULINK2 JTAG-cable into the JTAG or Cortex Debug connector of the board. The red cable-stripe marks pin 1 of the JTAG-connector.
  2. Then, plug a USB cable into the PC and ULINK2.

ULINK2 with MCB2140 Board
ULINK2 Adapter Connected to Target Hardware

ULINK2 connects to the target board via a ribbon cable attached to one of five JTAG interfaces:

  • ARM 10-pin interface (1.27mm/0.05" pin spacing).
  • ST 14-pin interface.
  • OCDS 16-pin interface.
  • ARM 20-pin interface (2.0mm/0.079" pin spacing).
  • ARM 20-pin interface (2.54mm/0.1" pin spacing).

ULINK2 JTAG Connections
ULINK2 Adapter Target Connections

The Target Connectors page provides the JTAG signal and pin assignment information.


ULINK2 User's Guide: Debug

Debug

The Debug section controls caching, downloading, and device resetting options applied each time a debugging session is started.

Cache Options
improve the performance of the µVision Debugger by caching target memory areas in the PC memory. By default, these options are enabled to get maximum performance.

  • Cache Code informs the debugger that the downloaded program code will not change. When this option is set, µVision never reads the program code from the target system. Disable this option if the application includes self-modifying code or if the program code might get overwritten.
  • Cache Memory determines whether memory displays are updated during a program stop. When this option is set, the debugger does not update memory displays until the next single step, procedure step, or go command executes. Disable this option to see the actual memory content (for example, the content of memory mapped peripherals) when the debugger is halted.

Download Options
compare and prepare the code downloaded to target for debugging.

  • Verify Code Download compares the content of the target memory with the application program loaded in the debugger for each new debug session. Enable this option to ensure program correlation between the image loaded in target system and the image loaded in the µVision debugger. This prevents debugging the wrong code when working with various targets or more instances of µVision.

  • Download to Flash downloads code to all memory regions. When disabled, the debugger does not download code to the memory address ranges defined in the Target Driver Settings - Programming Algorithm. Enable the option if the application is loaded into RAM and the Flash algorithm is defined for the same address range. By default, this option is disabled. Refer to the knowledgebase article µVision Debugger: Error 57:Illegal Address in Debugger Output Window.

Misc Options

  • Use Reset at Startup issues a CPU Reset to the target when the debugger starts. When disabled, the debugger just stops the CPU at the currently executed instruction. This allows to start a debugging session and debug a program that is currently executing on target. Refer to Start Sequence for more information.


ULINK2 User's Guide: Debug Driver Configuration

Debug Driver Configuration

This section describes the debug drive configuration for connecting to the debugging unit of the target hardware.

  1. Options for Target Button Open the dialog Options for Target - Debug.

    Set Use: and select ULINK2/ME Cortex Debugger from the drop-down list.

    Select Target Driver

  2. Click the button Settings to display the dialog Target Driver Setup, which consists of three configuration groups:

    • ULINK USB-JTAG Adapter
    • JTAG Device Chain
    • Debug

    Target Driver Setup


ULINK2 User's Guide: Debugging Programs

Debugging Programs

Follow the steps to debug applications using the µVision Debugger and ULINK2.

  1. Connect ULINK2 to the PC and to the target board.
  2. Power up the target board.
  3. Configure the Debugger.
  4. Start the Debugger.

    Start/Stop Debug Button Use the button Start/Stop Debug Session to start debugging the application.

    If the flag Update Target before Debugging is set, then the debugger loads the application to target prior to starting a debugging session.

Note

  • Details about debugging features are explained in the µVision User's Guide chapter Debugging, and Getting Started User's Guide chapter Start Debugging.


ULINK2 User's Guide: JTAG Device Chain

JTAG Device Chain

The section JTAG Device Chain displays the JTAG devices connected to the JTAG interface cable. ULINK2 automatically displays the IDCODE, Device Name, and IR Length of all JTAG-compatible targets it detects.

Target Driver Setup - JTAG Device Chain

Manual Configuration allows the developer to identify and name undetected JTAG devices. Specify the instruction register length (IR len) of each device in the JTAG device chain. The Device Name must begin with a one of the text strings below to identify the core. Characters entered behind the identifier are ignored and can be used for additional information, for example: "ARM7_NXP" or "ARM966_ST".

Text String | Identifies ARM Core...
"ARM7" or "ARM7TDMI" | ARM7TDMI, ARM7TDMI-S
"ARM7EJ" | ARM7EJ-S
"ARM9" or "ARM9TDMI" | ARM9TDMI
"ARM9E" | ARM9E-S
"ARM9EJ" | ARM9EJ-S
"ARM720" | ARM720T
"ARM920" | ARM920T
"ARM922" | ARM922T
"ARM940" | ARM940T
"ARM926" | ARM926EJ-S
"ARM946" | ARM946EJ-S
"ARM966" | ARM966E-S
"ARM968" | ARM968E-S
"ARM CoreSight JTAG-DP" | All Cortex-M

Note

  • See Chaining Multiple Targets for more information regarding multiple target configuration.


ULINK2 User's Guide: Downloading to Flash

Downloading to Flash

ULINK2 allows programming the Flash memory of the target system:

  1. Connect ULINK2 to the PC and to the target board.
  2. Power up the target board.
  3. Configure Flash Download.
  4. Download the application to Flash.

    Download to Flash Button Click the button Download to Flash to program the application to target.

    The Status Bar shows the download progress.

    Target Download Progress

    In addition, the window Build Output displays the individual download steps.

    Target Download Status

Thereafter, the application can be debugged on target.


ULINK2 User's Guide: Installing Drivers

Installing Drivers

ULINK2 uses standard Windows USB drivers. It is configured as a Human Interface Device (HID) and is, therefore, directly supported by Windows operating systems. No additional or ULINK2-specific drivers are required.

To view the status of the ULINK2 USB connection:

  1. Connect the Keil ULINK2 Adapter to the PC.
  2. Right-click on My Computer and open the Properties dialog.
  3. Under Hardware click on Device Manager and select Human Interface Devices.
  4. Open the Properties page for each device. Under General — Location find the name Keil ULINK2, which indicates that the ULINK2 adapter is connected properly.


ULINK2 User's Guide: Flash Download Configuration

Flash Download Configuration

Flash programming using ULINK2 can be configured in the Button Options for Target Options for Target - Utilities dialog. Available configuration options are explained in Flash Programming section in µVision User's Guide.

Select Target Driver


ULINK2 User's Guide: ULINK USB-JTAG Adapter

ULINK USB-JTAG Adapter

The section ULINK USB-JTAG Adapter displays driver, device, and firmware information about ULINK2.

Target Driver Setup - ULINK2 Adapter

  • Serial No displays the serial number of the ULINK2 adapter. When more ULINK2 adapters are connected, use the drop-down list to select the adapter.
  • Max JTAG Clock sets the JTAG clock rate for communicating to the target board. ULINK2 supports the Return Clock (RTCK) pin, which is available on most ARM7 and ARM9 devices. The RTCK signal adjusts the JTAG clock speed to the highest possible rate for that device.
  • Use nTRST asserts the nTRST signal for JTAG reset. By default, this option is disabled.

Some applications require starting with a lower JTAG Clock from RESET and have to switch to higher clock rates when debugging. Use the VTREG DEBUG_CLOCK to alter the clock rate from scripts:

/*-------------------------------------------------------------------------
  The function sets the JTAG Debug Clock to 1MHz
  after the Main Clock has been enabled and selected.
-------------------------------------------------------------------------*/
FUNC void setJTAGClock()  {
  enableMainClock();         // add your code to switch on the Main Clock

  DEBUG_CLOCK = 1000000;     // Set JTAG Debug Clock to 1MHz
  _sleep_(10);

  enableMainPLL();           // add your code to enable the main PLL
  _sleep_(100);
}

Note

  • RTCK can be used only with devices that provide the RTCK pin.
  • When communication issues arise, reduce the clock rate in Max JTAG Clock.


ULINK2 User's Guide: Configure µVision for Debugging

Configure µVision for Debugging

µVision must be configured to use ULINK2 for debugging. ULINK2 reads the device version and checks which core debug peripherals are present. With these information ULINK2 sets default values in the µVision configuration screens and can determine:

  • The number of Flash breakpoints.
  • The number of watchpoints.
  • The possible use of ITM, ETM, and TPIU.

µVision configures differently for the various architectures:

  • ARM Devices describes configuration options to debug on ARM processor-based devices.
  • Cortex-M Devices explains configuration options to debug and capture trace on Cortex-M processor-based devices.

Note

  • Setup the system as described in Connecting ULINK2 before configuring µVision.


ULINK2 User's Guide: Toshiba TMPM330 Devices

Toshiba TMPM330 Devices

Toshiba TMPM330 devices support all CoreSight features including ETM trace. No additional target resources are needed for debugging. By default, TMPM330 devices debug in JTAG mode and can be switched to Serial Wire Debug mode. TMPM330 devices offer ETM, ITM, and DWT trace data. However, to capture ETM trace data, a ULINKpro debugger adapter is needed instead of ULINK2.

To use the CoreSight trace functionalities, the TMPM330 device, the debugger adapter and connector, as well as µVision have to be configured properly:

  • Enable Serial Wire Trace

Note

  • Debug and trace operations are prohibited when the device's Security Function is enabled.
  • The watchdog timer stops in debug mode.
  • When PA0 and PB0 are configured as debug pins, output is enabled even in STOP mode, regardless of the SYSCR2<DRVE> or STBYCR2<DRVE> bit setting.
  • When PA1 is configured as a debug pin, low-power mode is not fully effective. Configure PA1 as a general-purpose port, if the debug function is not used.


ULINK2 User's Guide: Enable Serial Wire Trace

Enable Serial Wire Trace

To enable Serial Wire Trace on Toshiba TMPM330 devices:

  • Use a ULINK2 connector interface that supports Serial Wire, and connect ULINK2 to the board and to the host computer.
  • Configure µVision to capture Serial Wire Trace data as described in the manual 32-bit RISC Microprocessor - TMPM330 Family, chapters Port A (PA0-PA7), and Port B (PB0-PB7).

Configure µVision to capture Serial Wire Trace data

  1. Open the dialog Options for Target — Debug.

    Select the debugger adapter

  2. Enable Use, select ULINK Cortex Debugger, and click Settings open the Target Driver Setup dialog.

    Set the Serial Wire Trace options

  3. Enable SWJ and select SW from the Port drop-down list.
  4. Click the Trace tab.

    Configure the Serial Wire Debug mode

  5. Set Trace Enable.
  6. Set the Trace Port to Serial Wire Output - Manchester.
  7. Enable Autodetect for the SWO Clock.
  8. Make sure the Core Clock is set correctly.

Start the debugging session and verify the captured trace data with a µVision window.

Note

  • Use the examples delivered with the Keil board MCBTMPM330 as a reference.


ULINK2 User's Guide: Trace Events

Trace Events

The section Trace Events enables tracing of special events. The window Event Counters shows the result.

Cortex-M Target Driver Setup - Trace Events

CPI: Cycles per Instruction A general counter for instruction cycle count estimation. This counter increments on each additional cycle required to execute a multi-cycle instruction. The counter also increments on each cycle of any instruction fetch stall. The first cycle of an instruction and those recorded by the LSU are not counted.

EXC: Exception Overhead The counter increments on each cycle associated with exception entry or return. That is, it counts the cycles associated with entry stacking, return unstacking, preemption, and other exception-related processes.

SLEEP: Sleep Cycles The counter increments on each cycle associated with power saving, whether initiated by a WFI or WFE instruction, or by the sleep-on-exit functionality.

LSU: Load Store Unit Cycles This counter increments on each additional cycle required to execute a multi-cycle load-store instruction. It does not count the first cycle required to execute any instruction.

FOLD: Folded Instructions The counter increments on any instruction that executes in zero cycles (for example, an IT instruction is folded and does not use any cycles).

EXCTRC: Exception Tracing The counter increments on exceptions, interrupt entries, and interrupt exits. The window Trace Exceptions shows the statistics.


ULINK2 User's Guide: PC Sampling

PC Sampling

The section PC Sampling controls the creation of samples.

Cortex-M Target Driver Setup - PC Sampling Prescaler sets the period for generating PC samplings.

Periodic enables sampling at regular time intervals based on the PC Sampling Prescaler.

Period displays the time interval.

on Data R/W Sample creates PC samplings for each read/write instruction.


ULINK2 User's Guide: Trace Port

Trace Port

The section Trace Port controls the communication channel used for trace operations.

Cortex-M Target Driver Setup - Trace Port Options

Serial Wire Output – UART/NRZ is the only Trace Port that ULINK2 supports. Make sure to select SW for Port in the dialog ULINK USB-JTAG/SWD Adapter.

SWO Clock Prescaler defines the communication speed when using Serial Wire debugging mode. Values from 1 to 8192 are allowed (that result in any clock value up to 1.25 MHz or the discrete values 1.875 MHz/3.75 MHz).

Autodetect configures the prescaler automatically for the highest possible SWO Clock. It will be calculated using the given Trace or Core Clock setting.

SWO Clock displays the calculated SWO Clock rate, determined by the Trace or Core Clock and the SWO Clock Prescaler value.

Detected errors are displayed below the field SWO Clock.


ULINK2 User's Guide: ITM Stimulus Ports

ITM Stimulus Ports

The section ITM Stimulus Ports controls access to Instrumentation Trace Macrocell (ITM) Stimulus Ports.

Cortex-M Target Driver Setup - ITM Stimulus Ports

Enable activates the ITM Stimulus Ports 0..31. The field can be used to enter the value directly.

Privilege sets exclusive access rights for ITM Stimulus Port groups when the device is in User Mode. Ports are always accessible when the device is in Privilege Mode. For example, the settings can protect ports used by an operating system from being accessed by user code.

Note

  • Examples of useage are described in Using the ITM Viewer and Kernel Awareness.


ULINK2 User's Guide: Timestamps

Timestamps

The section Timestamps controls the creation of timestamp information.

Cortex-M Target Driver Setup - Timestamps Enable activates the timestamp creation and appends timestamp information to trace packets.

Prescaler sets the frequency of creating timestamps. Values of 1, 4, 16, and 64 are possible.


ULINK2 User's Guide: Event Counters Window

Event Counters Window

The Event Counters window displays cumulative numbers, which show how often an event triggered. Open this window through View - Trace - Event Counters.

To display data in this window:

  • Enable Trace.
  • Enable the event counters dynamically in the window. (It is identical to enabling the counters in Trace Events.)

Event Counters Window

For more information, refer to the Event Counters documentation.


ULINK2 User's Guide: Trace Exceptions Window

Trace Exceptions Window

The Trace Exceptions window displays statistical data for records captured with ITM trace. Open the window through View - Trace - Trace Exceptions.

To display data in this window:

  • Enable Tracing outside this window.
  • Enable EXCTRC: Exception Tracing. (Is identical to setting the option in Trace Events.)
  • Enable Timestamps Enable. (Is identical to setting the option in Timestamps.)

Exception Trace Records Window

Refer to Trace Exceptions documentation for more information.


ULINK2 User's Guide: Debug (printf) Viewer

Debug (printf) Viewer

The Debug (printf) Viewer window displays data streams that are transmitted sequentially via ITM Stimulus Port 0.

Debug (printf) Viewer

Note

  • For more information, refer to the Debug (printf) Viewer documentation.
  • Learn how to set up the debug session for SWO trace.
  • More ITM data can be monitored in the Trace Data Window.


ULINK2 User's Guide: Trace Records Window

Trace Records Window

The Trace Record window shows all the Trace records captured (including the overflows and timestamps). The Exception Trace, Logic Analyzer and ITM Viewer displays use data from this window and visually present them in a different way.

Trace Records Window

Trace records are stored in a compressed circular buffer which can hold up to 1 million records which equates to approximately 20 seconds of recording time. When the Running... message displays in the Trace Status bar, all records are captured until the capture buffer fills. Once full, the oldest records are replaced by newest ones.

Note

  • Double-clicking anywhere in the Trace Records window clears the trace record buffer.

Trace Record Types

Record Data | Description
Type
  • Data Read - 8/16/32 bit Data Read.
  • Data Write - 8/16/32 bit Data Write.
  • ITM - 8/16/32-bit data written by software through ITM port.
  • Exception Entry/Exit/Return - Exception events.
  • Counter Event - Overflow of an 8-bit counter (CPI, EXC, Sleep, LSU or Fold).
  • PC Sample - Periodic sample of the program counter.
Ovf | Overflow flag indicates that data in the previous trace record was lost because the Cortex-M hardware could not send the requested event information fast enough.
Num | Number of ITM Port or Exception Number.
Address | Address of Data Read/Write access.
Data | 8/16/32-bit data for Data Read/Write and ITM, or 8-bit data for overflow Counter Events (Bit0-CPI, Bit1-EXC, Bit2-Sleep, Bit3-LSU, Bit4-Fold).
PC | 32-bit Program Counter value for periodic PC Sample or Data Read/Write access.
Dly | Delayed Timestamp flag which indicates that the displayed Cycles/Time values are later than the actual event.
Cycles | Timestamp in Core Cycles.
Time[s] | Timestamp in seconds.

Filtering Trace Records

Right-click anywhere in the Trace Records window to display the Trace Records Filter Context Menu.

Trace Records Filter Context Menu

Use this menu to change the display to view different combinations of record types. Unchecking a record type does not remove that record from the record buffer.

Handling Data Overflows (OVF)

When events happen so close together that Trace data cannot be captured, an overflow occurs for that event and sets the OVF flag in the next trace record. When this happens, try:

  • Reducing the number of simultaneous events being captured.
  • Splitting your Trace analysis into multiple sessions.
  • Examining the variables you are tracing with the Logic Analyzer. When tracing variables with the Logic Analyzer, try to select variables that are written and never read (even if you have to define a "debug variable" for this) to prevent an additional Read event.


ULINK2 User's Guide: System Analyzer

System Analyzer

The System Analyzer is a graphical analysis tool that shows:

  • thread, interrupt, and exception execution over time.
  • Event Recorder messages.
  • value changes of variables or VTREGs.

System Analyzer can be used with any Arm Cortex-M based device that provides trace.

System Analyzer Button Open the System Analyzer from the toolbar or via the menu View - Analysis Windows - System Analyzer.

System Analyzer Window

System Analyzer window display

For more information, refer to the System Analyzer documentation.


ULINK2 User's Guide: Trace Status

Trace Status

The µVision Status Bar displays trace status messages whenever tracing has been enabled. Additional information is available in the general description of the Status Bar for CPUs that have enabled TrustZone for Armv8-M.

Trace Status Bar

The trace status:

  • Displays progress and error messages when the target processor is running.
  • Refreshes the Running... message every 3 seconds during error-free operations.
  • Is blank, when tracing is stopped without an error.
  • Displays the error message in red when the target stopped with an error.
  • Keeps the error message displayed until tracing is restarted.

Trace Status Messages

Message | Description
Communication Error | An invalid communication has been detected. Incorrect clock settings or hardware problems cause this message. Applications that change the Core Clock in the main() program may throw this message when data are captured incorrectly. This error message disappears once the Core Clock has been adjusted to the system settings.
HW Buffer Overrun | The USB port cannot accept data at the speed the adapter is sending them. Turn off trace events you do not need, or skip PC Sampling.
SW Buffer Overrun | Internal SW buffer overrun on the PC (this should never happen).
No Synchronization | There are no synchronization packets received from the target. This indicates that the trace hardware is either not connected or improperly configured.
Data Stream Error | Errors are detected in the Trace Data Stream.
Data Overflow | This indicates that Trace packets couldn't be transmitted because the Trace Port was too busy. The Trace Records dialog shows when the overflow occurred. This happens when too much Trace data is being captured.
Running ... | The target system itself and tracing operations are running without errors.
<no message> | The target stopped without throwing an error.

Note

To use Trace in your application before changing the clock setting, configure Trace with the startup (default) clock value then reconfigure Trace clock later (via dialog or by using the CORE_CLK VTreg directly from the command window or some custom load script).


ULINK2 User's Guide: Exchange Procedure

Exchange Procedure

Depending on where you purchased ULINK2, please contact your distributor and provide the following information:

  • The error code depicted through the steps described in this guide.
  • The serial number of ULINK2 located on the back side of the device.
  • Where and when you purchased your ULINK2 device. Invoice or order numbers are helpful.

Your distributor will contact you to agree on further steps based on the information provided.

Thank you! We appreciate your intensive investigation and detailed information.

Note

  • We do explicitly refer to our terms of guarantee!


ULINK2 User's Guide: Hardware Checklist

Hardware Checklist

  1. Disconnect all ULINK2 adapters from the PC and from your target system.
  2. Connect a single ULINK2 directly to the PC via USB. Do NOT use:
    • A USB hub.
    • USB cables longer than 2m(6.0 ft).
    • USB connections via docking stations or port extenders.
    • A battery-powered, laptop PC. Please, connect your AC power adapter to the laptop.
  3. Is the red LED on permanently? Have both LEDs (COM and RUN) flashed once after ULINK2 got connected?

    If this test succeeds

    1. Open the Windows Device Manager.

      ULINK2 in Device Manager

    2. Under Human Interface Devices check for the entry HID-compliant device and for an USB Input Device that appears in addition to the other HID devices you have connected (for example, keyboard and mouse).
    3. You may disconnect and reconnect ULINK2 to ensure that the device gets recognized.
    4. Right-click HID-compliant device and select Properties.
    5. Click the tab Details and select Hardware Ids from the Property drop-down.

    6. The Vendor Id, VID_C251, identifies ULINK2 as an Keil USB device.

    7. Check the Product Id (PID):

      PID | Description | Action
      PID_2720 ULINK2 firmware version is 1.42 or lower
      – OR –
      ULINK2 firmware version is 2.00 or higher and was configured for ULINK boot mode with the UL2_Configure.exe utility.       		These configurations are compatible to:
      • MDK-ARM V4.60 and before
      • PK51 V9.50 and before
      • PK166 V7.50 and before

      Later versions of these packages update the ULINK2 firmware automatically as soon as you are using ULINK2 the next time.
      PID_2722 ULINK2 firmware version is 2.00 or higher. These configurations are CMSIS-DAP compliant and have the default boot mode CMSIS-DAP. These configurations are compatible to:
      • MDK-ARM V4.70 and later
      • PK51 V9.51 and later
      • PK166 V7.51 and later

      To use ULINK2 with previous versions of the packages above, you have to set ULINK2 into the boot mode ULINK. Refer to Boot Mode Utility. Download the utility from the knowledgebase article ULINK: How to downgrade the firmware of ULINK2/ME, section ATTACHED FILES.
      PID_2727 | ULINK2 does not have any firmware. Only the bootloader is active. | Connect ULINK2 and open the µVision dialog Options for Target - Debug - Settings. The firmware download starts automatically in the background. No notification is displayed. If the firmware download fails and you see this PID again, the hardware of ULINK2 seems to be broken. Please proceed to the Exchange Procedure and report code U2H2.
      any other | ULINK2 firmware is in an undefined state. | The hardware of ULINK2 seems to be broken. Please proceed to the Exchange Procedure and report code U2H3.

    If this test fails

    1. Exchange the USB cable with another USB cable to see if it is defective.
    2. Try out a different USB port.
    3. Connect ULINK2 to a different PC. This does not require a Keil tool-chain to be installed.

    If the LEDs still do not light up as described, the ULINK2 is broken. If another ULINK2 is available, a defect can be confirmed by comparing the behavior of the two ULINK2 adapters. Please proceed to the Exchange Procedure and report code U2H1.


ULINK2 User's Guide: Target Checklist

Target Checklist

Cortex-M0, Cortex-M1, Cortex-M3, and Cortex-M4 Devices

  1. Enable SWJ and select Port SW.
  2. In Max Clock try selecting different Max Clock frequency settings (10MHz, 1MHz, 100kHz and 10kHz). Check after each selection, if a Device ID is shown in the field SW Device.
    • If a device is listed, ULINK2 seems to be working. Use this setting in the project.
    • If no device is listed, proceed with the next step.
  3. Enable SWJ and select Port JTAG. Try out the frequencies above.
    • If a device is shown in JTAG Device Chain, ULINK2 seems to be working.Use this setting in the project.
    • Otherwise, proceed with the next step.
  4. Unscrew the cover and ensure that the 10-pin or 20-pin ribbon cable is connected to the matching ARM connector (1.27mm, 2.54mm or 2.00mm pitch) with the red stripe connected to position 1 marked on the PCB. Refer to Target Connectors.
  5. Examine the 10-pin or 20-pin ribbon cable and ensure that the cable or connectors are not damaged.
  6. If the VCC jumper in ULINK2 is in position ARM, ensure pin 1 of the debug connector on your target system is connected to the power supply of the microcontroller. Refer to Jumpers.
  7. If the VCC jumper is in position 3.3V, ensure the supply voltage of your microcontroller is 3.3V.
  8. Swap the position of the VCC jumper and retry step 1 and step 2. If a device is listed, then ULINK2 is working. If you receive no positive result, proceed with Exchange Procedure and report code U2TC1.

ARM7 and ARM9 Devices

  1. Disable Use nTRST and try selecting different Max Clock frequency settings (RTCK, 10MHz, 1MHz, 100kHz and 10kHz). After each new selection, check if a Device ID is shown in JTAG Device Chain.
    • If YES, your ULINK2 is working . Use this setting in your project.
    • If you do not see a Device ID, proceed with the next step.
  2. Unscrew the back cover of ULINK2 and check:
    • Ensure that the 10-pin or 20-pin ribbon cable is connected and aligned properly to the matching ARM connector (1.27mm, 2.54mm or 2.00mm pitch) with the red stripe connected to position 1 marked on the PCB. Refer to Target Connectors.
    • Ensure that the 10-pin or 20-pin ribbon cable or connectors are not damaged.
    • If the VCC jumper in ULINK2 is in position ARM, ensure pin 1 of the debug connector on your target system is connected to the power supply of the microcontroller. Refer to Jumpers.
    • If the VCC jumper in ULINK2 is in position 3.3V, ensure the supply voltage of your microcontroller is 3.3V.
  3. Swap the position of the VCC jumper and retry step 1 and step 2.
    • If either position causes the device to be listed in the JTAG Device list, ULINK2 is working.
    • If no device is listed in JTAG Device, proceed with Exchange Procedure and report code U2TA1.


ULINK2 User's Guide: Troubleshooting Guide

Troubleshooting Guide

Most ULINK2 issues can be fixed by following the steps below. Complete the checks and answer the questions before contacting the support team.

Before you start testing ULINK2, ensure that:

  • Only one ULINK2 is connected to the PC.
  • Windows XP/Vista/7/8/10 is running.
  • The target system meets the IO voltage range of ULINK2 as described in Technical Data.
  • If possible, test one of the Keil example projects on a standard evaluation board. Use a target system that is known to be working.
  • ULINK2 is not connected to the target system.

Start Testing

  1. Select the ULINK2 driver depending on the target system in use:
    • ULINK2/ME Cortex Debugger for Cortex-M0, Cortex-M1, Cortex-M3, Cortex-M4, and Cortex-M7 devices.
    • ULINK2/ME ARM Debugger for ARM7 and ARM9 devices.
    • Infineon XC800 ULINK Driver for Infineon XC800 devices (PK51).
    • ULINK Driver for XC16x for Infineon XC16x, XE16x, and XC2xxx devices (PK166).

    Select Target Driver

  2. Click Settings.

    • If the Serial Number and Firmware Version is visible, continue with the next step.
    • If Serial Number and Firmware Version are blank, continue with Hardware Checklist.
  3. Connect the target system to ULINK2 using the supplied ribbon cable. Ensure that pin1 of the connector matches the red stripe on the ribbon cable. Ensure that the target system is powered ON correctly.
  4. If the JTAG Device ( or SW Device) list box contains an ARM Device Name and IDCODE, continue with the next step.

    If the JTAG Device ( or SW Device) list box is blank, or contains an error message, for example SWD Communication Failure, continue with Target Checklist.

  5. ULINK2 is communicating with your target system. In case that error messages appear during a flash download or a debug session, refer to Error Messages.


ULINK2 User's Guide: Using ULINK2

Using ULINK2

After µVision and ULINK2 have been setup for Flash programming and configured for debugging, download the application to target and start debugging.

  • Downloading to Flash explains how to download the application to the target system.
  • Debugging Programs describes how to start debugging the application on target.
  • Chaining Multiple Targets provides information on how to chain multiple targets onto a single ULINK2 adapter.


ULINK2 User's Guide: Utilities

Utilities

Utilities for ULINK2:

  • Boot Mode Utility - boot ULINK2 in CMSIS-DAP or native ULINK2 mode. Affects firmware version 2.00 and higher.


ULINK2 User's Guide: µVision Windows

µVision Windows

µVision shows trace information in:

  • The Trace Status that continuously displays status and progress messages.
  • The Component Viewer that shows detailed information about software components.
  • The Event Recorder that displays execution status and event information, which help to analyze the operation of software components.
  • The System Analyzer that graphically shows core clock, power consumption, interrupts, thread and exception execution over time.

Detailed trace information for Cortex-M3, Cortex-M4, and Cortex-M7 processor-based devices can be viewed using the following windows:

  • Debug (printf) Viewer for viewing debugging and program-specific information.
  • Trace Records - a real-time log of processor activity.
  • Trace Exceptions window that displays statistics about processor exceptions, which are based on trace events.
  • Event Counters window that displays a counter for each user-selected event.

Note

  • Trace Settings explains how to configure the trace output and configure individual devices.
  • The Logic Analyzer that displays up to 4 global or static variables on a time-graph is still available but superseded by System Analyzer which offers the same functionality plus more advanced features.