OTA update in mesh

I am working on OTA update .

Right now i am working simple 

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v5.0.0%2Fmd_doc_user_guide_modules_dfu_configuring_performing.html

using this link to configure DFU 

I know this is simple one but i think i am just messing up something 

Traceback (most recent call last):
  File "C:\Python27\Scripts\nrfutilmesh-script.py", line 11, in <module>
    load_entry_point('nrfutil==0.3.0.0', 'console_scripts', 'nrfutil')()
  File "C:\Python27\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Python27\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Python27\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Python27\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Python27\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python27\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\__main__.py", line 276, in genpkg
    package.generate_package(zipfile_path)
  File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\package.py", line 212, in generate_package
    Package.normalize_firmware_to_bin(work_directory, firmware[FirmwareKeys.FIRMWARE_FILENAME])
  File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\package.py", line 366, in normalize_firmware_to_bin
    temp.tobinfile(new_filepath)
  File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\nrfhex.py", line 162, in tobinfile
    super(nRFHex, self).tobinfile(fobj, start=start_address, size=size)
  File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 401, in tobinfile
    fobj.write(self._tobinstr_really(start, end, pad, size))
  File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 373, in _tobinstr_really
    return asstr(self._tobinarray_really(start, end, pad, size).tostring())
  File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 342, in _tobinarray_really
    raise ValueError("tobinarray: wrong value for size")
ValueError: tobinarray: wrong value for size

So i have tried again and again but failed now i am getting this error .

Please help me to get out of this .

At first i was trying to do with latest version of nrfutil but when i try to run the package it was giving me error .

