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

ot-nrf52840 dfu trigger library

I'm working with following project and would like to add the DFU trigger library.

https://github.com/openthread/ot-nrf528xx

1. Build like this, I'm using a PCA10059 Dongle

./script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB

2. I create the hex File

arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex

3. I generate .Zip file for nrfutil

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

4. I must press the reset button to get into Bootloader mode and load the Firmware.

nrfutil dfu usb-serial -pkg app_dfu_package.zip -p COM8

ERROR:

C:\Users\..Desktop\Nrfutil-Trigger-Test>nrfutil dfu usb-serial -pkg app_dfu_package.zip -p COM8
[------------------------------------] 0%2021-07-12 16:15:37,334 No trigger interface found for device with serial number: CFXXXXXXXX, Product ID: 0xCAFE and Vendor ID: 0x1915

How can I implement the DFU-Trigger library and how can I trigger it with nrfutil?

Output of ./script/build :

vscode ➜ /workspaces/ot-nrf528xx (main ✗) $ ./script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB
+ OT_CMAKE_NINJA_TARGET=
+ NRF_PLATFORMS=(nrf52811 nrf52833 nrf52840)
+ readonly NRF_PLATFORMS
+ NRF_BUILD_TYPES=(UART_trans USB_trans SPI_trans_NCP soft_crypto soft_crypto_threading)
+ readonly NRF_BUILD_TYPES
++ pwd
+ readonly OT_SRCDIR=/workspaces/ot-nrf528xx
+ OT_SRCDIR=/workspaces/ot-nrf528xx
+ OT_OPTIONS=("-DCMAKE_BUILD_TYPE=MinSizeRel" "-DOT_PLATFORM=external" "-DOT_SLAAC=ON")
+ readonly OT_OPTIONS
+ main nrf52840 USB_trans -DOT_BOOTLOADER=USB
+ [[ 3 == 0 ]]
+ local platform=nrf52840
+ echo nrf52811 nrf52833 nrf52840
+ grep -wq nrf52840
+ [[ 3 == 1 ]]
+ local nrf_build_type=USB_trans
+ echo UART_trans USB_trans SPI_trans_NCP soft_crypto soft_crypto_threading
+ grep -wq USB_trans
+ shift
+ shift
+ local_options=()
+ local local_options
+ options=("${OT_OPTIONS[@]}")
+ local options
+ case "${platform}" in
+ local_options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-none-eabi.cmake")
+ case "${nrf_build_type}" in
+ options+=("${local_options[@]}" "-DOT_USB=ON" "-DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls")
+ options+=("$@")
+ build -DNRF_PLATFORM=nrf52840 -DCMAKE_BUILD_TYPE=MinSizeRel -DOT_PLATFORM=external -DOT_SLAAC=ON -DCMAKE_TOOLCHAIN_FILE=src/nrf52840/arm-none-eabi.cmake -DOT_USB=ON -DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls -DOT_BOOTLOADER=USB
+ local builddir=build
+ mkdir -p build
+ cd build
+ cmake -GNinja -DOT_COMPILE_WARNING_AS_ERROR=ON -DNRF_PLATFORM=nrf52840 -DCMAKE_BUILD_TYPE=MinSizeRel -DOT_PLATFORM=external -DOT_SLAAC=ON -DCMAKE_TOOLCHAIN_FILE=src/nrf52840/arm-none-eabi.cmake -DOT_USB=ON -DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls -DOT_BOOTLOADER=USB /workspaces/ot-nrf528xx
-- OpenThread Source Directory: /workspaces/ot-nrf528xx/openthread
-- OpenThread CMake build type: MinSizeRel
-- Package Name: OPENTHREAD
-- Setting default package version: thread-reference-20200818-1060-g681214da9
-- Package Version: thread-reference-20200818-1060-g681214da9
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/ot-nrf528xx/build
+ [[ -n '' ]]
+ ninja
[29/113] cd /workspaces/ot-nrf528xx/build/openthread && /usr/bin/cmake -DLIST="OPENTHREAD_CONFIG_ASSER...eck.h";MBEDTLS_CONFIG_FILE="nrf-config.h"" -P /workspaces/ot-nrf528xx/openthread/etc/cmake/print.cmak
OPENTHREAD_CONFIG_ASSERT_ENABLE=1
OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0
OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0
OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0
OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=1
OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1
OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1
OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=0
PACKAGE_NAME=OPENTHREAD
PACKAGE_VERSION=thread-reference-20200818-1060-g681214da9
OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2
OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1
OPENTHREAD_CONFIG_FILE=openthread-core-nrf52840-config.h
OPENTHREAD_PROJECT_CORE_CONFIG_FILE=openthread-core-nrf52840-config.h
OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=openthread-core-nrf52840-config-check.h
MBEDTLS_USER_CONFIG_FILE=nrf52840-mbedtls-config.h
USB_CDC_AS_SERIAL_TRANSPORT=1
APP_USBD_NRF_DFU_TRIGGER_ENABLED=1
OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=openthread-core-nrf52840-config-check.h
MBEDTLS_CONFIG_FILE=nrf-config.h
[113/113] Linking CXX executable bin/ot-ncp-ftd
+ cd /workspaces/ot-nrf528xx

Parents
  • Hi Uyl,

    Did you see the red led blink?

    Best regards,

    Charlie

  • It's is only blinking when you enter the bootloader mode.

    I've changed following things:

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

    and the config files:

    ## 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

    Now the devices appears as "  nRF Connect USB CDC ACM (COM11) " and I can trigger the Reset with the NRF-Connect Programmer.

    But it still doesn't work with nrfutil, do you know the command?

Reply
  • It's is only blinking when you enter the bootloader mode.

    I've changed following things:

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

    and the config files:

    ## 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

    Now the devices appears as "  nRF Connect USB CDC ACM (COM11) " and I can trigger the Reset with the NRF-Connect Programmer.

    But it still doesn't work with nrfutil, do you know the command?

Children
  • Hi Uyl,

    This is already a Nordic Open bootloader preprogrammed into nRF52840 Dongle. You only need to trigger DFU mode manually. Plug in nRF52840 Dongle and press reset button to trigger the DFU mode, you will see the red LED start to blink. 

    I repeat your procedure without changing any codes and it worked well. It is on Ubuntu system but should be the same with Windows.

    cd ot-nrf528xx
    ./script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB
    arm-none-eabi-objcopy -O ihex build/bin/ot-cli-ftd ot-cli-ftd.hex
    nrfutil pkg generate --debug-mode --hw-version 52 --sd-req 0x00 --application ot-cli-ftd.hex app_dfu_package.zip
    sudo nrfutil dfu usb-serial -pkg app_dfu_package.zip -p /dev/ttyACM0
    [####################################]  100%          
    Device programmed.
    Could you confirm the way you trigger DFU mode is the same as I mentioned?

    Best regards,

    Charlile

  • Hello Charlie

    I know the procedure with the reset button.

    But I'm going to have a Thread network with 100 devices  for Testing and i dont want to press the rest button 100 times Slight smile.

    I want to be able to Flash firmware updates without pressing the RESET button.  I can enter the Bootloader mode without pressing the RESET button. But it doesn't work with NRFutil only with NRF-Connect programmer .

    This appears and when i press it, it changes to sDFU. This is all good but how can i trigger it with NRFutil?

Related