This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to setup Keil Uvision for Redbearlab BLE Nano?

I am having problem to download SDK NRF51 12.0 example firmware onto Redbearlab BLE Nano nrf51822. The compilation and build is fine. It is shown as

Erased Failed!
Error: Flash download failed - "Cortex M0" 

This BLE Nano is not using JLink but CMSIS-DAP Debugger. I have uploaded these bootloader here by drag and drop onto the mbed USB drive.

The SDK project points to the flash_s130nrf51_2.0.1_softdevice by default as another flash download option. I usually download the built firmware instead of this soft device. Should I change this, if so how?

Here are my setup for uVision

Device

Target

Output

Listing

Debug

Debug Settings

Flash download

  • Hi Daniel,

    if the screenshots of the "Options for Target" window belongs to your firmware project, then you have to modify the IRAM/IROM settings under "Options for Target" --> "Target" to the following

    IROM1 Start: 0x0001B000 Size: 0x25000 IRAM1 Start: 0x20002000 Size: 0x6000

    the minimum RAM size required by the S130 v2.x SoftDevice is 0x13C8 bytes, see this page in the SDS, but its commen to provide 0x2000 bytes to give the SoftDevice some headroom. If 0x2000 bytes is not enough, then sd_ble_enable will return the correct RAM start address in the app_ram_base argument.

    Best regards

    Bjørn

  • I am having same error after changing to this memory map. I tried IRAM1 Start:0x2000y000 (where y=4,6,8) but the error is still the same. Is there a way to report error in more precise way. I don't understand what is really causing "Erase Failed".

  • Thanks for highlighting the memory map issues. I reviewed the ROM and RAM management tutorial. I realized that Redbearlab uses S130 V1.0. Hence, I used IRAM base: 0x20002800 IRAM size : 0x5800 (32KB) IROM base: 0x1C000 IROM size : 0x24000 (256KB) Nevertheless, your answer is important for S130 V2.0. When I switch to V2.0, I will change to that IROM configuration. I think you should update the tutorial with your answer for V2.0. I am able to download the flash consistently now. But, the SDK example project doesn't run correctly. Does Keil uVision merge with softdevice and bootloader every time it downloads the program like mbed web IDE? My bootloader is not pointing correctly to the application now. It got stuck at OTA DFU bootloader mode loop cycle. It times out and reboots again.

  • Hi Daniel, Keil does not merge the application hex with the SoftDevice and bootloader everytime you press download in your application project. You have to flash the SoftDevice and the Bootloader separately or merge all the hex files ( App, SD and BL) into one hex file and flash that. If you do not DFU in the application, then you have to set the BANK_APP_VALID flag in order to tell the bootloader that there is a valid application, see this answer.

  • I was just porting the SDK projects to nRF51822 instead of nRF51422 PCA10028 board. It seems like I couldn't get the project running after flashing them. Is my bootloader having problem with these SDK projects? If so, should I compile a new bootloader? Is there any ready nRF51822 a bootloader that works with S130 V2.0/V1.0 for me to test?

Related