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

Buttonless DFU setting in Bootloader for nRF52832

Hello,

We have a custom board of nRF52832 with two buttons and right now Buttonless DFU is also working perfectly. But, we have scenario where if combination of two buttons pressed at once, than board gets into DFU mode and need to rid of it. Hence, I started working on the bootloader since at application level i,e when board is on entering DFU mode has  been removed. But, when device is off, by pressing button1 and than button2, the device still goes into DFU mode.

I comipled secure bootloader from SDK 14.2 and removed DFU enter via button press in in nrf_dfu_enter_check() inside nrf_dfu.c, by overridding with another function has shown in this link  by creating a custom_functions.c and adding it to makefile. And, now I can flash the bootloader and as well as the application and I get the icon to flash the DFU as it displayed below

       

but later than, I cannot do buttonless DFU update anymore. As soon I try to flash my application device turns off.

Also, I have set s_dfu_settings.enter_buttonless_dfu = 1; in nrf_dfu_init() function of nrf_dfu.c and than called overriding function nrf_dfu_enter_check() from custom_functions.c. Is this correct ?

Could anyone please look into it and let me know if I am doing something wrong ?

Thanks and Regards,

Nagarjun

  • Hi Nagarjun, 

    Please post the modification you made. How  you override the function. What's inside your override function. 
    Note that the nrf_dfu_enter_check() has 2 checks first is to check if the button is pressed and second is to check if GPREGRET is set (buttonless feature). 
    In your case if you only want to get rid of button check you should remove :

        if (nrf_dfu_button_enter_check() == true)
        {
            return true;
        }
    

  • HI Hung,

    Here is the overridden function below:

    bool nrf_dfu_enter_check(void)
    {	
    	if (s_dfu_settings.enter_buttonless_dfu == 1)
        {
            s_dfu_settings.enter_buttonless_dfu = 0;
            APP_ERROR_CHECK(nrf_dfu_settings_write(NULL));
            return true;
        }
    	return false;
    }

    How to to set GPREGRET ? I have set  s_dfu_settings.enter_buttonless_dfu = 1; in nrf_dfu_init() function of nrf_dfu.c. 

  • How do you trigger DFU enter in your application (buttonless application) ?
    If you write to the dfu setting (and save it)  s_dfu_settings.enter_buttonless_dfu = 1; then you trigger a reset to bootloader then it should work. 
    But if you do  s_dfu_settings.enter_buttonless_dfu = 1;  in nrf_dfu_init() then I don't know what you are planning to do. This will just force the bootloader enter DFU mode all the time. 
    I strongly suggest you to study the code and have a rough idea of how it works before editing it. 

  • If you write to the dfu setting (and save it)  s_dfu_settings.enter_buttonless_dfu = 1; then you trigger a reset to bootloader then it should work. 

    I did not get you?

    I am just planning to do DFU update. I have no problem entering DFU mode. the problem is after I enter, device turns off.

    GPREGRET is set (buttonless feature).

    As you mentioned in previous reply. , even though in my application this is set sd_power_gpregret_set(0, BOOTLOADER_DFU_START); and  in the bootloader also I added GPREGRET  method for buttonless feature still device turns off after entering DFU mode during update.

  • And also at debug output i get this,

    <info> app: ADC event number: 15
    <info> app: 713
    <info> app: Received indication state 1
    <info> app: hvx_len1 returned the err_code 3.
    <info> app: len1 returned the err_code 3.
    <info> app: sd_ble_gatts_hvx() returned the err_code 0.
    ��������������������������������������<info> app: Setting vector table to bootloader: 0x00078000
    <info> app: Setting vector table to main app: 0x00023000

Related