NordicSemiconductor / pynrfjprog

Python wrapper around the nrfjprog dynamic link library (DLL)
Other
74 stars 26 forks source link

`with LowLevel.API("NRF91") as api` fails with internal error -254 #29

Open fredaas opened 2 years ago

fredaas commented 2 years ago

Following the installation guide and installing the required JLink dlls, opening the api fails with the following error:

Traceback (most recent call last):
  File "./main.py", line 6, in <module>
    with LowLevel.API("NRF91") as api:
  File "/usr/local/lib/python3.8/dist-packages/pynrfjprog-10.14.0-py3.8.egg/pynrfjprog/LowLevel.py", line 1723, in __enter__
    self.open()
  File "/usr/local/lib/python3.8/dist-packages/pynrfjprog-10.14.0-py3.8.egg/pynrfjprog/LowLevel.py", line 177, in open
    raise APIError(result, error_data=self.get_errors())
pynrfjprog.APIError.APIError: An error was reported by NRFJPROG DLL: -254 INTERNAL_ERROR.

Same error occurs installing from the pip3 package and building from source.

System: Linux 5.11.0-41-generic, Ubuntu 20.04.2 LTS

fredaas commented 2 years ago

Any feedback on this?

blavka commented 2 years ago

I have same problem

2022-01-10 16:14:16,901 INFO: pynrfjprog.HighLevel: [HighLevel] Creating new probe 2022-01-10 16:14:16,901 INFO: pynrfjprog.HighLevel: [HighLevel] Initialize new probe. 2022-01-10 16:14:16,902 INFO: pynrfjprog.HighLevel: [Probes.801009414] [DebugProbe] Load library at /usr/local/lib/python3.7/dist-packages/pynrfjprog/lib_armhf/libnrfjprogdll.so. 2022-01-10 16:14:16,904 INFO: pynrfjprog.HighLevel: [Probes.801009414] [DebugProbe] Library loaded, loading member functions. 2022-01-10 16:14:16,905 INFO: pynrfjprog.HighLevel: [Probes.801009414] [DebugProbe] Member functions succesfully loaded. 2022-01-10 16:14:16,906 INFO: pynrfjprog.HighLevel: [Probes.801009414] [DebugProbe] Connecting to device from NRF91 family. 2022-01-10 16:14:16,929 ERROR: pynrfjprog.HighLevel: [Probes.801009414] [DebugProbe] Failed to open nfrjprogdll 2022-01-10 16:14:16,929 ERROR: pynrfjprog.HighLevel: [Probes.801009414] [DebugProbe] With family "NRF91". 2022-01-10 16:14:16,929 INFO: pynrfjprog.HighLevel: [Probes.801009414] [DebugProbe] Uninitializing probe with serial number 801009414. 2022-01-10 16:14:16,930 ERROR: pynrfjprog.HighLevel: [Probes.801009414] [Client] Worker process is dead, cannot execute command. 2022-01-10 16:14:17,040 ERROR: pynrfjprog.HighLevel: [HighLevel] Failed while initializing probe 2022-01-10 16:14:17,542 ERROR: pynrfjprog.HighLevel: [Probes.801009414] b'An error was reported by NRFJPROG DLL: -254 INTERNAL_ERROR. \n[Probes.801009414] [DebugProbe] Failed to open nfrjprogdll\n\textra: [Probes.801009414] [DebugProbe] With family "NRF91".\n\textra: [Probes.801009414] [Client] Worker process is dead, cannot execute command.\n\textra: [HighLevel] Failed while initializing probe' 2022-01-10 16:14:17,542 INFO: pynrfjprog.HighLevel: [HighLevel] Closing and freeing sub dlls.

blavka commented 2 years ago

Hi I was able to trace the program and I found where the problem was. Worker is dependent on files from the locale. If the locale is incorrect, it will fall. For fix locale I use on ubuntu: sudo dpkg-reconfigure locales

or you can try only generate locale files: sudo locale-gen

blavka commented 2 years ago

And fix executable flag on worker

for me work this: sudo chmod +x /usr/local/lib/python3.9/dist-packages/pynrfjprog/lib_x64/jlinkarm_nrf_worker_linux