[SOLVED] Could not connect to J-Link

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Could not connect to J-Link

    Hi,
    I am really struggling to get Segger working with PlatformIO and VSCode.

    I ave a number of different projects written in C++ using Platform IO / VSCode and I can’t seem to get it all working correctly, I am at a complete loss of what to do and where the problem may be. I have been struggling for a number of days with very little I can do to try and get it working.

    I was originally going to post about the debugger stuck at ’Starting Target CPU’ but now I can’t even get that far. I get a 'Failed to open listener port 2331’ which after a few more moments of messages I end up with ‘Command Aborted’.

    I have no idea where to how to resolve it, I’ve tried different software and redoing everything again, but I can’t make progress.

    Can somebody give me any clues as to what to do, where I can find debug info and any idea how to configure it.

    Thanks for reading may post

    Mac OS: Catalina
    VSCode: 1.51.0
    PlatformOI: Core 5.0.2, Home 3.3.1

    undefinedFailed to open listener port 2331
    Reading symbols from /Users/matthew/Documents/PlatformIO/Projects/arduino_jlink/.pio/build/mkrwan1310/firmware.elf...
    done.
    PlatformIO Unified Debugger -> bit.ly/pio-debug
    PlatformIO: debug_tool = jlink
    PlatformIO: Initializing remote target...
    0x0080d800 in ?? ()
    Select auto target interface speed (2000 kHz)
    Resetting target
    Loading section .text, size 0x3974 lma 0x2000
    Loading section .ramfunc, size 0x5c lma 0x5974
    Loading section .data, size 0x90 lma 0x59d0
    Start address 0x3ef8, load size 14944
    Transfer rate: 119552 bits in <1 sec, 4981 bytes/write.
    Temporary breakpoint 1 at 0x4054: file /Users/matthew/.platformio/packages/framework-arduino-samd/cores/arduino/main.cpp, line 34.
    PlatformIO: Initialization completed
    PlatformIO: Resume the execution to `debug_init_break = tbreak main`
    PlatformIO: More configuration options -> bit.ly/pio-debug
    Warning:
    Cannot insert breakpoint 1.
    Cannot access memory at address 0x4054

    Command aborted.
    They tell me I’m a grown up, I just want to play.
  • Hi,
    Thank you for your inquiry.

    This article might help you:
    wiki.segger.com/J-Link_Visual_…Code#Apple_Mac_OS_X_Setup

    If you generally have problems to connect to your device/J-Link, you can find a troubleshooting guide here:
    wiki.segger.com/J-Link_cannot_connect_to_the_CPU

    Best regards,
    Fabian
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/


    Or you can contact us via e-mail.
  • Hi,

    Thanks for the links, but I am still struggling.

    I have reinstalled VSCode, Platform IO and tried a really simple application. I already have gcc installed and I tried to ensure the path was set correctly, but your instructions don’t appear to be correct for the version of VSCode I have and it is not easy for me to understand what they are trying to configure. The tool recommends that you configure via the UI, which I can understand, so I am somewhat stuck.

    The second link you shared references J-Link Commander, I have no such application, which one is on Mac? If I use JLinkExe, it works, I can connect and gather info about processor and indicates 'Cortex-M0 identified.‘ so that appears to suggest there is a connection between the my Mac and the EDU Mini.

    It all appears to start, the debugger compiles, appears to do something and then the debug window stops at init. I can click forward using the debug controls, until I get to setup at which point it just stops - no error messages, nothing. If I had an error to go by, it would be much easier, but I have nothing. continually clicking just appears to change the screen below with nothing actually happening.

    I suspect the Segger is working, but without any information I am at a complete loss, son I am really grateful for your help.

    Below are the various configuration files, maybe they will help.

    here is my c_cpp_properties file:-
    {
    "configurations": [
    {
    "name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE docs.platformio.org/page/proje…nv_build.html#build-flags"
    },
    {
    "name": "Mac",
    "macFrameworkPath": [],
    "includePath": [
    "/Users/matthew/Documents/PlatformIO/Projects/arduino_jlink/include",
    "/Users/matthew/Documents/PlatformIO/Projects/arduino_jlink/src",
    "/Users/matthew/.platformio/packages/framework-cmsis@1.40500.0/CMSIS/Include",
    "/Users/matthew/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/cores/arduino",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/variants/mkrwan1300",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/HID",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/I2S/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SAMD_AnalogCorrection/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SAMD_BootloaderUpdater/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SDU/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SPI",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/USBHost/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/Wire",
    "/Users/matthew/.platformio/packages/tool-unity",
    ""
    ],
    "browse": {
    "limitSymbolsToIncludedHeaders": true,
    "path": [
    "/Users/matthew/Documents/PlatformIO/Projects/arduino_jlink/include",
    "/Users/matthew/Documents/PlatformIO/Projects/arduino_jlink/src",
    "/Users/matthew/.platformio/packages/framework-cmsis@1.40500.0/CMSIS/Include",
    "/Users/matthew/.platformio/packages/framework-cmsis-atmel/CMSIS/Device/ATMEL",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/cores/arduino",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/variants/mkrwan1300",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/HID",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/I2S/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SAMD_AnalogCorrection/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SAMD_BootloaderUpdater/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SDU/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/SPI",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/USBHost/src",
    "/Users/matthew/.platformio/packages/framework-arduino-samd/libraries/Wire",
    "/Users/matthew/.platformio/packages/tool-unity",
    ""
    ]
    },
    "defines": [
    "PLATFORMIO=50003",
    "ARDUINO_SAMD_MKRWAN1310",
    "__SAMD21G18A__",
    "USE_ARDUINO_MKR_PIN_LAYOUT",
    "USE_BQ24195L_PMIC",
    "VERY_LOW_POWER",
    "ARDUINO=10805",
    "F_CPU=48000000L",
    "USBCON",
    "USB_VID=0x2341",
    "USB_PID=0x8059",
    "USB_PRODUCT=\"Arduino MKR WAN 1310\"",
    "USB_MANUFACTURER=\"Arduino\"",
    "ARDUINO_ARCH_SAMD",
    ""
    ],
    "intelliSenseMode": "gcc-x64",
    "cStandard": "c11",
    "cppStandard": "c++11",
    "compilerPath": "/Users/matthew/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin/arm-none-eabi-gcc",
    "compilerArgs": [
    "-mcpu=cortex-m0plus",
    "-mthumb",
    ""
    ]
    ],
    "version": 4

    My platformio.ini file

    [env:mkrwan1310]
    platform = atmelsam
    board = mkrwan1310
    framework = arduino

    debug_tool = jlink
    upload_protocol = jlink


    My launch.json:
    // AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
    // PIO Unified Debugger
    //
    // Documentation: docs.platformio.org/page/plus/debugging.html
    // Configuration: docs.platformio.org/page/projectconf/section_env_debug.html

    {
    "version": "0.2.0",
    "configurations": [
    {
    "type": "platformio-debug",
    "request": "launch",
    "name": "PIO Debug",
    "executable": "/Users/matthew/Documents/PlatformIO/Projects/arduino_jlink/.pio/build/mkrwan1310/firmware.elf",
    "projectEnvName": "mkrwan1310",
    "toolchainBinDir": "/Users/matthew/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin",
    "svdPath": "/Users/matthew/.platformio/platforms/atmelsam/misc/svd/ATSAMD21G18A.svd",
    "preLaunchTask": {
    "type": "PlatformIO",
    "task": "Pre-Debug"
    },
    "internalConsoleOptions": "openOnSessionStart"
    },
    {
    "type": "platformio-debug",
    "request": "launch",
    "name": "PIO Debug (skip Pre-Debug)",
    "executable": "/Users/matthew/Documents/PlatformIO/Projects/arduino_jlink/.pio/build/mkrwan1310/firmware.elf",
    "projectEnvName": "mkrwan1310",
    "toolchainBinDir": "/Users/matthew/.platformio/packages/toolchain-gccarmnoneeabi@1.70201.0/bin",
    "svdPath": "/Users/matthew/.platformio/platforms/atmelsam/misc/svd/ATSAMD21G18A.svd",
    "internalConsoleOptions": "openOnSessionStart"
    }
    ]
    They tell me I’m a grown up, I just want to play.
  • Hello,

    mattb1969 wrote:

    The second link you shared references J-Link Commander, I have no such application, which one is on Mac? If I use JLinkExe, it works, I can connect and gather info about processor and indicates 'Cortex-M0 identified.‘ so that appears to suggest there is a connection between the my Mac and the EDU Mini.
    Yes, J-Link Commander is JLinkExe on macOS.
    So general connection with J-Link is working. From our software perspective there are no issues then.

    Please understand that we can't provide more assistance in the setup of VSCode and PlatformIO than the Wiki article provided by Fabian as both softwares are neither maintained nor supported through SEGGER.
    The Wiki article was successfully tested on all three OSs. Should something not work with your setup we recommend to try VSCode/PlatformIO support.

    We will keep this thread open for now, if someone from the community can provide you with more details.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.