Keil Logo

ULINK: Loading nRF52 Softdevice "Error: Flash Download failed..."

Information in this knowledgebase article applies to:

  • MDKv5
  • ULINKpro Debug Adapter
  • PCA10040 (nRF52832-QFAA) board


I have succesfully downloaded the softdevice and then loaded the application code to the board. This setup uses the ULINKpro's 10-pin cable attached the board's P18 connector for serial wire debug. I have the following Flash Download options for the softdevice target:

Flash Download options nRF52 softdevice

For the application code's target, Erase Sectors is set. Now, the softdevice must be re-downloaded because there was an update to the library or we are switching over to use another library. When I try to load the softdevice, a second time, the message window appears "Error: Flash Download failed - "Cortex-M4", and the command window also shows "Programming Failed!".


A new flash algorithm (or some other method) is required to force a full chip erase from the nonvolatile memory controller (NVMC).


There are multiple ways to resolve issue.

  • Download and install nRF_DeviceFamilyPack v8.6.0+ or add-on nRF5x-MDK v8.6.0+. These include a new flash algorithm called nrf52xxx_sde.flm specifically designed by Nordic to load the softdevice library. Use Erase Full Chip or Erase Sectors with this option.
  • Use the System Viewer's NVMC window to set CONFIG => WEN to 2 (Erase enable), and then set ERASEALL to 1 (Full chip erase). In debug mode, this window can be opened by going to Peripherals => System Viewer => NVMC. This option performs a full chip erase.
  • Another automated way is to add or edit an initialization file for the softdevice target in Options for Target, Utilities tab. This option performs a full chip erase. Use the following lines:
_WDWORD( 0x4001E504, 0x00000002 );
_WDWORD( 0x4001E50C, 0x00000001 );

Then flash the hex file, and it will load successfully.




The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Wednesday, May 22, 2019

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.