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

How to switch to bootloader when OTA?

Hi,

I'm using nRF5_SDK_12.2.0_f012efa and s132_nrf52_3.0.0_softdevice. We want to do the OTA on it. However, I found that there is no DFU service in the HRS example.If I want to switch to the bootloader in the application like HRS example in nRF5_SDK_11, so that it can easily swith to bootloader using APP instead of using button. what example could I refer to? Could you give me some advice? Thanks.

Best regards, Alice

  • No, this case hasn't been solved. link text I have read it and I test experimental_ble_app_buttonless_dfu example, it also cann't switch to bootloader.

  • Hi Hung, now I can use nRF Connect in IOS to write the characteristic(write 0x01 value) to make it switch to bootloader. I do it as follow, in the ble_dfu_evt_handler function, I will write the GPREGRET register: case BLE_DFU_EVT_ENTERING_BOOTLOADER: sd_power_gpregret_set(0,0xB1); NVIC_SystemReset(); printf("Device is entering bootloader mode!\r\n"); break; Then in the bootloader, I will check the GPREGRET register in nrf_dfu_enter_check() function:

    __WEAK bool nrf_dfu_enter_check(void)
    

    {

    	if(NRF_POWER->GPREGRET==0x01)	
    	{	
    		NRF_POWER->GPREGRET =0x00;		
    		return true;
    	}
    
    if (nrf_gpio_pin_read(BOOTLOADER_BUTTON) == 0)
    {
        return true;
    }
    
    if (s_dfu_settings.enter_buttonless_dfu == 1)
    {
        s_dfu_settings.enter_buttonless_dfu = 0;
        (void)nrf_dfu_settings_write(NULL);
        return true;
    }
    return false;
    

    }

    After that, it will switch to bootloader and then update the fireware. However, the DFU app in the nRF Toolbox cann't make it switch to bootloader. If I want to use it to make it switch to bootloader, what should I do? Could I use the APP to do OTA?

  • Hi Alice,

    It's a little bit strange because both nRFConnect and nRFToolbox uses the same DFU library. You may want to capture a sniffer trace when you test with nRFToolbox, it could tell what when wrong.

    You can also add a break point in the application code where you write to GPREGRET before you jump to bootloader, to see if it reach there when the nRFToolbox try to do DFU.

  • Hi Hung,it would reach the code where I write to GPREGRET when I use the nRFToolbox try to do DFU. Could you help to test it? Thanks.

  • How would I test, Alice ? It simply works with both NRFToolbox and nRFConnect with the buttonless example in our SDK. You need to check and compare why it works when you test with NRFConnect and not when with nRFToolbox.

Related