8 X2Cscope Protocol

X2Cscope is a runtime debugging tool that enables live variable monitoring and manipulation on Microchip microcontrollers. It communicates with the target using the LNet protocol over standard interfaces such as UART, allowing developers to inspect and modify firmware variables without halting execution.

The protocol has low overhead and uses UART for communication and a timer interrupt for sampling.

Key Features

  • Scope function: Capture buffered data on the target for visualization.
  • Watch function: Read and write firmware variables with optional periodic updates.
  • Target-side triggers: Configure trigger conditions that are evaluated on the MCU itself.

When to Use X2Cscope

X2Cscope is particularly suited for:
  • Motor control applications requiring real-time parameter tuning.
  • Power management systems needing runtime diagnostics.
  • Capturing data in applications that benefit from target-side buffering.
For a comparison with other protocols, see Protocol Comparison.

Scope Function

With the scope function, X2Cscope first samples data into an internal buffer on the target MCU, then transfers the complete buffer to the PC. This approach allows capturing high-frequency signals without requiring high bandwidth continuous communication. The set of monitored variables and timing parameters can be dynamically updated at runtime.

Trigger detection is performed on the target MCU itself and controls whether data is actually captured into the buffer on the target. This provides precise triggering on high-speed events.

See Scope Channels and Scope Triggers for details.

Watch Function

The watch function reads and writes variables on demand. The MCU only responds when requested - there is no streaming. There is no need for a buffer on the MCU to do this. This is suitable for configuration parameters and slow-changing values.

See Watch Table.

Related Resources

x2cscope.github.io/