nRF Connect for VS Code unable to connect to device

Hi!

I'm trying out the nRF Connect for VS Code on a M1 Mac, and have a nRF9160-DK connected.

The VS Code stuff works fine, I'm able to build sample programs fine, but the nRF9160-DK does not show up as "Connected Devices".
I'm able to flash the nRF9160-DK with the newly built .hex-file via the SEGGER Jlink program from the command line (JLinkExe), but not able to flash via "Actions" in the VSCode extension ("No devices connected").

Also the Programmer (from the Desktop manager) does not connect to the device.

I've read other posts stating some issues with the M1 Mac versions, so have (also) tried installed x86-versions of the tools, but still no change.

This is output of the system report (if it might help):

# nRFConnect System Report - 2022-01-02T17-57-31.753Z

- System:     Apple Inc. MacBookPro17,1
- BIOS:       Apple Inc. null
- CPU:        1 x Apple M1 2.4 GHz 8 cores (8 physical)
- Memory:     39.6 MB free of 16 GB total
- Filesystem: /dev/disk3s1s1 (APFS) 460.4 GB 5.8% used

- OS:         macOS (11.6.1) darwin x64

- Versions
    - kernel: 20.6.0
    - git: 2.30.1
    - node: 14.16.0
    - python: 2.7.16
    - python3: 3.8.9

- Connected devices:
    - /dev/tty.usbmodem0009600048861: 000960004886 PCA10090

