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

App does not work via DFU

I have a nRF51822 device which has softdevice and bootloader. And I'm trying upload my app with following steps:

  1. make .bin file with gcc
  2. Push the DFU button, and entering DFU mode. (Seen as DfuTarg)
  3. Upload bin file via iOS nRF Loader.
  4. The upload completed successfully.
  5. My app does not run.

Therefore, I have a question. Are there any special code or special settings for DFU on the app code side? Thanks in advance.

  • What means »My app does not run«? Is the bootloader still running (still seeing the "DfuTarg" via Ble)? What bootloader are you using (e.g. bootloader example from Nordic Sdk 5.2, compiled with gcc 4.8 or Keil ...)? If using nRFgo hardware (Starter Kit) which Led's are on? Does your app running right when flashing via Jtag? Startaddress of your app 0x14000?

  • The UICR must be set up correctly. You may check that with your Jtag adapter. If using S110 SoftDevice it looks like this:

    $ JLinkExe -Device nrf51822 -If SWD
    ...
    J-Link>mem 10001000 20
    10001000= 00 40 01 00 FF FF FF FF FF FF FF FF FF FF FF FF
    10001010= 49 00 FF FF 00 A0 03 00 FF FF FF FF FF FF FF FF
    
    
    • "00 40 01 00" is the beginning of your application code = 14000h.
    • "00 A0 03 00" is the beginning of the bootloader code = 3A000h. (3A000h is not the standard value here, you may see a 3C800h instead)

    Normally, the UICR should set up correctly, but it may depend on the way you flashed your SoftDevice and/or your bootloader (did you used Windows nRFgo Studio or Segger JLinkExe from Linux Command line ...?).

    The UICR is used by the SoftDevice for e.g.

    • Starting the bootloader at poweron
    • Switching the interrupt redirections to the application when the bootloader starts it

    You may also check the bootloaders persistent data which is located in the last flash sector (3FC000h):

    $ JLinkExe -Device nrf51822 -If SWD
    ...
    J-Link>mem 3FC00 10
    0003FC00= 01 00 00 00 F5 61 00 00 FF 00 00 00 DC 0A 00 00
    
    

    Check bootloader_settings_t (in bootloader_types.h of the bootloader example) for the meaning of the values.

  • Thank you for your advice! Actually, I bought this device from another supplier. I'm not sure how SoftDeivce and bootloader was flashed, but I think it was flashed by nRFgo Studio. (And I'm trying to upload bin file which built with gcc & Mac)

    So, the causes of this issues is that the way of flashing/building SoftDevice/bootloader/App was not unified?

  • What hardware are you working on, is it a Nordic dev-board (which) or a custom hardware with nRF51822? Hoping that you own a Jtag adapter, could you provide a dump of "mem 10001000 20" and "mem 3FC00 10"?

  • It's a custom hardware with nRF51822. And there is no JTAG adaptor yet...

    So, I was not able to DFU-OTA and I'm making JTAG adaptor jig right now. Will try to check "mem 10001000 20" and "mem 3FC00 10".

    Thank you.

Related