The datasheet appears to say that a pin_reset does not completely reset the chip:
in particular it does not reset the SWJ-DP interface which, I believe, in some circumstances leaves the debugger running and causes excessive current. This is referred to in this case:
and this case:
I have two questions:
1) Is the table above correct because when we issue a soft reset from nrfjprog we do not get the extra 1ma which implies that SWJ-DP is being reset
2) Is it possible for the firmware to determine the state of SWJ-DP and, if necessary, disable it
Okay, so the current stays at the 1mA (debug current) after you call --pinreset, but not when --reset is called? A pin reset is not a "hard reset" per se. Only the power-on and brownout resets…
1. Yes, this table should be correct. As you can see there is also a "Debug" column here, referring to the Debug and trace chapter for more information. In section 4.8.4 Debug Interface mode there is more information on when SWJ-DP is used. When a debug session is over, the external debugger makes sure to put the device back into normal mode, usually done by a soft reset, resetting the "debug" mode. In some cases if the SWJ-DP is active, this will require a hard reset. The state of the SWJ-DP can not be read I'm afraid, and will only be disabled on a hard reset, Power-on reset or Brownout. As long as the debug current is gone it should be safe to say that the SWJ-DP and debug mode is disabled as expected. If you want to be 100% sure without checking, a hard reset is required.
What specific nrfjprog command are you using to reset the device? There are --pinreset, --reset, or --debugreset. Which one are you using? If you're in doubt of what reset was called you can also read the RESETREAS register after a reset which will tell you what kind of reset was trigged.
We were using --pinreset but this didn't seem to clear the problem although --reset did
Is 'hard reset' the same as 'pin reset' - or is 'hard reset' only really power up?
Okay, so the current stays at the 1mA (debug current) after you call --pinreset, but not when --reset is called? A pin reset is not a "hard reset" per se. Only the power-on and brownout resets are considered "hard resets" as they reset all the target registers. --reset is also a soft reset that sets the SysResetReq bit of the AIRCR register of the core. The core will run after the operation.