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

NRF9160 SES 4.18 flash erase hanging

Hi,

Since migrating to SES 4.18 erasing of the flash hangs unless the JLink is unplugged and plugged in again. This is both on the DK and our own custom board. Here's the repro steps:

- Compile application to produce merged_hex

- Debug Go produces the following:

Found Cortex-M33 r0p2, Little endian.
Downloading ‘merged.hex’ to J-Link
Programming 32.0 KB of addresses 00000000 — 00007fff
Programming 229.9 KB of addresses 0000c000 — 000457cf
Timeout while erasing sectors, RAMCode did not respond in time. (PC = 0xFFFFFFFF, CPSR = 0x00000000, LR = 0x21000003)!
Failed to erase sectors.
Download failed

If we manually flash by going to Target, Connect-JLink, then Erase All it gets to 3.1% and then hangs with following:

Found Cortex-M33 r0p2, Little endian.
Erasing Chip
J-Link: Flash download: Total time needed: 0.237s (Prepare: 0.056s, Compare: 0.000s, Erase: 0.174s, Program: 0.000s, Verify: 0.000s, Restore: 0.006s)
J-Link: Flash download: Total time needed: 0.252s (Prepare: 0.070s, Compare: 0.000s, Erase: 0.174s, Program: 0.000s, Verify: 0.000s, Restore: 0.007s)
Timeout while erasing sectors, RAMCode did not respond in time. (PC = 0x00000000, CPSR = 0x00000000, LR = 0x01000003)!
Failed to erase sectors.
J-Link: Flash download: Total time needed: 20.767s (Prepare: 0.063s, Compare: 0.000s, Erase: 20.693s, Program: 0.000s, Verify: 0.000s, Restore: 0.009s)

- If we unplug the JLink, plug back in, then Target, Connect-JLink, Erase All, then it works. 

- It only works by having going through the above 3.1% Erase fail then unplugging. A fresh unplug+plug back in won't work unless it goes through the 3.1% failure step.

Any ideas? Thx!

Parents Reply
  • The issue has not been fixed yet (I will still update this thread once a fix is available), but what you can do instead is use the Segger IDE to write code & use the command line tools to build & flash. Or compile via SES & use west or nrfjprog to flash.

    To build & flash using command line tools:

    west build -b nrf9160_pca10090ns -d build1
    west flash -d build1

    where -b stands for board & -d stands for the build directory.

    Otherwise, you can also use nrfjprog directly:

    nrfjprog --program merged.hex --sectorerase -f nrf91 --verify

    The merged hex file is located here e.g:

    ncs\nrf\samples\nrf9160\http_application_update\build1\zephyr

    You could also use Visual Studio Code or something similar if you prefer to do that.

Children
  • The new release of nrfjprog v10.4.0 that came out today fixes this issue. You can download the new command line tools here.

    Update: My bad, it seems this fix only fixed the command line flashing issue. If you are using Segger Embedded Studio, you'll have to wait for the new J-Link fix, which should be out soon. SES uses J-Link directly (not nrfjprog), so the fix needs to be implemented there by Segger first.

    I will update this case once SES has been fixed.

  • I'm still experiencing the same issue with SES V4.20 after installing the above nrfjprog

  • Yes I still can not reprogram without a full erase.

    I would like to save EE Data between debug sessions.

  • I also get this everytime I do a Debug..Go in SES after rebuilding my firmware, 2nd time invariably succeeds. This is both on the 0.8.5 DK and our own custom board.

    with this in the console:

    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
    Downloading ‘merged.hex’ to J-Link
    Programming 33.1 KB of addresses 00000000 — 000084af
    Programming 397.3 KB of addresses 0000c000 — 0006f537
    Timeout while checking target RAM, RAMCode did not respond in time. (PC = 0x00000000, CPSR = 0x00000000, LR = 0x61000007)!
    Failed to prepare for programming.
    Failed to execute RAMCode for RAM check!
    CPU is not halted
    Download failed

    Then when it works I get the following:

    Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Reset: Reset device via AIRCR.SYSRESETREQ.
    Downloading ‘merged.hex’ to J-Link
    Programming 33.1 KB of addresses 00000000 — 000084af
    Programming 397.3 KB of addresses 0000c000 — 0006f537
    J-Link: Flash download: Bank 2 @ 0x00000000: Skipped. Contents already match
    Download successful



Related