nrfjprog --verify fails when programming just after a recover (nrf5340)

Hello,

To create an automated flash tool, we want to split flashing steps between erase and program steps. 

When performing a recover before flash, program verify fails.

nrfjprog --recover -f NRF53 --coprocessor CP_NETWORK
nrfjprog --program build/zephyr/GENERATED_CP_NETWORK_merged_domains.hex --verify -f NRF53 --coprocessor CP_NETWORK

When using single-line, it work fine. 

nrfjprog --program build/zephyr/GENERATED_CP_NETWORK_merged_domains.hex --recover --verify -f NRF53 --coprocessor CP_NETWORK

I use latest version of nrfjprog (10.23.2). Below is a two steps description of the problem

1) recover both CP_APPLICATION and CP_NETWORK

nrfjprog --recover -f NRF53 --coprocessor CP_APPLICATION
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
Writing image to disable ap protect.
nrfjprog --recover -f NRF53 --coprocessor CP_NETWORK
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
Writing image to disable ap protect.

2) program with --verify the CP_NETWORK (without --recover)

Programmation failed on verify:

[error] [ nRF53] - Failed while performing 'Verify' operation on target address 0x01000000.

nrfjprog --program build/zephyr/GENERATED_CP_NETWORK_merged_domains.hex --verify -f NRF53 --coprocessor CP_NETWORK
[ #################### ] 1.244s | Program file - Done programming
[error] [ Client] - Encountered error -160: Command verify_file executed for 274 milliseconds with result -160
[error] [ nRF53] - Failed while performing 'Verify' operation on target address 0x01000000.
-160: Data does not match in address range [0x01000000 - 0x01005B79] (Network Flash)
Expected byte value 0xA0 but read 0x00 at address 0x01000000.
[error] [ nRF53] - Failed while verifying device. -160: Data does not match in address range [0x01000000 - 0x01005B79] (Network Flash)
Expected byte value 0xA0 but read 0x00 at address 0x01000000.
[error] [ Worker] - Data does not match in address range [0x01000000 - 0x01005B79] (Network Flash)
Expected byte value 0xA0 but read 0x00 at address 0x01000000.
ERROR: Write verify failed.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.

Thanks for your feedback

Related