Parents
  • Hi, 

    What does the update package include SD+BL+APP?

    Please post the command you are using and provide the log from the device. 

    -Amanda

  • Microsoft Windows [Version 10.0.19042.1288]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\Users\Mohsin khan>cd ..
    
    C:\Users>d:
    
    D:\>cd nrf mesh]
    The system cannot find the path specified.
    
    D:\>cd nrf mesh
    
    D:\nrf mesh>nrfutilmesh dfu serial -pkg dfu_test.zip -p COM7 -b 115200 -fc --mesh
    Upgrading target on COM7 with DFU package D:\nrf mesh\dfu_test.zip. Flow control is enabled.
    
    
    Failed to upgrade target. Error is: Failed to establish connection
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
    - baud rate or flow control is not the same as in the target bootloader.
    - target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    
    D:\nrf mesh>nrfutilmesh keys --gen-key private.key
    Generated key at: private.key
    
    D:\nrf mesh>nrfutilmesh keys --show-vk hex private.key
    Verification key Qx: 714f113b75c0c50891da361d1f1968d5fe2a5bec49dbebce139791c2a8fa7f09
    Verification key Qy: beb8a06b430a2c1ab0f6d5caef9dbdc31b1480aec0035ee075f1f95e0ab39848
    
    D:\nrf mesh>nrfutilmesh dfu --help
    Usage: nrfutilmesh dfu [OPTIONS] COMMAND [ARGS]...
    
      This set of commands support Nordic DFU OTA package generation for
      distribution to applications and serial DFU.
    
    Options:
      --help  Show this message and exit.
    
    Commands:
      genpkg  Generate a package for distribution to Apps supporting Nordic DFU
              OTA
    
      serial  Program a device with bootloader that support serial DFU
    
    D:\nrf mesh>nrfutilmesh dfu genpkg --help
    Usage: nrfutilmesh dfu genpkg [OPTIONS] ZIPFILE
    
      Generate a zipfile package for distribution to Apps supporting Nordic DFU
      OTA. The application, bootloader and softdevice files are converted to
      .bin if it is a .hex file. For more information on the generated init
      packet see:
      http://developer.nordicsemi.com/nRF51_SDK/doc/7.2.0/s110/html/a00065.html
    
    Options:
      --application TEXT              The application firmware file
      --company-id INT OR NONE        Company ID for mesh-application. Must either
                                      be a Bluetooth SIG assigned company ID (see
                                      https://www.bluetooth.com/specifications
                                      /assigned-numbers/company-identifiers for
                                      more information), or a random number
                                      between 65535 and 4294967295. If a random
                                      number is chosen, it is recommended to not
                                      use the "lazy" approach of selecting an easy
                                      number, as this increases the risk of
                                      namespace collisions for the app-IDs. It is
                                      also recommended to use the same company-ID
                                      for all your applications.
    
      --application-id INT OR NONE    Mesh application ID, default: 0x0000
      --application-version INT OR NONE
                                      Application version, default: 0xFFFFFFFF
      --bootloader-id INT OR NONE     Mesh bootloader id, default: 0xFF00
      --bootloader TEXT               The bootloader firmware file
      --dev-revision INT OR NONE      Device revision, default: 0xFFFF
      --dev-type INT OR NONE          Device type, default: 0xFFFF
      --dfu-ver FLOAT                 DFU packet version to use, default: 0.5
      --sd-req TEXT OR NONE           SoftDevice requirement. A list of SoftDevice
                                      versions (1 or more)of which one is required
                                      to be present on the target device.Example:
                                      --sd-req 0x4F,0x5A. Default: 0xFFFE.
    
      --softdevice TEXT               The SoftDevice firmware file
      --key-file FILE                 Signing key (pem fomat)
      --mesh                          Generate a package targeting Mesh-DFU
      --help                          Show this message and exit.
    
    D:\nrf mesh>nrfutilmesh dfu genpkg --application bin/blinky/blinky_nrf52840_xxAA_s140_7.2.0.hex --company-id 0x00000059 --application-id 1 --application-version 1 --key-file private.key --sd-req 0x0101 --mesh dfu_test.zip
    Key file was given, setting DFU version to 0.8
    Traceback (most recent call last):
      File "C:\Python27\Scripts\nrfutilmesh-script.py", line 11, in <module>
        load_entry_point('nrfutil==0.3.0.0', 'console_scripts', 'nrfutil')()
      File "C:\Python27\lib\site-packages\click\core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "C:\Python27\lib\site-packages\click\core.py", line 782, in main
        rv = self.invoke(ctx)
      File "C:\Python27\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Python27\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Python27\lib\site-packages\click\core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "C:\Python27\lib\site-packages\click\core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\__main__.py", line 276, in genpkg
        package.generate_package(zipfile_path)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\package.py", line 212, in generate_package
        Package.normalize_firmware_to_bin(work_directory, firmware[FirmwareKeys.FIRMWARE_FILENAME])
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\package.py", line 366, in normalize_firmware_to_bin
        temp.tobinfile(new_filepath)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\nrfhex.py", line 162, in tobinfile
        super(nRFHex, self).tobinfile(fobj, start=start_address, size=size)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 401, in tobinfile
        fobj.write(self._tobinstr_really(start, end, pad, size))
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 373, in _tobinstr_really
        return asstr(self._tobinarray_really(start, end, pad, size).tostring())
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 342, in _tobinarray_really
        raise ValueError("tobinarray: wrong value for size")
    ValueError: tobinarray: wrong value for size

    So these are all code which i try to run with nrfutilmesh its version is 

    nrfutil version 0.3.0.0

    Right now its not making the packge 

    I am new to nrf mesh please help me out of this 

    my nrf52 version is 17.0.2

