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

buttonless_dfu 15.1 not advertising for s112

I have SD and BL secure flashed to the device, and now trying to get the second part of buttonless_dfu + app with settings flashed next.
After flashing the second part, DfuTarg no longer advertises, or any advertising.
The app works fine on its own based on the ble_template, then combined the app with buttonless_dfu as the base, which also seems to be based on the template, and that combination compiles fine.
(I have the buttonless tutorial working start to finish, but tutorial does not have a combined example).

RTT does not seem to display any info after this flash, and now not sure of where to look for clues.
Checking section placements in SES, the standalone app has the same flash & ram settings as the template, but not the buttonless_dfu template which has slightly different values.

15.1_template_custom_app
FLASH_PH_START=0x0
FLASH_PH_SIZE=0x30000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x6000
FLASH_START=0x19000
FLASH_SIZE=0x17000
RAM_START=0x20001b48
RAM_SIZE=0x44b8

15.1_buttonless_custom_app
FLASH_PH_START=0x0
FLASH_PH_SIZE=0x30000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x6000
FLASH_START=0x19000
FLASH_SIZE=0xf000
RAM_START=0x20001c18
RAM_SIZE=0x43e8

Changed the combined buttonless_custom_app settings to template_custom_app but same results of no advertising. Maybe other section placements settings would work.

Any other way to debug and find the error for buttonless_dfu not advertising?

thank-you,

  •   So just to clarify, you are merging the ble_app_buttonless_dfu example with the ble_app_template example?  Are you using a nRF52 DK with a nRF52832 or is it a custom board with a nRF52810?

    Could you debug your merged example and place a breakpoint at app_error_handler_bare() in app_error.c and see if you end up there? If so take a look at the call stack to see which function that caused the assert. My hunch is that its the sd_ble_enable() call in nrf_sdh_ble_enable() in srf_sdh_ble.c that is returning NRF_ERROR_NO_MEM, if that is the case then examine the variable pointed to by  p_app_ram_start, that is the application ram start address that should be used, i.e. RAM_START. 

    Best regards

    Bjørn 

  • I am merging the ble_app_buttonless_dfu example with the ble_app_template example (with an added TWI sensor using custom_ble_service_example as a guide), and it is a custom 810.

    I followed Step 6 in the tutorial, adjusted for the custom, on how to get into debug with the BL secure already flashed, had set the breakpoint at app_error.c, and now not sure of how to advance to trigger the assert (no adv on nrf connect either).

    I tried repeating the debug steps from the tutorial on the DK just to see what to expect, but it seems just the same state as with the custom in SES (expect adv as nordic_buttonless). If I could understand how to do it in the tutorial using just the DK with some ram error maybe that might help.

    thank-you,

  • So if you flash the merged example( custom template + buttonless dfu) and the S112 SoftDevice to your custom device, then it advertises as expected?

    From the screenshot you added it does not seem like you enter the application at all. And you did generate a bootloader settings page and flashed that to the nrf52810 together with the bootloader, e.g. nrfutil --program settings.hex --sectorerase ? 

    If you are using the debug bootloader( found in examples\dfu\secure_bootloader\pca10040e_ble_debug) then you will have to adjust the FLASH_SIZE of your application since the debug bootloader uses FLASH_START=0x22000. Hence the application's FLASH_SIZE = 0x19000 - 0x22000 = 0x9000.

  • Flash merged example( custom template + buttonless dfu) and the S112 SoftDevice to your custom device, then it advertises as expected?
    -->> no adv, RSS Viewer states:
    app: No bootloader was found
    app: Fatal error


    You did generate a bootloader settings page and flashed that to the nrf52810 together with the bootloader? 
    -->> yes, the following;
    first part:
    mergehex -m %S112% %BOOTLOADER% -o merged_SD_bootloader.hex
    nrfjprog --program merged_SD_bootloader.hex --chiperase
    second part:
    nrfutil settings generate --family NRF52810 --application dfu_app.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 dfu_app_settings.hex
    mergehex -m dfu_app.hex dfu_app_settings.hex -o merged_DFU.hex
    nrfjprog --program merged_DFU.hex --sectorerase


    Using the debug bootloader?
    -->> I tested with debug bootloader adjusting the app FLASH_SIZE to 0x9000, same result as before, no adv after toggling power.

    I tried again the example s132 BL secure with SD on DK, and then example buttonless dfu with settings, and all is good, adv buttonless after second flash.
    Then I tried the example s112 BL secure with SD (adv as DfuTarg), and then buttonless dfu with settings, which makes the new adv as DfuTarg, not adv as buttonless.
    Then I tried the example s112 BL secure Debug with SD (adv as DfuTarg), and then buttonless dfu with settings (adjust FLASH_SIZE to 0x9000, and also original 0xf000), no adv after toggling power.
    If I could get the example s112 working on the DK like s132, then the custom s112 would probably work as well.

    RTT viewer, after first flash (s112 BL secure debug + SD), no log output after second flash (buttonless dfu with settings)
    0> <info> app: Inside main
    0> <debug> app: In nrf_bootloader_init
    0> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    0> <warning> nrf_dfu_settings: Resetting bootloader settings since neither the settings page nor the backup are valid (CRC error).
    0> <debug> nrf_dfu_settings: Writing settings...
    0> <debug> nrf_dfu_settings: Erasing old settings at: 0x0002F000
    0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0002F000, lending 0
    0> ding 0

    thank-you,

  • Hi Simon, 

    we added an additional backup settings page in SDK v15.1.0 so in order for the application to start up correctly you have to generate two settings pages, one for the actual settings page and one for the backup settings page. If you only write to the settings page, then the comparison between the settings page and backup page will fail and the settings page will be overwritten with the backup. 

    //Generate settings page located @ 0x2F000 (default if --start-address option is omitted)
    nrfutil settings generate --family NRF52810 --application <name of application>.hex --application-version 1 --bl-settings-version 1 --bootloader-version 1  settings.hex
    
    //Generate backup settings @ 0x2E000 
    nrfutil settings generate --family NRF52810 --application <name of application>.hex --application-version 1 --bl-settings-version 1 --bootloader-version 1 --start-address 0x2E000 settings_backup.hex
    
    //Merge the two settings pages to one hex
    mergehex -m settings.hex settings_backup.hex -o settings_and_backup.hex
    
    //flash settings page and settings backup to the nRF528xx device
    nrfjprog --program settings_and_backup.hex --sectorerase --reset
    

    Also make sure that there is 2 flash pages for the FDS module between the bootloader start address and the last page used by the application. Otherwise, fds_init()( called by pds_init() which in turn is called by pm_init() will return NRF_ERROR_STORAGE_FULL.

Related