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

nRF52840 Dongle, PCA10059 DFU Trigger library

Hello I'm trying to implement the DFU Trigger library into my project. to get following function:

" When the trigger library is added to an application, it allows a connected USB host to remotely tell the app to reboot into the bootloader to allow it to be updated via DFU. When asked to enter bootloader mode, it pulls its own reset pin using the GPIO pin BSP_SELF_PINRESET_PIN (by default, only available on PCA10059). As a consequence, the library requires the following:

  • a GPIO pin connected to the RESET pin which is true for the PCA10059 dongle,
  • a bootloader that enters DFU mode on pin reset. "

I want to load Firmware updates to the Dongle without pressing the reset button.

In the main.c I've addded following code, I wasn't sure if i had to add some defines in the sdk_config.h:

#include "nrf_dfu_trigger_usb.h"
#include "app_usbd.h"
#include "boards.h"
#define BOARDS_WITH_USB_DFU_TRIGGER  1
#define NRF_DFU_TRIGGER_USB_INTERFACE_NUM 1
#define NRF_DFU_TRIGGER_USB_USB_SHARED 1
#define BOARD_PCA10059 1
#define BSP_INIT_NONE    0
#define BSP_INIT_LEDS    (1 << 0
#define BSP_INIT_BUTTONS (1 << 1)
const app_usbd_config_t * usbd_config = NULL;
...
int main(int argcchar *argv[])
{
    app_usbd_init(usbd_config);
    bsp_board_init(BSP_INIT_LEDS);
...
}
ERROR:
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/nrf_dfu_trigger_usb.c.o: in function `nrf_dfu_trigger_usb_init':
/workspaces/./third_party/NordicSemiconductor/components/libraries/usb/nrf_dfu_trigger_usb.c:221: undefined reference to `app_usbd_class_append'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/nrf_dfu_trigger_usb.c.o:(.rodata.m_app_dfu+0x4): undefined reference to `app_usbd_nrf_dfu_trigger_class_methods'
/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/main.c.o: in function `main':
/./app/main.c:174: undefined reference to `app_usbd_init'
collect2: error: ld returned 1 exit status
Makefile:360: recipe for target 'build' failed
make: *** [build] Error 1

I've added following librarys to my makefile:

  $(NORDIC_ROOT)/components/libraries/usb/app_usbd.c \
  $(NORDIC_ROOT)/components/libraries/usb/class/cdc/acm/app_usbd_cdc_acm.c \
  $(NORDIC_ROOT)/components/libraries/usb/app_usbd_string_desc.c \
  $(NORDIC_ROOT)/components/libraries/usb/nrf_dfu_trigger_usb.c \
  $(NORDIC_ROOT)/components/libraries/usb/app_usbd_nrf_dfu_trigger.c \
...
  -I$(NORDIC_ROOT)/config \
  -I$(NORDIC_ROOT)/components/libraries/usb \
  -I$(NORDIC_ROOT)/components/libraries/block_dev \
  -I$(NORDIC_ROOT)/components/libraries/usb/config \
  -I$(NORDIC_ROOT)/components/libraries/usb/class \
  -I$(NORDIC_ROOT)/components/libraries/usb/class/cdc \
Any advices ? Slight smile
Parents
  • Uyl,

    Did you get this to work? I am trying to do the same thing, program the nRF52840 dongle without pressing the reset button. I have dongles that are in a sealed cover and do not have access to the reset button. I don't even know how to start. Where did you find the documentation to get off the ground? Maybe there isn't any? I certainly have not found anything but documentation has always been difficult to find on the Nordic sites.

    I cannot even find the trigger library... of course I don't know what it is called in the SDK or if it even exists in the SDK. My current project uses SoftDevice and BTLE. It does not use the SDK for Bluetooth; just SoftDevice.

    I guess it does not exist in the SDK in any obvious form - I tried adding 

    #include "nrf_dfu_trigger_usb.h" in an example BTLE project (BPS) and the compiler could not find the file.

    Did you find an example project where this is implemented?

    Thanks,

    Brian

Reply
  • Uyl,

    Did you get this to work? I am trying to do the same thing, program the nRF52840 dongle without pressing the reset button. I have dongles that are in a sealed cover and do not have access to the reset button. I don't even know how to start. Where did you find the documentation to get off the ground? Maybe there isn't any? I certainly have not found anything but documentation has always been difficult to find on the Nordic sites.

    I cannot even find the trigger library... of course I don't know what it is called in the SDK or if it even exists in the SDK. My current project uses SoftDevice and BTLE. It does not use the SDK for Bluetooth; just SoftDevice.

    I guess it does not exist in the SDK in any obvious form - I tried adding 

    #include "nrf_dfu_trigger_usb.h" in an example BTLE project (BPS) and the compiler could not find the file.

    Did you find an example project where this is implemented?

    Thanks,

    Brian

Children
  • Hello Brian

    I couldn't find a trigger library either and i dont use Bluetooth. I had some little success with following setup:

    1. Change some values in following config files:

    ot-nrf528xx/third_party/NordicSemiconductor/config - app_config.h - sdk_config.h

    app_config.h

    #ifndef APP_USBD_PID
    #define APP_USBD_PID 0x0C00A
    endif
    
    #ifndef APP_USBD_NRF_DFU_TRIGGER_ENABLED
    #define APP_USBD_NRF_DFU_TRIGGER_ENABLED 1
    #endif

    nrf52840/sdk_config.h

    #ifndef APP_USBD_ENABLED
    #define APP_USBD_ENABLED 1
    #endif
    
    #ifndef APP_USBD_CONFIG_SELF_POWERED
    #define APP_USBD_CONFIG_SELF_POWERED 0
    #endif
    
    #ifndef APP_USBD_CDC_ACM_ENABLED
    #define APP_USBD_CDC_ACM_ENABLED 1
    #endif
    
    #ifndef APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_ENABLED
    #define APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_ENABLED 1
    #endif


    2. Build and generate hex file with these settings 

    $ ./script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB -DOT_APP_CLI=ON -DOT_FTD=ON

    $ arm-none-eabi-objcopy -O ihex build/bin/ot-cli-ftd ot-cli-ftd.hex

    3. Flash with Nrf Desktop connect or with nrfutil

    nrfutil:

    3.1. Generate .pkg file from .hex file. (nrfutil uses .pkg files to flash)

    C:\Users\..> nrfutil pkg generate --debug-mode --hw-version 52 --sd-req 0x00 --application ot-cli-ftd.hex app_dfu_package.zip

    3.2

    C:\Users\..> nrfutil dfu usb-serial -pkg app_dfu_package.zip -p COM8

    The Dongle should appear as nRF Connect USB CDC ACM (COM11) in device-manager. Choose this device in NRF-Connect Desktop Programmer. The RESET will be triggered and the device will be in bootloader mode.

    Let me know if it work and when you find better solutions.

  • I have been unable to get it to work. I have managed to include all the h-files and c-files to allow the single nrf_dfu_trigger_usb_init() to be supported. So I can build and install my app and the app runs, but I get the error Nordic DFU Trigger Interface was not found.Please physically reset device after programming with NRF Connect.

    However, there are all kinds of unknowns in the sdk_config.h file. I am not sure if I have enabled everything that needs to be enabled and configured everything correctly. My app does not use USB so I assumed that the SHARE option should be off. That drops the interface I believe. But that may not be the only thing. So I am still at quite a loss and there is no documentation for this trigger relative to all the settings and how they influence it.

Related