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

Buttonless DFU doesn't work in my project

Hi,

I'm using DSK 17.0.2 on the nRF52840 DK.

I followed the instructions for a buttonless serial DFU:

1. I cleared my board (nrfjprog -f nrf52 --recover)

2. flashed the SD (nrfjprog --program ./nRF5_SDK_17.0.2_d674dde/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex --reset --sectorerase)

3. Generated private and public keys.

4. flashed the Bootloader (nrfjprog --reset --program ./nRF5_SDK_17.0.2_d674dde/examples/dfu/secure_bootloader/pca10056_uart/ses/Output/Release/Exe/secure_bootloader_uart_mbr_pca10056.hex --family NRF52 --sectoranduicrerase)

DFU Mode is active (Led 1 and 3 on)

I dfu my zipped app.

I tried the sample buttonless DFU and it worked, I also tried adding code to the central UART project and it worked too (LEDs 1 and 3 are on again).

the code in Uart project (I set the flag, wait 2 seconds and reset):

int main(void)
{
    // Initialize.
    log_init();
    timer_init();
    uart_init();
    buttons_leds_init();
    db_discovery_init();
    power_management_init();
    ble_stack_init();
    gatt_init();
    nus_c_init();
    scan_init();

    // Start execution.
    printf("BLE UART central example started v1.\r\n");
    NRF_LOG_INFO("BLE UART central example started.");
    
    // Enter DFU Mode
    sd_power_gpregret_clr(0, 0xFFFF);
    sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
    nrf_delay_ms(2000);
    NVIC_SystemReset();

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}

But when trying the same thing in my own project I see the reset occurs but DFU mode isn't entered.

If I reset and hold button 4 I do enter DFU mode but I want the buttonless way to work.

Any idea what can cause this? I thought maybe differences in the sdk_config.h may cause it but changing them to be the same didn't help.

Thanks,

Robbie

Parents
  • Hi,

    1) Did you follow the same approach when you tested with your application as well? I.e. you DFU'ed your application after programming the SoftDevice and Bootloader?

    2) And then used this in your code to enter DFU mode?:

        // Enter DFU Mode
        sd_power_gpregret_clr(0, 0xFFFF);
        sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
        nrf_delay_ms(2000);
        NVIC_SystemReset();

    PS: Might not be directly related to your issue, but you should clear the whole GPREGRET, i.e.

    sd_power_gpregret_clr(0, 0xffffffff);

Reply
  • Hi,

    1) Did you follow the same approach when you tested with your application as well? I.e. you DFU'ed your application after programming the SoftDevice and Bootloader?

    2) And then used this in your code to enter DFU mode?:

        // Enter DFU Mode
        sd_power_gpregret_clr(0, 0xFFFF);
        sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
        nrf_delay_ms(2000);
        NVIC_SystemReset();

    PS: Might not be directly related to your issue, but you should clear the whole GPREGRET, i.e.

    sd_power_gpregret_clr(0, 0xffffffff);

Children
Related