nRF9160 Custom board debug issue

Hello DevZone

I am facing an issue debugging my custom board, that embeds an nRF9160. I use a JLink Base to debug the board.
I used to be able to debug with no problem, but it no longer works. Since, I am not sure why exactly (jlink updates ? VS Code ? SDK ? Toolchain ?), I started from scratch and created a dummy project, just for this troubleshoot.

I am using SDK and toolchain 2.4.2.


I created a new project, with a basic main that loop forever.
I created 2 build configurations

  • One using the existing nrf9160dk_ns board.
  • One using a custom board, selecting the SoC nRF9160 NON SECURE.
      I only added the following lines in prj.conf to get the compilation to succeed
        CONFIG_TRUSTED_EXECUTION_NONSECURE=y
        CONFIG_BUILD_WITH_TFM=y

In both cases, I can compile the firmware and flash my board. This means that both my JLink and PCB are working.
Trouble starts when I want to start a debug session ...

Using the build configuration of my custom board results in the following error.


If I select the build configuration with nrf9160dk_ns, I am able to launch a debug. However, this is not what I want, since this configuration contains the device tree corresponding to the DK.

Support info:



myTestApp.zip

  • Support info:

    IMPORTANT: The data below could contain sensitive or confidential information about your environment.
    If you do not wish this to be seen by others, please make sure to remove it before sharing.

    For help and support, visit the Nordic DevZone at devzone.nordicsemi.com/.

    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 10 Home",
        "osKernel": "10.0.22621",
        "vscode": "1.83.0",
        "electron": "25.8.4",
        "node": "v18.15.0"
      },
      "system": {
        "date": "2023-10-05T11:41:31.282Z",
        "vscodeRoot": "c:\\Users\\vince\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "01:54:03",
        "osUptime": "01:56:38",
        "cpu": "AMD Ryzen 5 5600H with Radeon Graphics"
      },
      "workspace": {
        "name": "myTestApp (Workspace)",
        "workspaceFile": "c:\\Users\\vince\\Desktop\\TestFolder\\myTestApp\\myTestApp.code-workspace",
        "folders": [
          "c:\\Users\\vince\\Desktop\\TestFolder\\myTestApp"
        ]
      },
      "sdks": [
        {
          "version": "2.4.2",
          "path": "c:\\ncs\\v2.4.2"
        }
      ],
      "activeBuild": "c:\\Users\\vince\\Desktop\\TestFolder\\myTestApp\\build_myBoard_ns",
      "apps": [
        {
          "workspace": "c:\\Users\\vince\\Desktop\\TestFolder\\myTestApp",
          "uri": "c:\\Users\\vince\\Desktop\\TestFolder\\myTestApp",
          "buildConfigurations": [
            {
              "id": "c:\\Users\\vince\\Desktop\\TestFolder\\myTestApp\\build_myBoard_ns",
              "name": "build_myBoard_ns",
              "boardId": "myboard_ns",
              "type": "Zephyr",
              "isChild": false,
              "isStale": false,
              "taskBindings": {
                "build": [],
                "pristineBuild": [],
                "flash": [],
                "eraseAndFlash": []
              }
            },
            {
              "id": "c:\\Users\\vince\\Desktop\\TestFolder\\myTestApp\\build_nrf9160DK_ns",
              "name": "build_nrf9160DK_ns",
              "boardId": "nrf9160dk_nrf9160_ns",
              "type": "Zephyr",
              "isChild": false,
              "isStale": false,
              "taskBindings": {
                "build": [],
                "pristineBuild": [],
                "flash": [],
                "eraseAndFlash": []
              }
            }
          ]
        }
      ],
      "topdir": "c:\\ncs\\v2.4.2",
      "workspaceState": "freestanding-ready",
      "toolchains": [
        {
          "version": "2.4.2",
          "path": "c:\\ncs\\toolchains\\31f4403e35"
        }
      ],
      "connectedDevices": [
        {
          "serialNumber": "000051001355",
          "boardVersion": "Unknown",
          "deviceFamily": "NRF91_FAMILY",
          "deviceVersion": "NRF9160_xxAA_REV2",
          "jlinkObFirmwareVersion": "J-Link V11 compiled Aug  2 2023 10:34:01"
        }
      ],
      "deviceProvider": "nrfutil",
      "tools": {
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gcc.exe": "0.16.0",
        "C:\\Program Files\\SEGGER\\JLink\\JLink.exe": "7.88j",
        "C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.23.0",
        "C:\\Users\\vince\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\nrfutil.exe": null,
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\cmake.exe": "3.20.5",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Scripts\\west.exe": "1.0.0",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\python.exe": "3.8.2",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\ninja.exe": "1.9.0",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\gperf.exe": "3.1",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\dtc.exe": "1.4.7",
        "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\gn.exe": "2105",
        "C:\\ncs\\toolchains\\31f4403e35\\mingw64\\bin\\git.exe": "2.37.3.windows.1",
        "gdbPath": "c:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gdb.exe"
      },
      "environment": {
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\vince",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\vince",
          "PATH": "C:\\ncs\\toolchains\\31f4403e35;C:\\ncs\\toolchains\\31f4403e35\\mingw64\\bin;C:\\ncs\\toolchains\\31f4403e35\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Scripts;C:\\ncs\\toolchains\\31f4403e35\\opt\\nanopb\\generator-bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\aarch64-zephyr-elf\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\x86_64-zephyr-elf\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin;c:\\Users\\vince\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2023.9.336-win32-x64\\platform\\nrfutil\\lib\\nrfutil-toolchain-manager;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\IVI Foundation\\IVI\\bin;C:\\Program Files\\IVI Foundation\\IVI\\bin;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin\\;C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin\\;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C:\\Program Files\\dotnet\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\vince\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\;C:\\Users\\vince\\AppData\\Local\\Programs\\Python\\Python311\\;C:\\Users\\vince\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\vince\\AppData\\Roaming\\npm;C:\\Users\\vince\\.dotnet\\tools;C:\\Users\\vince\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
          "ZEPHYR_BASE": "c:\\ncs\\v2.4.2\\zephyr",
          "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
          "ZEPHYR_SDK_INSTALL_DIR": "C:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk",
          "PYTHONPATH": "C:\\ncs\\toolchains\\31f4403e35\\opt\\bin;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Lib;C:\\ncs\\toolchains\\31f4403e35\\opt\\bin\\Lib\\site-packages"
        },
        "inherited": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\vince",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\vince",
          "Path": "C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\IVI Foundation\\IVI\\bin;C:\\Program Files\\IVI Foundation\\IVI\\bin;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin\\;C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin\\;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C:\\Program Files\\dotnet\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\vince\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\;C:\\Users\\vince\\AppData\\Local\\Programs\\Python\\Python311\\;C:\\Users\\vince\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\vince\\AppData\\Roaming\\npm;C:\\Users\\vince\\.dotnet\\tools;C:\\Users\\vince\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
          "PATH": "C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\IVI Foundation\\IVI\\bin;C:\\Program Files\\IVI Foundation\\IVI\\bin;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin\\;C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin\\;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C:\\Program Files\\dotnet\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\vince\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\;C:\\Users\\vince\\AppData\\Local\\Programs\\Python\\Python311\\;C:\\Users\\vince\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\vince\\AppData\\Roaming\\npm;C:\\Users\\vince\\.dotnet\\tools;C:\\Users\\vince\\AppData\\Local\\Programs\\Microsoft VS Code\\bin"
        },
        "toolchainPath": "c:\\ncs\\toolchains\\31f4403e35",
        "toolchainBinPath": "c:\\ncs\\toolchains\\31f4403e35\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin",
        "toolchainVersion": "2.4.2"
      },
      "terminal": {
        "defaultProfile": null
      },
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:2.3.0}",
          "toolchain": {
            "path": "${nrf-connect.toolchain:2.3.0}"
          },
          "ozonePath": "",
          "applications": [],
          "applicationOptions": {},
          "kconfig": {
            "interface": "kconfig",
            "executeInDefaultShell": false
          },
          "welcome": {
            "showOnStartup": false
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "taskBindings": {},
          "debugging": {
            "flash": true,
            "bindings": {}
          },
          "activeAppFollowActiveEditor": true,
          "deviceProvider": "nrfutil",
          "enableTelemetry": true,
          "thirdpartyIntegration": {},
          "toolchainManager": {
            "indexURL": null,
            "installDirectory": null
          },
          "nrfutil": {
            "home": null
          },
          "defaultOpenAction": "ask"
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        }
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2023.9.336",
            "path": "c:\\Users\\vince\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2023.9.336-win32-x64",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2023.9.29",
            "path": "c:\\Users\\vince\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2023.9.29",
            "isActive": true
          },
          "nordic-semiconductor.nrf-devicetree": {
            "version": "2023.9.57",
            "path": "c:\\Users\\vince\\.vscode\\extensions\\nordic-semiconductor.nrf-devicetree-2023.9.57",
            "isActive": true
          },
          "nordic-semiconductor.nrf-kconfig": {
            "version": "2023.9.94",
            "path": "c:\\Users\\vince\\.vscode\\extensions\\nordic-semiconductor.nrf-kconfig-2023.9.94",
            "isActive": true
          }
        },
        "external": {
          "marus25.cortex-debug": null,
          "ms-vscode.cpptools": "1.17.5",
          "ms-vscode-remote.remote-wsl-recommender": "0.0.19",
          "ms-vscode.js-debug": "1.83.0",
          "ms-vscode.js-debug-companion": "1.1.2",
          "ms-vscode.vscode-js-profile-table": "1.0.3",
          "lucasazzola.vscode-csproj": "0.7.0",
          "mcu-debug.debug-tracker-vscode": "0.0.15",
          "mcu-debug.memory-view": "0.0.24",
          "mcu-debug.peripheral-viewer": "1.4.6",
          "mcu-debug.rtos-views": "0.0.7",
          "ms-dotnettools.csharp": "2.5.30",
          "ms-dotnettools.vscode-dotnet-runtime": "1.8.0",
          "ms-python.python": "2023.16.0",
          "ms-python.vscode-pylance": "2023.10.10",
          "ms-toolsai.jupyter": "2023.9.1102792234",
          "ms-toolsai.jupyter-keymap": "1.1.2",
          "ms-toolsai.jupyter-renderers": "1.0.17",
          "ms-toolsai.vscode-jupyter-cell-tags": "0.1.8",
          "ms-toolsai.vscode-jupyter-slideshow": "0.1.5",
          "ms-vscode.cpptools-extension-pack": "1.3.0",
          "ms-vscode.cpptools-themes": "2.0.0",
          "patcx.vscode-nuget-gallery": "0.0.24",
          "tomoki1207.pdf": "1.2.2",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17"
        }
      }
    }

  • hello,

    You have no issue with nRf9160DK while debugging? I will pass the generate information to the respective team. Do you want me to make the case private? 

    Thanks.

    BR

    Kazi

  • Hello,

    Yes, debugging a project on the nRF9160DK works fine.

    So far, the case can remain public, since the attached test project is just an empty while(1).

  • I finally solved the problem.

    Don't know why, but the file boards/arm/myCustomBoard/board.cmake (which is, I believe, automatically generated when creating a new board) had the following line :

    board_runner_args(jlink "--device=nrf91" "--speed=4000")

    This data is used to start the debug session. I tried to start the debug session from command line to get some extra details on the error. Turn out "nrf91" is not recognized.

    Changing the line to the "nrf9160"  solved my issue.

    board_runner_args(jlink "--device=nrf9160" "--speed=4000")

    Not sure what happened here. I suspect a modification in the SDK/toolchain, to include the new nRF9161 SiP ? But the SEGGER suite is not ready yet. Or something along those line ?

    Anyway, it's all working now, I can debug my project.

Related