PYNRFJPROG

HI,  

We have two products that work together.  One uses the nrf52832 and the other nrf5340.  Using the Programmer (3.0.9) we can take a factory fresh 5340 Erase all and program both network and application cores perfectly.  However this is slow.  I have created a python programmer that does the job much more quickly.  On the 52832 its flawless, however, working with the 5340, I get:

An error was reported by NRFJPROG DLL: -90 NOT_AVAILABLE_BECAUSE_PROTECTION. 

Here is the relative part of the code:

if device_family == "NRF53":
            program_options = ProgramOptions( verify=VerifyAction.VERIFY_NONE, erase_action=EraseAction.ERASE_ALL, qspi_erase_action=EraseAction.ERASE_ALL,  reset=ResetAction.RESET_SYSTEM )
     
            api = LowLevel.API()
            api.open()
            api.connect_to_emu_without_snr()

            print(f"The DLL version is: {api.dll_version()}")
            print(f"Erase protect: {api.is_eraseprotect_enabled()}")
            print("Recovering device")
            api.recover()
            print("Erasing Device")
            api.erase_all()
            api.close()

            api = HighLevel.API()
            api.open()
            snr = api.get_connected_probes()
            for s in snr:
                print(f"snr: {s}")
                probe = HighLevel.DebugProbe(api, s)
                print(f"Device Family: {device_family}")
                print(f"Device Version: {device_version}")
             
                probe = HighLevel.DebugProbe(api, s)
                for f in files:  #only 1 file being programmed, works with programmer
                    print("Programming Application")

                    probe.program(f,program_options)
            api.close()

This results in:


Message=An error was reported by NRFJPROG DLL: -90 NOT_AVAILABLE_BECAUSE_PROTECTION.
[Probes.821001306] [Client] Encountered error -90: Command erase_file executed for 380 milliseconds with result -90
extra: [Probes.821001306] [DebugProbe] Failed while erasing device.
extra: [HighLevel] Failed programming the device.
extra: [Probes.821001306] [nRF53] Failed while erasing device. -90: Access protection is enabled, can't erase memory.
extra: [Probes.821001306] [Worker] Access protection is enabled, can't erase memory.
Source=C:\Users\xxxxx\source\repos\serializer\serializer.py
StackTrace:
File "C:\Users\xxxxx\source\repos\serializer\serializer.py", line 186, in flashHex
probe.program(f,program_options)
File "C:\Users\xxxxx\source\repos\serializer\serializer.py", line 227, in main
sc.flashHex(cwd)
File "C:\Users\xxxxx\source\repos\serializer\serializer.py", line 264, in <module> (Current frame)
main()
pynrfjprog.APIError.APIError: An error was reported by NRFJPROG DLL: -90 NOT_AVAILABLE_BECAUSE_PROTECTION.
[Probes.821001306] [Client] Encountered error -90: Command erase_file executed for 380 milliseconds with result -90
extra: [Probes.821001306] [DebugProbe] Failed while erasing device.
extra: [HighLevel] Failed programming the device.
extra: [Probes.821001306] [nRF53] Failed while erasing device. -90: Access protection is enabled, can't erase memory.
extra: [Probes.821001306] [Worker] Access protection is enabled, can't erase memory.

I have tried:

This but it doesn't seem to help and I get Failed to disable eraseprotect.  Another weird note is that when I use the programmer to erase all, I can then use the pynrfjprog to program the board without problems.  So my basic question is, What do i need to do to get the python version working te same as the programmer because using the programmer is way to slow.

Here is the output from the programmer:

2023-10-27T02:20:31.289Z DEBUG Application data folder: C:\Users\xxxx\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
2023-10-27T02:20:31.452Z DEBUG App pc-nrfconnect-programmer v3.0.9 local
2023-10-27T02:20:31.453Z DEBUG App path: C:\Users\xxxx\.nrfconnect-apps\node_modules\pc-nrfconnect-programmer
2023-10-27T02:20:31.453Z DEBUG nRFConnect 4.1.2, required by the app is (>=4.0.0)
2023-10-27T02:20:31.453Z DEBUG nRFConnect path: C:\Users\rgant\AppData\Local\Programs\nrfconnect\resources\app.asar
2023-10-27T02:20:31.453Z DEBUG HomeDir: C:\Users\xxxx
2023-10-27T02:20:31.453Z DEBUG TmpDir: C:\Users\xxxx\AppData\Local\Temp
2023-10-27T02:20:31.889Z INFO Using nrf-device-lib-js version: 0.6.12
2023-10-27T02:20:31.889Z INFO Using nrf-device-lib version: 0.15.3
2023-10-27T02:20:31.890Z INFO Using nrfjprog DLL version: 10.19.1
2023-10-27T02:20:31.890Z INFO Using JLink version: JLink_V7.88j
2023-10-27T02:20:32.133Z INFO Installed JLink version does not match the provided version (V7.80c)
2023-10-27T02:20:32.755Z INFO Getting serialport options from persistent store 000821000627.pc-nrfconnect-programmer
2023-10-27T02:20:36.308Z DEBUG Client Id: c7f57b89-aabe-4ece-ada9-af7fdcd2bec3
2023-10-27T02:20:37.604Z DEBUG Google Analytics for category pc-nrfconnect-programmer has initialized
2023-10-27T02:20:38.011Z INFO Using @nordicsemiconductor/nrf-device-lib-js to communicate with target via JLink
2023-10-27T02:20:38.011Z INFO JLink OB firmware version J-Link V11 compiled Mar 15 2023 11:20:48
2023-10-27T02:20:38.012Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"architecture","label":"x64"}
2023-10-27T02:20:38.013Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink OB version","label":"J-Link V11 compiled Mar 15 2023 11:20:48"}
2023-10-27T02:20:38.014Z INFO Device family NRF53_FAMILY
2023-10-27T02:20:38.015Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink device family","label":"NRF53_FAMILY"}
2023-10-27T02:20:38.016Z INFO Device version NRF5340_xxAA_ENGD
2023-10-27T02:20:38.016Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink device version","label":"NRF5340_xxAA_ENGD"}
2023-10-27T02:20:38.017Z INFO Board version Unknown
2023-10-27T02:20:38.017Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink device board version","label":"Unknown"}
2023-10-27T02:20:38.018Z INFO Loading readback protection status for Application core
2023-10-27T02:20:38.018Z INFO Loading readback protection status for Network core
2023-10-27T02:20:38.018Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open device","label":"jlink"}
2023-10-27T02:20:38.670Z INFO Readback protection status: NRFDL_PROTECTION_STATUS_ALL
2023-10-27T02:20:39.002Z INFO Readback protection status: NRFDL_PROTECTION_STATUS_ALL
2023-10-27T02:20:39.008Z INFO Parse memory regions for Application core
2023-10-27T02:20:39.009Z INFO Parse memory regions for Network core
2023-10-27T02:20:39.011Z INFO Update files regions according to Application core
2023-10-27T02:20:39.011Z INFO Parse memory regions for file
2023-10-27T02:20:39.011Z INFO Update files regions according to Network core
2023-10-27T02:20:39.011Z INFO Parse memory regions for file
2023-10-27T02:20:39.018Z INFO Device is loaded and ready for further operation
2023-10-27T02:20:44.932Z INFO Parsing HEX file:  C:\code\flashtest\mfg_test-0.2.hex
2023-10-27T02:20:44.948Z INFO File was last modified at  10/18/2023, 10:27:07 AM
2023-10-27T02:20:45.130Z INFO Update files regions according to Application core
2023-10-27T02:20:45.130Z INFO Parse memory regions for file
2023-10-27T02:20:45.131Z INFO Update files regions according to Network core
2023-10-27T02:20:45.131Z INFO Parse memory regions for file
2023-10-27T02:20:46.621Z INFO Recovering NRFDL_DEVICE_CORE_APPLICATION core
2023-10-27T02:20:48.767Z INFO Recovering NRFDL_DEVICE_CORE_APPLICATION core completed
2023-10-27T02:20:48.768Z INFO Recovering NRFDL_DEVICE_CORE_NETWORK core
2023-10-27T02:20:50.934Z INFO Recovering NRFDL_DEVICE_CORE_NETWORK core completed
2023-10-27T02:20:50.949Z INFO Device recovery completed
2023-10-27T02:20:50.951Z INFO Writing procedure starts for NRFDL_DEVICE_CORE_APPLICATION core
2023-10-27T02:20:51.118Z INFO Writing HEX to NRFDL_DEVICE_CORE_APPLICATION core
2023-10-27T02:20:51.558Z INFO  0%
2023-10-27T02:20:52.273Z INFO {"chip_erase_mode":"ERASE_ALL","qspi_erase_mode":"ERASE_NONE","reset":"RESET_NONE","verify":"VERIFY_NONE"} 100%
2023-10-27T02:20:52.274Z INFO Uploading image through JLink: 0%
2023-10-27T02:20:54.586Z INFO Uploading image through JLink: 100%
2023-10-27T02:20:54.587Z INFO  100%
2023-10-27T02:20:54.722Z INFO Writing HEX to NRFDL_DEVICE_CORE_APPLICATION core completed
2023-10-27T02:20:54.722Z INFO Writing procedure ends for NRFDL_DEVICE_CORE_APPLICATION core
2023-10-27T02:20:54.722Z INFO Writing procedure starts for NRFDL_DEVICE_CORE_NETWORK core
2023-10-27T02:20:54.805Z INFO Writing HEX to NRFDL_DEVICE_CORE_NETWORK core
2023-10-27T02:20:55.307Z INFO  0%
2023-10-27T02:20:55.920Z INFO {"chip_erase_mode":"ERASE_ALL","qspi_erase_mode":"ERASE_NONE","reset":"RESET_NONE","verify":"VERIFY_NONE"} 100%
2023-10-27T02:20:55.921Z INFO Uploading image through JLink: 0%
2023-10-27T02:20:57.329Z INFO Uploading image through JLink: 100%
2023-10-27T02:20:57.334Z INFO  100%
2023-10-27T02:20:57.482Z INFO Writing HEX to NRFDL_DEVICE_CORE_NETWORK core completed
2023-10-27T02:20:57.482Z INFO Writing procedure ends for NRFDL_DEVICE_CORE_NETWORK core
2023-10-27T02:20:58.336Z INFO Resetting device completed
2023-10-27T02:20:58.339Z INFO Using @nordicsemiconductor/nrf-device-lib-js to communicate with target via JLink
2023-10-27T02:20:58.339Z INFO JLink OB firmware version J-Link V11 compiled Mar 15 2023 11:20:48
2023-10-27T02:20:58.339Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink OB version","label":"J-Link V11 compiled Mar 15 2023 11:20:48"}
2023-10-27T02:20:58.340Z INFO Device family NRF53_FAMILY
2023-10-27T02:20:58.341Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink device family","label":"NRF53_FAMILY"}
2023-10-27T02:20:58.342Z INFO Device version NRF5340_xxAA_ENGD
2023-10-27T02:20:58.342Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink device version","label":"NRF5340_xxAA_ENGD"}
2023-10-27T02:20:58.343Z INFO Board version Unknown
2023-10-27T02:20:58.343Z DEBUG Sending usage data {"category":"pc-nrfconnect-programmer","action":"Open jlink device board version","label":"Unknown"}
2023-10-27T02:20:58.344Z INFO Loading readback protection status for Application core
2023-10-27T02:20:58.344Z INFO Loading readback protection status for Network core
2023-10-27T02:20:59.137Z INFO Readback protection status: NRFDL_PROTECTION_STATUS_NONE
2023-10-27T02:20:59.461Z INFO Readback protection status: NRFDL_PROTECTION_STATUS_NONE
2023-10-27T02:21:00.225Z INFO Parse memory regions for Application core
2023-10-27T02:21:00.225Z INFO Parse memory regions for Network core
2023-10-27T02:21:00.227Z INFO Update files regions according to Application core
2023-10-27T02:21:00.227Z INFO Parse memory regions for file
2023-10-27T02:21:00.227Z INFO Update files regions according to Network core
2023-10-27T02:21:00.227Z INFO Parse memory regions for file
2023-10-27T02:21:00.232Z INFO Device is loaded and ready for further operation

Related