To do a serial DFU I have followed the steps provided in the DFUMaster_UART link.
1) Generated the key using the NrfUtil.
2) Added the private.key and generated a DFU package using the NrfUtil tool.
3) Added the public.key to the secure_bootloader_uart example and build it.
4) Flashed the Softdevice and the above-builded bootloader to one nrf52840 DK.
5) Extracted the DFU package generated in step 2, got three files:
- app_xyz .bat
- app_xyz .bin
- manifest.json
6) Tried building in the DFUMaster_UART with the SDK v15.2 as it was giving some errors, tried building it with the SDKv14.2 it was successful.
7) Flashed DFUMaster_UART in one nrf52832 DK as the example available was for the PCA10040.
8) Flashed the extracted app_xyz.bat to 0x9000 location as in the DFUMaster code it was reading this location for the init packet.
9) Flashed the extracted app_xyz.bin to 0x30000 location as in the DFUMaster code it was reading this location for the image to be sent to DFU_Target(nrf52840).
10) Now Bootloader code was successfully able to parse the init package and validated it. But, as the DFUMaster Starts sending the FW Image the bootloader code resets after receiving the two packets and writing in to flash.
Debugged that by putting the breakpoint, got to know that as the bootloader tries to write the third packet in the flash it stuck in the wait_for_flash_ready().
Please correct me if any of the above steps are incorrect, so that I can successfully complete the DFU.