Getting Write verify failed every time when try to debug or write without erase.

Hi,

We are working with nRF5340 with SDK v2.5.2.

Each time we try to program the board, we get below error.

[ #################### ]  12.131s | Erase file - Done erasing                                                          
[ #################### ]   1.269s | Program file - Done programming                                                    
[ #################### ]   1.299s | Verify file - Done verifying                                                       
[ #################### ]  14.504s | Erase file - Done erasing                                                          
[ #################### ]   2.654s | Program file - Done programming                                                    
[error] [ Client] - Encountered error -160: Command verify_file executed for 2719 milliseconds with result -160        
[error] [  nRF53] - Failed while performing 'Verify' operation on target address 0x00FF8128.                           
-160: Data does not match in address range [0x00FF8128 - 0x00FF8177] (APP UICR)
Expected byte value 0xFF but read 0xFC at address 0x00FF8150.
[error] [  nRF53] - Failed while verifying device. -160: Data does not match in address range [0x00FF8128 - 0x00FF8177] (APP UICR)
Expected byte value 0xFF but read 0xFC at address 0x00FF8150.
[error] [ Worker] - Data does not match in address range [0x00FF8128 - 0x00FF8177] (APP UICR)
Expected byte value 0xFF but read 0xFC at address 0x00FF8150.
ERROR: Write verify failed.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
FATAL ERROR: command exited with status 25: nrfjprog --program 'd:\project\..\build\zephyr\GENERATED_CP_APPLICATION_merged_domains.hex' --sectorerase --verify -f NRF53 --coprocessor CP_APPLICATION --snr 960130361

We do not see this error if we try Erase and Flash option from VS Code. We observe the same issue even with the nRF5340DK board.

This is very annoying us as we cannot debug or program without erasing. Please help us solving the issue.

We are using VS Code with NRF Connect extensions. SDK v2.5.2.

Parents
  • Any update on this?

    Please let me know if any additional information is needed.

    Thank you in advance

  • Hello,

    Are you using a watchdog timer in your code by change?

    Best regards,

    Michal

  • Are you using a watchdog timer in your code by change?

    --> NO

  • What is your setup? Are you using a standalone debugger or a DK (if so, which version)?

    What is you nrfjprog version? Have you tried updating it to the newest one?

    Do you have APPROTECT turned on?

    Does the connection break even in other cases (such is while debugging)?

    What if you try a different cable?

    Can you run the west flash command with the --log argument as it is said in the output?

    Best regards,

    Michal

  • Hi Michal,

    Please see below for my comments,

    What is your setup? Are you using a standalone debugger or a DK (if so, which version)?

    --> We have VS Code with NRF Connect SDK v2.5.2

    We are using nRF5340DK as J-Link

    J-Link info as follows:

    PCA10095
    2.0.0
    2021.42

    What is you nrfjprog version? Have you tried updating it to the newest one?

    --> See below,

    ❯ nrfjprog --version
    nrfjprog version: 10.23.2 external
    JLinkARM.dll version: 7.88j

    Do you have APPROTECT turned on?

    --> How to confirm is APPROTECT enabled or not. Explicitly we did not change any setup.

    We are using default settings provided from the NRF Connect extension with VS Code as far as we know.

    Does the connection break even in other cases (such is while debugging)?

    --> In order to debug the code, we need to erase the flash using NRF Connect for Desktop and then we need to start the debugger from VS Code.

    Once we are in the debug mode, the connection does not break. It works even we restart the debugger.

    Whereas, if we stop/terminate the debugger and try to start debug again, we get the same error.

    What if you try a different cable?

    --> Same with other cables. I do not think it is cable fault.

    Can you run the west flash command with the --log argument as it is said in the output?

    --> I see below USAGE when I try to run the above command

    usage: west [-h] [-z ZEPHYR_BASE] [-v] [-V] <command> ...
    west: error: argument <command>: invalid choice: 'flash' (choose from 'init', 'update', 'list', 'manifest', 'diff', 'status', 'forall', 'help', 'config', 'topdir', 'selfupdate')

    Please let me know if any.

  • Thank you for the answers. About the last one, west error: did you try to run it specifically from nRF Connect terminal inside VS Code?

    Our nRF Connect for VS Code extension should set up all the environmental variables for you automatically.

    Best regards,

    Michal

  • About the last one, west error: did you try to run it specifically from nRF Connect terminal inside VS Code?

    --> Yes, tried on both VS Code terminal and command prompt (with ADMIN access) and I see the same error.

    Our nRF Connect for VS Code extension should set up all the environmental variables for you automatically.

    --> How can I confirm this on my end?

Reply Children
  • From the VS Code, please try generating support information. It's the headset icon in the welcome view, please check here:

    https://nrfconnect.github.io/vscode-nrf-connect/reference/ui_sidebar_welcome.html#toolbar-actions

    Best regards,

    Michal

  • Please see below.

    IMPORTANT: The data below could contain sensitive or confidential information about your environment.
    If you do not wish this to be seen by others, please make sure to remove it before sharing.
    
    For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 10 Home Single Language",
        "osKernel": "10.0.26058",
        "vscode": "1.87.0",
        "electron": "27.3.2",
        "node": "v18.17.1"
      },
      "system": {
        "date": "2024-03-06T06:14:36.245Z",
        "vscodeRoot": "c:\\Users\\user\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "16:17:20",
        "osUptime": "120:56:29",
        "cpu": "Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz"
      },
      "workspace": {
        "name": "prj (Workspace)",
        "workspaceFile": "d:\\work\\prj.code-workspace",
        "folders": [
          "d:\\work"
        ]
      },
      "sdks": [
        {
          "version": "v2.5.2",
          "path": "d:\\nrf\\sdk\\v2.5.2\\v2.5.2"
        }
      ],
      "activeBuild": "d:\\work\\build",
      "apps": [
        {
          "workspace": "d:\\work",
          "uri": "d:\\work",
          "buildConfigurations": [
            {
              "id": "d:\\work\\build",
              "name": "build",
              "boardId": "nrf5340dk_nrf5340_cpuapp_ns",
              "type": "Zephyr",
              "isChild": false,
              "isStale": false,
              "taskBindings": {
                "build": [],
                "pristineBuild": [],
                "flash": [],
                "eraseAndFlash": []
              }
            }
          ]
        }
      ],
      "topdir": "d:\\nrf\\sdk\\v2.5.2\\v2.5.2",
      "workspaceState": "freestanding-ready",
      "toolchains": [
        {
          "version": "2.5.2",
          "path": "d:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7"
        }
      ],
      "connectedDevices": [
        {
          "serialNumber": "000682458844"
        }
      ],
      "deviceProvider": "nrfutil",
      "tools": {
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gcc.exe": "0.16.1",
        "C:\\Program Files\\SEGGER\\JLink\\JLink.exe": "7.94e",
        "C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.24.0",
        "nrfutil": "Not found",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\cmake.exe": "3.20.5",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\Scripts\\west.exe": "1.1.0",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\python.exe": "3.8.2",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\ninja.exe": "1.9.0",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\gperf.exe": "3.1",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\dtc.exe": "1.4.7",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\gn.exe": "2122",
        "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\mingw64\\bin\\git.exe": "2.37.3.windows.1",
        "gdbPath": "d:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin\\arm-zephyr-eabi-gdb.exe"
      },
      "nrfutil": {
        "nrfutil-device": {
          "version": "2.0.0",
          "binPath": "c:\\Users\\user\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.2.214-win32-x64\\platform\\nrfutil\\bin\\nrfutil-device"
        },
        "nrfutil-toolchain-manager": {
          "version": "0.14.1",
          "binPath": "c:\\Users\\user\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.2.214-win32-x64\\platform\\nrfutil\\bin\\nrfutil-toolchain-manager"
        }
      },
      "environment": {
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\user",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\user",
          "PATH": "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\mingw64\\bin;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\bin;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\Scripts;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\nanopb\\generator-bin;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\zephyr-sdk\\aarch64-zephyr-elf\\bin;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\zephyr-sdk\\x86_64-zephyr-elf\\bin;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin;c:\\Users\\user\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.2.214-win32-x64\\platform\\nrfutil\\lib\\nrfutil-toolchain-manager;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\starship\\bin\\;C:\\mingw64\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\user\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
          "ZEPHYR_BASE": "d:\\nrf\\sdk\\v2.5.2\\v2.5.2\\zephyr",
          "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
          "ZEPHYR_SDK_INSTALL_DIR": "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\zephyr-sdk",
          "PYTHONPATH": "D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\Lib;D:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\bin\\Lib\\site-packages"
        },
        "inherited": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\user",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\user",
          "Path": "C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\starship\\bin\\;C:\\mingw64\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\user\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
          "PATH": "C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\starship\\bin\\;C:\\mingw64\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\;C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\;C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\user\\AppData\\Local\\Programs\\Microsoft VS Code\\bin"
        },
        "toolchainPath": "d:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7",
        "toolchainBinPath": "d:\\nrf\\sdk\\v2.5.2\\toolchains\\c57af46cb7\\opt\\zephyr-sdk\\arm-zephyr-eabi\\bin",
        "toolchainVersion": "2.5.2"
      },
      "terminal": {
        "defaultProfile": null
      },
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:2.5.2}",
          "toolchain": {
            "path": "${nrf-connect.toolchain:2.5.2}"
          },
          "ozonePath": "",
          "applications": [],
          "applicationOptions": {},
          "kconfig": {
            "interface": "kconfig"
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "taskBindings": {},
          "buildTerminal": {
            "condensedProgress": true
          },
          "debugging": {
            "flash": true,
            "bindings": {},
            "justMyCode": true
          },
          "activeAppFollowActiveEditor": true,
          "deviceProvider": "",
          "flash": {
            "softreset": false,
            "erase": false,
            "recover": false
          },
          "enableTelemetry": true,
          "thirdpartyIntegration": {},
          "toolchainManager": {
            "indexURL": null,
            "installDirectory": "D:\\nrf\\sdk"
          },
          "nrfutil": {
            "home": null
          },
          "defaultOpenAction": "ask",
          "welcome": {
            "showOnStartup": false
          }
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        }
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2024.2.214",
            "path": "c:\\Users\\user\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2024.2.214-win32-x64",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2024.2.78",
            "path": "c:\\Users\\user\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2024.2.78",
            "isActive": true
          },
          "nordic-semiconductor.nrf-devicetree": {
            "version": "2024.2.418",
            "path": "c:\\Users\\user\\.vscode\\extensions\\nordic-semiconductor.nrf-devicetree-2024.2.418",
            "isActive": true
          },
          "nordic-semiconductor.nrf-kconfig": {
            "version": "2024.2.71",
            "path": "c:\\Users\\user\\.vscode\\extensions\\nordic-semiconductor.nrf-kconfig-2024.2.71",
            "isActive": true
          }
        },
        "external": {
          "marus25.cortex-debug": null,
          "ms-vscode.cpptools": "1.19.5",
          "ms-vscode.js-debug": "1.87.0",
          "ms-vscode.js-debug-companion": "1.1.2",
          "ms-vscode.vscode-js-profile-table": "1.0.8",
          "ashwingopalsamy.macos-dark-theme": "0.0.4",
          "cschlosser.doxdocgen": "1.4.0",
          "davidbwaters.macos-modern-theme": "2.3.19",
          "donjayamanne.python-environment-manager": "1.2.4",
          "donjayamanne.python-extension-pack": "1.7.0",
          "KevinRose.vsc-python-indent": "1.18.0",
          "Maqing01223.zephyr": "0.0.1",
          "mgesbert.python-path": "0.0.14",
          "ms-python.debugpy": "2024.2.0",
          "ms-python.python": "2024.2.1",
          "ms-python.vscode-pylance": "2024.2.3",
          "ms-vscode-remote.remote-ssh": "0.109.0",
          "ms-vscode-remote.remote-ssh-edit": "0.86.0",
          "ms-vscode-remote.remote-wsl": "0.86.0",
          "ms-vscode-remote.vscode-remote-extensionpack": "0.25.0",
          "ms-vscode.cpptools-extension-pack": "1.3.0",
          "ms-vscode.cpptools-themes": "2.0.0",
          "ms-vscode.hexeditor": "1.9.14",
          "ms-vscode.remote-server": "1.5.1",
          "njpwerner.autodocstring": "0.6.1",
          "PKief.material-icon-theme": "4.34.0",
          "streetsidesoftware.code-spell-checker": "3.0.1",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "vvisionnn.one-dark-darker-with-border": "0.0.1"
        }
      }
    }
    
    

  • Thank you, I will look if I can find any issues there.

    Best regards,

    Michal

Related