On my dev system:
- MacOS (Monterey 12.6)
- Visual Studio Code v1.76.2
- nRF Connect SDK and toolchain v2.3.0
From a fresh start on my computer, plugged into my nRF5340dk, I can launch VS Code and debug the stock peripheral_uart example. However, if I halt that example and attempt to debug it again, the system attempts to flash the example, makes considerable progress in the flashing process, then halts with this error:
[ #################### ] 12.132s | Erase file - Done erasing [ #################### ] 1.239s | Program file - Done programming [ #################### ] 1.259s | Verify file - Done verifying [ #################### ] 5.708s | Erase file - Done erasing [error] [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.". [error] [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.". [error] [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.". [error] [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.". [error] [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.". [error] [ nRF53] - The write access failed, but no cause could be determined. [error] [ nRF53] - It may be due to an unaligned access, accessing a nonexistent memory, or a communication issue. [error] [ nRF53] - Failed writing to code! [error] [ nRF53] - Failed to program flash [error] [ nRF53] - Failed while programming file /Users/craigbroadbooks/Dev/Baxter/picard/nRF5340-firmware/peripheral_uart/build/zephyr/GENERATED_CP_APPLICATION_merged_domains.hex. 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/craigbroadbooks/Dev/Baxter/picard/nRF5340-firmware/peripheral_uart/build/zephyr/GENERATED_CP_APPLICATION_merged_domains.hex --sectorerase --verify -f NRF53 --snr 1050040129 --coprocessor CP_APPLICATION
Once in this state, I have found two ways to again debug the peripheral_uart example. This first is to perform the "Recover Board" option for the device. This doesn't always work. The second option is to reset the device, then debug another example(blinky, peripheral_hr, or similar). Once the other example loads, I can halt it and then debug the peripheral_uart example just fine. So far these are the only solutions I've found.
Please note that I can debug other examples over and over without any issues. This error scenario only seems to happen with the peripheral_uart example.
Is there a way to debug the peripheral_uart example successively without resorting to these workarounds? This is quite important because the firmware I'm developing is based on the peripheral_uart template, so I/we will be affected by this issue indefinitely.
Please let me know if I need to clarify anything and provide additional information.
Thanks,
Craig