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

How to adapt the BLE Secure DFU Bootloader to work with nRF52840 dongle?

Hi, you must be sick of me!

Now that (somehow) I've got the BLE Secure DFU Bootloader to work on my nRF52840 DK board. I'd now like to load it on a nRF52840 dongle pca10059. So I can then work on a buttonless DFU (oh if only this was available out of the box as it surely must be a common use case?)

So, what do I do? Please Slight smile

A question that really concerns me is how to program the dongle.

Programming the DK usually involves an erase option. I've read that doing this with the dongle puts the dongle in a low voltage state and any flashing must be complete before a reset.

How do I ensure that if my attempts don't work at flashing the bootloader that I don't brick the device?

If I do where are the instructions that I can use to recover the dongle using my dk board?

I'm thinking that I'll be okay if I just flash the softdevice and then just keep flashing the bootloader app until it works. Yes there may be some unused code left in the memory map (minimal surely), but hopefully for testing there'll be a "halt" instruction somewhere in the bootloader code  and I'll never reach any garbage? Then when it works I'll do a full erase and flash.

Gordon

Parents
  • Hi Gordon,

    I am glad to hear that you have the BLE Secure DFU Bootloader up and working on your DK! Slight smile

    You are correct that you should not erase UICR of the dongle, as doing so will leave it in a state where it cannot be re-programmed from an external debugger. In addition to this, if you want to program the dongle without needing a debugger, such as a DK, you must make sure not to delete the Open USB bootloader that it is shipped with. However, you do not need to erase the dongle when programming it. If you program it through the built-in bootloader you only need to put it in DFU mode, open the dongle in the Programmer application, add the hex file, and then write, no erasing needed.

    We have a nRF52840 Dongle Programming Tutorial that I recommend you check out! This explains a bit about the dongle and how it works, in addition to having some guides for working with the dongle. Some of the topics are:

    • How to adapt nRF5 SDK projects to the dongle, which is very relevant for what you want to do here.
      • This explains both what changes to make to the project and how to program the dongle using the Programmer app.
      • One guide for examples without SoftDevice, and one for examples with SoftDevice.
    • Programming using nrfutil, if you prefer to use that instead of the Programmer app
    • Programming using an external debugger, if you do not want to use the built-in bootloader
    • It also explains why you should not do a full chip erase, how to recover if you accidentally erase UICR, and how to recover the bootloader if you accidentally erase it

    The tutorial should answer your questions, but if you still have unanswered questions after reading through it, do not hesitate to ask here!

    Best regards,

    Marte

Reply
  • Hi Gordon,

    I am glad to hear that you have the BLE Secure DFU Bootloader up and working on your DK! Slight smile

    You are correct that you should not erase UICR of the dongle, as doing so will leave it in a state where it cannot be re-programmed from an external debugger. In addition to this, if you want to program the dongle without needing a debugger, such as a DK, you must make sure not to delete the Open USB bootloader that it is shipped with. However, you do not need to erase the dongle when programming it. If you program it through the built-in bootloader you only need to put it in DFU mode, open the dongle in the Programmer application, add the hex file, and then write, no erasing needed.

    We have a nRF52840 Dongle Programming Tutorial that I recommend you check out! This explains a bit about the dongle and how it works, in addition to having some guides for working with the dongle. Some of the topics are:

    • How to adapt nRF5 SDK projects to the dongle, which is very relevant for what you want to do here.
      • This explains both what changes to make to the project and how to program the dongle using the Programmer app.
      • One guide for examples without SoftDevice, and one for examples with SoftDevice.
    • Programming using nrfutil, if you prefer to use that instead of the Programmer app
    • Programming using an external debugger, if you do not want to use the built-in bootloader
    • It also explains why you should not do a full chip erase, how to recover if you accidentally erase UICR, and how to recover the bootloader if you accidentally erase it

    The tutorial should answer your questions, but if you still have unanswered questions after reading through it, do not hesitate to ask here!

    Best regards,

    Marte

Children
No Data
Related