Inconsistent behavior during NVMC ERASEALL register when written from JLinkExe

Hello,

        Want to use Segger JLinkExe for flashing the firmware for production. Found that Command Files can be used to automate the flashing process. Also, using "nrfjprog" is out of the question cause we need to run the automation script on ARM based SBCs as well.

Facing issues with Internal Flash erase.

1. Using NVMC Registers to invoke ERASEALL

2. Following this sequence -> read_data.jlink (everything is 0xFFFFFFFF) -> write_data.jlink -> read_data.jlink (data written is correct) -> erase_nrf52.jlink -> read_data.jlink

3. When the last read_data.jlink is done, a lot of the times, the data is not 0xFFFFFFFF (erase should set it to this always right?)

Questions -

1. Is the script being used correctly?

2. How to get consistent erases every time?

PFA the .jlink command files that are being used  with command -

$ JLinkExe -nogui 1 -device nrf52 -if SWD -speed 4000 -CommandFile <command_file.jlink>

read_data.jlink:
---------------
mem32 0x20000, 3
exit

write_data.jlink:
----------------
h
w4 0x20000, abababab, babababa, deadbeef
exit

erase_nrf52.jlink:
-----------------
h
w4 0x4001e504, 2
w4 0x4001e50c, 1
sleep 100
r
exit

Parents Reply Children
No Data
Related