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

nrfutil dfu ble seems to fail suddenly.

It was working a few times, then suddenly I started to get these errors, which I only got previously when not running as root (perhaps because it did not have permission to open the serial port), but now it happens all the time.

I have rebooted, and still the same.

I have tried to open the serial port with minicom and it works, seems to be sending the same few bytes every half a second.

I have installed the nrfutil with:

# pip install intelhex
# pip install nrfutil

Never a problem, and did not change anything...

So no idea why... Help would be greatly appreciatted as it is urgent to get that working again.

# nrfutil dfu ble -p /dev/ttyACM0 -ic NRF52 -pkg /home/david.fernandez/src_mgt/rowesolutions/Doorlock/_build/DoorlockFull_dfu.zip
No target selected. Default device name: DfuTarg is used.
  [------------------------------------]    0%
Traceback (most recent call last):
  File "/usr/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==3.5.1', 'console_scripts', 'nrfutil')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 838, in ble
    dfu.dfu_send_images()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 117, in dfu_send_images
    self._dfu_send_image(self.manifest.softdevice_bootloader)
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 90, in _dfu_send_image
    self.dfu_transport.open()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_ble.py", line 450, in open
    self.dfu_adapter.open()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_ble.py", line 106, in open
    self.adapter.driver.open()
  File "/usr/lib/python2.7/site-packages/wrapt/wrappers.py", line 562, in __call__
    args, kwargs)
  File "/usr/lib/python2.7/site-packages/pc_ble_driver_py/ble_driver.py", line 126, in wrapper
    raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code))
pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: 13

  • the error could be due to wrong firmware on the connectivity chip.

    Try to add the -f flag to force programming of the connectivity fw: rfutil dfu ble -p /dev/ttyACM0 -ic NRF52 -pkg /home/david.fernandez/src_mgt/rowesolutions/Doorlock/_build/DoorlockFull_dfu.zip -f

     Also, you could use the -vvvv (nrfutil -vvvv dfu ble ..., notice -vvvv before the other commands) for verbose logging.

  • I did try that too... sorry that I did not mentioned it.

    I'll re-do it with all those -vvvv and copy the output.

  • Here you are:

    $ nrfjprog -f NRF52 --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.
    
    $ nrfutil -vvvv dfu ble -f -p /dev/ttyACM0 -ic NRF52 -pkg /home/david.fernandez/src_mgt/rowesolutions/Doorlock/_build/DoorlockFull_dfu.zip 
    2018-09-05 11:59:02,383 Shared library: /usr/lib/python2.7/site-packages/pc_ble_driver_py/lib/linux/x86_64/libpc_ble_driver_shared_sd_api_v3.so
    2018-09-05 11:59:02,383 Swig module name: pc_ble_driver_sd_api_v3
    No target selected. Default device name: DfuTarg is used.
    Flashing connectivity firmware...
    Connectivity firmware flashed.
    2018-09-05 11:59:13,565 Using connectivity board at serial port: /dev/ttyACM0
    2018-09-05 11:59:13,569 Sending SoftDevice+Bootloader image.
    Traceback (most recent call last):
      File "/usr/bin/nrfutil", line 11, in <module>
        load_entry_point('nrfutil==3.5.1', 'console_scripts', 'nrfutil')()
      File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
        return self.main(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
        rv = self.invoke(ctx)
      File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
        return callback(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 840, in ble
        dfu.dfu_send_images()
      File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 117, in dfu_send_images
        self._dfu_send_image(self.manifest.softdevice_bootloader)
      File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 90, in _dfu_send_image
        self.dfu_transport.open()
      File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_ble.py", line 450, in open
        self.dfu_adapter.open()
      File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_ble.py", line 106, in open
        self.adapter.driver.open()
      File "/usr/lib/python2.7/site-packages/wrapt/wrappers.py", line 562, in __call__
        args, kwargs)
      File "/usr/lib/python2.7/site-packages/pc_ble_driver_py/ble_driver.py", line 126, in wrapper
        raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code))
    pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: 13
    
    

  • Hi David,

    We have found some timeout issues and are addressing them in the next release. We believe that your issue could be related. Can you please test our unreleased connectivity hex file where we addressed these issues.

    pc_ble_driver_py-0.11.4a0.tar.gz

    the problem is likely related to congestion on the transport of the nRF5 connectivity. This would be more likely to happen on the nRF51, but also observed on nRF52 as well. There have been made some improvements to the state machine of the underlying pc-ble-driver, which have not made their way into the pc-ble-driver-py.

    I have prepared an alpha build of pc-ble-driver-py that includes the mentioned fixed, and it would be interesting to hear if makes any improvements to the issue you are seeing.

    Procedure to install the alpha:

    pip uninstall pc_ble_driver_py
    pip install pc_ble_driver_py-0.11.4a0.tar.gz
    

    Could you also give info on what kits (boards) you are using? And check if this alpha helps with the problem?

  • Something not right with that pre-release:

    # pip install /home/david.fernandez/Downloads/Nordic/pc_ble_driver_py-0.11.4a0.tar.gz 
    WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
    Processing /home/david.fernandez/Downloads/Nordic/pc_ble_driver_py-0.11.4a0.tar.gz
    Requirement already satisfied: enum34 in /usr/lib/python2.7/site-packages (from pc-ble-driver-py==0.11.4a0)
    Requirement already satisfied: wrapt in /usr/lib/python2.7/site-packages (from pc-ble-driver-py==0.11.4a0)
    Requirement already satisfied: future in /usr/lib/python2.7/site-packages (from pc-ble-driver-py==0.11.4a0)
    Installing collected packages: pc-ble-driver-py
      Running setup.py install for pc-ble-driver-py ... done
    Successfully installed pc-ble-driver-py-0.11.4a0
    

    But:

    $ nrfutil -vvvv dfu ble -f -p /dev/ttyACM0 -ic NRF52 -pkg /home/david.fernandez/src_mgt/rowesolutions/Doorlock/_build/DoorlockFull_dfu.zip 
    Traceback (most recent call last):
      File "/usr/bin/nrfutil", line 11, in <module>
        load_entry_point('nrfutil==3.5.1', 'console_scripts', 'nrfutil')()
      File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
        return self.main(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
        rv = self.invoke(ctx)
      File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
        return callback(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 802, in ble
        ble_driver_init(conn_ic_id)
      File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 65, in ble_driver_init
        from pc_ble_driver_py.ble_driver    import BLEDriver, Flasher
      File "/usr/lib/python2.7/site-packages/pc_ble_driver_py/ble_driver.py", line 101, in <module>
        raise RuntimeError('Failed to locate the pc_ble_driver shared library: {}.'.format(shlib_path))
    RuntimeError: Failed to locate the pc_ble_driver shared library: /usr/lib/python2.7/site-packages/pc_ble_driver_py/lib/linux/x86_64/libpc_ble_driver_shared_sd_api_v3.so.
    

Related