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

SD + BL + APP dfu serial update failed

Hi, I try to update a nRF52832 with SDK 14.2.0 to SDK 15.3. I created a package with SD + BL + APP with the following command:

nrfutil pkg generate --hw-version 52 --key-file private.key \
        --application-version 2 --application application.hex \
        --sd-req 0x9D,0x98,0xB7 --softdevice softdevice.hex --sd-id 0xB7 \
        --bootloader bootloader.hex --bootloader-version 2 \
        app_dfu_package.zip

I'm using nrfutil (v5.1.0) to download the update via serial (nrfutil dfu serial -pkg ... ). Now the first part (SD + BL) succeeded, but somehow the second part, updating application, failed.
Nrfutil gives the following error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 89, in do_main
    do_serial(package = args.package[0], port = args.port[0], dfuStart = args.dfuStart)
  File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 69, in do_serial
    dfu.dfu_send_images()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 120, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 81, in _dfu_send_image
    self.dfu_transport.open()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 204, in open
    self.__get_mtu()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 306, in __get_mtu
    self.mtu = struct.unpack('<H', bytearray(response))[0]
TypeError: 'NoneType' object is not iterable

After updating the Bootloader and Softdevice, will still the old bootloader handle the application update or is already the new bootloader started? I read some threads about a problem with the softdevice size, but this should be fixed in SDK v15.3, correct? I also tried to do a package with SD + BL + APP from SDK 14.2.0 and the error is the same...

  • Hi,

    Which platform do you run nrfutil on? Linux? Do you get the same behavior with nrfutil 5.2, and is it the same if you use Python 2 or Python 3 (you can easily test both if using pip2 or pip3 if you have that installed)? Is this relevant?

    After updating the Bootloader and Softdevice, will still the old bootloader handle the application update or is already the new bootloader started?

    Yes. When you have a combined BL + SD + app update, the BL + SD is updated first, and after resetting the MBR activates/copies the BL + SD in place. This means that the new bootloader is used to update the application. 

  • Hi Einar,

    I'm run nrfutil on linux with python 2. I now updated to nrfutil 6.0.0a0, but with this version I get error while start:

    Traceback (most recent call last):
      File "/usr/local/bin/nrfutil", line 11, in <module>
        load_entry_point('nrfutil==6.0.0a0', 'console_scripts', 'nrfutil')()
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
        return ep.load()
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2411, in load
        return self.resolve()
      File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2417, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "/usr/local/lib/python3.7/dist-packages/nrfutil_dfu_serial-3.4.0-py3.7.egg/nordicsemi/__main__.py", line 42
        print os.getcwd()
               ^
    SyntaxError: invalid syntax

  • Hi,

    The error message "SyntaxError: invalid syntax" is because in this case, you are using Python3, but the python code you are executing is for python 2 (print being used as a keyword, not a function). Please check your versions and make sure they are compatible. I highly recommend using pip to install nrfutil if you have not done so before since that will ensure that dependencies are correct.

  • you're right, I mixed up the installations... I now using the nrfutil 5.2.0 from pip3 (with python 3.7). But now I have the next python error:

    sudo nrfutil -v -v -v dfu serial -b 115200 -p /dev/ttyUSB0 -pkg app_dfu_package.zip
    2019-10-18 17:32:00,363 Using board at serial port: /dev/ttyUSB0
    2019-10-18 17:32:00,364 Sending Application image.
    2019-10-18 17:32:03,888 Serial: Set Packet Receipt Notification 0
    Traceback (most recent call last):
      File "/usr/local/bin/nrfutil", line 8, in <module>
        sys.exit(cli())
      File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 717, in main
        rv = self.invoke(ctx)
      File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "/usr/local/lib/python3.7/dist-packages/nordicsemi/__main__.py", line 1042, in serial
        timeout)
      File "/usr/local/lib/python3.7/dist-packages/nordicsemi/__main__.py", line 958, in do_serial
        dfu.dfu_send_images()
      File "/usr/local/lib/python3.7/dist-packages/nordicsemi/dfu/dfu.py", line 129, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "/usr/local/lib/python3.7/dist-packages/nordicsemi/dfu/dfu.py", line 90, in _dfu_send_image
        self.dfu_transport.open()
      File "/usr/local/lib/python3.7/dist-packages/nordicsemi/dfu/dfu_transport_serial.py", line 216, in open
        self.__set_prn()
      File "/usr/local/lib/python3.7/dist-packages/nordicsemi/dfu/dfu_transport_serial.py", line 360, in __set_prn
        + map(ord, struct.pack('<H', self.prn)))
    TypeError: can only concatenate list (not "map") to list

    Do I still have not a python3 version of nrfutil? I installed nrfutil with pip3 install nrfutil, so there is not so much to do wrong...

  • To be honest, I don't know what is going on, but the error "TypeError: can only concatenate list (not "map") to list" indicates python version mismatch. Can you remove anything nordic related and make sure you erase everything within /usr/local/lib/python3.7/dist-packages/nordicsemi/ and anywhere else you could have something related and try installing again (just an idea, may not be sensible)?

Related