From d41493934b76e819b9b64d48ace1315e3fbe1ef3 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 16 Aug 2020 17:40:25 +0800 Subject: [PATCH] work around bladeRF FPGA loading and bias-tee problems --- shell.nix | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/shell.nix b/shell.nix index 83586e4..00cd631 100644 --- a/shell.nix +++ b/shell.nix @@ -16,6 +16,22 @@ let url = "https://www.nuand.com/fpga/v0.11.0/hostedxA4.rbf"; sha256 = "c172e35c4a92cf1e0ca3b37347a84d8376b275ece16cb9c5142b72b82b16fe8e"; }; + bladeRF-flash = pkgs.writeShellScriptBin "bladeRF-flash" + # Using the bladeRF bias-tee is royally annoying. Opening the bladeRF turns it off, + # and the API for turning it back on isn't exposed in SoapySDR. Using the configuration + # file works, but breaks FPGA loading since bladeRF-cli then attempts to turn on the + # bias-tee before loading the FPGA. Using the configuration file to load the FPGA + # works the first time and then crashes until the bladeRF is unplugged and plugged back in. + # To work around these assorted bugs, we flash the bladeRF from an empty directory where + # bladeRF-cli won't find the configuration file, and let it boot the FPGA from its flash, + # which seems less buggy/cumbersome than the other options. + '' + TMPDIR=`mktemp -d` + pushd $TMPDIR + ${pkgs.libbladeRF}/bin/bladeRF-cli -L ${bitstream} + popd + rmdir $TMPDIR + ''; sipyco = pkgs.python3Packages.buildPythonPackage rec { name = "sipyco"; version = "1.1"; @@ -33,13 +49,11 @@ in buildInputs = [ (pkgs.python3.withPackages(ps: [ps.soapysdr-with-plugins ps.scipy ps.pyserial ps.quamash ps.pyqt5 pyqtgraph-qt5 sipyco])) pkgs.libbladeRF pkgs.gqrx + bladeRF-flash ]; dontWrapQtApps = true; postFixup = '' wrapQtApp "$out/bin/python" ''; - shellHook = '' - ${pkgs.libbladeRF}/bin/bladeRF-cli -l ${bitstream} - ''; QT_QPA_PLATFORM = "wayland"; }