Table of Contents

Using ARM Cortex-M Single Wire Output (SWO)

About this document

This document describes how to use Cortex-M SWO to output data from .NET nanoFramework.

Prerequisites

You'll need:

  • Target board with SWO pin free and configured in it's reset state (meaning not used by GPIO or any other peripheral and not configured in any alternate mode).
  • If using a stock board it's also convenient to check the schematics if any hardware changes are required.
  • Software capable of driving and outputting data from an SWO source. ST-Link is an excellent tool for this purpose.
  • Set .NET nanoFramework build options to include support for SWO (either setting "SWO_OUTPUT" : "ON" in CMakeUserPresets.json or launching CMake with -DSWO_OUPUT=ON).

Outputting SWO

  • Step 1: Load the target flash with a .NET nanoFramework image build with SWO option
  • Step 2: On ST-Link menu choose ST-Link -> Printf via SWO viewer

st-link-menu-print-swo

  • Step 3: After SWO viewer windows loads, set the Sytem clock to match the target and the Stimulus port to 0.

st-link-menu-print-swo

  • Step 4: Click the Start button and watch the output in the main window area.

st-link-menu-print-swo