Any hints of how to solve this?

  • Hi and thanks for your effort so far!

    Here is the updated support info from VSCode:

    {
      "platform": {
        "os": "darwin",
        "osVersion": "Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:38 PDT 2021; root:xnu-7195.141.8~1/RELEASE_ARM64_T8101",
        "osKernel": "20.6.0",
        "vscode": "1.63.2",
        "electron": "13.5.2",
        "node": "v14.16.0"
      },
      "system": {
        "date": "2022-01-04T19:55:03.854Z",
        "vscodeRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "06:15:29",
        "osUptime": "1159:46:22",
        "cpu": {
          "model": "Apple M1",
          "speed": "24 MHz",
          "count": 4
        },
        "memory": {
          "total": "16.00 GB",
          "free": "0.16 GB"
        }
      },
      "workspace": {
        "name": "NRF",
        "workspaceFile": null,
        "folders": [
          "/Users/alfe/Documents/NRF"
        ]
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2021.12.137",
            "path": "/Users/alfe/.vscode/extensions/nordic-semiconductor.nrf-connect-2021.12.137",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2021.11.7",
            "path": "/Users/alfe/.vscode/extensions/nordic-semiconductor.nrf-terminal-2021.11.7",
            "isActive": true
          },
          "nordic-semiconductor.devicetree": null,
          "nordic-semiconductor.kconfig": null
        },
        "external": {
          "marus25.cortex-debug": "0.4.10",
          "ms-vscode.cpptools": "1.7.1",
          "ms-vscode.js-debug": "1.62.0",
          "ms-vscode.js-debug-companion": "1.0.15",
          "ms-vscode.references-view": "0.0.81",
          "ms-vscode.vscode-js-profile-table": "0.0.18",
          "atlassian.atlascode": "2.10.1",
          "cschlosser.doxdocgen": "1.3.2",
          "janjoerke.jenkins-pipeline-linter-connector": "1.2.0",
          "jeff-hykin.better-cpp-syntax": "1.15.10",
          "ms-azuretools.vscode-azureappservice": "0.23.0",
          "ms-azuretools.vscode-azurefunctions": "1.6.0",
          "ms-azuretools.vscode-azureresourcegroups": "0.4.0",
          "ms-python.python": "2021.12.1559732655",
          "ms-python.vscode-pylance": "2021.12.2",
          "ms-toolsai.jupyter": "2021.11.1001550889",
          "ms-toolsai.jupyter-keymap": "1.0.0",
          "ms-toolsai.jupyter-renderers": "1.0.4",
          "ms-vscode-remote.remote-containers": "0.209.6",
          "ms-vscode-remote.remote-ssh": "0.70.0",
          "ms-vscode-remote.remote-wsl": "0.63.13",
          "ms-vscode.azure-account": "0.9.11",
          "ms-vscode.cmake-tools": "1.9.2",
          "ms-vscode.cpptools-extension-pack": "1.1.0",
          "ms-vscode.cpptools-themes": "1.0.0",
          "redhat.java": "1.2.0",
          "redhat.vscode-yaml": "1.2.2",
          "siegebell.incremental-search": "0.2.1",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17",
          "VisualStudioExptTeam.vscodeintellicode": "1.2.15",
          "vscjava.vscode-java-debug": "0.37.0",
          "vscjava.vscode-java-dependency": "0.18.9",
          "vscjava.vscode-java-pack": "0.20.0",
          "vscjava.vscode-java-test": "0.33.1",
          "vscjava.vscode-maven": "0.34.2"
        }
      },
      "tools": {
        "/Applications/SEGGER/JLink/JLinkExe": "7.58b",
        "/Applications/Nordic Semiconductor/bin//nrfjprog": "10.15.1",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/cmake": "3.21.1",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/west": "0.12.0",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/python3": "3.9.6",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/ninja": "1.10.2",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/gperf": "3.1",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/dtc": "1.6.1",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/arm-none-eabi-gcc": "9-2019-q4-major",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/gn": "1959",
        "/opt/nordic/ncs/v1.8.0/toolchain/bin/git": "2.32.0"
      },
      "connectedDevices": [
        {
          "id": "960004886"
        }
      ],
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:1.8.0}",
          "toolchain": {
            "path": "${nrf-connect.toolchain:1.8.0}"
          },
          "ozonePath": "",
          "applications": [
            "${workspaceFolder}/blinky2",
            "${workspaceFolder}/hello_world3",
            "${workspaceFolder}/azure_iot_hub"
          ],
          "jlink": {
            "rtosPlugin": ""
          },
          "kconfig": {
            "interface": "kconfig"
          },
          "welcome": {
            "showOnStartup": false
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "enableTelemetry": false
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        },
        "nordic-semiconductor.devicetree": {
          "modules": [
            "${zephyrBase}",
            "${zephyrBase}/../nrf",
            "."
          ],
          "zephyr": "",
          "ctxFile": "",
          "defaultBoard": ""
        },
        "nordic-semiconductor.kconfig": {
          "root": "",
          "env": {},
          "cfiles": true,
          "disable": false,
          "zephyr": {
            "base": ""
          },
          "python": ""
        },
        "marus25.cortex-debug": {
          "armToolchainPath": null,
          "armToolchainPrefix": "arm-none-eabi",
          "gdbPath": null,
          "JLinkGDBServerPath": null,
          "openocdPath": null,
          "pyocdPath": null,
          "PEGDBServerPath": null,
          "stutilPath": null,
          "stlinkPath": null,
          "stm32cubeprogrammer": null,
          "enableTelemetry": true,
          "flattenAnonymous": false,
          "registerUseNaturalFormat": true,
          "variableUseNaturalFormat": true,
          "dbgServerLogfile": null
        }
      },
      "environment": {
        "westExe": "/opt/nordic/ncs/v1.8.0/toolchain/bin/west",
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "GIT_EXEC_PATH": "/opt/nordic/ncs/v1.8.0/toolchain/Cellar/git/2.32.0_1/libexec/git-core",
          "HOME": "/Users/alfe",
          "PATH": "/opt/nordic/ncs/v1.8.0/toolchain/bin:/Applications/SEGGER/JLink:/Applications/Nordic Semiconductor/bin/:/opt/nordic/ncs/v1.8.0/toolchain/bin/:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin/",
          "ZEPHYR_BASE": "/opt/nordic/ncs/v1.8.0/zephyr",
          "GNUARMEMB_TOOLCHAIN_PATH": "/opt/nordic/ncs/v1.8.0/toolchain",
          "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
          "USER": "alfe"
        },
        "toolchainPath": "/opt/nordic/ncs/v1.8.0/toolchain",
        "toolchainBinPath": "/opt/nordic/ncs/v1.8.0/toolchain/bin",
        "toolchainVersion": "1.8.0"
      },
      "terminal": {
        "shell": null,
        "defaultProfile": null
      }
    }
    

    -Alf

  • Hi Alf,

    Which variant did you chose when installing the J-Link drivers for nrfjprog v10.15.1?

    I see you write that you chose the x86 variants in your original post, but was this for earlier versions of the tools, or did you install the x86 variant for the latest version as well? On M1 based Mac machines you must install the Intel/x86 variant, see Vidar's comment here.

    Can you try uninstalling the Apple Silicon version of VS Code and install the Intel (x86) version of VS Code instead?

    Edit: Please make sure that you have the Intel variant of Python installed as well.

    Best regards,

    Marte

  • Thanks Marte,

    I guess you've finally nailed it!

    x86 versions of JLink drivers and VSCode did the trick!

    Connected devices shows up in VSCode, and debugging, flashing etc works from within VSCode.
    Also the Programmer works nicely, able to connect and read/write to the device through it.

    nrfjprog from the command line still fails, but forcing it to run as x86 works:
    aeh-mbp:hello_world3 alfe$ arch -arch x86_64 nrfjprog -r
    Applying system reset.
    Run.

    A mix of x86 and M1 version does not "communicate" at all!

    The M1 versions (of both JLink and VSCode) mostly works, except that it fails flashing from VSCode, and the Programmer does not connect properly to the device.
    Both fails complaining about the JLinkARM DLL load failing.

    Guess I'll continue using the x86-versions for now, and hope you're able to fix the DLL handling issues for M1 in a future release of your tools?

    -Alf

  • Hi Alf,

    I am glad to hear that the issue is fixed!

    The reason to use Intel is because of driver incompatibilities, as we do not have M1 versions of all components yet. We do have a goal of getting native M1 support, but I do not have any information about when this will happen, unfortunately.

    Best regards,

    Marte

Related