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?

Parents Reply Children
  • 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.

  • This is absurd!! I am adding file after file and every time there are more and more undefined symbols.

    I have had to add many config items in the sdk_config.h file and there are only more undefined references.

    Catch this!!

    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol app_usbd_nrf_dfu_trigger_class_methods (referred from nrf_dfu_trigger_usb.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrf_drv_power_init (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrf_drv_power_usbevt_init (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrf_drv_power_usbevt_uninit (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_active_irq_config (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_disable (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_enable (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_disable (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_dtoggle_clear (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_enable (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_enable_check (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_handled_transfer (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_stall (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_stall_clear (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_transfer (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_force_bus_wakeup (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_init (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_is_enabled (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_is_initialized (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_start (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_stop (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_suspend (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_suspend_irq_config (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_uninit (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_wakeup_req (referred from app_usbd.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_max_packet_size_get (referred from app_usbd_core.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_ep_stall_check (referred from app_usbd_core.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_feeder_buffer_get (referred from app_usbd_core.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_last_setup_dir_get (referred from app_usbd_core.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_setup_clear (referred from app_usbd_core.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_setup_data_clear (referred from app_usbd_core.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_setup_get (referred from app_usbd_core.o).
    .\_build\nrf52840_xxaa.axf: Error: L6218E: Undefined symbol nrfx_usbd_setup_stall (referred from app_usbd_core.o).

    By the time this is done my 10K project is going to be 100K. Is this for real? How big is the overhead here? Building that project gives a size of more than 70K. I thought it would be adding two methods and a few source files and two config lines.

    I can't even find half of these undefined symbols. They are all over the place in the SDK

    Everywhere I see this Macro

    NRF_MODULE_ENABLED(...)

    The code after it is disabled. More config items copied into the sdk_config.h file and still more undefined references but some of those disables become enabled.

    DO I have to copy the entire sdk_config.h file into mine and then include every c-file in the project into mine?

Related