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

DFU with nRF52805

I have a custom board with a nRF52805 based module from Minew and I'm trying to do a OTA DFU but I can't quite understand how it works.

This is what I do. For info, I'm using the softdevice s112 version 7.0.1.

  1. Generate the public and private key and replace it in the folder to compile the bootloader.
  2. Compile the secure bootloader from 
    examples\dfu\secure_bootloader\pca10040e_s112_ble\sessecure_bootloader_ble_s112_pca10040e.emProject
    and it compiled successfully. I renamed it to bootloader.hex
  3. Then I compiled simple blinky app and rename it to app.hex
  4. Generate the settings for the bootloader with this commands in command line: 
    nrfutil settings generate --family NRF52810 --application app.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 settings.hex
    .
  5. Use the software nRF Connect Programmer to view the memory map and it show there is no overlap between the files: app.hex, bootloader.hex, settings.hex and the softdevice.

  6. Erase and write to the target and reset.

At this point I think everything is ok but when the target reset the blinky is not running. I scann with nRF Connect mobile app and the DFU Target is visible and available to do DFU. So my questions are:

1. May I have to use the mbr blinky app template to do this?

2. May I have to enable some module or change something at sdk_config.h file in my app to work alongside the bootloader and execute the app first? It seems like the device is entering in DFU mode instead of run the app.

3. To enter DFU mode just have to assign the button pin number of my device to NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN in the sdk_config.h?

Another question I have about the use of DFU is how does the ble_app_buttonless_dfu work? I follow this guide/tutorial but I can't quite understand how it works. I understand that the example app is just a BT advertising and you can make the DFU through nRF Connect mobile app right? Please correct me if I'm wrong.

Thanks in advance...

Parents
  • Hi AGarcia,

    Could you let me know which blinky example did you test ? 
    Since you are compiling it to work with a softdevice, have you modified the start address of the blinky example to the correct location (right after the softdevice). 

    I would suggest to test doing normal DFU (1. Flash softdevice + bootloader; 2. Generate .zip file from app.hex; 3. DFU update the .zip file) just to be sure that the app would work fine with the bootloader + softdevice.

    After that you can test with the bootloader setting. The main job of the bootloader setting is to tell the bootloader that there is a valid application on the chip and the bootloader should run the app. 

    To debug this I think the easiest is to use the debug bootloader (don't forget to do a chip erase when you switch to debug bootloader). With that you can step into the code and check why the bootloader doesn't want to jump to the app but stay in bootloader mode instead. 

    I noticed that you are using a custom board, please make sure NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN is not active when the bootloader booting up, otherwise it will enter DFU mode automatically. You can disable this feature by setting NRF_BL_DFU_ENTER_METHOD_BUTTON = 0.

  • Hi!

    I try what you suggest to do and it works, so this is what I did:

    1. I'm going to make a BT application so I'm using the ble_app_template in this directory:
      examples\ble_peripheral\ble_app_template\pca10040e\s112\ses\ble_app_template_pca10040e_s112.emProject
       At the moment I don't have the application fully implemented, just configure a GPIO to blink a LED and test if it works.
    2. My memory segments in the ble_app_template are this: 
      FLASH_PH_START=0x0
      FLASH_PH_SIZE=0x30000
      RAM_PH_START=0x20000000
      RAM_PH_SIZE=0x6000
      FLASH_START=0x19000
      FLASH_SIZE=0x17000
      RAM_START=0x20001a40
      RAM_SIZE=0x45c0
    3. Make the zip package with the app to make the DFU.
    4. Change NRF_BL_DFU_ENTER_METHOD_BUTTON = 0 in bootloader and compile.
    5. Load to the target the softdevice and the bootloader
    6. Use the mobile app to make the DFU

    When the DFU were finished the app run correctly, the led blinks. Now I know that my app works with the bootloader and softdevice, what have I to do if I want to enter DFU mode with a button in my app?

Reply
  • Hi!

    I try what you suggest to do and it works, so this is what I did:

    1. I'm going to make a BT application so I'm using the ble_app_template in this directory:
      examples\ble_peripheral\ble_app_template\pca10040e\s112\ses\ble_app_template_pca10040e_s112.emProject
       At the moment I don't have the application fully implemented, just configure a GPIO to blink a LED and test if it works.
    2. My memory segments in the ble_app_template are this: 
      FLASH_PH_START=0x0
      FLASH_PH_SIZE=0x30000
      RAM_PH_START=0x20000000
      RAM_PH_SIZE=0x6000
      FLASH_START=0x19000
      FLASH_SIZE=0x17000
      RAM_START=0x20001a40
      RAM_SIZE=0x45c0
    3. Make the zip package with the app to make the DFU.
    4. Change NRF_BL_DFU_ENTER_METHOD_BUTTON = 0 in bootloader and compile.
    5. Load to the target the softdevice and the bootloader
    6. Use the mobile app to make the DFU

    When the DFU were finished the app run correctly, the led blinks. Now I know that my app works with the bootloader and softdevice, what have I to do if I want to enter DFU mode with a button in my app?

Children
Related