This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Flash erasing has strange behavior with nrfjprog 10.3.0

I updated to v10.3.0 of the nrfjprog and mergehex tools and I've noticed that the behavior of the page erase command takes far less time when it gets to a certain region of the flash, and that it's very inconsistent if things get flashed there after.

An example from the log is this:

$ west -v flash
ZEPHYR_BASE=<private>/ncs/zephyr (origin: configfile)
ninja: no work to do.
Using runner: nrfjprog
nrfjprog --ids
Flashing file:<private>/ncs/ss-firmware/experiment/shell_test/build/zephyr/merged.hex
nrfjprog --program<private>/ncs/ss-firmware/experiment/shell_test/build/zephyr/merged.hex -f NRF91 --snr 960024724 --sectorerase
Parsing hex file.
Erasing page at address 0x0.
Erasing page at address 0x1000.
Erasing page at address 0x2000.
Erasing page at address 0x3000.
Erasing page at address 0x4000.
Erasing page at address 0x5000.
Erasing page at address 0x6000.
Erasing page at address 0x7000.
Erasing page at address 0xC000.
Erasing page at address 0xD000.
Erasing page at address 0xE000.
Erasing page at address 0xF000.
Erasing page at address 0x10000.  <-- Erasing page command starts taking significantly less time at around this point
Erasing page at address 0x11000.
Erasing page at address 0x12000.
Erasing page at address 0x13000.
Erasing page at address 0x14000.
Erasing page at address 0x15000.
Erasing page at address 0x16000.
Erasing page at address 0x17000.
Erasing page at address 0x18000.
Erasing page at address 0x19000.
Erasing page at address 0x1A000.
Erasing page at address 0x1B000.
Erasing page at address 0x1C000.
Erasing page at address 0x1D000.
Erasing page at address 0x1E000.
Erasing page at address 0x1F000.
Erasing page at address 0x20000.
Erasing page at address 0x21000.
Erasing page at address 0x22000.
Erasing page at address 0x23000.
Erasing page at address 0x24000.
Erasing page at address 0x25000.
Erasing page at address 0x26000.
Erasing page at address 0x27000.
Erasing page at address 0x28000.
Erasing page at address 0x29000.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
nrfjprog --pinreset -f NRF91 --snr 960024724
Applying pin reset.
Board with serial number 960024724 flashed successfully.

If enough changes with the application image being merged with the spm image, the spm no longer has the correct address to jump to and the processor either hangs or goes into a reboot loop.

If I change the flash command to use the "--erase" command instead everything seems to work correctly.  Also if I revert to v10.2.1 the page erase commands all take the same amount of time again.

Is this a known issue with the latest nrfjprog?

Cheers!

Parents
  • I'm seeing the same issues.  Also I have the --verify flag added to my nrfjprog --program command to ensure the firmware got on the device correctly, and it causes nrfjprog to fail every other time.  I read somewhere there is an issue with --sectorerase not working consistently.  You might want to add this as well because you might have hidden programming issues.  My only work-around is to call nrfjprog until it succeeds (seems to always be twice).

    while true; do
         nrfjprog --program build/zephyr/merged.hex --sectorerase -r -f nrf91 --verify
         if [ $? -eq 0 ]; then
             break
         fi
         sleep 1 
    done

Reply
  • I'm seeing the same issues.  Also I have the --verify flag added to my nrfjprog --program command to ensure the firmware got on the device correctly, and it causes nrfjprog to fail every other time.  I read somewhere there is an issue with --sectorerase not working consistently.  You might want to add this as well because you might have hidden programming issues.  My only work-around is to call nrfjprog until it succeeds (seems to always be twice).

    while true; do
         nrfjprog --program build/zephyr/merged.hex --sectorerase -r -f nrf91 --verify
         if [ $? -eq 0 ]; then
             break
         fi
         sleep 1 
    done

Children
No Data
Related