Auto resetting NRF5340 DK board after uploading firmware using DFU

Hello NRF community. 

I am using the USB DFU method to upload a binary file onto my NRF5340 DK board. Here are the steps that I am following:

1. First, I compile the DFU sample program given at zephyr/samples/subsys/usb/dfu.

The program compiles and then I flash the app_update.bin file generated in /build/zephyr directory onto the NRF5340DK board.

This is the content of my prj.conf file : 

CONFIG_STDOUT_CONSOLE=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

CONFIG_BT=y
CONFIG_BT_HCI_RAW=y

CONFIG_USB_DEVICE_STACK=y
#CONFIG_USB_DEVICE_PID=0x000B
CONFIG_USB_DEVICE_BLUETOOTH=y
CONFIG_USB_DEVICE_BLUETOOTH_VS_H4=n

# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
# Host number of completed commands does not follow normal flow control.
CONFIG_BT_BUF_CMD_TX_COUNT=10

#This flag is enabled to make the mcuboot features for DFU available
CONFIG_BOOTLOADER_MCUBOOT=y

#These flags are taken from the usb dfu application
CONFIG_STDOUT_CONSOLE=y
CONFIG_GPIO=y
CONFIG_USB_DEVICE_PRODUCT="OTA BLE HCI Test"
CONFIG_USB_DEVICE_PID=0x0005
CONFIG_USB_DFU_CLASS=y
CONFIG_USB_DFU_ENABLE_UPLOAD=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_STREAM_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

Now I use the dfu-util tool to upload the .bin file of the blink program:

The program successfully uploads as well. The blink program starts executing once I press the reset button.

My query is how do I automatically switch to executing the blink program once the upload is complete without having to manually press the reset button? Is there something that needs to be changed in the prj.conf file? Any flags or options that I can add while uploading the image using dfu-util tool? 

Any leads and ideas about how to implement auto reset will be extremely helpful ! Thanks in advance.

Related