I am building an automated test stand for programming our production devices. After programming, I need to pin-reset the device to leave debug mode so I can get an accurate current measurement as part of a go/no-go test before the device is accepted.
I've used "nrfjprog -p" and it works correctly -- I can see the current drop from about 1mA (see why does my nrf51822 consume 1mA in sleep ), but I can't use "nrfjprog" in my test stand code, because it's running on Mac OS X.
I've tried the equivalent advice provided in the linked question, which is to use JLinkExe to send the commands "w4 40000544 1" and then "r". However, this does not achieve the pin reset. I have also tried "RSetType 2" before "r", and this also did not have any effect.
Exactly what set of commands in JLinkExe is "nrfjprog -p" doing?
I found a JLink incantation that works! After setting the appropriate NRF_POWER->RESET register to enable pin resetting, it next switches the Segger device into JTAG mode and directly manipulates the SWDIO (i.e. TMS) / SWDCLK (i.e. TCK) level to achieve the reset. This provides a pin reset, which provides a hard reset and does not re-engage the debugger mode.
w4 40000544 1
Tested and working for me!
Thanks for this. Added to github.com/.../jlinkpy