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

Nrfutil dfu ble -- Failed to open. Error code: 13

I have been unable to perform a DFU over BLE using the bootloader_secure_ble example.

I am using SDK 14.0, nRF52832, S132 with a custom board, along with the nRF51 Development Board flashed with the connectivity software, and nrfutil version 3.4.0. The project is in IAR, and I’m on Windows 10.

I am not using the debug version, and I generated my own private key and added the public key file to my project. I program the bootloader onto a blank device (only the softdevice is flashed—no application code yet).

My firmware package was created using:

nrfutil pkg generate --hw-version 52 --sd-req 0x9D --application-version 1 --application app.hex --key-file private.pem app.zip

When using nRF Connect to perform a DFU over BLE, I get the following:

When using the Windows Command Prompt (running as administrator), I use this command:

nrfutil dfu ble -ic NRF51 -pkg app.zip -p COM4 -n “DfuTarg” -f

And get this response:

I followed the directions here: http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v13.0.0%2Fble_sdk_app_dfu_bootloader.html

The only change I made to the example code was to ignore waiting for a button press and immediately go into DFU mode. This seems to be working fine.

I’ve searched through the forums and tried every possible solution that I’ve seen. So far nothing has helped. I have tried unplugging and re-plugging in the development board BLE dongle.   

  • UPDATE: 

    Through debugging I pinpointed the issue to the function nrf_crypto_ecdsa_verify_hash() that is returning NRF_DFU_RES_CODE_INVALID_OBJECT. Searching through the forums I found two solutions: 

    1. In nrf_crypto_ecdsa.h, changing the declaration of buffer from 

    static uint8_t name ## _buffer[NRF_CRYPTO_ECDSA_SIGN_CONTEXT_SIZE]; 

    to 

    __ALIGN(4) static uint8_t name ## _buffer[NRF_CRYPTO_ECDSA_SIGN_CONTEXT_SIZE];

    I did this for each macro that declares this buffer. It did not change the problem.

    2. Re-compile the micro-ecc library in IAR instead of using 'make' in the .../micro-ecc/nrf52_iar/armgcc folder.

    I am currently trying to figure out how to do this and will update this when I do! 

  • I tried going back to basics and compiling the secure_dfu_ble example, replacing the public key with my own. I got linker error [Lt009], which thanks to this post: https://devzone.nordicsemi.com/f/nordic-q-a/27260/linker-error-error-lt009-inconsistent-wchar_t-size/119942#119942 I was able to discover my issue is because I am using IAR 8.11.2.

    How can I compile the micro-ecc library using IAR 8? Should I edit Makefile in nrf52_iar/armgcc/? Or is there a cleaner solution?

  • It seems like the first issue you were experiencing was caused by the micro_ecc library being incompatible with the project, and the rest of your setup seems to work as intended.

    flopash said:
    How can I compile the micro-ecc library using IAR 8? Should I edit Makefile in nrf52_iar/armgcc/? Or is there a cleaner solution?

    I would recommend going with a supported version of your compiler. SDK 14.0.0 was made for and tested with IAR Workbench 7.80.4. We don't know what other compatibility issues there might be in IAR8. GCC with make is also tested and supported, so that's always an option.

    Best regards,
    Rune Holmgren

Related