25. Debug support (DBG)

25.1 SWD debug features

The STM32WL3Rxx device JTAG ID[31:0] is the following:

The Cortex-M0+ subsystem of the STM32WL3Rxx embeds 4 breakpoints and 2 watchpoints.

STM32WL3Rxx devices embed the ARM serial wire debug port which enables Serial Wire debug (2-wire) to be connected to the CPU (default after power-on reset).

Note: When the device enters Deepstop mode, the SWD debug port is not powered. As a consequence, debug access is disabled and the chip cannot be accessed through the SWD channel.
One possible recovery option is to activate the internal embedded UART bootloader through the PA10 pin (by forcing PA10 high during hardware reset).

25.2 MCU debug component (DBG)

The MCU debug component helps the debugger provide support for:

25.2.1 Debug support for low-power modes

To enter low-power mode, the instruction WFI or WFE must be executed.

The MCU implements several low-power modes which can either deactivate the CPU clock or reduce the power of the CPU.

The core does not allow FCLK or HCLK to be turned off during a debug session. As these are required for the debugger connection, during a debug, they must remain active. The MCU integrates special means to allow the user to debug software in low-power modes.

For this, the debugger host must first set some debug configuration registers to change the low-power mode behavior:

This enables the internal RC oscillator clock to feed FCLK and HCLK in DeepStop mode.

25.2.2 Debug support for timers, watchdog and I2C

During a breakpoint, it is necessary to choose how the counter of timers and watchdog should behave:

For the I2C, the user can choose to block the SMBUS timeout during a breakpoint.

Note: 1 Only I2C1 is available only on STM32WL3Rxx devices.

25.3 DBG registers

25.3.1 DBG configuration register (DBG_CR)

This register configures the low-power modes of the MCU under debug.

It is asynchronously reset by the POR (and not the system reset). It can be written by the debugger under system reset.

If the debugger host does not support this feature, it is still possible for the user software to write to this register.

Address offset: 0x00

POR Reset: 0x0000 0000 (not reset by system reset)

Only 32-bit access supported

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
ST logo
ST logo
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBG_STOPDBG_SLEEP
rwrw

Bits 31:2 reserved, must be kept at reset value.

Bit 1 DBG_STOP: Allow debug of the CPU in Deepstop mode

0: Normal operation. All clocks are disabled automatically in STOP mode

1: Automatic clock stop disabled. All active CPU clocks and oscillators continue to run during STOP mode, allowing full CPU debug capability. On exit from STOP mode, the clock settings are set to the STOP mode exit state.

Bit 0 DBG_SLEEP: Allow debug of the CPU in SLEEP mode

0: Normal operation. All clocks are disabled automatically in SLEEP mode

1: Automatic clock stop disabled. All active CPU clocks and oscillators continue to run during SLEEP mode, allowing full CPU debug capability. On exit from SLEEP mode, the clock settings are set to the SLEEP mode exit state.

25.3.2 DBG APB0 freeze register (DBG_APB0_FZ)

This register configures the clocking of timers, RTC, IWDG, peripherals of the MCU under debug:

The register is asynchronously reset by the POR (and not the system reset). It can be written by the debugger under system reset.

Address offset: 0x04

Power on reset (POR): 0x0000 0000 (not reset by system reset)

Only 32-bit access are supported.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.DBG_IWDG_STOPRes.DBG_RTC_STOPRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBG_TIM16_STOPDBG_TIM2_STOP
rwrwrwrw

Bits 31:15 reserved, must be kept at reset value.

Bit 14 DBG_IWDG_STOP: IWDG stop in the CPU debug

Bit 13 reserved, must be kept at reset value.

Bit 12 DBG_RTC_STOP: RTC stop in CPU debug

Bits 11:2 reserved, must be kept at reset value.

Bit 1 DBG_TIM16_STOP: TIM16 stop in the CPU debug

Bit 0 DBG_TIM2_STOP: TIM2 stop in the CPU debug

25.3.3 DBG APB1 freeze register (DBG_APB1_FZ)

This register configures the clocking of the I2C SMBUS peripherals of the MCU under debug:

The register is asynchronously reset by the POR (and not the system reset). It can be written by the debugger under system reset.

Address offset: 0x08

Power on reset (POR): 0x0000 0000 (not reset by system reset)

Only 32-bit access are supported.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBG_I2C1_STOPRes.Res.Res.Res.Res.
rw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.

Bits 31:22 reserved, must be kept at reset value.

Bit 21 DBG_I2C1_STOP: I2C1 SMBUS timeout stop in CPU debug

0: Normal operation. I2C1 SMBUS timeout continues to operate while the CPU is in debug mode

1: Stop in debug. I2C1 SMBUS timeou is frozen while the CPU is in debug mode.

Bits 20:0 reserved, must be kept at reset value.

25.4 DBG register map

Refer to Table 3: Memory map and peripheral register boundary addresses for the DBG registers base address location in the STM32WL3Rxx.

Table 130. DBG register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x00DBG_CRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00
0x04DBG_APB0_FZRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBG_IWDG_STOPRes.DBG_RTC_STOPRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBG_TIM16_STOPDBG_TIM2_STOP
Reset value0000
0x08DBG_APB1_FZRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBG_I2C1_STOPRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value0