We have an automated test system which builds, flashes and then runs our SW on various different Nordic nRF5x DK boards: nRF52840, nRF5340 and now nRF52833.
The problem we have is that, in the nRF52833 case, and that case _only_, flash download fails to work 50% of the time, reporting the error given in the subject line (see also full output at the bottom of this post).
With the nRF52840DK boards and the nRF5340DK boards, flash download is always 100% successful (and has been for years), but with the nRF52833DK board that we added a few months ago we simply cannot get the flash download to work reliably. We have tried more than one nRF52833DK board and the problem remains. We have even tried using a dedicated Segger J-Link box connected to the debug connector on the nRF52833DK board, rather than connecting via the on-board debug chip, but the problem is the same: 50% of the time the flash download fails, always with the error given above.
In all cases, for all boards, flashing/running is done from a Raspberry Pi 4 [identical machines, all SD-card copies] using west (NCS 2.3/Zephyr 3.3) as follows:
west flash --skip-rebuild -d /home/build --erase --recover
[we always add --erase and --recover in all cases as we have hit situations where those are necessary and they do no harm when added for all cases].
Anticipating that you will ask for a log from nrfjprog, we tried adding --log to the end of the west command-line but that doesn't seem to work:
How should we go about getting reliable flash downloads to an nRF52833DK board?
Full output from west:
west flash --skip-rebuild -d /home/build --erase --recover -- west flash: using runner nrfjprog -- runners.nrfjprog: mass erase requested Using board 685174508 -- runners.nrfjprog: Recovering and erasing all flash memory. Recovering device. This operation might take 30s. [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] - 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] - 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] - 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] - 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] - 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] - 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] - 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] - 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] - 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] - 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] - 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: Recover failed. Please make sure that the correct device family is given ERROR: and try again. 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 62: nrfjprog --recover -f NRF52 --snr 685174508 script returned exit code 62
For reference, here is a success case:
west flash --skip-rebuild -d /home/build --erase --recover -- west flash: using runner nrfjprog -- runners.nrfjprog: mass erase requested Using board 685174508 -- runners.nrfjprog: Recovering and erasing all flash memory. Recovering device. This operation might take 30s. Erasing user code and UICR flash areas. -- runners.nrfjprog: Flashing file: /home/build/zephyr/zephyr.hex [ ###### ] 0.000s | Erase file - Check image [ #################### ] 0.205s | Erase file - Done erasing [ ###### ] 0.000s | Program file - Checking image [ #### ] 0.000s | Check image validity - Initialize device info [ ######## ] 0.000s | Check image validity - Check region 0 settings [ ############ ] 0.000s | Check image validity - block 1 of 3 [ #################### ] 0.010s | Check image validity - Finished [ ############# ] 0.000s | Program file - Programming [ ###### ] 0.000s | Programming image - block 1 of 2 [ #################### ] 0.000s | Programming image - Write successful [ #################### ] 4.500s | Program file - Done programming [ ###### ] 0.000s | Verify file - Check image [ #### ] 0.000s | Check image validity - Initialize device info [ ######## ] 0.000s | Check image validity - Check region 0 settings [ ############ ] 3.192s | Check image validity - block 1 of 3 [ #################### ] 0.000s | Check image validity - Finished [ ############# ] 0.000s | Verify file - Verifying [ ###### ] 0.000s | Verifying image - block 1 of 2 [ #################### ] 0.000s | Verifying image - Verify successful [ #################### ] 4.426s | Verify file - Done verifying Enabling pin reset. Applying pin reset. -- runners.nrfjprog: Board with serial number 685174508 flashed successfully.