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

DFU over USB not running application on nRF52840

Hey all.  I was testing DFU over USB on an nRF52840, SDK 17.0.2 and I can't seem to get the actual application to run after a successful DFU.  I generate my own keys, use them with the secure_bootloader_usb_mbr_pca10056 example, everything builds great.  My application is just an adaptation of blinky for my setup - it runs fine if I flash it by itself - and no SoftDevice.

Here's my successful packet generation:

nrfutil pkg generate --hw-version 52 --application-version 1 --application blinky_pca10056_mbr.hex --sd-req 0x0100 --key-file private.key app_dfu_package.zip
Zip created at app_dfu_package.zip

Then I erase the chip and flash the bootloader, no problems.

If I send the DFU without any SoftDevice programmed, I get an error:

Traceback (most recent call last):
  File "nordicsemi\__main__.py", line 1545, in <module>
  ...
  File "nordicsemi\dfu\dfu_transport_serial.py", line 502, in __get_response
pc_ble_driver_py.exceptions.NordicSemiException: Extended Error 0x07: The array of supported SoftDevices for the update does not contain the FWID of the current SoftDevice.
[22908] Failed to execute script __main__

If I flash the SoftDevice (version 7.2.0, and I flash it first, then the bootloader), and I send the DFU, I get no errors:

nrfutil dfu usb-serial -pkg app_dfu_package.zip -p COM5 -b 115200
  [####################################]  100%
Device programmed.

But now, instead of flashing LEDs, I get nothing.  I get the sense I am doing something wrong, but I'm not seeing it.  Here is my application code:

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"

#define LED                 NRF_GPIO_PIN_MAP(0, 27)
#define LED2                NRF_GPIO_PIN_MAP(1, 8)

int main(void)
{
    /* Configure GPIO. */
    nrf_gpio_pin_clear(LED);
    nrf_gpio_cfg_output(LED);
    nrf_gpio_pin_set(LED2);
    nrf_gpio_cfg_output(LED2);

    /* Toggle LEDs. */
    while (true)
    {
        nrf_gpio_pin_toggle(LED);
        nrf_gpio_pin_toggle(LED2);
        nrf_delay_ms(500);
    }
}

Related