Reply
  • Microsoft Windows [Version 10.0.19042.1288]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\Users\Mohsin khan>cd ..
    
    C:\Users>d:
    
    D:\>cd nrf mesh]
    The system cannot find the path specified.
    
    D:\>cd nrf mesh
    
    D:\nrf mesh>nrfutilmesh dfu serial -pkg dfu_test.zip -p COM7 -b 115200 -fc --mesh
    Upgrading target on COM7 with DFU package D:\nrf mesh\dfu_test.zip. Flow control is enabled.
    
    
    Failed to upgrade target. Error is: Failed to establish connection
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
    - baud rate or flow control is not the same as in the target bootloader.
    - target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    
    D:\nrf mesh>nrfutilmesh keys --gen-key private.key
    Generated key at: private.key
    
    D:\nrf mesh>nrfutilmesh keys --show-vk hex private.key
    Verification key Qx: 714f113b75c0c50891da361d1f1968d5fe2a5bec49dbebce139791c2a8fa7f09
    Verification key Qy: beb8a06b430a2c1ab0f6d5caef9dbdc31b1480aec0035ee075f1f95e0ab39848
    
    D:\nrf mesh>nrfutilmesh dfu --help
    Usage: nrfutilmesh dfu [OPTIONS] COMMAND [ARGS]...
    
      This set of commands support Nordic DFU OTA package generation for
      distribution to applications and serial DFU.
    
    Options:
      --help  Show this message and exit.
    
    Commands:
      genpkg  Generate a package for distribution to Apps supporting Nordic DFU
              OTA
    
      serial  Program a device with bootloader that support serial DFU
    
    D:\nrf mesh>nrfutilmesh dfu genpkg --help
    Usage: nrfutilmesh dfu genpkg [OPTIONS] ZIPFILE
    
      Generate a zipfile package for distribution to Apps supporting Nordic DFU
      OTA. The application, bootloader and softdevice files are converted to
      .bin if it is a .hex file. For more information on the generated init
      packet see:
      http://developer.nordicsemi.com/nRF51_SDK/doc/7.2.0/s110/html/a00065.html
    
    Options:
      --application TEXT              The application firmware file
      --company-id INT OR NONE        Company ID for mesh-application. Must either
                                      be a Bluetooth SIG assigned company ID (see
                                      https://www.bluetooth.com/specifications
                                      /assigned-numbers/company-identifiers for
                                      more information), or a random number
                                      between 65535 and 4294967295. If a random
                                      number is chosen, it is recommended to not
                                      use the "lazy" approach of selecting an easy
                                      number, as this increases the risk of
                                      namespace collisions for the app-IDs. It is
                                      also recommended to use the same company-ID
                                      for all your applications.
    
      --application-id INT OR NONE    Mesh application ID, default: 0x0000
      --application-version INT OR NONE
                                      Application version, default: 0xFFFFFFFF
      --bootloader-id INT OR NONE     Mesh bootloader id, default: 0xFF00
      --bootloader TEXT               The bootloader firmware file
      --dev-revision INT OR NONE      Device revision, default: 0xFFFF
      --dev-type INT OR NONE          Device type, default: 0xFFFF
      --dfu-ver FLOAT                 DFU packet version to use, default: 0.5
      --sd-req TEXT OR NONE           SoftDevice requirement. A list of SoftDevice
                                      versions (1 or more)of which one is required
                                      to be present on the target device.Example:
                                      --sd-req 0x4F,0x5A. Default: 0xFFFE.
    
      --softdevice TEXT               The SoftDevice firmware file
      --key-file FILE                 Signing key (pem fomat)
      --mesh                          Generate a package targeting Mesh-DFU
      --help                          Show this message and exit.
    
    D:\nrf mesh>nrfutilmesh dfu genpkg --application bin/blinky/blinky_nrf52840_xxAA_s140_7.2.0.hex --company-id 0x00000059 --application-id 1 --application-version 1 --key-file private.key --sd-req 0x0101 --mesh dfu_test.zip
    Key file was given, setting DFU version to 0.8
    Traceback (most recent call last):
      File "C:\Python27\Scripts\nrfutilmesh-script.py", line 11, in <module>
        load_entry_point('nrfutil==0.3.0.0', 'console_scripts', 'nrfutil')()
      File "C:\Python27\lib\site-packages\click\core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "C:\Python27\lib\site-packages\click\core.py", line 782, in main
        rv = self.invoke(ctx)
      File "C:\Python27\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Python27\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Python27\lib\site-packages\click\core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "C:\Python27\lib\site-packages\click\core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\__main__.py", line 276, in genpkg
        package.generate_package(zipfile_path)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\package.py", line 212, in generate_package
        Package.normalize_firmware_to_bin(work_directory, firmware[FirmwareKeys.FIRMWARE_FILENAME])
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\package.py", line 366, in normalize_firmware_to_bin
        temp.tobinfile(new_filepath)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\nrfhex.py", line 162, in tobinfile
        super(nRFHex, self).tobinfile(fobj, start=start_address, size=size)
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 401, in tobinfile
        fobj.write(self._tobinstr_really(start, end, pad, size))
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 373, in _tobinstr_really
        return asstr(self._tobinarray_really(start, end, pad, size).tostring())
      File "c:\python27\lib\site-packages\nrfutil-0.3.0.0-py2.7.egg\nordicsemi\dfu\intelhex\__init__.py", line 342, in _tobinarray_really
        raise ValueError("tobinarray: wrong value for size")
    ValueError: tobinarray: wrong value for size

    So these are all code which i try to run with nrfutilmesh its version is 

    nrfutil version 0.3.0.0

    Right now its not making the packge 

    I am new to nrf mesh please help me out of this 

    my nrf52 version is 17.0.2

