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

nrf52840 dongle flashing but going back to program mode on reboot

I was successful in flashing the dongle using SWD and the development kit. I used the blinky example. It all works perfectly. However, as soon as I reboot the dongle, it goes back to program mode with the red light flashing. Why does it do that? How can I flash permanently so that the program stays and executes even during reboots?

Parents
  • Hi,

    How did you program and how did you reboot the dongle? If you have programmed it via USB DFU (which is the most common), then the USB bootloader is still there. It will normally start the application if it is present after a power-on reset, but in case of a pin reset (pushing the sideways reset button), the bootloader will enter DFU mode. This is intentional, as alternatively there would not be any way to trigger DFU mode if you program an application that had no explicit support for it.

  • I programmed using the SWD pins (no USB). I connected the pins to my nrf52 DK and used SES to load it directly. It worked. I even did the SB1 and SB2 jumpers so the power does not come from the USB. I had a cell battery connected to VDD. All worked. The only problem is that when you remove the battery and start again it goes back to boot mode (red light flashing)

Reply Children
  • Hi,

    I see. Since you see flashing red lights, the bootloader is clearly running. If you have a bootloader, you need to either update the application via DFU or generate and program a valid bootloader settings page together with the application. The reason is that the bootloader will calculate and compare the CRC of the application with the CRC in bootloader settings. If it differs, it will enter DFU mode instead of starting the application.

    This leaves you with a few options:

    • Perform a chip erase, deleting the bootloader and MBR. This way you can program an application starting at address 0, and there is no bootloader in the system. Note that this means that you need to program the bootloader via SWD if you want to use USB DFU at a later time. Also remember to flash the firmware that sets the REG0 voltage correctly, as described in the nRF52840 Dongle Programming Tutorial.
    • Generate and program a valid bootloader settings page.
    • Modify the bootloader to not check application CRC. You can do this by adapting the dfu_enter_check() function in the bootloader.
Related