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

Its unclear that precompield BLE Mesh 2.0.1 demo does not run on nf52840 develboard

Hello

For the BLE Mesh 2.0.1 demo i bought some nrf52840 develboards. Then i write the demo with "python scripts/quick_start/quick_start_demo.py" to the nrf52840 develboard and the demo do nothing. After some look around i realized that the demo is prepared only for nrf52832 boards..

For me thats no problem but for someone who is new to Nordic ...

I follow this page, and "Compatibility" say that nf52840 is ok.
   http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v2.0.1%2Findex.html
And the light switch demo does not restrict to nrf52832 for the precompiled demo
  infocenter.nordicsemi.com/index.jsp

But look at BLE Mesh 1.0, see the restriction to the nrf52832 board 
(One PCA10028 or PCA10040 development board for the client.....)
infocenter.nordicsemi.com/index.jsp

Please add the restriction to the documentation. Maybe in the next Mesh SDK add a second script for nrf52840 develboards.

Thanks,
Lukas

Parents
  • Hi,

    Thank you for reporting this issue, it is highly appreciated.

    I have notified the team of this bug. It should either be stated clearly that the script only supports nRF52832 DK, or the script should be improved to support also the nRF52840. Exactly as you write, both nRF52832 and nRF52840 are supported. You can mix and match as much as you would like if you program the boards manually.

    Regards,
    Terje

Reply
  • Hi,

    Thank you for reporting this issue, it is highly appreciated.

    I have notified the team of this bug. It should either be stated clearly that the script only supports nRF52832 DK, or the script should be improved to support also the nRF52840. Exactly as you write, both nRF52832 and nRF52840 are supported. You can mix and match as much as you would like if you program the boards manually.

    Regards,
    Terje

