Updating nrf9160 modem firmware through the command line. (2024)

Hi,

I'm trying to install modem fw using the script given by Sigurd:

https://devzone.nordicsemi.com/f/nordic-q-a/53208/updating-nrf9160-modem-firmware-through-the-command-line

#!/usr/bin/env python3
#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic

import os
import time
import argparse
import subprocess
import logging
from tempfile import TemporaryDirectory, mkstemp
from pynrfjprog import HighLevel

logging.basicConfig(level=logging.INFO)
log = logging.getLogger('modem_update')


def flash_modem_pkg(modem_zip, verify):
    start = time.time()
    with HighLevel.API(True) as api:
        snr = api.get_connected_probes()
        for s in snr:
            log.info("Establish board connection")
            log.info(f"Flashing '{modem_zip}' to board {s}")
            with HighLevel.IPCDFUProbe(api, s, HighLevel.CoProcessor.CP_MODEM) as probe:
                log.info(f"Programming '{modem_zip}'")
                probe.program(modem_zip)
                log.info("Programming complete")
                if verify:
                    log.info("Verifying")
                    probe.verify(modem_zip)
                    log.info("Verifying complete")
        api.close()
        log.info(f"Completed in {time.time() - start} seconds")

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("modem_pkg")
    args = parser.parse_args()
    log.info("Modem firmware upgrade")
    flash_modem_pkg(args.modem_pkg,True)

if __name__ == '__main__':
    main()


Seams to work but I'm getting an error:

INFO:pynrfjprog.HighLevel:[Probes.505101579] [nRF91] {"amountOfSteps":33,"description":"Uploading modem image","duration":43395,"message":"segment 2 of 2","operation":"upload_image","progressPercentage":100,"result":"success","step":33}
WARNING:pynrfjprog.HighLevel:[Probes.505101579] [DebugProbe] A programming operation has been performed with verify == VERIFY_NONE.
WARNING:pynrfjprog.HighLevel:[Probes.505101579] [DebugProbe] Programming can fail without error.
INFO:pynrfjprog.HighLevel:[Probes.505101579] [DebugProbe] Perform system reset.
INFO:pynrfjprog.HighLevel:[Probes.505101579] [nRF91] Response active, slave responded with: 0xa5000005
INFO:pynrfjprog.HighLevel:[Probes.505101579] [nRF91] Loading new coprocessor data.
ERROR:pynrfjprog.HighLevel:[Probes.505101579] [Client] Encountered error -90: Command sys_reset executed for 5 milliseconds with result -90
ERROR:pynrfjprog.HighLevel:[Probes.505101579] [DebugProbe] Failed while performing system reset!
ERROR:pynrfjprog.HighLevel:[Probes.505101579] [DebugProbe] Failed while resetting!
ERROR:pynrfjprog.HighLevel:[HighLevel] Failed programming the device.
ERROR:pynrfjprog.HighLevel:[Probes.505101579] [nRF91] Unable to perform system reset. Device is readback protected.
ERROR:pynrfjprog.HighLevel:[Probes.505101579] [Worker] Try a debug reset instead if possible.
ERROR:pynrfjprog.HighLevel:[Probes.505101579] b"An error was reported by NRFJPROG DLL: -90 NOT_AVAILABLE_BECAUSE_PROTECTION.


I'm running:
Name: pynrfjprog
Version: 10.24.2

Related