Insufficient RAM for Flash Algorithms !

I clone the repository on GitHub, which is the accompanying code for the Application Note nAN-36 "Creating Bluetooth Low Energy Applications Using nRF51822", in the nrf51822/Board/pca10001/s110/ folder. Though I can successfully build the project, I can not download the image the the PCA10001 target board. The log is as shown below:

=================================================================================== Rebuild target 'nrf51822_xxaa_s110 (256K)' assembling arm_startup_nrf51.s... compiling system_nrf51.c... compiling main.c... compiling ble_srv_common.c... compiling ble_lbs.c... compiling ble_error_log.c... compiling pstorage.c... compiling crc16.c... compiling ble_advdata.c... compiling app_scheduler.c... compiling app_timer.c... compiling ble_conn_params.c... compiling softdevice_handler.c... compiling app_button.c... compiling app_gpiote.c... compiling ble_debug_assert_handler.c... linking... Program Size: Code=15556 RO-data=244 RW-data=212 ZI-data=5876
FromELF: creating hex file... "._build\ble_app_lbs.axf" - 0 Error(s), 0 Warning(s). Load "C:\Keil_v5\ARM\Device\Nordic\nrf51822\Board\pca10001\s110\nrf51-ble-app-lbs-master\arm\_build\ble_app_lbs.axf" Set JLink Project File to "C:\Keil_v5\ARM\Device\Nordic\nrf51822\Board\pca10001\s110\nrf51-ble-app-lbs-master\arm\JLinkSettings.ini"

  • JLink Info: Device "NRF51822_XXAA" selected (257 KB flash, 16 KB RAM).

JLink info:

DLL: V4.90e, compiled Sep 8 2014 18:46:31 Firmware: J-Link OB-SAM3U128 V1 compiled Aug 22 2014 17:25:44 Hardware: V1.00 S/N : 480208319

  • JLink Info: Found SWD-DP with ID 0x0BB11477
  • JLink Info: Found Cortex-M0 r0p0, Little endian.
  • JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots ROMTableAddr = 0xE00FF003

Target info:

Device: nRF51822_xxAA VTarget = 3.300V State of Pins: TCK: 0, TDI: 0, TDO: 1, TMS: 1, TRES: 1, TRST: 1 Hardware-Breakpoints: 4 Software-Breakpoints: 8192 Watchpoints: 2 JTAG speed: 2000 kHz

Insufficient RAM for Flash Algorithms ! Erase Failed! Error: Flash Download failed - "Cortex-M0"


"Insufficient RAM for Flash Algorithms ! ?" what is that mean? How did it happen?

I did download the S110 SoftDevice using nRFgo Studio before downloading the application image within Keil μVision.

Thank you for your help.

  • There's been some changes to how the flash routine is done and on code examples created, but not updated for recent nRF51 SDK the amount of RAM set aside for programming by Keil is not sufficient. Please change the field in "Option for target" -> "Debug" -> "Settings" -> "Flash Download" to a bigger size. It's RAM used for flash programming, so unless you have some specific needs, I recommend to use 0x2000 as I do. Please see the attached screen shot.

    RAM for flash algorithm.jpg

  • Thank you for your reply and support. The following are the original settings from Project -> Options for Target 'nrf51822_xxaa_s110 (256K)'

    image description

    image description

    The following are the new settings based on your suggestions and some clues from your Bluetooth low energy heart rate monitor demo.

    image description

    image description

    ​I can build the project without any error and download to the PCA10001 board successfully. But, when I click "Start Discovery" within the "Master Control Panel", the nRF51822 Development Dongle can not scan any available Bluetooth low energy devices within range. There might have some other settings needed to be adjusted to make the demo work. Thank you for your answer.

  • The code example you are using was compiled for softdevice 5.2.0 and 6.0.0 which had a size of 80 kB. From the error message it looks like you are using the softdevice 7.0.0 which is slightly bigger at 88 kB. So when you try to write the application compiled for a SD of 80 kB you try to overwrite the SD of 88 kB size and you will get this error message.

    See chapter 10 of the S110 softdevice specification.

  • Hi all, I had same problem resolved with these tips. However, as Tsan-Ming said, once downloaded the code into PCA10001 v2.2, the dongle (PCA10000) previously loaded with SoftDevice 7.1 don't discover any BLE device. Tsan-Ming, have you ever solved this issue? Thank you!

  • I'm sorry I did not solve the problem yet. I believe the PCA10001 did not broadcasting such that the PCA10000 can not scan it. If I find the solution, I will let you know.