Children
  • # 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.
    
    from __future__ import print_function
    import argparse
    import subprocess
    import sys
    import os
    import os.path
    import functools
    
    #---------------------------------------------------------------------------------------------------
    class CmdExecutor(object):
        def run(self, cmd, verbose=False):
            if (verbose == False):
                cmd.append('-q')
    
            print (' '.join(cmd))
    
            result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            log = result.communicate()[0].decode("ascii")
            while (result.returncode == None):
                log += result.communicate()[0].decode("ascii")
                continue
    
            retval = result.returncode
    
            if (verbose):
                print(log)
    
            return (log, retval)
    
    #---------------------------------------------------------------------------------------------------
    class ProgramDevice(object):
        cmd = CmdExecutor()
    
        def __init__(self, verbose=False):
            self.verbose = verbose
    
        def program(self, soft_dev_hex, app_hex, device_id, type="NRF52"):
            error_count = []
            print ('\n# Programming the SoftDevice on: ', device_id)
            (log, ec) = cmd.run(['nrfjprog', '--program', soft_dev_hex, "-s", device_id, "-f", type,], self.verbose)
            error_count.append(ec)
    
            print ('# Programming hex ')
            (log, ec) = cmd.run(['nrfjprog', '--program', app_hex, "-s", device_id, "-f", type,], self.verbose)
            error_count.append(ec)
            return error_count
    
        def erase(self, device_id):
            print ('\n# Erasing the device: ', device_id)
            (log, ec) = cmd.run(['nrfjprog', '--eraseall', "-s", device_id], self.verbose)
            return [ec]
    
        def reset(self, device_id):
            print ('\n# Resetting the device: ', device_id)
            (log, ec) = cmd.run(['nrfjprog', '--reset', "-s", device_id], self.verbose)
            return [ec]
    
    #---------------------------------------------------------------------------------------------------
    def device_type_get(device_id):
        if (len(device_id) < 9):
            return "00"
        elif (device_id[2] == "2" or device_id[2] == "3" or device_id[2] == "4"):
            return "52"
        elif (device_id[2] == "0" or device_id[2] == "1"):
            return "51"
        else:
            return "00"
    
    #---------------------------------------------------------------------------------------------------
    def get_board_index(msg, devs):
        printBoards(devs)
        while(1):
            try:
                if (sys.version_info[0] == 2):
                    getinput = raw_input
                else:
                    getinput = input
    
                lst_range = list(range(len(devs)))
                inp = getinput('\n' + msg + str(lst_range) + ' [Enter `s`: To skip]: ')
    
                if (len(inp) > 1 or len(inp) == 0):
                    raise ValueError
    
                inp = str(inp.lower())
    
                if (not (inp == 's' or (inp in map(str, lst_range)))):
                    raise ValueError
                elif (inp == 's'):
                    print ("Warning: Skipping this firmware.")
                    return 0
    
                num = int(inp)
            except  ValueError:
                print ("Error: Please enter valid input")
                continue
    
            return(devs[num])
    
    #---------------------------------------------------------------------------------------------------
    def printBoards(devices):
        print ("\nBoards with nRF52 devices: \n(Board index : Segger ID)")
        for i in range(len(devices)):
            print(str(i) + ' : ' + devices[i])
    
    
    #---------------------------------------------------------------------------------------------------
    class errorList(object):
        def __init__(self):
            self.error_lst = []
    
        def addErrors(self,ec):
            for e in ec:
                self.error_lst.append(e)
        def getErrors(self):
            return self.error_lst
    
    #---------------------------------------------------------------------------------------------------
    cwd = os.getcwd()
    print ("Current directory: " + cwd)
    
    parser = argparse.ArgumentParser(description="Mesh quick start demo - Firmware flashing script")
    parser.add_argument('-p', '--provisioner', default=1, help="Provide the provisioner device ID")
    parser.add_argument('-c', '--client', default=2, help="Provide the client device ID")
    parser.add_argument('-v', '--verbose', action='store_true', help="Print nrfjprog output")
    args = parser.parse_args()
    
    prov_loaded = False
    client_loaded = False
    server_loaded = False
    ec = 0
    eList = errorList()
    server_devices = []
    
    soft_dev_hex52    =  cwd + "./bin/softdevice/s140_nrf52_6.0.0_softdevice.hex"
    provisioner_hex52 =  cwd + "./bin/otime/light_switch_provisioner_nrf52840_xxAA_s140_6.0.0.hex"
    client_hex52      =  cwd + "./bin/otime/light_switch_client_nrf52840_xxAA_s140_6.0.0.hex"
    server_hex52      =  cwd + "./bin/otime/light_switch_server_nrf52840_xxAA_s140_6.0.0.hex"
    
    # All files must be valid
    for f in [soft_dev_hex52, provisioner_hex52, client_hex52, server_hex52]:
        if (not os.path.isfile(soft_dev_hex52)):
            print("Error: File ", f, " does not exist")
            quit()
    
    # Filter nRF52 boards
    cmd = CmdExecutor()
    (log, ec) = cmd.run(['nrfjprog', '-i'])
    devices = log.splitlines()
    devices = [d for d in devices if device_type_get(d) == "52"]
    
    
    # Ask user input if required.
    device_selection = devices[:]
    if (args.provisioner == 1):
        ret = get_board_index('# Enter board index you want to use as a Provisioner ', device_selection)
        if (ret):
            args.provisioner = ret
            device_selection.remove(args.provisioner)
    
    if (args.client == 2):
        ret = get_board_index('# Enter board index you want to use as a Client ', device_selection)
        if (ret):
            args.client = ret
    
    
    # Argument checks
    if (len(str(args.provisioner)) < 9):
        print("Warning: Segger ID for Provisioner is not provided")
    if (len(str(args.client)) < 9):
        print("Warning: Segger ID for Client is not provided")
    if (len(str(args.provisioner)) == 9 and str(args.provisioner) == str(args.client)):
        print("Error: Provisioner and Client boards cannot be the same")
        quit()
    if (len(str(args.client)) >= 9 and args.provisioner not in devices):
        print("Warning: Segger ID %s could not be found. Skipping." % args.provisioner)
    if (len(str(args.client)) >= 9 and args.client not in devices):
        print("Warning: Segger ID %s could not be found. Skipping." % args.client)
    
    # Action: Erase devices
    programmer = ProgramDevice(args.verbose)
    for d in devices:
        ec = programmer.erase(d)
        eList.addErrors(ec)
    
    if (sum(err > 0 for err in eList.getErrors()) > 0):
        print('Error: While erasing the devices, please check if boards are connected')
        quit()
    
    # Action: Program SoftDevice and firmware
    for d in devices:
        # PROVISIONER - 52xx
        if (d == str(args.provisioner)):
                ec = programmer.program(soft_dev_hex52, provisioner_hex52, d)
                eList.addErrors(ec)
                if (all(e == 0 for e in ec)):
                    prov_loaded = True
                else:
                    print ("Error: Provisioner could not be programmed on: %s, please retry." % args.provisioner)
                    quit()
    
        # CLIENT - 52xx
        elif (d == str(args.client)):
                ec =  programmer.program(soft_dev_hex52, client_hex52, d)
                eList.addErrors(ec)
                if (all(e == 0 for e in ec)):
                    client_loaded = True
                else:
                    print ("Error: Client could not be programmed on: %s, please retry." % args.client)
                    quit()
    
        # SERVERs - 52xx
        else:
                ec =  programmer.program(soft_dev_hex52, server_hex52, d)
                if (all(e == 0 for e in ec)):
                    server_loaded = True
                    server_devices.append(d)
                else:
                    print ("Warning: Server could not be programmed on: %s" % d)
                    eList.addErrors(ec)
    
    # Action: Reset all devices
    for d in devices:
        ec = programmer.reset(d)
        eList.addErrors(ec)
    
    print("\n# Summary:")
    print("Errors occurred: %d" % sum(err > 0 for err in eList.getErrors()))
    if (prov_loaded):
        print(" Provisioner ID: %s" % args.provisioner)
        devices.remove(args.provisioner)
    else:
        print(" Provisioner ID: Not programmed")
    
    if (client_loaded):
        print("      Client ID: %s" % args.client)
        devices.remove(args.client)
    else:
        print("      Client ID: Not programmed")
    
    if (server_loaded):
        print("     Server IDs: " + ", ".join(server_devices))
    else:
        print("     Server IDs: Not programmed")
    
    

    Add file to scripts\quick_start\quick_start_demo_nrf52840.py
    (4 lines at Line 164 are changed)


    soft_dev_hex52 = cwd + "./bin/softdevice/s140_nrf52_6.0.0_softdevice.hex"
    provisioner_hex52 = cwd + "./bin/otime/light_switch_provisioner_nrf52840_xxAA_s140_6.0.0.hex"
    client_hex52 = cwd + "./bin/otime/light_switch_client_nrf52840_xxAA_s140_6.0.0.hex"
    server_hex52 = cwd + "./bin/otime/light_switch_server_nrf52840_xxAA_s140_6.0.0.hex"
    
    

    In the documentation add a small note.

    Best regards,
    Lukas

  • Hi,

    Thank you for sharing! Making a copy named quick_start_demo_nrf52840.py and change those four lines would be a very quick and easy way to support a set of nRF52840 DKs.

    Regards,
    Terje

  • hello,

    Apologies for being late to the 'party' on this... however both the current quick_start_demo.py and the proposed quick_start_demo_nrf52840.py scripts only support environments with single type NRF52 boards.

    I did change the quick_start_demo.py script a little while back to support environments regardless of the make up of devkit boards.

    soft_dev_hex52832    =  cwd + "./bin/softdevice/s132_nrf52_6.0.0_softdevice.hex"
    provisioner_hex52832 =  cwd + "./bin/otime/light_switch_provisioner_nrf52832_xxAA_s132_6.0.0.hex"
    client_hex52832      =  cwd + "./bin/otime/light_switch_client_nrf52832_xxAA_s132_6.0.0.hex"
    server_hex52832      =  cwd + "./bin/otime/light_switch_server_nrf52832_xxAA_s132_6.0.0.hex"
    
    soft_dev_hex52840    =  cwd + "./bin/softdevice/s140_nrf52_6.0.0_softdevice.hex"
    provisioner_hex52840 =  cwd + "./bin/otime/light_switch_provisioner_nrf52840_xxAA_s140_6.0.0.hex"
    client_hex52840      =  cwd + "./bin/otime/light_switch_client_nrf52840_xxAA_s140_6.0.0.hex"
    server_hex52840      =  cwd + "./bin/otime/light_switch_server_nrf52840_xxAA_s140_6.0.0.hex"

    Needless to say it's based upon determining the type of board 52832 or 52840 and then flashing the requisite hex files accordingly (see attached quick_start_demo-v2.py script)

    def board_type_get(device_id):
        if (device_id[2] == "2"):
            return "52832"
        elif (device_id[2] == "3"):
            return "52840"
        else:
            return "00"


    # 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.
    
    from __future__ import print_function
    import argparse
    import subprocess
    import sys
    import os
    import os.path
    import functools
    
    #---------------------------------------------------------------------------------------------------
    class CmdExecutor(object):
        def run(self, cmd, verbose=False):
            if (verbose == False):
                cmd.append('-q')
    
            print (' '.join(cmd))
    
            result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            log = result.communicate()[0].decode("ascii")
            while (result.returncode == None):
                log += result.communicate()[0].decode("ascii")
                continue
    
            retval = result.returncode
    
            if (verbose):
                print(log)
    
            return (log, retval)
    
    #---------------------------------------------------------------------------------------------------
    class ProgramDevice(object):
        cmd = CmdExecutor()
    
        def __init__(self, verbose=False):
            self.verbose = verbose
    
        def program(self, soft_dev_hex, app_hex, device_id, type="NRF52"):
            error_count = []
            print ('\n# Programming the SoftDevice on: ', device_id)
            (log, ec) = cmd.run(['nrfjprog', '--program', soft_dev_hex, "-s", device_id, "-f", type,], self.verbose)
            error_count.append(ec)
    
            print ('# Programming hex ')
            (log, ec) = cmd.run(['nrfjprog', '--program', app_hex, "-s", device_id, "-f", type,], self.verbose)
            error_count.append(ec)
            return error_count
    
        def erase(self, device_id):
            print ('\n# Erasing the device: ', device_id)
            (log, ec) = cmd.run(['nrfjprog', '--eraseall', "-s", device_id], self.verbose)
            return [ec]
    
        def reset(self, device_id):
            print ('\n# Resetting the device: ', device_id)
            (log, ec) = cmd.run(['nrfjprog', '--reset', "-s", device_id], self.verbose)
            return [ec]
    
    #---------------------------------------------------------------------------------------------------
    def device_type_get(device_id):
        if (len(device_id) < 9):
            return "00"
        elif (device_id[2] == "2" or device_id[2] == "3" or device_id[2] == "4"):
            return "52"
        elif (device_id[2] == "0" or device_id[2] == "1"):
            return "51"
        else:
            return "00"
    
    #---------------------------------------------------------------------------------------------------
    def board_type_get(device_id):
        if (device_id[2] == "2"):
            return "52832"
        elif (device_id[2] == "3"):
            return "52840"
        else:
            return "00"
    
    #---------------------------------------------------------------------------------------------------
    def get_board_index(msg, devs):
        printBoards(devs)
        while(1):
            try:
                if (sys.version_info[0] == 2):
                    getinput = raw_input
                else:
                    getinput = input
    
                lst_range = list(range(len(devs)))
                inp = getinput('\n' + msg + str(lst_range) + ' [Enter `s`: To skip]: ')
    
                if (len(inp) > 1 or len(inp) == 0):
                    raise ValueError
    
                inp = str(inp.lower())
    
                if (not (inp == 's' or (inp in map(str, lst_range)))):
                    raise ValueError
                elif (inp == 's'):
                    print ("Warning: Skipping this firmware.")
                    return 0
    
                num = int(inp)
            except  ValueError:
                print ("Error: Please enter valid input")
                continue
    
            return(devs[num])
    
    #---------------------------------------------------------------------------------------------------
    def printBoards(devices):
        print ("\nBoards with nRF52 devices: \n(Board index : Segger ID)")
        for i in range(len(devices)):
            print(str(i) + ' : ' + devices[i])
    
    
    #---------------------------------------------------------------------------------------------------
    class errorList(object):
        def __init__(self):
            self.error_lst = []
    
        def addErrors(self,ec):
            for e in ec:
                self.error_lst.append(e)
        def getErrors(self):
            return self.error_lst
    
    #---------------------------------------------------------------------------------------------------
    cwd = os.getcwd()
    print ("Current directory: " + cwd)
    
    parser = argparse.ArgumentParser(description="Mesh quick start demo - Firmware flashing script")
    parser.add_argument('-p', '--provisioner', default=1, help="Provide the provisioner device ID")
    parser.add_argument('-c', '--client', default=2, help="Provide the client device ID")
    parser.add_argument('-v', '--verbose', action='store_true', help="Print nrfjprog output")
    args = parser.parse_args()
    
    prov_loaded = False
    client_loaded = False
    server_loaded = False
    ec = 0
    eList = errorList()
    server_devices = []
    
    #soft_dev_hex52    =  cwd + "./bin/softdevice/s132_nrf52_6.0.0_softdevice.hex"
    #provisioner_hex52 =  cwd + "./bin/otime/light_switch_provisioner_nrf52832_xxAA_s132_6.0.0.hex"
    #client_hex52      =  cwd + "./bin/otime/light_switch_client_nrf52832_xxAA_s132_6.0.0.hex"
    #server_hex52      =  cwd + "./bin/otime/light_switch_server_nrf52832_xxAA_s132_6.0.0.hex"
    
    soft_dev_hex52832    =  cwd + "./bin/softdevice/s132_nrf52_6.0.0_softdevice.hex"
    provisioner_hex52832 =  cwd + "./bin/otime/light_switch_provisioner_nrf52832_xxAA_s132_6.0.0.hex"
    client_hex52832      =  cwd + "./bin/otime/light_switch_client_nrf52832_xxAA_s132_6.0.0.hex"
    server_hex52832      =  cwd + "./bin/otime/light_switch_server_nrf52832_xxAA_s132_6.0.0.hex"
    
    soft_dev_hex52840    =  cwd + "./bin/softdevice/s140_nrf52_6.0.0_softdevice.hex"
    provisioner_hex52840 =  cwd + "./bin/otime/light_switch_provisioner_nrf52840_xxAA_s140_6.0.0.hex"
    client_hex52840      =  cwd + "./bin/otime/light_switch_client_nrf52840_xxAA_s140_6.0.0.hex"
    server_hex52840      =  cwd + "./bin/otime/light_switch_server_nrf52840_xxAA_s140_6.0.0.hex"
    
    # All files must be valid
    for f in [soft_dev_hex52832, provisioner_hex52832, client_hex52832, server_hex52832, soft_dev_hex52840, provisioner_hex52840, client_hex52840, server_hex52840]:
        if (not os.path.isfile(soft_dev_hex52832)):
            print("Error: File ", f, " does not exist")
            quit()
    
    # Filter nRF52 boards
    cmd = CmdExecutor()
    (log, ec) = cmd.run(['nrfjprog', '-i'])
    devices = log.splitlines()
    devices = [d for d in devices if device_type_get(d) == "52"]
    
    
    # Ask user input if required.
    device_selection = devices[:]
    if (args.provisioner == 1):
        ret = get_board_index('# Enter board index you want to use as a Provisioner ', device_selection)
        if (ret):
            args.provisioner = ret
            device_selection.remove(args.provisioner)
    
    if (args.client == 2):
        ret = get_board_index('# Enter board index you want to use as a Client ', device_selection)
        if (ret):
            args.client = ret
    
    
    # Argument checks
    if (len(str(args.provisioner)) < 9):
        print("Warning: Segger ID for Provisioner is not provided")
    if (len(str(args.client)) < 9):
        print("Warning: Segger ID for Client is not provided")
    if (len(str(args.provisioner)) == 9 and str(args.provisioner) == str(args.client)):
        print("Error: Provisioner and Client boards cannot be the same")
        quit()
    if (len(str(args.client)) >= 9 and args.provisioner not in devices):
        print("Warning: Segger ID %s could not be found. Skipping." % args.provisioner)
    if (len(str(args.client)) >= 9 and args.client not in devices):
        print("Warning: Segger ID %s could not be found. Skipping." % args.client)
    
    # Action: Erase devices
    programmer = ProgramDevice(args.verbose)
    for d in devices:
        ec = programmer.erase(d)
        eList.addErrors(ec)
    
    if (sum(err > 0 for err in eList.getErrors()) > 0):
        print('Error: While erasing the devices, please check if boards are connected')
        quit()
    
    # Action: Program SoftDevice and firmware
    for d in devices:
        # PROVISIONER - 52xx
        if (d == str(args.provisioner)):
            print("Programming provisioner...")
            if (board_type_get(d) == "52832"):
                print("Dev board type: nrf82832")
                ec = programmer.program(soft_dev_hex52832, provisioner_hex52832, d)
            elif (board_type_get(d) == "52840"):
                print("Dev board type: nrf82840")
                ec = programmer.program(soft_dev_hex52840, provisioner_hex52840, d)
    
                eList.addErrors(ec)
                if (all(e == 0 for e in ec)):
                    prov_loaded = True
                else:
                    print ("Error: Provisioner could not be programmed on: %s, please retry." % args.provisioner)
                    quit()
    
        # CLIENT - 52xx
        elif (d == str(args.client)):
            print("Programming client...")
            if (board_type_get(d) == "52832"):
                print("Dev board type: nrf82832")
                ec = programmer.program(soft_dev_hex52832, client_hex52832, d)
            elif (board_type_get(d) == "52840"):
                print("Dev board type: nrf82840")
                ec = programmer.program(soft_dev_hex52840, client_hex52840, d)
    
                eList.addErrors(ec)
                if (all(e == 0 for e in ec)):
                    client_loaded = True
                else:
                    print ("Error: Client could not be programmed on: %s, please retry." % args.client)
                    quit()
    
        # SERVERs - 52xx
        else:
            if (board_type_get(d) == "52832"):
                print("Programming server...")
                print("Dev board type: nrf82832")
                ec = programmer.program(soft_dev_hex52832, server_hex52832, d)
            elif (board_type_get(d) == "52840"):
                print("Programming server...")
                print("Dev board type: nrf82840")
                ec = programmer.program(soft_dev_hex52840, server_hex52840, d)
    
            if (all(e == 0 for e in ec)):
               server_loaded = True
               server_devices.append(d)
            else:
               print ("Warning: Server could not be programmed on: %s" % d)
               eList.addErrors(ec)
    
    # Action: Reset all devices
    for d in devices:
        ec = programmer.reset(d)
        eList.addErrors(ec)
    
    print("\n# Summary:")
    print("Errors occurred: %d" % sum(err > 0 for err in eList.getErrors()))
    if (prov_loaded):
        print(" Provisioner ID: %s" % args.provisioner)
        devices.remove(args.provisioner)
    else:
        print(" Provisioner ID: Not programmed")
    
    if (client_loaded):
        print("      Client ID: %s" % args.client)
        devices.remove(args.client)
    else:
        print("      Client ID: Not programmed")
    
    if (server_loaded):
        print("     Server IDs: " + ", ".join(server_devices))
    else:
        print("     Server IDs: Not programmed")
    
    

    Regards,

Related