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

How to use the DFU library without increasing the flash size

I am usin the nrf52840 with USB DFU on the nrf52840 dongle. I want to use the DFU since I may be needing the reset button or will not be configuring it. If I don't configure the bsp.c for the reset button will the nrf52840 still go into bootloader when I press the reset button(can me modifying something in the application cause the nrf52840 to not go into bootloader)?

When I tried to compile the bootloader application(dfu\open_bootloader\pca10059_usb_debug\ses) for the nrf52840 pca10059 it looks like the flash used became very large. Why is this? I am using the 15.3 SDK. I did not make any changes.

If I want to integrate DFU USB into blinky what changes do I have to make in SES?

  • Hi,

    If I don't configure the bsp.c for the reset button will the nrf52840 still go into bootloader when I press the reset button(can me modifying something in the application cause the nrf52840 to not go into bootloader)?

    You don't need to configure anything in the bsp.c for the reset button. The reset button is configured in SystemInit when the CONFIG_GPIO_AS_PINRESET preprocessor symbol is defined. This is done in the bootloader that is alrady on the dongle.

    When I tried to compile the bootloader application(dfu\open_bootloader\pca10059_usb_debug\ses) for the nrf52840 pca10059 it looks like the flash used became very large. Why is this?

    It's just a bug with SES. The bootloader start and end address is close to the end of the flash, but SES thinks it starts at 0x0, so the displayed flash usage becomes incorrectly large.

    If I want to integrate DFU USB into blinky what changes do I have to make in SES?

    The DFU USB bootloader is already flashed on the dongle. So if you plan to use the reset button to enter DFU mode, you don't need to make any changes.

    You might find the nRF52840 Dongle Programming Tutorial useful.

  • If I am using a dongle in which the bootloader does not exist and I want to flash an application along with the USB DFU bootloader what are the steps that I have to use?

    The idea is after I flas the bootloader and the application and I want to flash a new application I want to be able to use the nrfconnect to place the application in the flash.

  • If I am using a dongle in which the bootloader does not exist and I want to flash an application along with the USB DFU bootloader what are the steps that I have to use?

    The nRF52840 dongle is already flashed with the USB bootloader. But, if the bootloader was not present on the chip, you would need to use a programmer/debugger(E.g. a J-Link that we have on our development kits) and flash the chip using SWD. 

  • Which application do I flash using SWD for installing the bootloader? Is dfu\open_bootloader\pca10059_usb_debug\ using this enough?

  • No, you also need the MBR. + maybe use the non-debug variant instead, if you don't need to debug the bootloader(i.e. dfu\open_bootloader\pca10059_usb).

    The MBR can be found in the folder:

    SDK15_folder/components/softdevice/mbr/nrf52840/hex/mbr_nrf52_2.3.0_mbr.hex

    Note that the MBR is included in the SoftDevice binary, so if you flash the SD, you don't need to flash the MBR.

    You can find the pre-compiled bootloader for the dongle including MBR in this post.

Related