TheBestPlayer
TheBestPlayer

Reputation: 404

How to read serial number of J-Link debug probe via cmd

I am required to read the serial number of connected J-Link (I use J-Link Compact Plus from Segger) via the command line.

I am using tools from Segger such as JFlash.exe and JLink.exe

I managed to find a way to read a serial number via JLink.exe by executing the following command:

JLink.exe -CommanderScript -CommandFile GetSerial.jlink

Where GetSerial.jlink is a custom file that I have created and it looks like:

ShowEmuList
exit

The response is as following: enter image description here

The above method seems to work fine but I am not convinced that this is the most optimal way.

My questions:

  1. Is it possible to read the serial number using JFlash.exe instead of JLink.exe. Since I use JFlash.exe from flashing, I would prefer to rely on a single tool instead of 2.
  2. If the answer to above is no. I would like to know if there is any way to optimise the JLink.exe command to read the device serial number. I do not fully understand why do I need to pass GetSerial.jlink as an argument to the command. I would much rather prefer something like:
Jlink.exe -ShowEmuList

But the above does not seem to work: enter image description here

Thanks in advance for the help.

Upvotes: 1

Views: 3046

Answers (1)

chwi
chwi

Reputation: 2802

1: I couldn't find anything in the JFlash reference.

To answer 2: The command line options for JLinkEXE are not that good, unfortunately. If you just need the connected emulators printed, I would rather go for Nordic Semiconductors nrfjprog, part of the nRF Command Line tools found here.

Then you can simply do

# nrfjprog -i
960063027
960036138
960019988
821009140

It has a lot of other nice features as well but is mostly made for their nRF-chipsets though. If you are indeed using their chipset, this is a one-stop shop for everything you need.

Upvotes: 0

Related Questions