Skip to content

Wireless Programming and Debugging for STM32 with TapNLink Primer

Introduction

Update and debug of firmware can be done thanks to typical physical links such as USB, UART or I2C but this procedure requires a physical access with specific connectors on the device. But sometimes a physical access is not easy, either because of the distance between the PC and your electronic board or that your electronic system stands in a moving object.

Robot programming
Our Robot application could be debugged while moving!

Thanks to TapNLink Primer, it is now possible to remotely update and debug the firmware by using a wireless BLE connection. In this tutorial we will present the steps to use TapNLink Primer as an SWD programming and debugging tool with the help of Ride7 debugging environment. Even if programming over a BLE communication is quite slow (about 3x slower than a connected debugger Raisonance's RLink), the debugging process is quite similar and useful.

Prerequisites

  • Windows 10 PC: For using TapNLink Primer as a debugger you need a BLE enabled Windows 10 (version 1803 or above). If your PC does not have a BLE device integrated you can purchase an USB Bluetooth Dongle like CSR 4.0. Please verify that the dongle is compatible with Windows 10 environment.
  • TapNLink Primer Evaluation Kit: this is an evaluation kit that allows iot designers to test all the advantages of IoTizeTapNLink products for building a connected electronic system. For this guide, TapNLink is used only as an SWD debugging tool. You can purchase a TapNLink Primer Evaluation Kit from Digikey.
  • Ride7 + RKit ARM Software: Raisonance’s software tool set for ARM core-based microcontrollers is a fully integrated environment for building and debugging applications. TapNLink Primer can be used as a remote debugger for Ride7 without any functional limitation (No license is needed). Download Ride7 IDE and ARM RKit (version &.70 or above) from Raisonance Support website.

Step1: Hardware Preparation

TapNLink Primer Evaluation Kit is coming with the Sensor-demo sample application on an STM32F103x8 application board (Blue pill). Connect the STM32 application board to TapNLink as shown in this picture. Power the STM32 target board with a micro USB power cable: its red LED lights up and the green LED starts blinking. The target board powers the TapNLink Primer.

TapNLink Primer

Step2: Make sure that BLE peripherals are enabled

Open Windows10 Settings, click on Bluetooth & other devices. Turn on the Bluetooth toggle switch. Click the Add Bluetooth or other device button to explore the available BLE devices.

BLE Settings

When scanning for Bluetooth devices that are available around your PC, you should find your TapNLink device displayed with the name of our sample application: Sensor demo_XXXXX, where XXXXX corresponds to the unique ID number associated with your TapNLink.

BLE Scanner

Step3: Install Ride7 development kit

Download and install Ride7 IDE, then RKit ARM from Raisonance Support Website.
RKit ARM is coming with a set of application examples that are installed in the examples directory of Ride7 installation folder. Among these installed examples you will find the sensor_demo application example:

C:\Raisonance\Ride\Examples\ARM\Sensor_Demo\ STM32_Sensor.rprj

Double click the .rprj project file to open the project in Ride7 environment.

Sensor Demo

The STM32 Blue Pill board that is included in the TapNLink Primer Evaluation Kit is pre-programmed with this STM32_Sensor application. The application demonstrates a few simple features like blinking the board led, measuring the internal temperature and voltage etc. In this guide, we are going to build and debug this simple application using Ride7 development environment and TapNLink Primer as an SWD debugger.

Start with rebuilding the application using Project|Build Project command. Now you are ready to program and debug the application.

From the STM32_Sensor Local settings pane, select TapNLink as the application’s debugging tool. Then scroll down the settings pane to reach the RLink configuration| Advanced Options:

Settings

Click the 'Click here to open dialog box' button to configure TapNLink advanced options.

Settings

In the Advanced debugger selection dialog box, select TapNLink as the debugger tool, and BLE for the communication protocol. Programming and debugging are also available through Socket and MQTT relay but in this guide, we are going to focus on using BLE communication protocol. If you don’t know the advertised name of your TapNLink Primer device, you can click the button beside the Name or Address text field: Ride7 will scan and display the available devices, so you can find and select yours.

Settings

TapNLink connection to the target is protected with a User\Profile permission system. TapNLink Primers are coming with a default configuration, and Ride7 will use this default administrator login to get access to the target application.

Settings

Select Ok to close the dialog box. You are now ready to start programming your blue pill target board and start debugging the STM32_Sensor demo. Select Debug|Start command from the command bar and press ok to close the Cortex Debug Options dialog box.

Step5: Debugging STM32_sensor application

Ride7 is a fully integrated debugging environment with high-level language debugging features and a full range of views (Symbols, locals, disassembly, registers, peripherals, ...).

Ride7

Troubleshooting

On Windows 10 1803 and above, you may get randomly device disconnection resulting in connection fails and latency: Unpair the device from the BLE peripherals center of Windows 10 Settings and re-connect to your TapNLink device.

To go further