How to use Jlink to check where the program died after the GD32 chip ran away?

Infineon / Mitsubishi / Fuji / Semikron / Eupec / IXYS

How to use Jlink to check where the program died after the GD32 chip ran away?

Posted Date: 2024-01-29

I believe that everyone will encounter such a scenario: the chip program becomes abnormal while it is running, and it cannot be simulated at this time, because once the simulation program is downloaded again, the abnormality disappears. Now I will teach you how to use the Jlink emulator to check where the program died after the GD32 chip ran away.

First, we need to connect the target board to Jlink. We only need to connect three wires: SWDIO (PA13), SWCLK (PA14) and GND. Remember, you must not connect the NRST pin, otherwise the chip may be reset when connecting. Of course , and be sure to ensure that the chip does not lose power during the connection process.

Then find Jlink.exe in the Jlink driver installation directory and double-click to open:

After opening, this interface will appear:

Keyboard input: usb, click Enter:

Prompt to connect to Jlink, then enter: s and press Enter

There will be a default chip model here. If it is inconsistent with the model on the target board, you can enter:? , and press Enter. If they are consistent, press Enter directly.

Because the editor is using GD32F303ZGT6, so after entering "?", a list of chip selections will pop up. Find the target chip and double-click:

Return to the Jlink.exe interface:

Because we are using the SWD interface, enter: s and press Enter:

Here you will be asked to choose the communication speed of Jlink. The default is 4000KHz. If the line between your target board and Jlink is relatively long, you can reduce the speed appropriately. For example, if you need 1000KHz, enter: 1000 on the keyboard and press Enter. It will The following interface appears:

We see that the chip ID has been found in the red frame. At this time, enter: h and press Enter. You will see the following interface:

The PC value in the red box represents the current execution position of the program. We can find out which function the program is running by looking at the map file in the program project. For example, the PC value here is 0x08000AAA, in the map file What fits this address is the delay_1ms function.

Isn't it very simple?

In the future, the editor will also teach you how to debug the chip through Jlink.exe, so stay tuned.

#Jlink #check #program #died #GD32 #chip #ran