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

DFU package creation error using nftutil

When creating dfu package using nrfutil, an error is displayed.

Traceback (most recent call last):
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\Scripts\nrfutil-script.py", line 33, in <module>
    sys.exit(load_entry_point('nrfutil==6.1.0', 'console_scripts', 'nrfutil')())
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\__main__.py", line 881, in generate
    package.generate_package(zipfile_path)
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\package.py", line 414, in generate_package
    Package.normalize_firmware_to_bin(self.work_dir, firmware_data[FirmwareKeys.FIRMWARE_FILENAME])
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\package.py", line 615, in normalize_firmware_to_bin
    temp.tobinfile(new_filepath)
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\nrfhex.py", line 181, in tobinfile
    start_address = self.minaddr()
  File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\nrfhex.py", line 135, in minaddr
    min_address = max(self.get_mbr_end_address(), min_address)
TypeError: '>' not supported between instances of 'NoneType' and 'int'

When I looked for and checked the file where the error occurred, a problem occurred in Python's max function.

    def minaddr(self):
        min_address = super().minaddr()
        
        # Lower addresses are reserved for master boot record
        if self.file_format != 'bin':
            min_address = max(self.get_mbr_end_address(), min_address)

        return min_address

The value of min_address appears as None.

How do I solve this problem?

Used command : 

nrfutil.exe pkg generate --hw-version 99 --sd-req 0x80 --application-version 99 --application blinky_pca10056.hex test.zip

Parents
  • Hi, 

    (Updated)

    If you use blinky_pca10056.hex from nRF5_SDK\examples\peripheral\blinky\hex, you should use blinky_pca10056_mbr.hex which combines the mbr image.  Set --sd_req 0x00 which means "The update does not depend on the SoftDevice".  Then the following command could work

    nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 99 --application blinky_pca10056_mbr.hex test.zip 

    --

    If you use ble_app_blinky_pca10056_s140.hex under nRF5_SDK\examples\ble_peripheral\ble_app_blinky\hex, then the following command should work

    nrfutil.exe pkg generate --hw-version 52 --sd-req 0xB6 --application-version 99 --application ble_app_blinky_pca10056_s140.hex test.zip

    You could use "nrfutil.exe pkg generate --help" to check the SoftDevice ID. 

    Notice that we are entering the Christmas and New Year holidays and will have reduced staff, please expect delayed responses until after January 4th. Sorry for the inconvenience.

    -Amanda H.

  • Happy new year.
    Thanks for the comment.

    I solved the problem with the suggested solution.
    However, a new problem arose.

    PS C:\Users\2020090001001\Desktop\nrf_flash_dfu\Exe_1> nrfutil.exe pkg generate --hw-version 52 --sd-req 0xCA --application-version 99 --key-file priv.pem --application ble_app_blinky_pca10056_s140.hex test.zip       Zip created at test.zip
    PS C:\Users\2020090001001\Desktop\nrf_flash_dfu\Exe_1> nrfutil.exe dfu serial -pkg test.zip -p COM21                                                                                                                     
    Traceback (most recent call last):
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\Scripts\nrfutil-script.py", line 33, in <module>
        sys.exit(load_entry_point('nrfutil==6.1.0', 'console_scripts', 'nrfutil')())
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 782, in main
        rv = self.invoke(ctx)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\__main__.py", line 1055, in serial
        do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, True,
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\__main__.py", line 970, in do_serial
        dfu.dfu_send_images()
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 95, in _dfu_send_image
        self.dfu_transport.send_init_packet(data)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 256, in send_init_packet
        self.__execute()
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 421, in __execute
        self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 502, in __get_response
        raise NordicSemiException('Extended Error 0x{:02X}: {}'.format(resp[3], data))
    pc_ble_driver_py.exceptions.NordicSemiException: Extended Error 0x07: The array of supported SoftDevices for the update does not contain the FWID of the current SoftDevice.

    The "BLE_APP_BLINKY" example I used was "nRF5_SDK_17.0.2\examples\ble_peripheral\ble_app_blinky\hex\ble_app_blinky_pca10056_s140".

    I checked the SoftDevice ID you gave me, but there was no version I used.

    I use "s140_nrf52_7.2.0_softdevice".

    --sd-req TEXT                   The SoftDevice requirements. A comma-
                                      separated list of SoftDevice firmware IDs (1
                                      or more) of which one must be present on the
                                      target device. Each item on the list must be
                                      a two- or four-digit hex number prefixed
                                      with "0x" (e.g. "0x12", "0x1234"). A non-
                                      exhaustive list of well-known values to use
                                      with this option follows:
                                      |s112_nrf52_6.0.0|0xA7|
                                      |s112_nrf52_6.1.0|0xB0|
                                      |s112_nrf52_6.1.1|0xB8|
                                      |s112_nrf52_7.0.0|0xC4|
                                      |s112_nrf52_7.0.1|0xCD|
                                      |s113_nrf52_7.0.0|0xC3|
                                      |s113_nrf52_7.0.1|0xCC|
                                      |s130_nrf51_1.0.0|0x67|
                                      |s130_nrf51_2.0.0|0x80|
                                      |s132_nrf52_2.0.0|0x81|
                                      |s130_nrf51_2.0.1|0x87|
                                      |s132_nrf52_2.0.1|0x88|
                                      |s132_nrf52_3.0.0|0x8C|
                                      |s132_nrf52_3.1.0|0x91|
                                      |s132_nrf52_4.0.0|0x95|
                                      |s132_nrf52_4.0.2|0x98|
                                      |s132_nrf52_4.0.3|0x99|
                                      |s132_nrf52_4.0.4|0x9E|
                                      |s132_nrf52_4.0.5|0x9F|
                                      |s132_nrf52_5.0.0|0x9D|
                                      |s132_nrf52_5.1.0|0xA5|
                                      |s132_nrf52_6.0.0|0xA8|
                                      |s132_nrf52_6.1.0|0xAF|
                                      |s132_nrf52_6.1.1|0xB7|
                                      |s132_nrf52_7.0.0|0xC2|
                                      |s132_nrf52_7.0.1|0xCB|
                                      |s140_nrf52_6.0.0|0xA9|
                                      |s140_nrf52_6.1.0|0xAE|
                                      |s140_nrf52_6.1.1|0xB6|
                                      |s140_nrf52_7.0.0|0xC1|
                                      |s140_nrf52_7.0.1|0xCA|
                                      |s212_nrf52_6.1.1|0xBC|
                                      |s332_nrf52_6.1.1|0xBA|
                                      |s340_nrf52_6.1.1|0xB9|

  • Hi, 

    The Firmware ID of s140_nrf52_7.2.0_softdevice is 0x0100. See the s140_nrf52_7.2.0_release-notes.pdf under nRF5_SDK\components\softdevice\s140\doc

    If the answer helps you, please verify the answer to benefit other users. 

    -Amanda H.

