add wishlist add wishlist show wishlist add compare add compare show compare preloader icon-theme-126 icon-theme-161 icon-theme-138 icon-theme-027 electro-thumb electro-return-icon electro-brands-icon electro-payment
  • +1 (857) 226-1305
  • +86 18825289328

Operating Procedures for Flashing and Debugging Programs on the STM32 Robot Controller Using J-Link

1. Introduction

This tutorial is applicable for flashing and debugging programs on the Hiwonder STM32 robot controller using a J-Link debugger during Keil development.

2. Wiring Instructions

The required tools include Dupont wires, the STM32 robot controller, and a J-Link debugger.

Relevant pin silkscreens are located on the back of the STM32 robot controller, and the specific wiring is as follows:


       STM32 robot controller                    J-Link

             PA13                                SWDIO

             PA14                                SWCLK

              GND                                 GND

              5V                                  5V

If the 5V power supply from the J-Link debugger is insufficient, connect the UART1 port of the STM32 robot controller to a computer for power and disconnect the 5V port of the J-Link debugger.

3. Operation Steps

Open a web browser and navigate to the J-Link download page at https://www.segger.com/downloads/jlink/. Select the appropriate download option based on the computer's operating system configuration. A 64-bit Windows operating system running version V8.06 is used here as an example.

Once the download is complete, open the installation package and leave all options at their default settings, except for the file installation location. After the installation finishes, the following screen will appear, at which point clicking OK and Finish is all that is required.

Following installation, connect the J-Link to the controller and open the Universal Serial Bus Controllers section in the computer's Device Manager. The following display indicates a successful driver installation.

3.2 Keil Environment Configuration and Operating Procedure

First, configure the Keil development environment according to the Development Environment Setup found in the Tutorial. The path for the documentation is as follows:

After configuring the development environment, extract and open the Keil project folder. The buzzer alarm routine from the STM32 robot controller tutorial serves as an example here, and the documentation path is shown below:

After extracting the folder, open the Keil project file located at the following path:

Upon opening Keil, click Compile first. If the development environment is configured correctly, the following output will appear:

After compiling and running the build successfully with no errors or warnings, open the J-Link settings and follow the steps shown in the image:

After opening the J-Link settings, select SW for J-Link flashing. Once selected, the interface will display the corresponding device address, similar to item ③ in the image. This indicates that J-Link has successfully connected to the microcontroller. This method also allows verification of whether J-Link is properly connected to the microcontroller.

Once the J-Link and the microcontroller are successfully connected, close the pop-up window, return to the main interface, and click the Download button to flash the program onto the microcontroller. After clicking Download, a progress bar will appear in the Build Output section at the bottom of Keil. Upon completion, the display marked as ② in the image below will appear, and the buzzer on the STM32 robot controller will sound an alarm.

After the program is successfully flashed, clicking the Debug icon on the Keil toolbar will open the debugging interface if debugging is required. Specific details are highlighted in the image below:

Light
Dark