Children
  • Hello Amanda,

    sorry for being late i am getting error using the file in the link please tell me where the issue is 

    D:\nrf mesh>nrfutilmesh --verbose dfu serial -pkg dfu_test.zip -p COM7 -b 115200 -fc --mesh
    Upgrading target on COM7 with DFU package D:\nrf mesh\dfu_test.zip. Flow control is enabled.
    Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 130832
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    1: PC -> target: 0502aabbccdd
    2: PC -> target: 0502aabbccdd
    3: PC -> target: 0502aabbccdd
    4: PC -> target: 0502aabbccdd
    5: PC -> target: 0502aabbccdd
    6: PC -> target: 0502aabbccdd
    7: PC -> target: 0502aabbccdd
    8: PC -> target: 0502aabbccdd
    9: PC -> target: 0502aabbccdd
    10: PC -> target: 0502aabbccdd
    
    
    Failed to upgrade target. Error is: Failed to establish connection
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
    - baud rate or flow control is not the same as in the target bootloader.
    - target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    Closing serial port...
    
    D:\nrf mesh>nrfutilmesh --verbose dfu serial -pkg dfu_test.zip -p COM7 -b 115200 -fc --mesh
    Upgrading target on COM7 with DFU package D:\nrf mesh\dfu_test.zip. Flow control is enabled.
    Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 130832
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    1: PC -> target: 0502aabbccdd
    
    
    Failed to upgrade target. Error is: WriteFile failed (WindowsError(22, 'The device does not recognize the command.'))
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
    - baud rate or flow control is not the same as in the target bootloader.
    - target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    Closing serial port...
    
    D:\nrf mesh>nrfutilmesh --verbose dfu serial -pkg dfu_test.zip -p COM7 -b 115200 -fc --mesh
    Upgrading target on COM7 with DFU package D:\nrf mesh\dfu_test.zip. Flow control is enabled.
    Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 130832
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    1: PC -> target: 0502aabbccdd
    2: PC -> target: 0502aabbccdd
    3: PC -> target: 0502aabbccdd
    4: PC -> target: 0502aabbccdd
    5: PC -> target: 0502aabbccdd
    6: PC -> target: 0502aabbccdd
    7: PC -> target: 0502aabbccdd
    8: PC -> target: 0502aabbccdd
    9: PC -> target: 0502aabbccdd
    10: PC -> target: 0502aabbccdd
    
    
    Failed to upgrade target. Error is: Failed to establish connection
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
    - baud rate or flow control is not the same as in the target bootloader.
    - target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    Closing serial port...

  • Hi, 

    Please try testing without using any key. Just to simplify the testing.

    Please make sure COM7 is the correct comport and in your code NRF_MESH_SERIAL_ENABLE is set to 1. 

    Please print out RTT log from the DFU firmware, and check if mesh_evt_handler() is called for any DFU event. 

    -Amanda

  • Hello 

    I want to clear one thing i have successfully done DFU with development kit but i want to do this with nrf52840 eval kit waveshare but when i try to do on that its giving me same error which i have showed you . Can you please tell me steps to follow to do DFU on waveshare eval kit of NRF52840 . I am attaching some pictures to show you my board . And tell me one more thing when we are trying to do on eval board so we have to program from jlink or USB board . 

  • Hi, 

    Mohsin khan said:
    Can you please tell me steps to follow to do DFU on waveshare eval kit of NRF52840 .

    The waveshare eval kit of NRF52840 is not developed by Nordic, and I don't have their board to reproduce it. The RTT log from the DFU firmware might help provide clues. Please create a new support case. The latest issue is away from the original scope. 

    Mohsin khan said:
    tell me one more thing when we are trying to do on eval board so we have to program from jlink or USB board . 

    Not sure the waveshare eval kit has the onboard debugger or not, but I guess not. On the NRF52840 Eval Kit User Manual page.6, there is a 4PIN SWD debugging interface: for connecting ARM Debugger to program/debug. Seems you need an ARM Debugger (Jlink) to program. 

    -Amanda

Related