Reply Children
  • I changed the value of "--sd-req" to 0x0100, but the same error occurs.

    PS C:\Users\2020090001001\Desktop\nrf_flash_dfu\Exe_1> nrfutil.exe pkg generate --hw-version 52 --sd-req 0x0100 --application-version 99 --key-file priv.pem --application ble_app_blinky_pca10056_s140.hex test.zip     Zip created at test.zip
    PS C:\Users\2020090001001\Desktop\nrf_flash_dfu\Exe_1> nrfutil.exe dfu serial -pkg test.zip -p COM21                                                                                                                     
    Traceback (most recent call last):
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\Scripts\nrfutil-script.py", line 33, in <module>
        sys.exit(load_entry_point('nrfutil==6.1.0', 'console_scripts', 'nrfutil')())
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 782, in main
        rv = self.invoke(ctx)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\click\core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\__main__.py", line 1055, in serial
        do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, True,
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\__main__.py", line 970, in do_serial
        dfu.dfu_send_images()
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 95, in _dfu_send_image
        self.dfu_transport.send_init_packet(data)
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 256, in send_init_packet
        self.__execute()
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 421, in __execute
        self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
      File "C:\Users\2020090001001\AppData\Local\Programs\Python\Python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 502, in __get_response
        raise NordicSemiException('Extended Error 0x{:02X}: {}'.format(resp[3], data))
    pc_ble_driver_py.exceptions.NordicSemiException: Extended Error 0x07: The array of supported SoftDevices for the update does not contain the FWID of the current SoftDevice.

  • Does the device have SD image? If so, What is the version? If not, flash the softdevice.hex with nRF Connect Programmer and load secure_bootloader_uart_mbr_pca10056_debug project (I think you are using this). Then update the app again. 

    -Amanda H.   

Related