Getting extremely frustrated with nRF5340 DK so far

HW PROBLEM 1
First of all, it seems that the board has some HW issues: when I plug in the USB in the IMCU USB to use the on-board J-Link, the chance of the board booting up properly are very slim. Power source set on VDD. I need to switch ON and OFF around 100 times before the board boot up fine and the power LED stays ON, in most cases the power LED blinks then switch off, and the J-Link is not recognized. As a workaround I discovered a small truck, I use the Power Profiler Kit II VOUT set at 5V, connect to nRF current measurement VDD_HV on the nRF5340 DK, and then i can get it kickstarted (after the boot, I can unplug the VDD_HV and it will stay on).
But this is something insane to do at each boot, it's extremely annoying.
Shuold I RMA?

--------------

Then, let's move to software problems. I'm using a Mac M1.
I have the following problems:

SW PROBLEM 1

Most of the time when adding a build config to a template (e.g. blinky or Matter Lock), without changing or customizing anything, just picking the compatible nRF5340 DK, it gets stuck at:

-- Found GnuLd: /opt/nordic/ncs/toolchains/15b490767d/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 

It seems I'm not the only one (VS-CODE: build hangs: "Found GnuLd: ld.bfd...") but so far no solution, I'm really stuck with this, I'm unable to build any project now.

--------------

SW PROBLEM 2

I'm using latest SDK (2.8.0) and suggested Segger J-Link sw (7.94i universal).
Before starting to have SW PROBLEM 1 I was able to build blinky (and I have an old copy of the proj with the build folder and the merged.hex), but flashing always fails from VS Code / nrfjprog:

 *  Executing task: nRF Connect: Build: blinky/build_2 (active) 

Building blinky
west build --build-dir /Users/anon/blinky/build_2 /Users/anon/blinky

[4/5] cd /Users/anon/blinky/build_2/_sysbuild && /opt/nordic/ncs/toolchains/15b490767d/Cellar/cmake/3.21.0/bin/cmake -E true
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: nRF Connect: Flash: blinky/build_2 (active) 

Flashing build_2 to nRF5340 DK
west flash -d /Users/anon/blinky/build_2 --skip-rebuild --dev-id 1050083703 --erase

-- west flash: using runner nrfjprog
-- runners.nrfjprog: mass erase requested
-- runners.nrfjprog: reset after flashing requested
-- runners.nrfjprog: Flashing file: /Users/anon/blinky/build_2/merged.hex
[error] [ Client] - Encountered error -90: Command read_memory_descriptors executed for 5 milliseconds with result -90
[error] [ Client] - Encountered error -90: Command erase_file executed for 11 milliseconds with result -90
[error] [ Worker] - Can't read memory descriptors, ap-protection is enabled.
[error] [  nRF53] - Failed while erasing device. -90: Access protection is enabled, can't read block protection state. 
[error] [ Worker] - Access protection is enabled, can't read block protection state.
ERROR: The operation attempted is unavailable due to readback protection in
ERROR: your device. Please use --recover to unlock the device.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
ERROR: runners.nrfjprog: Flashing failed because the target must be recovered.
  To fix, run "west flash --recover" instead.
  Note: your target is an nRF53; all flash memory for both the network and application cores will be erased prior to reflashing.
FATAL ERROR: command exited with status 24: nrfjprog --program /Users/anon/blinky/build_2/merged.hex --chiperase --verify -f NRF53 --coprocessor CP_APPLICATION --snr 1050083703

 *  The terminal process terminated with exit code: 24. 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: nRF Connect: Flash: blinky/build_2 

Flashing build_2 to nRF5340 DK
west flash -d /Users/anon/blinky/build_2 --skip-rebuild --dev-id 1050083703 --recover

