
AT32F413
Series Reference Manual
2022.06.27
Page 364
Rev 2.00
24
Debug (DEBUG)
24.1 Debug introduction
Cortex
™
-M4F core provides poweful debugging features including halt and single step support, as well
as trace function that is used for checking the details of the program execution. The debug features are
implemented with two interfaces: serial wire debug (SWD) and JTAG debug port. Trace information is
collected by a single-wire serial wire view interface, or by TRACE interface when a larger trace
bandwidth is needed. Trace and debugging interfaces can be combined into one interface.
ARM Cortex
™
-M4F reference documentation:
Cortex™-M4 Technical Reference Manual (TRM)
ARM Debug Interface V5
ARM CoreSight Design Kit revision r1p0 Technical Reference Manual
24.2 Debug and Trace
It is possible to support debugging for different peripherals, and configure the working status of
peripherals during debugging. For timers and watchdogs, the user can select whether or not to stop or
continue counting during debugging; For CAN, the user can select whether or not to stop or continue
updating receive registers during debugging; For I2C, the user can select whether or not to stop or
continue SMBUS timeout counting.
In addition, code debugging is supported in Low-Power mode. In Sleep mode, the clock programmed by
code remains active for HCLK and FCLK to continue to work. In DeepSleep mode, HICK oscillator is
enabled to feed FCLK and HCLK.
There are several ID codes inside the MCU, which is accessible by the debugger using the
DEBUG_IDCODE at address 0xE0042000. It is part of the DEBUG and is mapped on the external PPB
bus. These codes are accessible using the JTAG debug port or the SWD debug port or by the user
software. They are even accessible while the MCU is under system reset.
Two trace interface modes supported: single-pin mode for serial wire view and multi-pin trace interface.
24.3 I/O pin control
SWJ-DP is supported in different packages of AT32F413. It uses 5 general-purpose I/O ports. After reset,
the SWJ-DP can be immediately used by the debugger as a default function. To ensure that JTAG input
pins are not floating (especially SWCLK/JTCK), the JTAG input pins are embedded with internal pull-up
or pull-down feature, NJTRST, JTDI and JTMS/SWDIO with internal pull-up feature, and JTCK/SWCLK
with internal pull-down feature.
When the user wants to switch to a different debug port or disable debug feature, either IOMUX_MAPR
or IOMUX_MAPR7 register can be configured to release these dedicated I/O pins. Once a corresponding
debug I/O is released by the user, the GPIO controller takes control, and then these I/Os can be used
as general-purpose I/Os.
For trace feature, it is possible to set the TRACE_IOEN and TRACE_MODE bits in the DEBUG_CTRL
register to enable trace function and slect trace modes.
Table 24-1
Trace function enable
TRACE_IOEN
Description
0
No Trace (default state)
1
Trace enabled