Can't flash nrf5340 via SWD

Hello, 

I am having trouble programming the nrf5340 chip using SWD. 

Set up: 

 Custom hardware with the MDBT53V-1M module from Raytac, nrf5340 chip.

 SWD, using J-Link EDU mini. 

Problem scenario: was able to flash the code to the chip at first. Then after few successful attempts, failed to connect to target.

Now, I have another board with the same hardware and can connect to the chip fine there, so that eliminates the wrong wiring problem. 

I suspect the chip has gone into AP protect mode or  something similar which is preventing the SWD. 

Any help is much appreciated. 

Thank You

PS C: nrfjprog --recover
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 736.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 629.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 911.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3139.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3087.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3112.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3349.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3160.
[error] [SeggerBackend] - JLinkARM.dll reported error -256 at line 3176.
[error] [ Client] - Encountered error -6: Command connect_to_emu_with_snr executed for 10124 milliseconds with result -6
ERROR: Unable to connect to a debugger.
[error] [ Worker] - Device is not recognized.
ERROR: nrfjprog could not identify the target device. This may be due to an 
ERROR: invalid family argument, a problem with your device, or nrfjprog may
ERROR: not yet support your device.
ERROR: Please check the family argument passed, or upgrade nrfjprog to a more
ERROR: recent version.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.

Related