Skip to content

Instantly share code, notes, and snippets.

@pabigot
Last active January 3, 2018 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pabigot/d6ba8efc2bfebeec2834ac30407b8c47 to your computer and use it in GitHub Desktop.
Save pabigot/d6ba8efc2bfebeec2834ac30407b8c47 to your computer and use it in GitHub Desktop.
ppk-v11-hangs-on-linux-bug-report patch

Nordic PPK Linux Patches

This gist has patches to the Nordic PPK software to help it run under Linux.

Some other hints:

  • If you get whining about unable to find JLINKARM.dll, modify the JLink.py file in pynrfjprog to set the DEFAULT_SEGGER_ROOT_PATH to where you actually installed your JLink software:

      pip show pynrfjprog
      vi ~/.local/lib/python2.7/site-packages/pynrfjprog/JLink.py
    
  • For the non-responsive plotting issue you want 0001-ui-ppk_plotter-fix-starvation-on-Linux.patch

From 30f59ddc72c66720a66112723ecd78fe7b5a04a6 Mon Sep 17 00:00:00 2001
From: "Peter A. Bigot" <pab@pabigot.com>
Date: Wed, 3 Jan 2018 13:18:08 -0600
Subject: [PATCH] ui/ppk_plotter: fix starvation on Linux
Problem identification and general approach as in devzone topic below.
Using a condvar made more sense to me, and this seems to work.
See: https://devzone.nordicsemi.com/question/162707/ppk-v11-hangs-on-linux-bug-report/
---
ui/ppk_plotter.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ui/ppk_plotter.py b/ui/ppk_plotter.py
index bc36f72..d2ca15b 100644
--- a/ui/ppk_plotter.py
+++ b/ui/ppk_plotter.py
@@ -77,6 +77,7 @@ class ppk_plotter():
self.alive = True
self.logfile_name = 'ppk_avg.csv'
self.started_log = False
+ self.update_condvar = threading.Condition();
self.log_stopped = False
self.update_log = False
@@ -269,7 +270,10 @@ class ppk_plotter():
except Exception as e:
print(str(e))
# Just set update log after every sample
+ self.update_condvar.acquire();
self.update_log = True
+ self.update_condvar.notify()
+ self.update_condvar.release()
else:
# Trigger data received as raw adc float, with range flag prepended
@@ -314,6 +318,9 @@ class ppk_plotter():
def do_logging(self):
ts = 0
while(self.alive):
+ self.update_condvar.acquire()
+ while not (self.update_log or self.log_stopped):
+ self.update_condvar.wait()
try:
if(self.update_log and not self.log_stopped):
ts += self.plotdata.avg_interval
@@ -331,6 +338,7 @@ class ppk_plotter():
pass
except Exception as e:
print(str(e))
+ self.update_condvar.release()
def medfilt(self, x, k):
"""Apply a length-k median filter to a 1D array x.
--
2.7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment