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

Programming with pynrfjprog

Hi,

I have a python scipt that uses pynrfjprog to program some custom information into a board's flash to be used by my application (calibration parameters, serial number etc).

I'd like to customise this to also program the softdevice, application and bootloader. nrfjprog can do this using the command:

nrfjprog.exe --eraseall --programs softdevice.hex --program application.hex bootloader.hex --verify --reset

Is there a way to access this functionality from the Python API?

Parents
  • Yes there is. There is an examples folder when you install pynrfjprog here C:\Python27\Lib\site-packages\pynrfjprog\examples

    program_multiple_hex_file.py does this for you and should work out of the box. I attached it as well.program_multiple_hex_files.py

  • Not quite:

    C:\>nrfjprog -v
    nrfjprog Version: 5.2.0.45203
    
    C:\nrfjprog --help
    <<snip>>
         --programs <hex_file> [--dfu]                Programs the specified hex
                             into the device. In addition, checks that the
                             hex file is a well constructed SoftDevice:
                             It contains a the FWID either in the UICR or
                             the SoftDevice itself, it contains a valid
                             value for the length of the SoftDevice, does
                             not contain any data above the afore mentioned
                             length, and only writes into SoftDevice
                             reserved space in UICR. Can be combined with
                             the erase operations, the reset operations and
                             the other programming operations. If dfu option
                             is given and the SoftDevice allows it, the
                             device will not be run time protected. otherwise,
                             the UICR.CLENR0 will be written. It will
                             automatically disable the MPU NVM protection
                             regions if enabled and enable it again after the
                             program operation.
    

    I've read that the --dfu flag is needed to enable DFU update of the SoftDevice?

Reply
  • Not quite:

    C:\>nrfjprog -v
    nrfjprog Version: 5.2.0.45203
    
    C:\nrfjprog --help
    <<snip>>
         --programs <hex_file> [--dfu]                Programs the specified hex
                             into the device. In addition, checks that the
                             hex file is a well constructed SoftDevice:
                             It contains a the FWID either in the UICR or
                             the SoftDevice itself, it contains a valid
                             value for the length of the SoftDevice, does
                             not contain any data above the afore mentioned
                             length, and only writes into SoftDevice
                             reserved space in UICR. Can be combined with
                             the erase operations, the reset operations and
                             the other programming operations. If dfu option
                             is given and the SoftDevice allows it, the
                             device will not be run time protected. otherwise,
                             the UICR.CLENR0 will be written. It will
                             automatically disable the MPU NVM protection
                             regions if enabled and enable it again after the
                             program operation.
    

    I've read that the --dfu flag is needed to enable DFU update of the SoftDevice?

Children
No Data
Related