DBG - Debug#

Debug (DBG) Peripheral API.

This module contains functions to control the DBG peripheral of Silicon Labs 32-bit MCUs and SoCs. The Debug Interface is used to program and debug Silicon Labs devices.

Enumerations#

enum
dbgLockModeAllowErase = 1UL
dbgLockModePermanent = 2UL
}

Lock modes.

Functions#

void
DBG_SWOEnable(unsigned int location)

Enable Serial Wire Output (SWO) pin.

bool

Check if a debugger is connected (and debug session activated).

void
DBG_EM2DebugEnable(bool enable)

Enable or disable debug support while in EM2 mode.

Enumeration Documentation#

DBG_LockMode_TypeDef#

DBG_LockMode_TypeDef

Lock modes.

Enumerator
dbgLockModeAllowErase

Lock debug access.

dbgLockModePermanent

Lock debug access permanently.


Definition at line 53 of file platform/emlib/inc/em_dbg.h

Function Documentation#

DBG_SWOEnable#

void DBG_SWOEnable (unsigned int location)

Enable Serial Wire Output (SWO) pin.

Parameters
[in]location

A pin location used for SWO pin on the application in use.

The SWO pin (sometimes denoted SWV, serial wire viewer) allows for miscellaneous output to be passed from the Cortex-M3 debug trace module to an external debug probe. By default, the debug trace module and pin output may be disabled.

Since the SWO pin is only useful when using a debugger, a suggested use of this function during startup may be:

* if (DBG_Connected())
* {
* DBG_SWOEnable(1);
* }
* 

By checking if the debugger is attached, a setup leading to a higher energy consumption when the debugger is attached can be avoided when not using a debugger.

Another alternative may be to set the debugger tool chain to configure the required setup (similar to the content of this function) by some sort of toolchain scripting during its attach/reset procedure. In that case, the above suggested code for enabling the SWO pin is not required in the application.


Definition at line 90 of file platform/emlib/src/em_dbg.c

DBG_Connected#

bool DBG_Connected (void )

Check if a debugger is connected (and debug session activated).

Parameters
N/A

Used to make run-time decisions depending on whether or not a debug session has been active since last reset, i.e., using a debug probe or similar. In some cases, special handling is required in that scenario.

Returns

  • True if a debug session is active since last reset, otherwise false.


Definition at line 79 of file platform/emlib/inc/em_dbg.h

DBG_EM2DebugEnable#

void DBG_EM2DebugEnable (bool enable)

Enable or disable debug support while in EM2 mode.

Parameters
[in]enable

Boolean true enables EM2 debug support, false disables.

Warnings

  • Disabling debug support in EM2 will reduce current consumption with 1-2 uA, but some debuggers will have problems regaining control over a device which is in EM2 and has debug support disabled.

To remedy this, set the WSTK switch next to the battery holder to USB (powers down the EFR). Execute Simplicity Commander with command line parameters: "./commander.exe device recover" and then immediately move the switch to the AEM position. An additional "./commander.exe device masserase" command completes the recovery procedure.


Definition at line 116 of file platform/emlib/inc/em_dbg.h