J-Link Musings — Official is Good
Posted On March 17, 2023
Using a J-Link with VSCode / VSCodium (vscodium.org) works for many folks. The Segger folks have a web page about it: https://wiki.segger.com/J-Link_Visual_Studio_Code
If you have a clone, it might work. I have found even a manufacturer specific J-Link version not targeted for your device will tend to work if you generically specify the processor, so there is no reason to purchase a clone. The clone prices are almost identical to the manufacturer specific J-Link debuggers.
You can use off-target J-Links because OpenOCD uses basic J-Link commands to debug. Programming Flash is another matter. In those cases you have to create program that is loaded into the target and programs the flash when it runs. This is how QuickFeather does it.
If you have a Clone, then be aware that most of the Clones provide 3.3V to the target when you use an adapter board. This can destroy the cpu on your board if it is a 1.8v processor. You must be very careful, or work around those issues with jumper wires.
If you use an official Segger, it will not supply voltage to the target. That means you can use it regardless of the cpu voltage, from 1 to 5 volts. There may be ways to prevent that voltage from the Clone driving the target; but on the one I came across, which is a V9 clone, I don’t have proper information to accomplish that.
Use With CortexM Processors
The adapter board being discussed is J-Link Adapter CortexM, and a part (?) number on it is 10-03-31. That board was out of stock, or extremely expensive when I tried to purchase it. After much looking, I found a used one on Ebay for $25 (which is about the parts price of building it myself). It worked fine. I had to use needle nose pliers to straighten the 0.05 post pins, as they were damaged during shipping/handling.
I have an official J-Link-ARM debugger, which is based on the V8 debugger. When I plugged it into my Macintosh, the JLinkExe program updated the firmware for me. I was able to use it to play with the QuickFeather board and load a program into its ram.
I also have an XMC J-Link adapter from Infineon (and we use a lot of Infineon products here). We will keep using their products, assuming they start supplying their distributors again, and keep the PSOC5LP family around. It also worked to program the QuickFeather board.
I was happy with Cypress. They were honest with their customer base, supported them, but ended up almost going under. It is too bad that good companies die. They were purchased by Infineon. Infineon has no clue about the Weekend Engineer market, which spawned Arduino and 3d printing, and kept a rival chip manufacturer in business for many years. Infineon is busy with their big customer alligators. Gnats are ignored, even though they will be around when alligators are killed off.
J-Link OB’s that will probably work, such as upgraded STLink-V2’s from manufacturers of things like the Nucleo Board, or the XMC J-Link, are the same price as getting a J-Link Clone from Alibaba after shipping.
Price of the latest version Clone J-Link is $53 + $25 shipping which is very close to the $90 for XMC J-Link, and much more than the $30 for the Nucleo board. In addition, once Segger discovers the SN being used, the JLink will become non-functional with a software update. The official STLink-V2 on the Nucleo board can be upgraded by Segger software to J-Link OB for free, although that is a tedious process.
So, the price differential between a Clone and the official Segger for the student has almost disappeared (unless you are gifted a Clone). In that case it is always better to go for the official unit, if for no other reason than the fact Segger has poured so much money into creating the software, making it a good product. Segger is also keeping it free to use.
If you are not able to use a Segger, the STLinkV2 is a good choice with OpenOCD, and those STLink Clones are out there very inexpensively, using real and fake STM32 devices. Since the STLink is for debugging STM devices, using an STM STLink Clone on STM32 devices does not bother me at all.
These Clones are available on Amazon and other places. You can also modify them with open source firmware. Go to some of my previous posts for some of those links.