I'm was testing the gsp sample in samples/nrf9160/gps. It runs fine on my nRF9160DK and reports NMEA messages. However, when i ran it on my custom board, it failed in setup_modem(). This is where it starts transmitting AT commands. I couldn't for the life of me figure out why it worked on my DK and not on my custom board. But of course, the nRF9160 comes blank without no modem firmware.
My production facility had problems getting nRF Connect to discover the chip (another ticket, driver problem?), so we just used the CLI tools for uploading application firmware. This tool isn't for flashing modem firmware. To flash the modem we tried the python script from Nordic, but it always failed due to a missing file (highlevelnrfjprog.dll). The file was indeed in the lib_x64 directory, so we concluded it was a missing dependency.
We then installed DLL Diagnostic Tools:
pip install dll-diagnostics
dlldiag deps highlevelnrfjprog.dll
This told us MSVCP140.dll was missing (although it's scattered 10-15 places around the hard drive, python did not find it).
Copied the MSVCP140.dll to the location of highlevelnrfjprog.dll.
I used these directories:
C:\Users\Dell\ncs\v1.5.0\toolchain\segger_embedded_studio\bin\MSVCP140.dll
C:\Users\Dell\AppData\Local\Programs\Python\Python39\Lib\site-packages\pynrfjprog\lib_x64\
I hope this helps for others with the same problem.
The script i used:
#!/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()