I use nrfjprog in a CI system (on Windows 10) which has multiple NRF52 boards attached to it. The boards are all run in parallel with the -s parameter to nrfjprog and the -USB parameter to jlink (which is used to obtain RTT logging from the boards) indicating which board is being addressed by each command-line operation. I also apply mutex locks so that nrfjprog is never called at the same time to program two different boards.
About 1 in 10 times my call to nrfjprog just hangs, does nothing. When I terminate it the return value is 15, "The arguments passed do not perform a valid operation", but the parameters are always the same:
nrfjprog -f nrf52 --program nrf52840_xxaa.hex --chiperase --verify -r -s <serialnumber>
Retrying the command doesn't help, nrfjprog just continues to hang. I believe that on the occasions this occurs jlink has just completed a logging session and the board is being programmed for the next thing. Like I say, it doesn't happen all the time, roughly 1 in 10 times, which is enough to cause frequent CI failures.
Any suggestions as to what I might do to work around this?
Version numbers are:
nrfjprog version: 10.6.0
JLinkARM.dll version: 6.80a