This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Soft device enable and disable - [DFU] disconnected by the remote device

Hello all

I am facing a very strange issue, already searched the forum but didnt find anything like it.

Okay so I can get DFU to work. For our custom application we have to disable the soft device for some time for sensor acquisitions and re enable it at a later time for OTA upgrades.

I simply use nrf_sdh_disable_request() to de initialize the soft device successfully, which it does.

I later re - enable soft device using the standard ble calls in example code:

ble_stack_init();
    peer_manager_init();
    gap_params_init();
    gatt_init();
    advertising_init();
    services_init_2();
    conn_params_init();   
     
    //Start execution.
    application_timers_start();
    advertising_start(erase_bonds);

BLE gets initialized successfully, device is advertised and connects to as well. The problem is in DFU. When I attempt DFU, it keeps getting stuck into trying to switch to bootloader, repeatedly giving
"[DFU] disconnected by the remote device"

The logs then try to open the firmware file again, re initiating the process but nothing happen. I have spend quite some time on this and hit a blocker. Any help is appreciated. There must be a step I am missing during re-enabling the soft device

Parents
  • Hello,

    "[DFU] disconnected by the remote device"

    Where is this message printed? Is it in the mobile app on iOS or Android? And have you tried to debug the FW app to see if it hangs or enters the app_error_fault_handler() function?

    Okay so I can get DFU to work. For our custom application we have to disable the soft device for some time for sensor acquisitions and re enable it at a later time for OTA upgrades.

    Sure you really need to disable the Softdevice for this? The only case I can think of where it makes sense to disable the Softdevice is when there is a need to stop the LF clock. 

    Best regards,

    Vidar

  • Hi Vidar.
    I read an article here which said that in order to disable a service and re-enable it later, I need to disable the whole soft device as the services at start up become part of the "stack"

    if there is another way, please let me know. Basically I just want to disable the DFU service and show that service at some other point

    Also, this message appeared on the android app

  • Hi Vidar. Our custom project was in debug mode, and the bootloader project is always in Release Mode. So both need to be in Release mode.

    Although I don't know why that is necessary. Thanks a lot for all your help and patience :)

  • Hi,

    Thanks for the update. However, it should not be necessary to align the build configuration between the bootloader and app. The difference between release and debug in our projects is that debug disables code optimization and enables the DEBUG and DEBUG_NRF flag as you can see here:

      <configuration Name="Release"
        c_preprocessor_definitions="NDEBUG"
        link_time_optimization="No"    gcc_optimization_level="Optimize For Size" />
      <configuration Name="Debug"
        c_preprocessor_definitions="DEBUG; DEBUG_NRF"
        gcc_optimization_level="None"/>

    Maybe your debug jlink settings file is corrupted. You can try to delete the *.jlink setting files in your project directory. SES will create a new setting file next time you start a debug session.

  • Hmm I will look into this and try this. Thanks a lot

    Also, once again, I have another question Stuck out tongue

    Actually I keep assuming it's better than posting in a new thread and this is easier for the nordic team, but I am not sure.

    So the question is that I was looking into Single vs Dual Bank

    I play with NRF_DFU_FORCE_DUAL_BANK_APP_UPDATES and NRF_DFU_SINGLE_BANK_APP_UPDATES. In single bank mode I stop DFU in between and on restart I always see DFU Mode

    For Double bank I always get the old application on re-start
    My question is that is it possible for the bootloader to simply re-start the system if interrupted on DFU? Because we cant restart the devices in the field in case of a failed DFU. Even if we can, we dont want to. Is it possible to add that in the bootloader project using NVIC Reset?

  • Ideally we want there to be one question and one correct answer per thread. Long threads are hard to follow for others who may be looking for the same answers.

    Anyway. I'm not sure I understand your last question. Do you want the bootloader to fall back to DFU mode or boot the main app after a failed DFU attempt? The bootloader has an inactivity timer that expires after 2 minutes by default So the bootloader will not get stuck in DFU mode if you still have the old app in bank 0.

  • Vidar, the latter of what you said (Inactivity timer) is true. Thanks a lot for your help. God Bless you

    I am sorry to ask multiple questions on the same thread. The way you put it, it seems right.

Reply Children
No Data
Related