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

Best way to Enter DFU Mode from software.

Hi there, 

I would like to set my dongle into DFU mode from software, I am using the USB-CDC-ACM class, and the softdevice as a central device. 

Ideally I would send a command to the dongle and it will jump into reset and then go into DFU mode, the same way it does when the reset buttons is pressed.

What would be the best approach to do this ? 

Cheers, 

Parents Reply Children
  • Hi Amanda, 

    It seems to me like this answer is not related to the actual question in this thread.

    The question I have is how to put the dongle in DFU mode by sending a command from the USB host ? 

    Basically, having both options to set the DFU mode pushing the reset button and sending a command. 

    I have checked in the SDK and have not found any examples on this matter. 

    Any feedback on this is much appreciated. 

    Thanks 

  • Hi,  

    Curiosus said:
    The question I have is how to put the dongle in DFU mode by sending a command from the USB host ? 

    As I previously replyed, you have to load the connectivity FW onto the dongle, and then refer to the flow and commeand in the Programming an example using nrfutil section in the tutorial

    -Amanda H. 

  • Hi Amanda, 

    Thanks for your quick repply, I have loaded the connectivity FW and I was able to set the dongle into dfu mode using nrfutil. 

    However I would like to implement the same in my own application, I have been looking into the connectivity FW coruce code but have not found yet, what the sequence would be to set the device into DFU mode. 

    What would be the procedure to set the device to DFU mode from the application in the same way it does when the push button is pressed ?

    Any other documentation that I could look at apart from this, or an example?

    My application creates a VCP and I can send and receive commands using this COM port. Ideally on receiveing a given command the device should go into DFU mode. 

    Cheers, 

  • Hi Felipe, 

    The USB DFU trigger library can be included in an application to allow the USB host to put the nRF52840 Dongle in DFU mode. This is for instance used in the Connectivity firmware that is used by the nRF Connect BLE app. See the nRF5_SDK_17.0.2_d674dde_old\examples\connectivity\ble_connectivity\pca10059\ser_s140_usb_hci example, where nrf_dfu_trigger_usb_init() is called in usbd_enable(). 

    Curiosus said:
    What would be the procedure to set the device to DFU mode from the application in the same way it does when the push button is pressed ?

    The similar sentences in that tutorial essentially mean that to enter DFU mode on the dongle you do a pin reset, which happens to be on the sideways button. It uses the PINRESET as one of the methods to enter the bootloader (NRF_BL_DFU_ENTER_METHOD_PINRESET). You can take a look at the nRF5_SDK\examples\dfu\open_bootloader\pca10059_usb_debug, where the Open Bootloader is configured to enter DFU mode after pinresets by default (can be disabled in sdk_config.h). It detects this by reading out the POWER->RESETREAS on boot. 

    -Amanda H.

  • Hi Amanda, 

    Thanks for your quick reply, I had a look at the library and found exactly what I needed. 

    In my application in cdc_acm_user_ev_handler. 

    When I receive a given command, I just clear the pin that is wired to the reset pin( BSP_SELF_PINRESET_PIN ) . and it effectively goes into bootloader mode so I can update the firmware without having to press the button.

    Cheers,

Related