This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrfjprog --program: code starts executing though no --reset option has been given on command line. Causes unwanted activation of readback protection.

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

8203.log.log

Parents
  • Update: i inserted a "pause" command after the --program and the --verify command and added some debug prints to the firmware when it starts. That showed me that the firmware does not start until the --verify operation begins.

    Also i tried downgrading to an older nrfjprog version (10.5.0) to see if that changes anything. The error occurs also with the older version, only a bit less often.

    Frank

Reply
  • Update: i inserted a "pause" command after the --program and the --verify command and added some debug prints to the firmware when it starts. That showed me that the firmware does not start until the --verify operation begins.

    Also i tried downgrading to an older nrfjprog version (10.5.0) to see if that changes anything. The error occurs also with the older version, only a bit less often.

    Frank

Children
No Data
Related