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

nRF52810 DFU attempt #2

I'm trying to set up DFU for a custom board with a nRF52810 module (Rigado BMD-330).  I created the secure bootloader from the recent project for SDK 15 posted by Vidar Berg.  All seems to be working and I can connect to the DFUTARG.  The DFU download works .... once.  I discovered I need to add the buttonless DFU service to my application in order to  switch from the application back to the bootloader if I want to support multiple DFUs.

I started this task using the guidelines on the infocenter and with the buttonless DFU example, only to find I'm getting compile errors from nrf_dfu_types.h.  This is looking for  NRF52 defined or I get: #error "Architecture not set."  However, my application followed the PCA10040e path and does not use the NRF52 flag and also uses gcc_startup_nrf52810.S and system_nrf52810.c versus gcc_startup_nrf52.S and system_nrf52.c ..... which seems the right thing to do for nRF52810 development and the app without DFU service is running nicely.   I attempted to add the NRF52 flag and as you might expect that resulted in linker errors.

I don't know how to resolve this ..... if it even can be resolved.  It seems rather ugly at this point. 

Any suggestions?  I know there's working example of nRF52810_S112 buttonless DFU service for SDK 14.2 but I'd like to stick with SDK 15 if possible.  I'd be happy to beta test a SDK 15 buttonless DFU service for the nRF52810. 

Thanks,  Max

 

  • Hi Max,

    I saw the same problem when I made the bootloader project. The pre-processor check in dfu_types.h does not include check for NRF52810_XXA, which is why you get the "Architecture not set." error. 

    Here is the change I made: 

    diff --git a/components/libraries/bootloader/dfu/nrf_dfu_types.h b/components/libraries/bootloader/dfu/nrf_dfu_types.h
    index 5ccd290..db6b918 100644
    --- a/components/libraries/bootloader/dfu/nrf_dfu_types.h
    +++ b/components/libraries/bootloader/dfu/nrf_dfu_types.h
    @@ -72,7 +72,7 @@ extern "C" {
      */
     #if defined(NRF51)
         #define CODE_PAGE_SIZE            (PAGE_SIZE_IN_WORDS * sizeof(uint32_t))
    -#elif defined(NRF52) || defined(NRF52840_XXAA)
    +#elif defined(NRF52) || defined(NRF52840_XXAA) || defined(NRF52810_XXAA)
         #define CODE_PAGE_SIZE            (MBR_PAGE_SIZE_IN_WORDS * sizeof(uint32_t))
     #else
         #error "Architecture not set."
    diff --git a/components/libraries/bootloader/nrf_bootloader_app_start_final.c b/components/libraries/bootloader/nrf_bootloader_app_start_final.c
    index a818322..dde759b 100644

  • Thanks Vidar,

    I'll give that a try.

    I also found some guidance and updated files at:

    https://devzone.nordicsemi.com/f/nordic-q-a/27185/52810-how-to-use-dfu 

    I'll let you know how it goes.

    Max

  • I made the changes Vidar suggested and the application compiled with my GCC Makefile.  The other files in the link I referenced were for SDK 14 and didn't apply to my environment.

    Unfortunately, the application with the Buttonless DFU Service added does not appear to initialize on my custom nRF52810 board and I have to figure some way to debug it.  Since I have no visibility to my custom board, I'm going to try and go back to developing for nRF52810 in the nRF52 DK board and review the log information displayed.  This involves redefining some GPIO, but not too difficult.  Hopefully this will give some clues where it's failing via the log messages.

    I found the application with the Buttonless DFU Service will not run without a valid bootloader present so I'd like to set up the bootloader + bootloader settings to run with a valid application so I can load everything into flash and execute the application.  I'm not clear on the details of how to set the bootloader settings to do this, so some specific how-to information would be helpful.

    I'm also not sure the nRF5810 bootloader will run on the nRF52832 on the nRF52 DK board.  Should I be using a nRF52832 bootloader instead?  

    Later .........

    Max

      

  • I did not enable debug logging in the bootloader port I provided earlier as it would significantly increase the code size. If you wish to enable it you first need to adjust the bootloader start address downwards in order to allocate more flash space, like we have done for the bootloader *_debug projects. Start address is set in the linker script (*.ld file adjacent to Makefile). Once you have adjusted the start address you can enable the logger module in sdk_config.h and rebuild the bootloader. 

    "I found the application with the Buttonless DFU Service will not run without a valid bootloader present so I'd like to set up the bootloader + bootloader settings to run with a valid application so I can load everything into flash and execute the application.  I'm not clear on the details of how to set the bootloader settings to do this, so some specific how-to information would be helpful."

    The buttonless service requires the bootloader to be present in order to set up the supervisor call interface between application and bootlaoder.  The settings page can be generated with nrfutil as explained here: http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.tools/dita/tools/nrfutil/nrfutil_settings_generate_display.html?cp=5_5_6 

    E.g., Generate and upload settings page

    nrfutil settings generate --family NRF52810 --application <app.hex> --application-version <version number> --bootloader-version <version number>
    --bl-settings-version 1 settings.hex && nrfjprog --program settings.hex --sectorerase -r

    You can run the 52810 bootloader on a 52832 IC.
  • Vidar,

    Thanks so much!  Great helpful information.

    I'm working my way through it and we'll see how I make out.

    I did try to generate a bootloader settings file and merge it with the bootloader.  I noticed in the info displayed it reports:

    Bank0 Bank Code: 0x00000001

    Is this the code that indicates a valid application?

    Max

Related