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

Buttonless DFU Debugging Problem

I'm trying to add buttonless DFU to the SDK's template application. 

Here is my setup: 

  • Soft Device 6.1.0
  • Secure Bootloader
  • Modified Template App (Added buttonless DFU)

I am able to successfully OTA upload my package .zip to the board, but the application does not run and there is no advertising.
The bootloader is there because holding button 4 and doing a reset on the dev-kit puts it into DFU.

Trying to debug the code, I can not run a debug session through Segger Embedded Studio when the bootloader is present. 
With just the APP + SD, I can step through and get to the point in services_init where ble_dfu_buttonless_async_svci_init returns: No bootloader was found


Adding a debug post build script for the bootloader settings:

C:\Python27\Scripts\nrfutil.exe settings generate --family NRF52840 --application $(ProjectDir)\Output\$(Configuration)\Exe\$(ProjectName).hex  --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex
With this added, flashing the SD, and Bootloader, and trying to debug through SES, the code just tries to run with no advertising without giving me the option to step through the code.
I've tried adding the SD, Bootloader settings, and Bootloader as Additional Load files in the debug build to no success.

Section Placement Macros:
FLASH_PH_START=0x0
FLASH_PH_SIZE=0x100000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x40000
FLASH_START=0x26000
FLASH_SIZE=0xd2000
RAM_START=0x20002210
RAM_SIZE=0x3dde0

The same results are seen for my experiments with trying to debug the SDK's buttonless DFU app.
Any help would be appreciated,
Jeff

  • Jeff,

    thanks for confirming. Maybe it could be the bootloader button pin then. The bootloader will enter DFU mode if the NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN is pulled low on startup?

    Vidar

  • Vidar,

    Holding down the button on power-up fixed the issue.
    This is strange to me, as the button is pulled low on contact. (See schematic)
    Perhaps I need to activate an internal pull-up inside the boot?



    Thanks for your continued support!
    Jeff

  • Jeff,

    Happy to help:) Yes, you need to enable pull-up on the pin, see BUTTON_PULL define in you BOARD header. 

    Update: guess I responded too quickly. Based on the schematic, I don't think it make sense that it works when you hold the button on power-up.

    Here are the lines of code that determines if the bootloader should enter DFU mode (nrf_bootloader.c::dfu_enter_check):

    static bool dfu_enter_check(void)
    {
    if (!nrf_dfu_app_is_valid(crc_on_valid_app_required()))
    {
    NRF_LOG_DEBUG("DFU mode because app is not valid.");
    return true;
    }

    if (NRF_BL_DFU_ENTER_METHOD_BUTTON &&
    (nrf_gpio_pin_read(NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN) == 0)) // Active low
    {
    NRF_LOG_DEBUG("DFU mode requested via button.");
    return true;
    }

    if (NRF_BL_DFU_ENTER_METHOD_PINRESET &&
    (NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk))
    {
    NRF_LOG_DEBUG("DFU mode requested via pin-reset.");
    return true;
    }

    if (NRF_BL_DFU_ENTER_METHOD_GPREGRET &&
    (nrf_power_gpregret_get() & BOOTLOADER_DFU_START))
    {
    NRF_LOG_DEBUG("DFU mode requested via GPREGRET.");
    return true;
    }

    if (NRF_BL_DFU_ENTER_METHOD_BUTTONLESS &&
    (s_dfu_settings.enter_buttonless_dfu == 1))
    {
    NRF_LOG_DEBUG("DFU mode requested via bootloader settings.");
    return true;
    }

    return false;
    }

    And the bootloader button initialization (nrf_bootloader.c::dfu_enter_button_init):

    nrf_gpio_cfg_sense_input(NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN,
    BUTTON_PULL,
    NRF_GPIO_PIN_SENSE_LOW); 

     

      

Related