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

SDK 15 and Mesh 2.0 Generate a DFU file with nrfutil - ValueError

We used nRF5_SDK_15.0.0_a53641a and nrf5_SDK_for_Mesh_v2.0.0_src.

We are following DFU quick start guide http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v0.10.0%2Findex.html

For nRF52:

mesh-sdk$ nrfutil dfu genpkg --application bin/blinky/blinky_nrf52832_xxAA_s132_5.0.0.hex \
--company-id 0x00000089 \
--application-id 1 \
--application-version 2 \
--key-file private_key.txt \
--sd-req 0x009D \
--mesh dfu_test.zip
We used "--company-id 0x00000089 \" to match Step 2 public key:
{
"bootloader_config": {
"bootloader_id": 1,
"bootloader_version": 1,
"company_id": 89,
"application_id": 1,
"application_version": 1,
"public_key": "ed09a58df6db5cd15b8637304f31d31f4042492ed7c7e4839fbe903f260a2ba1a855e92b72885825481ad56282bcf549ad7455ec46f000f0f62d97eeec883ba6"
}
}
The hex we used is C:\Nordic\nRF5_SDK_15.0.0_a53641a\mesh_sdk\bin\blinky\blinky_nrf52832_xxAA_s132_5.0.0.hexblinky_nrf52832_xxAA_s132_5.0.0.hex
We got ValueError, please see attached screen shot. 
Please advise.  Thanks
Parents
  • We started command prompt on an administrator.  I have make sure all the steps before and after step 8 using s132 softdevice version 6.0.  We tried to flash the program via both SES and nrfjprog (like shown in step 8).  We also used difference Bud rate 115200, 57600, 38400, 19200, 14400 and 9600.

    Attached are the cmd script file

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    
    C:\Users\ALaw>cd C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil keys --gen-key private_key.txt
    Generated key at: private_key.txt
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil keys --show-vk hex private_key.tx
    t
    Verification key Qx: d78ea2728b31c63b185402f4209803b478d0828b02a0f44da9f5d782b04
    7fe45
    Verification key Qy: b60bf4db2e572b4b6053c0c7e9371b309c93ee53c300906afc6c7f2d99c
    e11cd
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil dfu genpkg --application bin/blin
    ky/blinky_nrf52832_xxAA_s132_6.0.0.hex --company-id 0x00000059 --application-id
    1 --application-version 2 --key-file private_key.txt --sd-req 0x009D --mesh dfu_
    test.zip
    Key file was given, setting DFU version to 0.8
    Zip created at dfu_test.zip
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>cd tools/dfu
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu>python device_page_generator.py
     -d nrf52832_xxAA -sd "s132_6.0.0"
    Wrote device page for nrf52832_xxAA with the s132_6.0.0 SoftDevice to bin/device
    _page_nrf52832_xxAA_s132_6.0.0.hex.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools\dfu>cd ..
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src\tools>cd ..
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfjprog --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfjprog --program bin/softdevice/s132_nr
    f52_6.0.0_softdevice.hex --chiperase
    Parsing hex file.
    Erasing user available code and UICR flash areas.
    Applying system reset.
    Checking that the area to write is not protected.
    Programming device.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfjprog --program bin/bootloader/armcc/m
    esh_bootloader_serial_armcc__nrf52832_xxAA.hex
    Parsing hex file.
    ERROR: The file specified could not be found.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfjprog --program bin/bootloader/armcc/m
    esh_bootloader_serial_armcc_nrf52832_xxAA.hex
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfjprog --program examples\dfu\build\dfu
    _nrf52832_xxAA_s132_6.0.0_Debug\dfu_nrf52832_xxAA_s132_6.0.0.hex
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfjprog --program tools/dfu/bin/device_p
    age_nrf52832_xxAA_s132_6.0.0.hex
    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfjprog --reset
    Applying system reset.
    Run.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil dfu serial -pkg dfu_test.zip -p C
    OM46 -b 115200 -fc --mesh
    Upgrading target on COM46 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_sr
    c\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%
    
    Failed to upgrade target. Error is: Failed to establish connection
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirement
    s 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.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil --verbose dfu serial -pkg dfu_tes
    t.zip -p COM46 -b 115200 -fc --mesh
    Upgrading target on COM46 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_sr
    c\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, applicat
    ion size: 1912
    Sending DFU start packet, afterwards we wait for the flash on target to be initi
    alized before continuing.
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    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 requirement
    s 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.
    Closing serial port...
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil dfu serial -pkg dfu_test.zip -p C
    OM46 -b 57600 -fc --mesh
    Upgrading target on COM46 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_sr
    c\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%
    
    Failed to upgrade target. Error is: Failed to establish connection
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirement
    s 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.
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil --verbose dfu serial -pkg dfu_tes
    t.zip -p COM46 -b 38400 -fc --mesh
    Upgrading target on COM46 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_sr
    c\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, applicat
    ion size: 1912
    Sending DFU start packet, afterwards we wait for the flash on target to be initi
    alized before continuing.
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    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 requirement
    s 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.
    Closing serial port...
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil --verbose dfu serial -pkg dfu_tes
    t.zip -p COM46 -b 19200 -fc --mesh
    Upgrading target on COM46 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_sr
    c\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, applicat
    ion size: 1912
    Sending DFU start packet, afterwards we wait for the flash on target to be initi
    alized before continuing.
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    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 requirement
    s 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.
    Closing serial port...
    target -> PC: e8
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil --verbose dfu serial -pkg dfu_tes
    t.zip -p COM46 -b 14400 -fc --mesh
    Upgrading target on COM46 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_sr
    c\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, applicat
    ion size: 1912
    Sending DFU start packet, afterwards we wait for the flash on target to be initi
    alized before continuing.
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    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 requirement
    s 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.
    Closing serial port...
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>nrfutil --verbose dfu serial -pkg dfu_tes
    t.zip -p COM46 -b 9600 -fc --mesh
    Upgrading target on COM46 with DFU package C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_sr
    c\dfu_test.zip. Flow control is enabled.
      [------------------------------------]    0%Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, applicat
    ion size: 1912
    Sending DFU start packet, afterwards we wait for the flash on target to be initi
    alized before continuing.
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    PC -> target: 0502aabbccdd
    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 requirement
    s 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.
    Closing serial port...
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>
    
    
    
    
    C:\Nordic\nrf5_SDK_for_Mesh_v2.0.1_src>

    Step 1: private_key.txt 

    -----BEGIN EC PRIVATE KEY-----
    MHcCAQEEIHPeFxystPEoiZd7uOpCqfRxyO69QavgEeIowj7u+fp2oAoGCCqGSM49
    AwEHoUQDQgAE146icosxxjsYVAL0IJgDtHjQgosCoPRNqfXXgrBH/kW2C/TbLlcr
    S2BTwMfpNxswnJPuU8MAkGr8bH8tmc4RzQ==
    -----END EC PRIVATE KEY-----
    

    Step 2: bootloader_config_default.json 

    {
        "bootloader_config": {
            "bootloader_id": 1,
            "bootloader_version": 1,
            "company_id": 89,
            "application_id": 1,
            "application_version": 1,
    		"public_key": 
    	"d78ea2728b31c63b185402f4209803b478d0828b02a0f44da9f5d782b047fe45b60bf4db2e572b4b6053c0c7e9371b309c93ee53c300906afc6c7f2d99ce11cd"	
    	
        }
    }
    

    Step 3: dfu_test.zip dfu_test.zip

    Step 4: Modified  dfu_nrf52832_xxAA_s132_6.0.0.py from 5.0.0 to 6.0.0 

    # Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
    # All rights reserved.
    #
    # Redistribution and use in source and binary forms, with or without
    # modification, are permitted provided that the following conditions are met:
    #
    # 1. Redistributions of source code must retain the above copyright notice, this
    #    list of conditions and the following disclaimer.
    #
    # 2. Redistributions in binary form must reproduce the above copyright
    #    notice, this list of conditions and the following disclaimer in the
    #    documentation and/or other materials provided with the distribution.
    #
    # 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    #    contributors may be used to endorse or promote products derived from this
    #    software without specific prior written permission.
    #
    # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    # IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
    # ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
    # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    # POSSIBILITY OF SUCH DAMAGE.
    
    import argparse
    import enum
    import struct
    import intelhex
    import sys
    import json
    import os
    
    PACKAGE_PARENT = '..'
    SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
    sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
    
    from deviceutil.deviceutil import \
        get_application_limits, \
        make_bootloader_for_platforms, \
        set_softdevices_for_platforms, \
        load_softdevies, \
        load_platforms
    
    WORD_SIZE = 4
    
    
    class BLInfoType(enum.IntEnum):
        INVALID = 0x00
        ECDSA_PUBLIC_KEY = 0x01
        VERSION = 0x02
        JOURNAL = 0x03
        FLAGS = 0x04
        SEGMENT_SD = 0x10
        SEGMENT_BL = 0x11
        SEGMENT_APP = 0x12
        LAST = 0x7FFF
    
    
    class DevicePageEntry(object):
        def __init__(self, bl_info_type, data):
            #print("Type: ", type(data).__name__)
            if not (isinstance(bl_info_type, BLInfoType) and
                    (isinstance(data, bytearray) or isinstance(data, str))):
                raise TypeError("Invalid type %r" % (type(data)))
    
            self.bl_info_type = bl_info_type
            if (isinstance(data, str)):
               data = bytearray.fromhex(data)
            self.data = self.pad(data)
    
        @property
        def word_count(self):
            return (len(self.data) + WORD_SIZE) // WORD_SIZE
    
        def pad(self, data):
            pad_byte_count = (WORD_SIZE - len(data) % WORD_SIZE) % WORD_SIZE
            if pad_byte_count > 0:
                data += bytearray([0xFF] * pad_byte_count)
            return data
    
        def serialize(self):
            return (bytearray(struct.pack('<HH', self.word_count, self.bl_info_type)
                              + self.data))
    
    
    class DevicePage(object):
        def __init__(self, platform, softdevice, bootloader_config):
            self.entries = []
            self.generate_entries(platform, softdevice, bootloader_config)
            self.platform = platform
            self.softdevice = softdevice
    
        def generate_entries(self, platform, softdevice, bootloader_config):
            public_key = bytearray.fromhex(bootloader_config["public_key"]) \
                         if "public_key" in bootloader_config else None
            if public_key:
                self.entries.append(
                    DevicePageEntry(BLInfoType.ECDSA_PUBLIC_KEY, public_key))
    
            app_limits = get_application_limits(platform, softdevice)
            app_segment = bytearray(struct.pack("<II",
                                                app_limits["flash_start"],
                                                app_limits["flash_size"]))
            sd_segment = bytearray(struct.pack("<II",
                                               softdevice["flash_start"],
                                               softdevice["flash_size"]))
            bl_segment = bytearray(struct.pack("<II",
                                               platform["bootloader"]["flash_start"],
                                               platform["bootloader"]["flash_size"]))
    
            self.entries.append(
                DevicePageEntry(BLInfoType.SEGMENT_APP, app_segment))
            self.entries.append(
                DevicePageEntry(BLInfoType.SEGMENT_SD, sd_segment))
            self.entries.append(
                DevicePageEntry(BLInfoType.SEGMENT_BL, bl_segment))
    
            version_data = bytearray(struct.pack("<HBBIHI",
                                                 int(softdevice["version"], 16),
                                                 bootloader_config["bootloader_id"],
                                                 bootloader_config["bootloader_version"],
                                                 bootloader_config["company_id"],
                                                 bootloader_config["application_id"],
                                                 bootloader_config["application_version"]))
    
            #print(version_data)
            self.entries.append(DevicePageEntry(BLInfoType.VERSION,
                                                version_data))
    
            self.entries.append(DevicePageEntry(BLInfoType.FLAGS,
                                                bytearray(struct.pack('I', 0xFFFFFFFF))))
    
        def write_hex(self, hexfile):
            # Info page metadata
            raw_data = bytearray(struct.pack("<BBBB", 4, 1, 8, 8))
            raw_data += bytearray().join(map(DevicePageEntry.serialize, self.entries))
            raw_data += bytearray(struct.pack("<HH", 0xFFFF, BLInfoType.LAST))
            hex_output = intelhex.IntelHex()
            hex_output.frombytes(raw_data,
                                 self.platform["flash_size"] - self.platform["page_size"])
            hex_output.tofile(hexfile, "hex")
    
    
    def write_specific_page(platforms, softdevices, args):
        platform = next((p for p in platforms if args.device == p["name"]), None)
        if not platform:
            print("Unknown device: \"%s\" in list %r" % (args.device, [p["name"] for p in platforms]))
            sys.exit(1)
    
        softdevice = next((s for s in softdevices if args.softdevice == s["name"]), None)
        if not softdevice:
            print("Unknown SoftDevice: \"%s\"" % (args.softdevice))
            sys.exit(1)
    
        if args.softdevice not in platform["softdevices"]:
            print("Unknown SoftDevice \"%s\" for platform \"%s\"" %
                  (args.softdevice, args.device))
            sys.exit(1)
    
        # Filter out the others...
        platforms = [p for p in platforms
                     if args.device.lower() in p["name"].lower()]
    
        make_bootloader_for_platforms(platforms)
        set_softdevices_for_platforms(platforms, softdevices)
    
        # Dict is updated by reference
        # platform = platforms[args.device]
        # softdevice = softdevices[args.softdevice]
    
        with open(args.bootloader_config, "r") as f:
            bootloader_config = json.load(f)["bootloader_config"]
        device_page = DevicePage(platform, softdevice, bootloader_config)
        if not args.output_file:
            args.output_file = "_".join(["device_page",
                                         self.platform["name"],
                                         self.softdevice["name"]]) + ".hex"
    
        device_page.write_hex(args.output_file)
    
    
    def write_all(platforms, softdevices, args):
        make_bootloader_for_platforms(platforms)
        set_softdevices_for_platforms(platforms, softdevices)
    
        with open(args.bootloader_config, "r") as f:
            bootloader_config = json.load(f)["bootloader_config"]
    
        for platform in platforms:
            for softdevice in platform["softdevices"]:
                device_page = DevicePage(platform, softdevice, bootloader_config)
                device_page.write_hex(args.output_file)
    
    
    def main():
        softdevices = load_softdevies("../configuration/softdevices.json")
        platforms = load_platforms("../configuration/platforms.json")
        sd_str = ''
        for sd in softdevices:
            sd_str += ''.join(sd["name"]) + "\n"
        plt_str = ''
        for plt in platforms:
            plt_str += ''.join(plt["name"]) + '\n'
    
        SOFTDEVICE = "s132_6.0.0"
        DEVICE = "nrf52832_xxAA"
        parser = argparse.ArgumentParser(description="Device Page Generator")
        parser.add_argument("-d", "--device", help="Select device: " + ''.join(plt_str),
                            default=DEVICE)
        parser.add_argument("-sd", "--softdevice", help="Select SoftDevice: "  + ''.join(sd_str),
                            default=SOFTDEVICE)
        parser.add_argument("-c", "--bootloader-config",
                            default="bootloader_config_default.json",
                            help="Bootloader configuration file")
        parser.add_argument("-o", "--output-file", help="Output hex file",
                            default="bin/device_page_%s_%s.hex" % (DEVICE, SOFTDEVICE))
        parser.add_argument("--all", default=False, action="store_true",
                            help=("Writes all known device page combinations to "
                                  + "\'bin/\'"))
        args = parser.parse_args()
    
        dirname = os.path.dirname(args.output_file)
        if not os.path.exists(dirname):
            os.mkdir(dirname)
    
        if args.all:
            write_all(platforms, softdevices, args)
            print("Wrote for device pages for all devices.")
        elif args.softdevice and args.device:
            write_specific_page(platforms, softdevices, args)
            print("Wrote device page for %s with the %s SoftDevice to %s." %
                  (args.device, args.softdevice, args.output_file))
    
    
    if __name__ == "__main__":
        main()
    

    to generate 

     device_page_nrf52832_xxAA_s132_6.0.0.hex device_page_nrf52832_xxAA_s132_6.0.0.hex

    Step 6: s132_nrf52_6.0.0_softdevice.hex s132_nrf52_6.0.0_softdevice.hex

    Step 7: s132_nrf52_6.0.0_softdevice.hex mesh_bootloader_serial_armcc_nrf52832_xxAA.hex

    Step 8: Program device using nrfjprog  to download dfu_nrf52832_xxAA_s132_6.0.0.hex dfu_nrf52832_xxAA_s132_6.0.0.hexdfu_nrf52832_xxAA_s132_6.0.0.map

     

    Step 9: Program device_page_nrf52832_xxAA_s132_6.0.0.hex device_page_nrf52832_xxAA_s132_6.0.0.hex 

    Step 10: We tried difference Baud Rates, press Button 4 and RESET and release both to enter DFU mode and use s132 and version 6.0.0, still got

    "Error is: Failed to establish connection"

     

    Please advise.  Thanks.

  • I got a few tips from a Mesh developer here at Nordic:

    "The original issue seems to be an error in the json file. Looks like there is an extra "}" at the end, maybe.

    Next, is the customer sure that the com port used is the correct com port?

    The SEGGER DFU build had a known issue with the flash_placement.xml file. I would advise the customer to use some of the pre-compiled binaries to test the DFU first."

    But I believe you have fixed the first issue, correct? I also believe you are using the correct com port & I believe you have used the pre-compiled binaries & not your own built hex files.

    I am not sure these tips will help all too much, but it's worth giving it a shot!

  • Hi, yes, unfortunately still see the issue. I will open another case to follow up. thank you.

  • I followed the DFU quick start guide using 2 development kits, where one (682630616) is interfaced over the COM port, which is the one we have been using to check out from Step 1 to Step 10.  Now I am using the other development kits (682686733) receives the DFU from the first device (682630616) over the mesh.  According to the DFU quick start guide, I specified which device to use in which context, add the -s 682686733 option for each call to the nrfjprog command.  Therefore, we started to communicate with 682686733 starting Step 5 to Step 9 as below:

    Step 5 Erase all chip memory (including UICR) on all devices
    nrfjprog --eraseall -s 682686733

    Step 6 Flash the SoftDevice on all devices
    nrfjprog --program bin/softdevice/s132_nrf52_6.0.0_softdevice.hex --chiperase -s 682686733

    Step 7 Flash the serial bootloader on all devices
    nrfjprog --program bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52832_xxAA.hex -s 682686733

    Step 8 Flash the first application on all devices
    nrfjprog --program examples\dfu\build\dfu_nrf52832_xxAA_s132_6.0.0_Release\dfu_nrf52832_xxAA_s132_6.0.0.hex -s 682686733

    Step 9 Flash the device page on all devices
    nrfjprog --program tools/dfu/bin/device_page_nrf52832_xxAA_s132_6.0.0.hex -s 682686733

    nrfjprog --reset -s 682686733

    Every Step, I got an error:
    ERROR: There is no debugger connected to the PC with the given serial number.

    Please see below attached screen shoot.

     

    Do we need to connect the other development kit 682686733 to the PC?  How can we do it over the mesh or over the air?

    According to the DFU quick start guide, I also downloaded the mesh_dfu branch as shown at below screen shoot, but I don't know how to use it. 

    Please advise.  Thanks.

  • I used gcc armemb. gcc armemb uses the GCC ARM compiler & armcc uses the compiler provided by keil. You need to add the nrfjprog -s command to all of the nrfjprog commands in this quick start guide.

    But what I do instead, which I find easier, is to just write the nrfjprog commands without the -s at the back. That way, you should get a popup with a list of all the segger IDs if you have attached multiple DKs. If you only have one connected, the nrfjprog command will run without any errors. Then, you can choose the segger ID that you want to use.

  • I'm facing a problem in step 4 when i need to generate a hex version of device page, i did this : 

    dfu$ py device_page_generator.py -d nrf52832_xxAA -sd "s132_6.0.0"

    and this is the result

    Wrote device page for nrf53832_xxAA with the s132_6.0.0 SoftDevice to bin/device_page_nrf52832_xxAA_s132_5.0.0.hex instead of s132 version 6 

    here is the bin directory 

    I don't know why it doesn't generate device page with s132 v6.0.0, help please 

Reply
  • I'm facing a problem in step 4 when i need to generate a hex version of device page, i did this : 

    dfu$ py device_page_generator.py -d nrf52832_xxAA -sd "s132_6.0.0"

    and this is the result

    Wrote device page for nrf53832_xxAA with the s132_6.0.0 SoftDevice to bin/device_page_nrf52832_xxAA_s132_5.0.0.hex instead of s132 version 6 

    here is the bin directory 

    I don't know why it doesn't generate device page with s132 v6.0.0, help please 

Children
Related