AT32F421
Series Reference Manual
2022.11.11
Page 332
Rev 2.02
22
Debug (DEBUG)
22.1 Debug introduction
Cortex
™
-M4 core provides powerful 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 a serial wire debug interface.
ARM Cortex
™
-M4 reference documentation:
Cortex™-M4 Technical Reference Manual (TRM)
ARM Debug Interface V5
ARM CoreSight Design Kit revision r1p0 Technical Reference Manual
22.2 Debug and trace
This feature supports debugging for different peripherals, and configures the 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 I
2
C, 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 by the SW 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.
22.3 I/O pin control
The AT32F421 has two general-purpose I/O ports for SW-DP debugging. After a system reset, the SW-
DP can be immediately used by the debugger as a default function.
When the user wants to switch to a different debug port or disable debug feature, it is possible to release
these dedicated I/O pins by setting GPIO registers. Once a corresponding debug I/O is released by the
user, the GPIO controller takes control, and releases these I/Os for general purposes.
22.4 DEBUG registers
shows DEBUG register map and reset values.
These peripheral registers must be accessed by word (32 bits)
Table 22-1 DEBUG register address and reset value
Register name
Offset
Reset value
DEBUG_IDCODE
0xE004 2000
0xXXXX XXXX
DEBUG_CTRL
0xE004 2004
0x0000 0000