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...