Last Updated: 30-10-2020

This article describes how you can turn a RaspberryPi 2/3/4 (RPi) into a SWD programmer / SWO Viewer without additional hardware. Just download and install the free software packages available, as described below.

Unlike most programmers that connect to the target over USB, this implementation allows programming over your local network, between your development machine and the programmer installed on a networked Raspberry Pi.

This article has 5 sections:

Programmer installation on RPi

Download the server install zip file to your RPi. Unzip and run the install script.

pi: wget
pi: unzip
pi: cd SWorDServerInstall
pi: chmod 755
pi: sudo ./

After a few seconds the install script will complete and the server will be running in the background. The server is set to run as a unix daemon and will automatically be restarted when the RPi is powered.

To allow output from the SWO pin, the UART on the RPi needs to be reconfigured. To do this, edit /boot/config.txt and add the line:


Disable the console:

pi: sudo systemctl stop serial-getty@ttyS0.service
pi: sudo systemctl disable serial-getty@ttyS0.service

At this point, if you haven’t given your RPi a name it might be worthwhile doing so now. This is straightforward and simple to do.

Reboot the RPi and that’s it, the programmer should be running on the RPi.

Connect the Raspberry Pi to the target microcontroller

One of the main benefits of using ARM SWD is that it only requires 2 pins to interface to the microcontroller. A further pin is required to get printf style output through the SWO pin.

Raspberry Pi connection

  • Pin 1. 3.3V supply to the microcontroller (only required if the target is powered from the RPi)
  • Pin 6. Gnd. Actually any ground pin can be used
  • Pin 7. GPIO4. Reset (optional)
  • Pin 10. UART RXD. SWO output from the microcontroller
  • Pin 16. GPIO23. VSense. Checks the microcontroller is powered (optional)
  • Pin 18. GPIO24. SWDIO
  • Pin 22 GPIO25. SWDCLK.

Microcontroller connection

Microcontroller connection depends on which microcontroller you are working with. However, the pin names are fairly standard so should be very easy to work out. In this example, we are using the NoSMD BL652 Adapter which is based on a Nordic nRF52832 SoC.

  • Pin H2.13. 3.3V supply. VDD_nREF
  • Pin H1.8. SWO. SIO_18
  • Pin H2.13. VSense. VDD_nREF
  • Pin H1.4. SWDIO
  • Pin H1.5 SWDCLK
  • Pin H2.1. GND.
BL652 Adapter connection to RPi
Looks a little messy but the connection is actually quite simple

Programming the target microcontroller

There are three ways you can program the target microcontroller from your development machine:

  • Using the programmers built in web user interface
  • Using commonly available HTTP clients, like cURL and Wget
  • Using the SWorD command line tools.

The examples below show how to flash the files from the example project BLEUICR to the target.

Using the web user interface

This is the simplest method and does not require installation of any software onto the development machine. You will just need to know the IP address of your RPi on your local network.

Assuming your RPi has an IP address of, open a web browser and enter the following URI:

You should see a screen like below:

Programmer screen in the web browser

Add the files to be flashed (in any order), set the page size accordingly and click ‘Program Target’. You can leave the page size field blank, however this will mean programming will take considerably longer.

Using cURL

Using a tool like cURL means the process of programming a target can be scripted. cURL is installed by default on some platforms, but on others e.g. Windows, you may need to download and install a third party package.

The example below will program the target microcontroller with the same three files used in the WebUI example above:

C:\> curl -i -X POST -H "PageSize: 4096" -H "NoVsense: 1" -H "Content-Type: multipart/form-data" -F "files=@C:\SDK\NordicSDK\nRF5_SDK_17.0.0_9d13099\components\softdevice\s132\hex\s132_nrf52_7.0.1_softdevice.hex" -F "files=@C:\Temp\bleuicr.elf" -F "files=@C:\Temp\UICR.json"

Using SWorD command line tools

Like cURL, using the command line tools means the process of programming a microcontroller can be scripted. The main benefits of using the SWorD command line tools over using something like cURL, is that the IP address of the RPi does not need to be known (or hardcoded in a script) and the tools provide feedback on progress.

At this point, the client applications are only available for Windows, however, if there is demand then Mac/OSX and Linux versions will be made available.

Download the client install package to your development machine. Run the installer.

By default the applications will be installed to C:\Program Files\NoSMD\SWorD and data files will be created in C:\ProgramData\NoSMD\SWorD. Nothing is installed into the registry.

The example below will program the target microcontroller with the same three files used in the WebUI and cURL examples above.

C:\> "C:\Program Files\NoSMD\SWorD\bin\SWorDProgrammer.exe" -probe:rpi4programmer -pagesize:4096 -novsense -program:"C:\SDK\NordicSDK\nRF5_SDK_17.0.0_9d13099\components\softdevice\s132\hex\s132_nrf52_7.0.1_softdevice.hex,C:\Temp\bleuicr.elf,C:\Temp\UICR.json"

The argument -probe:rpi4programmer instructs the application to locate a programmer called rpi4programmer on the network and connect to it. Alternatively, the IP address of the programmer could be used instead i.e. -probe:

If you do not know the page size, the pagesize argument can be omitted. However, it will mean that programming will take considerably longer as program memory addresses will need to be set individually.

Several examples of this process using the NoSMD BL652 Adapter are available here.

SWorDProgrammer can also be used to erase a target, read back memory from a target and verify that a target is programmed with a binary.

See SWorDProgrammer for full usage instructions.

SWO output

If your application outputs messages over the SWO pin then this can be viewed in one of two ways:

  • Using the programmers built in web user interface
  • Using the SWorD command line tools

Viewing SWO output through the web user interface

Assuming your RPi has an IP address of, open a web browser and enter the following URI:

Click on the ‘SWO Output’ tab and you should see a screen like below:

SWO output displayed in the browser

Click ‘Connect’ to start displaying output from the SWO pin in real time.

Viewing SWO output using the SWorD command line tools

To see output from the target connected to the programmer named rpi4programmer, start a terminal and type:

C:\> "C:\Program Files\NoSMD\SWorD\bin\SWorDSWO.exe" -probe:rpi4programmer

See SWorDSWO for full usage instructions.


Taking a long time to program

If the pagesize argument is omitted and the programmer can not automatically determine the memory layout of the microcontroller, it can take considerably longer to flash the program to the microcontroller. This can be easily fixed by setting the pagesize of the microcontrollers flash – in the case of the nRF52832, this is 4096 bytes.


Each of the applications are capable of providing detailed logs to identify the cause of any problems. By default, no logging is produced but instructions to enable logging can be found:


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: