How to use the trigger library to program the nRF52840 dongle

Sorry but I find the documentation useless. I don't even know where to start. It could be I have not found the correct documentation which is not surprising.

The best I have is this: https://devzone.nordicsemi.com/f/nordic-q-a/77254/nrf52840-dongle-pca10059-dfu-trigger-library/332347#332347

but I have no idea how this even started.

Right now the project works. I can use the reset button to flash the dongle and it works. Its a BTLE peripheral that a cycle power client connects to at which time the device starts a scanner and gets data from an unconnectable advertisement from a bike and notifies the data to the client. The USB is used only as a source of power. The project uses SoftDevice for BTLE and flash writes and not the SDK.

Now I want to add the overhead to be able program the dongle without touching the reset button. I don't know where to start. It's clear I have to add lots of h-files and c-files to the project. However, where do I find the steps that document how one adds this functionality to an existing project?

  • What methods do I need to call and when?
  • What configuration parameters do I need to set outside of sdk_config.h?
  • What configuration parameters do I need to set in sdk_config.h?
  • Where are these methods and h-files located so I can pull/configure my project?

One final question, how much overhead does this add? Will it greatly increase the size of my executable project?

When and if this ever gets completed, would that mean I can flash the dongle directly from Keil or Segger or do I still need nRF_Connect that I use now where I have to press the reset button?

  • Confidence is low. Either it is much harder than the line 'add the trigger library' in the documentation (there is little else so one is lead to believe that it is very easy) or I am really missing something.

  • Can you explain (or show) how you have added the trigger library, and also explain how you have tested and in what way it fails?

  • I don't know how to add it into my project. No clue even how to start. It probably requires configuring a lot of h-files (via the IDE) and including c-files into my project. No documentation anywhere that I can find. Piecemeal stuff scattered about but no way to piece it together.

  • I see. I suggest you start with the main things:

    • Use the <SDK>\examples\connectivity\ble_connectivity\pca10059\ser_s140_usb_hci\ example project that matches your toolchain as reference, so that you have an example where all required files and configurations are present.
    • Update your application code to include nrf_dfu_trigger_usb.h and call nrf_dfu_trigger_usb_init() during initialization. This is the only change needed in your code apart from sdk_config.h
    • Modify your sdk_config.h, copying in the two NRF_DFU_TRIGGER_* configurations from <SDK>\examples\connectivity\ble_connectivity\pca10059\ser_s140_usb_hci\config\sdk_config.h. Adapt to your application.
    • Add missing include paths to your project. If you have a USB project your probably have most from before, but make sure you add ../../../../../../components/libraries/bootloader/dfu and ../../../../../../components/libraries/usbd/class/nrf_dfu_trigger (relative path may differ in your project).
    • Add ../../../../../../components/libraries/bootloader/dfu/nrf_dfu_trigger_usb.c and ../../../../../../components/libraries/usbd/class/nrf_dfu_trigger/app_usbd_nrf_dfu_trigger.c to your project.

    If you still miss somethings you should get sensible errors/warnings from the tools so that you can correct.

1 2 3 4 5 »