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

pynrfjprog: unable to access nRF53 network core on Windows

I am attempting to programmatically access the nRF5340 network core using pynrfjprog on Windows, but am continuously hitting:

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

As far as I can tell I have followed the correct procedure for erasing both cores, and the standalone `nrfjprog` tool is able to read memory from the network core with no errors.

Furthermore, my code can access the network core fine under MacOS.

Below is my test program:

```

#!/usr/bin/env python3

from pynrfjprog import HighLevel
from pynrfjprog.Parameters import CoProcessor

import subprocess

def test():
        # Completely recover connected nRF53 device
        out = subprocess.run(['nrfjprog''-f''nrf53''--coprocessor''CP_NETWORK''--recover'], capture_output=True)
        if out.returncode != 0:
                print("Failed to erase network core")
                return
        out = subprocess.run(['nrfjprog''-f''nrf53''--coprocessor''CP_APPLICATION''--recover'], capture_output=True)
        if out.returncode != 0:
                print("Failed to erase application core")
                return
        # Validate that nrfjprog can read network core memory
        out = subprocess.run(['nrfjprog''-f''nrf53''--coprocessor''CP_NETWORK''--memrd''0x01FF0000''--n''8'], capture_output=True)
        if out.returncode != 0:
                print("Failed to read network core memory")
                return
        print(f"nrfjprog output: {out.stdout}")

        # Try and programmatically access network core
        with HighLevel.API() as api:
                probes = api.get_connected_probes()
                with HighLevel.DebugProbe(api, probes[0], CoProcessor.CP_NETWORKas p:
                        info = p.get_device_info()
                        print(info.device_type)

if __name__ == '__main__':
        test()

```

The above works when accessing `CoProcessor.CP_APPLICATION`, but fails when accessing `CoProcessor.CP_NETWORK` with:

```

nrfjprog output: b'0x01FF0000: 5B800000 0004FFFC |...[....|\r\n'
Traceback (most recent call last):
File "C:\Users\Jordan\code\scripts\test.py", line 33, in <module>
test()
File "C:\Users\Jordan\code\scripts\test.py", line 29, in test
info = p.get_device_info()
File "C:\Python38\lib\site-packages\pynrfjprog\HighLevel.py", line 272, in get_device_info
raise APIError(result, log=self._logger.error)
pynrfjprog.APIError.APIError: An error was reported by NRFJPROG DLL: -90 NOT_AVAILABLE_BECAUSE_PROTECTION.

```

Software versions are:

python: 3.8.0

pynrfjprog: 10.6.0

JLink: 7.50a

Parents Reply
  • Yes. I just downloaded the installer again (10.13.0 Win64) and the options it gives are 'repair' and 'uninstall', so it's up to date.

    Interestingly, part of the changelog for 10.13.0 is:

    "- (nrfjprog.exe) Made --coprocessor flag with CP_APPLICATION as the argument available for all devices."

    But when I try to create a probe on a nRF52840 device with that flag it still fails for me:
    "
    probe = HighLevel.DebugProbe(api, probes[0], CoProcessor.CP_APPLICATION)"

    "pynrfjprog.APIError.APIError: An error was reported by NRFJPROG DLL: -4 INVALID_DEVICE_FOR_OPERATION."

    Not directly related to my problem with the nRF5340, but another issue related to the coprocessor option.

Children
Related