Example Serial Secure DFU Bootloader not work

ubirajara almeida gravatar image

asked 2017-05-19 17:14:58 +0100

hungbui gravatar image

updated 2017-05-22 12:15:38 +0100

Hi,

I used a PCA10040 dev kit with nrf52832 to test Serial Secure DFU Bootloader.

Followed all the steps in the example with my PC (Ubuntu 16.04.1 LTS 64-bit).

I used the images that are in the folder <InstallFolder>\examples\dfu\ble_dfu_send_hex

1) Erase Dev Kit - nrfjprog -e -f nrf52

2) Flash Soft Device

- nrfjprog --program .../nRF5_SDK_13.0.0_04a0bfd/components/softdevice/s132/hex/s132_nrf52_4.0.2_softdevice.hex -f nrf52 --sectorerase

3) Install micro-ecc

4) Compile and program the bootloader - cd .../nRF5_SDK_13.0.0_04a0bfd/examples/dfu/experimental_bootloader_secure_serial/pca10040_debug/s132/armgcc - make clean && make - nrfjprog --reset --program _build/nrf52832_xxaa_s132.hex

5) The board entered in dfu mode was left with the leds 1 and 3 lit

6) Installed nrfutil (tried with installed from PyPI and from source)

7) Run nrfutil dfu serial -pkg dfu_test_app_hrm_s132.zip -p /dev/ttyACM0 -b 115200

8) I got the following output:

From PC:

 [------------------------------------]    0%
Traceback (most recent call last):
  File "/usr/local/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==2.3.0', 'console_scripts', 'nrfutil')()
  File "/.local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/.local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/.local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/.local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nrfutil-2.3.0-py2.7.egg/nordicsemi/__main__.py", line 605, in serial
    dfu.dfu_send_images()
  File "/usr/local/lib/python2.7/dist-packages/nrfutil-2.3.0-py2.7.egg/nordicsemi/dfu/dfu.py", line 118, in dfu_send_images
    self._dfu_send_image(self.manifest.bootloader)
  File "/usr/local/lib/python2.7/dist-packages/nrfutil-2.3.0-py2.7.egg/nordicsemi/dfu/dfu.py", line 90, in _dfu_send_image
    self.dfu_transport.send_init_packet(data)
  File "/usr/local/lib/python2.7/dist-packages/nrfutil-2.3.0-py2.7.egg/nordicsemi/dfu/dfu_transport_serial.py", line 245, in send_init_packet
    raise NordicSemiException("Failed to send init packet")
pc_ble_driver_py.exceptions.NordicSemiException: Failed to send init packet

--------------------------------------------OR------------------------------------------------
 [------------------------------------]    0%
Traceback (most recent call last):
  File "/usr/local/bin/nrfutil", line 11, in <module>
    sys.exit(cli())
  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/nordicsemi/__main__.py", line 605, in serial
    dfu.dfu_send_images()
  File "/usr/local/lib/python2.7/dist-packages/nordicsemi/dfu/dfu.py", line 118, in dfu_send_images
    self._dfu_send_image(self.manifest.bootloader)
  File "/usr/local/lib/python2.7/dist-packages/nordicsemi/dfu/dfu.py", line 83, in _dfu_send_image
    self.dfu_transport.open()
  File "/usr/local/lib/python2.7/dist-packages/nordicsemi/dfu/dfu_transport_serial.py", line 190, in open
    if self.__ping() == False:
  File "/usr/local/lib/python2.7/dist-packages/nordicsemi/dfu/dfu_transport_serial.py", line 321, in __ping
    + 'Expected: 0x{:02X} Received: 0x{:02X}'.format(operation, resp[1]))
NameError: global name 'operation' is not defined

From Board:

: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:Application sent bootloader request
: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]

I tried with bootloader and softdevice images and the result was the same

I tried to decrease baudrate and disable flow control as recommended in post: https://devzone.nordicsemi.com/questi...

As I saw this post I also tried a VM with Ubuntu 16.04 and obtained the same results - https://devzone.nordicsemi.com/questi...

The example BLE Secure DFU Bootloader worked well and I successfully amanged to update the application and softdevice.

Does anyone have an idea how to solve this problem or have some idea that can help ?

edit retag flag offensive close delete report spam

Comments

I don't see any issue with the steps you described. Could you check which version of nrfutil you have? I'm testing with nrfutil v2.3.0 followed your steps and it worked for me.

Hung Bui ( 2017-05-22 17:08:21 +0100 )editconvert to answer

I also have version 2.3.0 installed by PyPI and after i tried by source but the result is the same

ubirajara ( 2017-05-22 17:29:31 +0100 )editconvert to answer

@ubirajara: It seems like the issue is with the PC side. Could you explain what you meant here: "The example BLE Secure DFU Bootloader worked well and I successfully amanged to update the application and softdevice." Did you mean that you only have the trouble with the debug version ?

Hung Bui ( 2017-05-23 11:30:53 +0100 )editconvert to answer