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

Application updated over the air doesn't start properly

Dear all,

I have nRF51 DK and I use mbed CLI to build my application that is simple mbed-os-example-blinky. Also I have SDK11.0.0 and I built the ble dfu bootloader (./examples/dfu/bootloader/pca10028/dual_bank_ble_s130/armgcc), merged that .hex file with softdevice s130 .hex file (./components/softdevice/s130/hex/s130_nrf51_2.0.0_softdevice.hex) and flashed the board via nRFStudio (Program Bootloader tab) with the result .hex file.

I built my application with command

$ mbed compile -m NRF51_DK_OTA -t GCC_ARM -c --profile release

I follow the tutorial to update the application over the air. After update I realized that my application did bot start. I look into mbed-os-example-blinky.hex file and found out that FLASH MEMORY region set at 0x0001C000 however it has to be set at 0x0001b000 for softdevice s130 v2.0.0. So I fixed file ./mbed-os/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_GCC_ARM/TARGET_MCU_NORDIC_32K/NRF51822.ld as following:

 MEMORY
 {
-  FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000
+  FLASH (rx) : ORIGIN = 0x0001b000, LENGTH = 0x24000
   RAM (rwx) :  ORIGIN = 0x20002800, LENGTH = 0x5800
 }

then rebuilt my application and updated over the air again. I noticed that LED blinked once at the beginning and that was all. I pressed reset button a few times and I saw how it blinked. I connected to the board via Ozone debugger and found out that my application started and after calling wait() function it didn't work anymore.

I built a few applications from SDK11, update them OTA and all of them work fine, as I undestood they don't use softdevice (BTW, is it true?).

I guess something is wrong with softdevice initialization in my application but I can't understand what exactly and how to fix it.

Any ideas? Because I ran out of them.

  • I'm not very familiar with mbed (you should post your question on mbed forum as well). But did the mbed firmware work if you flash it directly (softdevice + application, no bootloader) ? Strange to see that the start address is 0x1C000. On the ld file for S110 it was correct.

    It's normal to be in wait() most likely it put the CPU to sleep and if there isn't any event, the CPU will remain in sleep mode.

  • @Hung Bui Yes, NRF51_DK target: software + application (no bootloader) works fine. That is why I suspect that NRF51_DK_OTA target doesn't have proper softdevice initialization during start of the application.

  • Have you tried to change the start address to 0x0001b000 and flash softdevice + application ?

    Could you check what happens inside wait() ? If you make a very simple application of blinking an LED (no wait()) should it work properly after OTA ?

    1. when I build NRF51_DK, which means softdevice + application, the result .hex file contains the paplication start address as 0x0001b000 and it works fine.

    2. Thanks for your suggestion. I created .mbedignore file as following:

      mbed-os/rtos/* mbed-os/features/FEATURE_CLIENT/* mbed-os/features/FEATURE_COMMON_PAL/* mbed-os/features/FEATURE_UVISOR/* mbed-os/features/frameworks/* mbed-os/features/net/* mbed-os/features/netsocket/* mbed-os/features/storage/* mbed-os/events/*

    then rebuilt my application as NRF51_DK_OTA target and updated it OTA and it works! As far I understood we have only one thread this way and no events. Is that right?

  • I'm sorry that I don't have much experience with mbed-os. The mbed team should be at best position to help you. One thing you can do is to reading out the flash and compare the hex files between flash your application directly and flash your application via DFU OTA.

Related