 | ULINK2 User's Guide |  |
|
|
| Enable Serial Wire TraceTo 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- 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); - Open the dialog Options for Target — Debug and insert conf_STM32F10xxx.ini into the Initialization File field.

Configure µVision to capture trace data- Open the dialog Options for Target — Debug.

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

- Enable SWJ and select SW.
- Click the Trace tab.

- Set Trace Enable and Autodetect.
- 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.
|
|