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

dfu problem

Hello,

I'm realizing dfu.

  1. 1st case - for test NRF_LOG_PRINTF("main start\r\n"); // ******* main loop start ******* // while (1) { enterBootloader();

     }
    

Dfu works well.

  1. 2nd case - question I call enterBootloader(); in some function. I can see jumping to the enterBootloader(). But, I can't see my device in nrfToolBox.

  2. question : Application doesn't restart automatically after dfu done successfully.

  • I use sd130/sdk12.1.0. and experimental_ble_app_buttonless_dfu.

image description

thanks.

  • Hi Air,

    You mean sometimes you can enter the DFU bootloader sometimes you can't?

    Could you try to test on a fresh copy of the SDK with no modification ? And state the steps you used to test.

  • Hello,

    1. As in the above question, if enterBootloader() is executed directly in main, it enters into bootloader. But, If enterBootloader() is executed while doing other work, it doesn’t enter into bootloader. I wonder if there are things to do before enterBootloader() call.

    2. As you mentioned, I tried the example dfu_secure(only blocked the FW version check). The result is same.

    3. I am wondering why the application doesn’t run after dfu via nrfToolBox / dfu_secure. However, the application runs normally after power off / on.

    Thanks.

  • What is that "doing other work" ? Please send your code snippet.

    I noticed that in your enterBootloader() code you triggered a reset right after nrf_dfu_settings_write(). This maybe not a good idea. Because nrf_dfu_settings_write() is not a blocking function. The flash is not written right after the call, but you need to wait for the call back before you can trigger the reset.

    What we did in flash_callback() is to try to disconnect after we have a flash call back. Then after that we trigger the reset.

    Again, I suggest you to test with unmodified dfu bootloader and unmodified experimental_ble_app_buttonless_dfu example.

  • The “doing other work” is to execute key function after some key input. It's not special work. There I call the enterBootloader() for test. This way I use now is the way your colleague suggested earlier. Of course I might be wrong. I want to send you my code. So, I would like to know your personal mail if possible.

    Thanks.

  • I tried repetition and delay. The result is same.

    void enterBootloader(void)
    {
    #if 0			// old
    	s_dfu_settings.enter_buttonless_dfu = true;
    	(void)nrf_dfu_settings_write(flash_callback);
    	sd_nvic_SystemReset();
    
    #else
    	uint8_t i;
    	uint8_t result = 0;
    
    	__disable_irq();
    	nrf_delay_ms(100);
    
    	s_dfu_settings.enter_buttonless_dfu = true;
    
    	for(i=0; i<10; i++)
    	{
    		if(nrf_dfu_settings_write(flash_callback) == NRF_SUCCESS)
    		{
    			result = 1;
    			break;
    		}
    		else
    			nrf_delay_ms(200);
    	}
    
    	if(result)
    	{
    		nrf_delay_ms(100);
    		sd_nvic_SystemReset();
    	}
    	else
    	{
    
    	}
    #endif
    }
    
Related