pynrfjprog cannot update modem of nrf9160

Hi Nordic

   I had used pynrfjprog to update modem of nrf9160 for a long time. Everything ran well and smoothly.

But, yesterday, I found it failed to update modem. I have no idea what I happened. The python script was same. The hardware was same.

What I did between was to upgrade pynrfjprog and nrf command line. 

Please help me. Thanks.

1. my software

python: v3.8

pynrfjprog: v10.24.0

nrf command line: lates 10.24.0. 

2.

LOG after run "python update_modem.py .\mfw_nrf9160_1.3.4.zip". It logged NOT_AVAILABLE_BECAUSE_PROTECTION

3. update_modem.py

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

import argparse
from pynrfjprog import HighLevel

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("modem_pkg", default=None, help="Path to nrf9160 modem firmware zip folder")
    args = parser.parse_args()
    print("Modem firmware upgrade")
    api = HighLevel.API()
    api.open()
    snr = api.get_connected_probes()
    for s in snr:
      print("snr:%s",s)
      probe = HighLevel.IPCDFUProbe(api, s, HighLevel.CoProcessor.CP_MODEM)
      print("programming...")
      probe.program(args.modem_pkg)
      print("verifying...")
      probe.verify(args.modem_pkg)
      print("Done")
    api.close()

if __name__ == '__main__':
    main()

Parents Reply Children
  • Hi Jeff,

    Could you provide information about both pynrfjprog and nRF Command Line Tools versions in cases where everything worked as expected and when you got NOT_AVAILABLE_BECAUSE_PROTECTION error?

    Best regards,
    Dejan

  • Hi Dejans

    I already gave information at first message. Please check the content at 1st message.

    pynrjprog and nrf command line both are v10.24.0.

    Then, referring to documentation, I made a pyhton script. Also at 1st message.

    Thanks

    Jeff

  • Hi Jeff,

    I am looking at this:

    What I did between was to upgrade pynrfjprog and nrf command line. 

    If you performed an upgrade, what were your initial and upgraded versions of the tools.

    Jeffery said:
    Then, referring to documentation, I made a pyhton script.

    Could you provide a link to the documentation you refer to?

    Best regards,
    Dejan

  • Hi Dejans

    1.

    Since this issue found after upgrading tools, I forgot the previous versions both.

    I also tried to downgrade pynrfjprog and nrf command line. However, it was no use.

    It still failed to update modem at same reason. It was weird.

    2. Could you try my "up_modem.py" at your side?

        Or, if you saw some error at this python script. Please tell me how to correct it.

    Jeff

  • Hi Jeff,

    Jeffery said:

    1.

    Since this issue found after upgrading tools, I forgot the previous versions both.

    I also tried to downgrade pynrfjprog and nrf command line. However, it was no use.

    It still failed to update modem at same reason. It was weird.

    Knowing working versions of the tools could potentially help in finding out the cause of your issue. Which versions of the tools did you try downgrading to?

    Jeffery said:
    2. Could you try my "up_modem.py" at your side?

    I have tested your script and managed to reproduce the error. 

    EDIT: I have tested using CP_APPLICATION instead of CP_MODEM in your update_modem.py script and I did not see the error anymore. Can you test yourself?

    Best regards,
    Dejan

Related