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

  • 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?

  • 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

Reply Children
  • Hello,

    I am starting to look into this from the beginning now because Michal is away. Sorry about the delay.

    I will share a few things which caught my eye as I was reading through your original ticket and the replies.

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

    Expected byte value 0xFF but read 0xFC at address 0x00FF8150.

    From the error log I saw that the addresses in the logs are from the UICR for the application core, more specifically the UICR part which is handled by the Key management unit. The KMU documentation has a section on the intended usage which includes the required format for OTP (one-time programmable) write operations. My initial hypothesis is that when you flash without erasing, you write something to the UICR which has a wrong format. Please read the documentation on UICR and KMU and let me know if there is something which is not clear on those pages.

    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

    This error is a NrfjprogIniNotFoundError with the explanation that nrfjprog.ini is not found in the install folder. The proposed solution is to reinstall nrfjprog. More nrfjprog error codes can be found here.


    After looking quickly over the nRF Connect for VS Code support information you attached I could not find any indicators for what causes the error.

    Since the error only happens when you don't fully erase the chip, I want you to look over the documentation I linked for the UICR and KMU before we go further into other possibilities.

    Best regards,

    Maria

  • Hi Maria,

    We are not able to solve the issue.

    Can you educate me on the below error message.

    WARNING: runners.nrfjprog: The hex file contains data placed in the UICR, which may require a full erase before reprogramming. Run west flash again with --erase, or --recover.

    We are not writing anything into UICR and yet we see the above message. How come the hex contains data to be written UICR when we are not including anything to write on UICR. Please let us know if we are doing something wrong.

  • Jithin A said:
    Can you educate me on the below error message.

    The UICR is the address space 0x00FF8000-0x00FF8FFC. nrfjprog reads that there is data in the address space which is reserved for UICR. I get that you haven't purposefully configured anything to be written to UICR, so we need to find out if something unexpected has been configured for the UICR.

    Finding out if there is a partition which uses the address space will help us to find out why nrfjprog sees data in the UICR. If you have a multi-image build, the partition manager will generate a partitions.yml file in the build folder. There you can read the addresses for every partition and check if one of them is configured within the UICR address space.

    Is your application based on a sample from nRF Connect SDK? If yes: which?

Related