J-link appears to be broken on OSX Catalina

It appears that there is a binary loading issue for J-link on catalina currently. This works fine on linux for me but on my mac it returns

Linking .pio/build/nrf52_express/firmware.elf
Checking size .pio/build/nrf52_express/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
DATA:    [          ]   4.5% (used 11276 bytes from 248832 bytes)
Building .pio/build/nrf52_express/firmware.hex
PROGRAM: [=         ]   8.9% (used 72432 bytes from 815104 bytes)
Configuring upload protocol...
AVAILABLE: jlink, nrfjprog, nrfutil, stlink
CURRENT: upload_protocol = jlink
Uploading .pio/build/nrf52_express/firmware.hex
SEGGER J-Link Commander V6.52 (Compiled Sep 27 2019 17:51:12)
DLL version V6.52, compiled Sep 27 2019 17:51:01


J-Link Command File read successfully.
Processing script file...

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Failed to open DLL

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Failed to open DLL

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Failed to open DLL


Script processing completed.

It returns code 0 but the device is never updated

I can successfully use J-Link (V8 and V9) with PlatformIO and a nRF52832 Bluefruit Feather board on macOS Catalina.

What version of the J-Link adapter are you using?

According to your log, the problem seems to be with the USB communication. Can you check another cable and another USB port?

I have a J-link light rev v8.1

The cable works fine on my linux box, I tried both a different port and different USB-C to A adapter. The message makes me a bit weary of the idea of a hardware issue. Its almost like the driver isn’t linking properly.

It seems like it fails to load a DLL / dynalib, but is quiet about which file >_>.

Following this mention you might need to install libusb. You can get brew and then use brew install libusb.

Otherwise we’d need to see a verbose upload log (pio run -t upload -v) and see if we can get a manual invocation of the JLink.exe working. If dynamic DLL loading still fails, we’d maybe have to use a system call tracer…

I will give that a shot tonight. I just remembered that have been able to use the j-link outside pio to flash the bootloader so the system can use it, its just PIO that is confused.

libusb is already installed

Processing nrf52_express (board: adafruit_feather_nrf52840_s340; framework: arduino; platform: nordicnrf52; platform_packages: framework-arduinoadafruitnrf52 @ https://github.com/cujomalainey/Adafruit_nRF52_Arduino; upload_protocol: jlink)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/adafruit_feather_nrf52840_s340.html
PLATFORM: Nordic nRF52 4.0.0 > Adafruit Feather nRF52840 Express
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (jlink) External (jlink, stlink)
PACKAGES: toolchain-gccarmnoneeabi 1.70201.0 (7.2.1), framework-arduinoadafruitnrf52 459a94d (git+https://github.com/cujomalainey/Adafruit_nRF52_Arduino), tool-sreccat 1.164.0 (1.64), tool-openocd 2.1000.190707 (10.0), tool-jlink 1.65200.0 (6.52.0), tool-bossac-nordicnrf52 1.10866.191129 (1.8.66)
Warning! Cannot find an appropriate softdevice binary!
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 10 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Adafruit Bluefruit nRF52 Libraries> 0.14.5 (/Users/curtismalainey/.platformio/packages/framework-arduinoadafruitnrf52@src-a3397c4684d09776374b404e065175e0/libraries/Bluefruit52Lib)
|   |-- <Adafruit Little File System Libraries> 0.11.0 (/Users/curtismalainey/.platformio/packages/framework-arduinoadafruitnrf52@src-a3397c4684d09776374b404e065175e0/libraries/Adafruit_LittleFS)
|   |-- <Adafruit Internal File System on Bluefruit nRF52> 0.11.0 (/Users/curtismalainey/.platformio/packages/framework-arduinoadafruitnrf52@src-a3397c4684d09776374b404e065175e0/libraries/InternalFileSytem)
|   |   |-- <Adafruit Little File System Libraries> 0.11.0 (/Users/curtismalainey/.platformio/packages/framework-arduinoadafruitnrf52@src-a3397c4684d09776374b404e065175e0/libraries/Adafruit_LittleFS)
Building in release mode
MethodWrapper(["checkprogsize"], [".pio/build/nrf52_express/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
DATA:    [          ]   4.5% (used 11148 bytes from 248832 bytes)
PROGRAM: [=         ]   8.8% (used 72136 bytes from 815104 bytes)
.pio/build/nrf52_express/firmware.elf  :
section             size        addr
.text              71452      200704
.ARM.exidx             8      272156
.data                676   536895488
.bss               10472   536896164
.heap             224372   536906636
.ARM.attributes       50           0
.comment             126           0
.debug_frame        5040           0
.stab                180           0
.stabstr             387           0
Total             312763
<lambda>(["upload"], [".pio/build/nrf52_express/firmware.hex"])
AVAILABLE: jlink, nrfjprog, nrfutil, stlink
CURRENT: upload_protocol = jlink
JLinkExe -device nRF52840_xxAA -speed 4000 -if swd -autoconnect 1 -CommanderScript "/Users/curtismalainey/Github/ant-arduino/.pio/build/nrf52_express/upload.jlink"
SEGGER J-Link Commander V6.52 (Compiled Sep 27 2019 17:51:12)
DLL version V6.52, compiled Sep 27 2019 17:51:01


J-Link Command File read successfully.
Processing script file...

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Failed to open DLL

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Failed to open DLL

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...FAILED: Failed to open DLL


Script processing completed.

================================================================================================================ [SUCCESS] Took 2.28 seconds ================================================================================================================

Environment       Status    Duration
----------------  --------  ------------
teensy31-arduino  IGNORED
teensy31-mbed     IGNORED
native            IGNORED
huzzah32          IGNORED
nrf52_express     SUCCESS   00:00:02.278
================================================================================================================ 1 succeeded in 00:00:02.278 ================================================================================================================

The upload.jlink contains the following

h
loadbin .pio/build/nrf52_express/firmware.hex,0x0
r
q

No idea what that script is about

Have you resolved this issue?

Haven’t had much time to work on projects since COVID started. will check once i get the chance.

I had similar problem. I resolved it on my Mac by downloading SEGGER - The Embedded Experts - Downloads - J-Link / J-Trace for my mac, installing it and then restarting the computer.

Hope it helps to anyone end up on this thread.

Hmm I tried that before but will try again with 5.0. Thanks