In-Circuit Debugging
Aka. ICD. Allows developers to observe and control program execution inside the microcontroller while it remains in the circuit.
Capabilities:
- Set and trigger breakpoints at specific instructions
- Step through code instruction by instruction
- Inspect and modify CPU registers
- Read and write memory contents in real time
Requires a hardware debugger probe which connects between the host computer and the target MCU.
IoT devices have no screen, keyboard, or OS-level error catching. ICD is essential for timing-sensitive faults and step-by-step register-level diagnosis that logging cannot provide.
JTAG
IEEE 1149.1 standard. Originally designed for PCB boundary-scan testing. Now the primary in-circuit debug and programming interface for MCUs, SoCs, and FPGAs.
Test Access Port (TAP) is a state machine inside the chip. It controls access to internal scan chains (shift registers connected to CPU registers, memory, and peripherals).
Pins:
- TCK - Test ClocK
Clocks the TAP state machine. - TMS - Test Mode Select
Controls state transitions in the TAP. - TDI - Test Data In
Shifts data into the chip serially. - TDO - Test Data Out
Shifts data out of the chip serially. - TRST - Test ReSeT
Optional. Resets the TAP asynchronously.
Multiple JTAG devices on a board are daisy-chained. It means TDO of one device feeds TDI of the next. A single JTAG connector reaches all devices on the chain.
SWD
Serial Wire Debug. ARM proprietary protocol, part of the CoreSight debug architecture. ARM Cortex-M specific.
SWD accesses Debug and Access ports of the CoreSight system:
- Debug Port (DP)
Handles physical connection - Access Ports (APs)
Exposes the CPU halt/resume, register access, and memory-mapped access to peripherals.
Pins:
- SWDIO - Input Output
Bidirectional data flow between host and target. A single wire. Direction switching within each transaction. - SWDCLK - Clock
- SWO - Serial Wire Output
Optional. A third unidirectional pin for non-intrusive real-time trace from the target with no CPU involvement.
Uses 2 mandatory pins against JTAG’s 4–5; trace uses SWO rather than separate ETM pins. Functionally identical to JTAG for single-device debugging. Daisy-chaining is not supported.
Debugger Probes
Hardware circuit bridging the host computer to the target MCU over JTAG or SWD. The host runs a debug server (e.g. OpenOCD, J-Link GDB Server) that exposes a GDB-compatible interface.
Common probes:
- J-Link (SEGGER)
- ST-Link (STMicroelectronics)
- CMSIS-DAP compatible probes
Remote Debugging
Firmware debugged over a wireless or network link. Physical access to the device is not required. Used for deployed IoT devices in the field.
GDB Stub
A minimal GDB remote serial protocol implementation running on the target. Exposes breakpoint insertion, register reads, and memory inspection over a TCP socket. The host connects with target remote <ip>:<port>.
Latency is higher than JTAG/SWD. Not suitable for debugging timing-critical interrupt handlers or hard real-time faults.
Log Forwarding
Non-interactive. Firmware emits structured output over UART or a network socket; the host captures and filters messages in real time.
No breakpoints or state inspection. Suitable for fault isolation in production deployments where ICD is unavailable.
External Instruments
Hardware connected to the circuit externally to observe signals without modifying firmware or halting execution.
Logic Analyzer
Captures digital signal transitions on multiple channels simultaneously. Decodes serial protocols (I²C, SPI, UART, CAN) into human-readable frames.
Useful for verifying peripheral communication and timing relationships between signals.
Oscilloscope
Measures analog voltage over time. Reveals signal integrity issues, ringing, voltage level violations, and timing jitter that a logic analyzer’s digital threshold cannot detect.
In-Circuit Emulator
Aka. ICE. A device that physically replaces the MCU on the board using a pin-compatible form factor. Provides cycle-accurate tracing and visibility into every register and bus transaction with no firmware changes required.
More capable than a probe-based ICD but requires a package-compatible ICE unit. Not available for all MCU variants.