pynrfjprog LowLevel production programming

Hey,

We've been using the pynrfjprog HighLevel API for our production programming, and I see that's now deprecated. There aren't any examples showing how to program the modem firmware using the low-level API - but I managed to figure it out. Here's some sample code from our programming tool

from pathlib import Path
from pynrfjprog import LowLevel
mfw = Path('mfw_nrf91x1_2.0.1.zip')
afw = Path('zephyr.hex')

with LowLevel.API('NRF91') as api:
    api.connect_to_emu_without_snr()

    # Recover first, as that lets us program
    api.recover()
    api.erase_all()

    # Program the modem firmware
    api.select_coprocessor(LowLevel.CoProcessor.CP_MODEM)
    api.program_file(mfw)
    api.verify_file(mfw)

    # Program the application
    api.select_coprocessor(LowLevel.CoProcessor.CP_APPLICATION)
    api.erase_file(afw)
    api.program_file(afw)
    api.verify_file(afw)

    # Reset the device
    api.sys_reset()
    api.close()

print('Done')

Our tool has wrapped all of this with CLI, looping for multiple devices, auto-selection between 9160 and 9151 firmware images etc - but the above should be enough for anyone else trying to get started.

The one issue I have, however, is that sys_reset() call doesn't seem to work. I've also tried hard_reset() (which isn't available) and soft_reset() - but none seem to actually reset and start the application. Is there some additional steps I need to make that work?

Our firmware image lights up an LED on our board when it boots - so that's a nice check to know the modem and application firmware have loaded. My HighLevel-based tool used a SYSTEM_RESET and that worked well on the 9160.

Kind regards,

Dan

Parents Reply Children
Related