This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SDK 13.1 secure DFU

Hello,

I've been trying to test DFU over UART which has been added in SDK13.1 but after following every resource I've found I always end up with DFU not working

The first time I try to run DFU LED1 on DK turns off and LED2 immediately turns on. This is the best I've got so far.

I'm using the following tools:

  • Linux
  • nrfutil version 3.1.0. Also tried 2.2.0
  • nrfjprog version: 9.6.0
  • arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 6.3.1 20170215. Also tried with 4.9.3

I'm building the DFU package via

nrfutil pkg generate \
--debug-mode \
--application=${APP_HEX_PATH} \
--bootloader=${BOOTLOADER_HEX_PATH} \
--softdevice=${SD_PATH} \
--key-file=${KEY_PATH} \
${OUT_PATH}

so in above case key should not matter. I cannot build without specifying a key so I'm pointing to the one in pc-nrfutil-3.1.0/nordicsemi/dfu/tests/key.pem. In any case I've tried with different keys generated by myself but with similar results.

As for the UART DFU procedure I'm launching it via

nrfutil -v dfu serial \
--package ${DFU_PKG_PATH} \
--port ${TTY_PORT} \

nrfutil 3.1.0 responds with

pc_ble_driver_py.exceptions.NordicSemiException: No ping response

nrfutil 2.2.0 responds with

pc_ble_driver_py.exceptions.NordicSemiException: Failed to send init packet

Full RTT output from experimental_bootloader_secure_serial + s132_nrf52_4.0.2_softdevice.hex compiled with GCC 6.3.1 running against nrfutil 3.1.0 is:

Process: JLinkExe
:INFO:Inside main
:DEBUG:In nrf_bootloader_init
:DEBUG:In real nrf_dfu_init
:DEBUG:running nrf_dfu_settings_init
:DEBUG:!!!!!!!!!!!!!!! Resetting bootloader settings !!!!!!!!!!!
:DEBUG:Erasing old settings at: 0x0007f000
:DEBUG:Erasing: 0x0007f000, num: 1
:DEBUG:Writing 0x00000057 words
:DEBUG:Writing settings...
:DEBUG:Enter nrf_dfu_continue
:ERROR:Single: Invalid bank
:DEBUG:Enter nrf_dfu_app_is_valid
:DEBUG:Return false in valid app check
:DEBUG:In nrf_dfu_transports_init
:WARNING:Received unsupported OP code
:DEBUG:Sending Response: [0x9, 0x3]

Full RTT output from experimental_bootloader_secure_serial compiled with GCC 4.9.3 running against nrfutil 3.1.0 is:

:INFO:Inside main
:DEBUG:In nrf_bootloader_init
:DEBUG:In real nrf_dfu_init
:DEBUG:running nrf_dfu_settings_init
:DEBUG:Enter nrf_dfu_continue
:ERROR:Single: Invalid bank
:DEBUG:Enter nrf_dfu_app_is_valid
:DEBUG:Return false in valid app check
:DEBUG:In nrf_dfu_transports_init
:DEBUG:num transports: 1
:DEBUG:UART initialized
:DEBUG:After nrf_dfu_transports_init
:DEBUG:Waiting for events
:WARNING:Received unsupported OP code
:DEBUG:Sending Response: [0x9, 0x3]
:WARNING:Received unsupported OP code
:DEBUG:Sending Response: [0x9, 0x3]

Full RTT output from experimental_bootloader_secure_serial compiled with GCC 4.9.3 running against nrfutil 2.2.0 is:

:INFO:Inside main
:DEBUG:In nrf_bootloader_init
:DEBUG:In real nrf_dfu_init
:DEBUG:running nrf_dfu_settings_init
:DEBUG:Enter nrf_dfu_continue
:ERROR:Single: Invalid bank
:DEBUG:Enter nrf_dfu_app_is_valid
:DEBUG:Return false in valid app check
:DEBUG:In nrf_dfu_transports_init
:DEBUG:num transports: 1
:DEBUG:UART initialized
:DEBUG:After nrf_dfu_transports_init
:DEBUG:Waiting for events
:DEBUG:Set receipt notif
:DEBUG:Sending Response: [0x2, 0x1]
:DEBUG:Received get serial mtu
:DEBUG:Sending Response: [0x7, 0x1]
:DEBUG:Received select object
:INFO:Valid Command: NRF_DFU_OBJECT_OP_SELECT
:DEBUG:Sending Response: [0x6, 0x1]
:DEBUG:Received create object
:INFO:Before OP create command
:INFO:Valid Command Create
:DEBUG:Sending Response: [0x1, 0x1]
:INFO:Before OP write command
:DEBUG:Received calculate CRC
:INFO:Valid Command CRC
:DEBUG:Sending Response: [0x3, 0x1]

I have read two posts with similar problems on this forum but without any success. It always fails with the same errors and I've drained the resources. Does anyone have a suggestion of what I could try next?

One thing that seems strange to me is that when I run nrfutil settings display nrf52832_xxaa_s132.hex in experimental_bootloader_secure_serial/pca10040_debug/s132/armgcc/_build I end up with this error for nrfutil 3.1.0:

Failed to parse .hex file: Bad access at 0xFF000: not enough data to read 4 contiguous bytes

And this error for nrfutil 2.2.0:

Traceback (most recent call last):
  File "/usr/local/bin/nrfutil", line 9, in <module>
    load_entry_point('nrfutil==2.2.0', 'console_scripts', 'nrfutil')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nrfutil-2.2.0-py2.7.egg/nordicsemi/__main__.py", line 247, in display
    click.echo("{0}".format(str(sett)))
  File "/usr/local/lib/python2.7/dist-packages/nrfutil-2.2.0-py2.7.egg/nordicsemi/dfu/bl_dfu_sett.py", line 252, in __str__
    """.format(self.hex_file, self.arch_str, self.crc, self.bl_sett_ver, self.app_ver, self.bl_ver, self.bank_layout, self.bank_current, self.app_sz, self.app_crc, self.bank0_bank_code)
AttributeError: 'BLDFUSettings' object has no attribute 'arch_str'

Links to topics I've used as some reference:

Related