Accessing registers in an unclocked or powered-down peripheral

Technical Note 160909






9/12/2023 6:09 AM


Accessing registers in an unclocked or powered-down peripheral unit, in C-SPY, might give unexpected results.


Accessing registers in an unclocked or powered-down peripheral unit during debugging might cause unexpected behavior. Incorrect data can be read, writing might have unexpected results or no effect. In some cases, writing or reading might cause the CPU to reset or the debug connection might be lost.

The exact behavior in such cases depends on the device implementation.

Just displaying the peripheral memory address range in the Memory window or displaying the peripheral registers in the Registers window can be enough to cause these effects.

Using custom Register groups

One way to view some registers, while avoiding accessing unclocked or powered-down peripheral registers, is to create an application-specific register group.

  1. To do that, choose View > Registers > Register User Groups Setup during a debug session.
  2. Create a User Register Group with only the registers that can be accessed without issues.

Note that you can create a combined group that contains registers from any predefined register group (for example a combination of UART and GPIO registers).

Disabling C-SPY features

To limit C-SPY from accessing potentially disabled peripherals or memory areas, you should disable trace functionality, and try to avoid excessive breakpoint usage.

Limiting the number of breakpoints set by C-SPY:

  • Disable Project > Options > Debugger > Setup > Run to
  • Disable all checkboxes in Tools > Options > Stack
  • Select Project > Options > General Options > Library configuration > Library low-level interface implementation: None

Disable trace

  • To disable trace functionality in IAR Embedded Workench for Arm:
    • Project > Options > I-jet > Trace > Mode: None
  • To disable trace functionality in IAR Embedded Workbench for RISC-V:
    • Project > Options > Debugger > Extra Options: --jet_sigprobe_opt=trace(mode=off)


If accessing registers in an unclocked, powered-down or otherwise disabled peripheral unit leads to crashes or to a change in program behavior, you must take steps to avoid this. Consider these alternatives:

  • Avoid accessing the registers.
  • Ensure that the peripheral unit is enabled when C-SPY accesses register contents, for example by enabling the peripheral unit via a C-SPY macro.

For information on C-SPY macros and Register User Groups, choose Help > C-SPY Debugging guide.

All product names are trademarks or registered trademarks of their respective owners.

We do no longer support Internet Explorer. To get the best experience of, we recommend upgrading to a modern browser such as Chrome or Edge.