I have a custom nrf52833 based board that I tried programming over the integrated JLink on then nrf52 dk via swd. All attempts to program or recover the board failed with the same "-21" error from nrfjprog. I also tested the JLinkExe program from segger, which failed with this output:
Device "NRF52833_XXAA" selected. Connecting to target via SWD InitTarget() start InitTarget() end - Took 2.96ms Found SW-DP with ID 0x2BA01477 DPv0 detected Scanning AP map to find all available APs AP[1]: Stopped AP scan as end of AP map has been reached AP[0]: JTAG-AP (IDR: 0x00660000, ADDR: 0x00000000) Iterating through AP map to find AHB-AP to use AP[0]: Skipped. Not an AHB-AP Attach to CPU failed. Executing connect under reset. Failed to power up DAP InitTarget() start InitTarget() end - Took 1.93ms Found SW-DP with ID 0x2BA01477 DPv0 detected Scanning AP map to find all available APs AP[1]: Stopped AP scan as end of AP map has been reached AP[0]: JTAG-AP (IDR: 0x00660000, ADDR: 0x00000000) Iterating through AP map to find AHB-AP to use AP[0]: Skipped. Not an AHB-AP Attach to CPU failed. Executing connect under reset. Failed to power up DAP Error occurred: Could not connect to the target device. For troubleshooting steps visit: https://kb.segger.com/J-Link_Troubleshooting
Some information about my target board and setup.
I have a 2030-ctx cable that I use to connect the debug out port on the nrf52dk to the swd pins on the target.
The target board operates at high voltage mode (5v) from usb.
The VTref voltage on the swd pins on the target is 1.8v.
I have done basic hardware tests. I see the correct voltages and could not detect any shorts or critical issues.
I have also tested an identical board to check if this was a one of issue but that also threw the same error.
Maybe someone had similar issues and can help me resolve this.
If you need more information I would be happy to share schematics, images or anything you need.
Thanks!