-- west flash: using runner nrfjprog
-- runners.nrfjprog: reset after flashing requested
-- runners.nrfjprog: Recovering and erasing flash memory for both the network and application cores.
[error] [ Client] - Encountered error -90: Command enable_coprocessor executed for 10 milliseconds with result -90
Recovering device. This operation might take 30s.
[error] [ Worker] - Application core access protection is enabled, can't enable coprocessor.
Erasing user code and UICR flash areas.
Writing image to disable ap protect.
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
Writing image to disable ap protect.
-- runners.nrfjprog: Flashing file: /Users/anon/blinky/build_2/merged.hex
[error] [  JLink] - Not supported by current CPU + target interface combination.
[error] [  JLink] - Not supported by current CPU + target interface combination.
[error] [  JLink] - Not supported by current CPU + target interface combination.
[error] [  JLink] - Not supported by current CPU + target interface combination.
[error] [  JLink] - Not supported by current CPU + target interface combination.
[error] [ Client] - Encountered error -102: Command select_coprocessor executed for 608 milliseconds with result -102
ERROR: Failed when selecting coprocessor APPLICATION
[error] [  JLink] - Not supported by current CPU + target interface combination.
[error] [ Worker] - Failed to read access port 0 register 0.
This indicates that the debug port is available, but the access port is not.
An unknown error.
ERROR: JLinkARM DLL reported an error. Try again. If error condition
ERROR: persists, run the same command again with argument --log, contact Nordic
ERROR: Semiconductor and provide the generated log.log file to them.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
FATAL ERROR: command exited with status 33: nrfjprog --program /Users/anon/blinky/build_2/merged.hex --sectorerase --verify -f NRF53 --coprocessor CP_APPLICATION --snr 1050083703

 *  The terminal process terminated with exit code: 33. 
 *  Terminal will be reused by tasks, press any key to close it. 

Even from command line, nrfjprog it fails 200 times, eventually I found a workaround, but it's annoying as hell

#!/bin/bash

# Initialize variables to track success states
recovery_main_done=false
recovery_network_done=false
recovery_application_done=false

while true; do
    # Run the first command only if it hasn't succeeded yet
    if [ "$recovery_main_done" = false ]; then
        #nrfjprog --recover -f nrf53 --log
        nrfjprog --program /Users/anon/blinky/build/merged.hex --chiperase --verify -f NRF53
        if [ $? -eq 0 ]; then
            recovery_main_done=true
            echo "APP CPU flash succeeded."
        else
            echo "APP CPU flash failed."
        fi
    fi

    # Run the second command only if it hasn't succeeded yet
    if [ "$recovery_network_done" = false ]; then
        nrfjprog --recover -f nrf53 --coprocessor CP_NETWORK --log
        if [ $? -eq 0 ]; then
            recovery_network_done=true
            echo "Network recovery succeeded."
        else
            echo "Network recovery failed."
        fi
    fi

    # Run the third command only if it hasn't succeeded yet
    if [ "$recovery_application_done" = false ]; then
        nrfjprog --recover -f nrf53 --coprocessor CP_APPLICATION --log
        if [ $? -eq 0 ]; then
            recovery_application_done=true
            echo "Application recovery succeeded."
        else
            echo "Application recovery failed."
        fi
    fi

    # Check if all recoveries are done
    if [ "$recovery_main_done" = true ] && [ "$recovery_network_done" = true ] && [ "$recovery_application_done" = true ]; then
        echo "All recoveries completed successfully."
        break  # Exit the loop since everything succeeded
    fi

    # Optional delay to prevent rapid looping
    # sleep 1
done

But it takes several minutes and many attempts while resetting the board before flashing succeed....

I tried also the latest Segger J-Link sw version 8.10i, and I get the same error.

BUT, if I use JFlash.app or JFlashLite.app I can flash both APPCPU and NETCPU in one shot, no errors, zero problems, so it seems there is some bug in nrfjprog.

Still...extremely frustrating to do all those manual operations just to get "blinky" template to run, imagine doing actual development...

I also have a Segger Edu Mini, same behaviour as the embedded J-Link port...

--------------

Then 

