I'm using nrfjprog version: 10.13.0 / JLinkARM.dll version: 7.50a to flash a firmware onto a custom PCB with nRF52840. Programming hardware is a nRF52840 DK. Our firmware activates readback protection on the first boot.
Here is the programming script that i use:
nrfjprog -f NRF52 --recover
nrfjprog -f NRF52 --program final_image_1_1_8_no_sp.hex --chiperase
nrfjprog -f NRF52 --verify final_image_1_1_8_no_sp.hex --fast
nrfjprog -f NRF52 --reset
I noticed that sometimes the 3rd and 4th line of the script fail due to activated readback protection. So i assume that the firmware already starts after the --program step. The firmware will then activate the readback protection after a while, and if the timing is bad, then the --verify and --reset will fail.
This is what the output looks like, when the error occurs:
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --recover
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --program final_image_1_1_8_no_sp.hex --chiperase
Parsing image file.
Applying system reset.
Verified OK.
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --verify final_image_1_1_8_no_sp.hex --fast
ERROR: The operation attempted is unavailable due to readback protection in
ERROR: your device. Please use --recover to unlock the device.
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --reset
ERROR: The operation attempted is unavailable due to readback protection in
ERROR: your device. Please use --recover to unlock the device.
Command output after a succesful operation is this:
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --recover
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --program final_image_1_1_8_no_sp.hex --chiperase
Parsing image file.
Applying system reset.
Verified OK.
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --verify final_image_1_1_8_no_sp.hex --fast
Verifying programming.
Verified OK.
C:\Temp\1.1.8_internal>nrfjprog -f NRF52 --reset
Applying system reset.
Run.
Though no --reset or --verify option is given with the --program command, it appears to do a system reset and a verify.
A log file from a failed skript execution is attached.
Best regards,
Frank