Skip to main content

Debugging

TinyCLR gives you full Visual Studio debugging on the device — set breakpoints, step through code, inspect variables, and view exceptions, all over a regular USB cable. No JTAG probe, no specialized hardware, no separate toolchain.

Debug interface

By default, the device chooses its debug interface (USB or serial) by reading the MOD pin at startup — see Special Pins for the pin reference. The MOD-pin selection can be overridden — see Device Info for forcing or disabling either interface.

When serial debugging is active, the default UART is:

  • SC13xxx — UART1
  • SC20100 — UART1
  • SC20260 — UART5

USB is the default choice for most workflows. Serial is useful when the USB Client port is needed for other purposes (a USB device profile, mass storage, etc. — see USB Client).

Debug output

Use System.Diagnostics.Debug for printf-style debugging — output appears in the Output window in Visual Studio:

using System.Diagnostics;

Debug.WriteLine("Sensor reading: " + reading);

Debug output is stripped from release builds automatically — you don't need to remove the calls before shipping.

Disabling the debug interface in production

Production devices should usually have the debug interface disabled — both to free the port for other uses and as a defense-in-depth security measure. See IP Protection for the secure-design pattern that disables the debug interface and uses In-Field Update for post-deployment firmware updates instead.

Using the Visual Studio debugger

The on-device experience matches the regular .NET Visual Studio debugger. For the keyboard shortcuts, breakpoint types, watch windows, and call-stack navigation features, see Microsoft's Visual Studio debugger feature tour.