NRF5340-DK's JLink resetting during firmware validation for 50% of flashes in VSCode

Hi all,

I recently installed the nRF Connect SDK and have had some success. Very snazzy.

I have seen some issues with the JLink on the DK resetting during firmware validation about half the time when selected through VS Code. The issue reports as below when it happens. 

[ #################### ] 11.027s | Erase file - Done erasing
[ #################### ] 1.239s | Program file - Done programming
[error] [ JLink] - Communication timed out: Requested 8196 bytes, received -1 bytes !
[error] [SeggerBackend] - JLinkARM.dll ReadMem returned error 1.
[error] [SeggerBackend] - JLinkARM.dll ReadMem returned error 1.
[error] [SeggerBackend] - JLinkARM.dll ReadMem returned error 1.
[error] [SeggerBackend] - JLinkARM.dll ReadMem returned error 1.
[error] [SeggerBackend] - JLinkARM.dll ReadMem returned error 1.
[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 read access failed due to memory protection.
[error] [ nRF53] - Failed to read from flash
[error] [ nRF53] - Flash verification failed.
[error] [ nRF53] - Failed while verifying file C:\ncs\v2.1.0\nrf\samples\bluetooth\peripheral_uart\build\zephyr\GENERATED_CP_NETWORK_merged_domains.hex.
[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] [SeggerBackend] - Failed while ensuring debug power was enabled for device connection.
[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: The JLinkARM DLL timed out while communicating to the J-Link probe.
ERROR: If the error condition persists, run the same command again with
ERROR: argument -- log, contact Nordic Semiconductor and provide the generated
ERROR: 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 35: nrfjprog --program 'C:\ncs\v2.1.0\nrf\samples\bluetooth\peripheral_uart\build\zephyr\GENERATED_CP_NETWORK_merged_domains.hex' --sectorerase --verify -f NRF53 --snr 960154273 --coprocessor CP_NETWORK

Since the hex file is preserved I did the same command in the command prompt and am unable to reproduce the issue. When it happens, it sounds like the JLink spontaneously disconnects and reconnects from the PC, and the auto-load drag and drop window appears. Since I can't get it to reproduce on the command line, I can't use the --log option to provide any additional info. 

Running Windows 10, VS Code 1.68.1, and the latest nRF Connect SDK and extensions provided by the toolchain editor (as of 10/18). 

It's not a super blocking issue since it fixes itself the next time I try, it's just a quality of life thing. Any advice would be appreciated - hopefully I missed a config or a jumper or something. 

Related