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:

Fullscreen
1
2
3
4
5
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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...

Parents
  • 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. 

Reply
  • 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. 

Children
  • 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:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • 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:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    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)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    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)?

  • I now completly removed all files and reinstall nrfutil and it now run with python 3.7...
    But now I again have the same issue as with the v 5.1.0 of nrfutil:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    sudo nrfutil -v -v -v dfu serial -b 115200 -p /dev/ttyUSB0 -pkg app_dfu_package.zip
    2019-10-21 16:46:41,364 Using board at serial port: /dev/ttyUSB0
    2019-10-21 16:46:41,365 Sending SoftDevice+Bootloader image.
    2019-10-21 16:46:44,379 Serial: Set Packet Receipt Notification 0
    2019-10-21 16:46:44,411 Sending init packet...
    2019-10-21 16:46:44,411 Serial: Selecting Object: type:1
    2019-10-21 16:46:44,427 Serial: Object selected: max_size:256 offset:0 crc:0
    2019-10-21 16:46:44,443 Serial: Streaming Data: len:154 offset:0 crc:0x00000000
    2019-10-21 16:46:44,635 Sending firmware file...
    2019-10-21 16:46:44,636 Serial: Selecting Object: type:2
    2019-10-21 16:46:44,651 Serial: Object selected: max_size:4096 offset:0 crc:0
    2019-10-21 16:46:44,667 Serial: Streaming Data: len:4096 offset:0 crc:0x00000000
    2019-10-21 16:46:45,152 Serial: Streaming Data: len:4096 offset:4096 crc:0x086FE1F0
    ......
    2019-10-21 16:47:04,451 Serial: Streaming Data: len:596 offset:167936 crc:0x9E5B00C2
    2019-10-21 16:47:04,819 Image sent in 20.407888889312744s
    2019-10-21 16:47:04,820 Sending Application image.
    2019-10-21 16:47:08,824 Serial: No ping response
    2019-10-21 16:47:09,826 Serial: No ping response
    2019-10-21 16:47:10,827 Serial: No ping response
    2019-10-21 16:47:11,829 Serial: No ping response
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I noticed that the device after download the first image, the LED 3 shortly ligths up (1-2s).  How can I check, that the update of bootloader + softdevice is successfully? If I enable log, the image is too big (insufficient ressources)...

    Edit:
    I today checked, if I flash the device with programmer to SDK 15.3 and then try update with nrftool, every thing was successfully. So from my point of view something went wrong while exchange the bootloader. Or could it be that the softdevice or bootloader is at wrong place? If I use the wrong sd-req or sd-id, would I get an error from nrfutil?