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

Flashing nRF91 through segger always fails on first try

Modem firmware version 1.0.0

Segger version v4.18

nrf tag v1.0.0

Often when I try to flash a new build of an application and try to flash an application through Targert->Download zephyr/merged.hex I get an "Undocumented error"

Below is the Target output

Preparing target for download
Executing Reset script TargetInterface.resetAndStop()
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Reset: CPU may have not been reset (DHCSR.S_RESET_ST never gets set).
Reset: Using fallback: Reset pin.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via reset pin
Reset: VC_CORERESET did not halt CPU. (Debug logic also reset by reset pin?).
Reset: Reconnecting and manually halting CPU.
Found SW-DP with ID 0x6BA02477
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FD212. Implementer code: 0x41 (ARM)
Found Cortex-M33 r0p2, Little endian.
Downloading 'merged.hex' to J-Link
Programming 32.0 KB of addresses 00000000 -- 00007fff
Programming 169.1 KB of addresses 0000c000 -- 0003649b
Timeout while erasing sectors, RAMCode did not respond in time. (PC = 0xFFFFFFFF, CPSR = 0x00000000, LR = 0x21000003)!
Failed to erase sectors.
Download failed

Below is the log output, it will always get stuck at around this point(either section 29 or 30 of SRAM)

[11:43:13:013] ***** Booting Zephyr OS v1.14.99-ncs2 *****␍␊
[11:43:13:019] Flash region⇥	⇥	Domain⇥	⇥	Permissions␍␊
[11:43:13:022] 00 0x00000 0x08000 ⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:026] 01 0x08000 0x10000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:031] 02 0x10000 0x18000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:031] 03 0x18000 0x20000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:036] 04 0x20000 0x28000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:040] 05 0x28000 0x30000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:040] 06 0x30000 0x38000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:045] 07 0x38000 0x40000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:052] 08 0x40000 0x48000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:052] 09 0x48000 0x50000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:058] 10 0x50000 0x58000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:058] 11 0x58000 0x60000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:064] 12 0x60000 0x68000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:064] 13 0x68000 0x70000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:071] 14 0x70000 0x78000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:071] 15 0x78000 0x80000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:078] 16 0x80000 0x88000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:078] 17 0x88000 0x90000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:087] 18 0x90000 0x98000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:087] 19 0x98000 0xa0000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:087] 20 0xa0000 0xa8000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:094] 21 0xa8000 0xb0000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:094] 22 0xb0000 0xb8000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:101] 23 0xb8000 0xc0000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:101] 24 0xc0000 0xc8000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:105] 25 0xc8000 0xd0000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:105] 26 0xd0000 0xd8000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:111] 27 0xd8000 0xe0000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:117] 28 0xe0000 0xe8000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:117] 29 0xe8000 0xf0000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:121] 30 0xf0000 0xf8000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:124] 31 0xf8000 0x100000 ⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:128] Non-secure callable region 0 placed in flash region 0 with size 32.␍␊
[11:43:13:133] ␍␊
[11:43:13:133] ␍␊
[11:43:13:133] SRAM region⇥	⇥	Domain⇥	⇥	Permissions␍␊
[11:43:13:137] 00 0x00000 0x02000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:140] 01 0x02000 0x04000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:140] 02 0x04000 0x06000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:144] 03 0x06000 0x08000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:147] 04 0x08000 0x0a000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:151] 05 0x0a000 0x0c000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:154] 06 0x0c000 0x0e000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:158] 07 0x0e000 0x10000⇥	Secure⇥	⇥	rwxl␍␊
[11:43:13:158] 08 0x10000 0x12000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:161] 09 0x12000 0x14000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:166] 10 0x14000 0x16000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:169] 11 0x16000 0x18000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:173] 12 0x18000 0x1a000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:176] 13 0x1a000 0x1c000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:179] 14 0x1c000 0x1e000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:179] 15 0x1e000 0x20000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:183] 16 0x20000 0x22000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:187] 17 0x22000 0x24000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:190] 18 0x24000 0x26000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:194] 19 0x26000 0x28000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:199] 20 0x28000 0x2a000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:199] 21 0x2a000 0x2c000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:202] 22 0x2c000 0x2e000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:206] 23 0x2e000 0x30000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:209] 24 0x30000 0x32000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:213] 25 0x32000 0x34000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:216] 26 0x34000 0x36000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:220] 27 0x36000 0x38000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:223] 28 0x38000 0x3a000⇥	Non-Secure⇥	rwxl␍␊
[11:43:13:227] 29 0x3a000 0x3c000⇥	Non-Secure⇥	r

Trying again a second time seems to always work but why does the first time fail? Seems like the reset always fails the first time

A successful flash is shown below

Preparing target for download
Executing Reset script TargetInterface.resetAndStop()
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Downloading 'merged.hex' to J-Link
Programming 32.0 KB of addresses 00000000 -- 00007fff
Programming 169.1 KB of addresses 0000c000 -- 0003649b
J-Link: Flash download: Bank 2 @ 0x00000000: 1 range affected (176128 bytes)
J-Link: Flash download: Total time needed: 5.333s (Prepare: 0.071s, Compare: 0.034s, Erase: 3.756s, Program: 1.417s, Verify: 0.004s, Restore: 0.049s)
Download successful

Parents Reply Children
Related