While I was struggling to flash, I tried to use latest OPEN-OCD with a RPI4 as flasher, but it seems only the APPCPU hex flashing is supported (and I'm not sure about erasing, recovering, other flags/segments), and NETCPU is not...can you add support for it?

--------------

Then, on top of that, it is frustrating that the only way to do quick development is being forced using VS Code (with buggy config build) + nrfjprog (which is extremely buggy for flashing) and being forced to use Zephyr. Having a micropython port, even not baremetal but running on top of Zephyr, with support for APPCPU/SECCPU/NETCPU would be amazing...

So far the experience have been incredibly frustrating, developing on a ESP32-C6 is like 100X easier, zero problems, everything goes smooth, so far "on paper" the only advantage of nRF5340 is extremely lower power consumption, but for the rest...my gosh what a disaster has been so far...

Parents
  • Hello, 

    Sorry to hear that you are having so many issues with our development kit and SDK toolchain. Now there are a lot of things going on in this ticket, but I would say that some of this boils down to HW issue i.e. board problems. 

    Can you please provide the output from "generate support information" in VS Code. Either by clicking the "headset" icon, or from command palette: nRF Connect: Generate Support information


    Thanks. 

    Kind regards,
    Øyvind

  • I stripped out some env PATH unrelated to Nordic

    // IMPORTANT: The following data can contain sensitive or confidential information about your environment.
    // If you do not want others to see this information, make sure to remove it before sharing the data.
    
    // For help and support, visit Nordic Semiconductor's DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "darwin",
        "osVersion": "Darwin Kernel Version 24.1.0: Tue Sep 17 07:46:59 PDT 2024; root:xnu-11215.40.59~38/RELEASE_ARM64_T6000",
        "osKernel": "24.1.0",
        "vscode": "1.95.3",
        "electron": "32.2.1",
        "node": "v20.18.0"
      },
      "system": {
        "date": "2024-12-02T18:25:54.463Z",
        "vscodeRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "00:03:22",
        "osUptime": "26:31:18",
        "cpu": "Apple M1 Pro"
      },
      "workspace": {
        "name": null,
        "workspaceFile": null,
        "folders": []
      },
      "sdks": [],
      "apps": [],
      "workspaceState": "empty-ready",
      "toolchains": [
        {
          "version": "2.8.0",
          "path": "/opt/nordic/ncs/toolchains/15b490767d"
        }
      ],
      "activeToolchain": {
        "type": "installation",
        "path": "/opt/nordic/ncs/toolchains/15b490767d",
        "version": "2.8.0",
        "displayName": "nRF Connect SDK Toolchain v2.8.0"
      },
      "connectedDevices": [
        {
          "serialNumber": "001050083703"
        }
      ],
      "tools": {
        "/opt/nordic/ncs/toolchains/15b490767d/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": "0.16.8 (arm64)",
        "/Applications/SEGGER/JLink/JLinkExe": "7.94i (x64,arm64)",
        "/usr/local/bin/nrfjprog": "10.24.2 (x64,arm64)",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/cmake": "3.21.0 (arm64)",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/west": "1.2.0",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/python3": "3.12.4 (arm64)",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/ninja": "1.10.2 (arm64)",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/gperf": "3.1 (arm64)",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/dtc": "1.6.1 (arm64)",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/gn": "2201 (arm64)",
        "/opt/nordic/ncs/toolchains/15b490767d/bin/git": "2.37.3 (arm64)",
        "arm-gdbPath": "/opt/nordic/ncs/toolchains/15b490767d/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb",
        "riscv-gdbPath": "/opt/nordic/ncs/toolchains/15b490767d/opt/zephyr-sdk/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gdb"
      },
      "nrfutil": {
        "nrfutil-device": {
          "version": "2.7.2",
          "binPath": "/Users/anon/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.11.75-darwin-arm64/platform/nrfutil/bin/nrfutil-device",
          "jlinkInfo": {
            "name": "JlinkARM",
            "version": "JLink_V7.94i",
            "versionFormat": "string"
          }
        },
        "nrfutil-toolchain-manager": {
          "version": "0.14.4",
          "binPath": "/Users/anon/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.11.75-darwin-arm64/platform/nrfutil/bin/nrfutil-toolchain-manager"
        }
      },
      "environment": {
        "westEnv": {
          "GIT_EXEC_PATH": "/opt/nordic/ncs/toolchains/15b490767d/Cellar/git/2.37.3/libexec/git-core",
          "HOME": "/Users/anon",
          "PATH": "/opt/nordic/ncs/toolchains/15b490767d/bin:/opt/nordic/ncs/toolchains/15b490767d/usr/bin:/opt/nordic/ncs/toolchains/15b490767d/usr/local/bin:/opt/nordic/ncs/toolchains/15b490767d/opt/bin:/opt/nordic/ncs/toolchains/15b490767d/opt/nanopb/generator-bin:/opt/nordic/ncs/toolchains/15b490767d/opt/zephyr-sdk/arm-zephyr-eabi/bin:/opt/nordic/ncs/toolchains/15b490767d/opt/zephyr-sdk/riscv64-zephyr-elf/bin:...<stripped out, nothing related to Nordic>...",
          "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
          "ZEPHYR_SDK_INSTALL_DIR": "/opt/nordic/ncs/toolchains/15b490767d/opt/zephyr-sdk",
          "USER": "anon"
        },
        "inherited": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "/Users/anon",
          "PATH": "...<stripped out, nothing related to Nordic>...",
          "USER": "anon"
        }
      },
      "terminal": {
        "defaultProfile": null
      },
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "",
          "toolchain": {
            "path": ""
          },
          "ozonePath": "",
          "applications": [],
          "applicationOptions": {},
          "kconfig": {
            "interface": "kconfig"
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "taskBindings": {},
          "buildTerminal": {
            "condensedProgress": true
          },
          "debugging": {
            "flash": true,
            "bindings": {},
            "justMyCode": false
          },
          "activeAppFollowActiveEditor": true,
          "flash": {
            "softreset": false,
            "erase": false,
            "recover": false
          },
          "enableTelemetry": true,
          "thirdpartyIntegration": {},
          "toolchainManager": {
            "indexURL": null,
            "installDirectory": null
          },
          "nrfutil": {
            "home": null
          },
          "defaultOpenAction": "ask",
          "terminalProfile": {
            "shell": null
          }
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        }
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2024.11.75",
            "path": "/Users/anon/.vscode/extensions/nordic-semiconductor.nrf-connect-2024.11.75-darwin-arm64",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2024.9.14",
            "path": "/Users/anon/.vscode/extensions/nordic-semiconductor.nrf-terminal-2024.9.14",
            "isActive": true
          },
          "nordic-semiconductor.nrf-devicetree": {
            "version": "2024.11.36",
            "path": "/Users/anon/.vscode/extensions/nordic-semiconductor.nrf-devicetree-2024.11.36",
            "isActive": true
          },
          "nordic-semiconductor.nrf-kconfig": {
            "version": "2024.11.16",
            "path": "/Users/anon/.vscode/extensions/nordic-semiconductor.nrf-kconfig-2024.11.16",
            "isActive": true
          }
        },
        "external": {
          "marus25.cortex-debug": null,
          "ms-vscode.cpptools": "1.22.11",
          "ms-vscode.js-debug": "1.95.3",
          "ms-vscode.js-debug-companion": "1.1.3",
          "ms-vscode.vscode-js-profile-table": "1.0.10",
          "ms-python.debugpy": "2024.12.0",
          "ms-python.isort": "2023.10.1",
          "ms-python.python": "2024.20.0",
          "ms-python.vscode-pylance": "2024.11.3",
          "ms-toolsai.jupyter": "2024.10.0",
          "ms-toolsai.jupyter-keymap": "1.1.2",
          "ms-toolsai.jupyter-renderers": "1.0.21",
          "ms-toolsai.vscode-jupyter-cell-tags": "0.1.9",
          "ms-toolsai.vscode-jupyter-slideshow": "0.1.6",
          "ms-vscode.cmake-tools": "1.19.52",
          "ms-vscode.cpptools-extension-pack": "1.3.0",
          "ms-vscode.cpptools-themes": "2.0.0",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17"
        }
      }
    }

  • Thanks for providing this information. 

    With regards to the issues that you are seeing. Have you installed the Apple Silicon or universal version of your VS Code? How did you install the nRF Connect SDK? What we have seen earlier is the mix of an Intel based environment causing the toolchain to be based on Intel. Can you please confirm? Without testing this at the moment, please see steps in this Reddit thread https://www.reddit.com/r/vscode/comments/zserk6/how_can_i_tell_if_my_vscode_is_the_apple_silicon/

    If you do have this mixed environment, can you please remove the toolchains installed with e.g. Intel based VS Code and reinstall with Apple Silicon or universal based VS Code?

    Kind regards,
    Øyvind

Reply Children
No Data
Related