This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Update softdevice in mbed kit

Hi guys,

How to update softdevice on mBED nRF51882 kit?

Details: I have couple mbed dev kits with nrf51882. I use Keil for development but will move to GCC after while.

Because debugger is CMSIS-DAP I can't use nRF Studio to update softdevice. So I used pyOCD and arm-none-eabi-gdb to flash s110_7.0.0.

And today I noticed strange thing...

If I flash softdevice by pyOCD: arm-none-eabi-gdb s110_nrf51822_7.0.0_softdevice.hex -ex "target remote :3333" -ex "load"

and then upload Keil project over CMSIS-DAP it doesn't work and even doesn't start. But if I merge s110_nrf51822_7.0.0_softdevice.hex and my application code it runs ok.

I have a feeling it that is because of wrong UICR configuration... I'm quite confuse because I can't find any article or forum discussions about this issue.

  • You have to use nRF51 SDK v6.0.0 with S110 v7.0.0. From S110 v7.0.0 (and future versions), the write into UICR is not required. You can load the S110-firmware directly into address area 0 to 0x15FFF.

    Have you tried loading the S110 by copying it into the MBED-drive instead? Or loading it from Keil: www.keil.com/.../uv4_fl_hexdownload.htm

    Cheers, Håkon

  • pyOCD and the mbed-msd only does a full chip erase. It is much more convenient to just flash elf files in gdb, so I converted the softdevice hex file to binary and I compile it into the elf file.

    In my .ld file:

    MEMORY
    {  
            /* flash: 0x00000000 - 0x0003FFFF (256K) */
            /* sram:  0x20000000 - 0x20003FFF  (16K) */
    
            /* S110 7.0.0 softdevice occupies top 88K of flash and 8K of SRAM */
            SD_FLASH (rx)   : ORIGIN = 0x00000000, LENGTH = 0x16000
            SD_RAM (rwx)    : ORIGIN = 0x20000000, LENGTH = 0x2000 
       
            /* application gets the rest of flash and sram */
            FLASH (rx)      : ORIGIN = 0x00016000, LENGTH = 0x2A000
            RAM (rwx)       : ORIGIN = 0x20002000, LENGTH = 0x2000
    }
       
    SECTIONS
    {
            /* include the softdevice binary image: */
            .SOFTDEVICE :
            {
                    KEEP(*(.softdevice))
            } > SD_FLASH = 0xFF
    }
     
    INCLUDE "gcc_nrf51_common.ld"
    

    softdevice.s:

    /* Convert the binary softdevice into a linkable object. */
            .section .softdevice, "ax"
            .incbin "softdevice/s110_nrf51822_7.0.0_softdevice.bin"
    
  • Thanks Håkon,

    There were few issues on my board and major one was wrong level on SWDIO pin. So cpu time to time was in wrong state.

    So far I use Keil for developing but I'll have to move to gcc+cmsis-dap in near feature. I feel it will be painful due to low speed and unstable debug process. 8(

  • Hi Clem,

    Thanks for idea! BTW, If use cmsis-dap adapet speed is ~4kb/s which means 25-30 seconds for full firmware update. 8( Temporary to update test devices (I have few peripheral devices) I compile app to .bin and use flash_nrf51822.py to download it. It's fastest way to update firmware on the device. Unfortunately this trick can't be use for GDB 8(

Related