From e57cf49c49ec0ff1587179565c726ae74e8e00c9 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 10 Nov 2023 11:38:06 +0100 Subject: [PATCH] Dev: trigger signal issues handled at acquire (#864) * if blocking and handling sync, only master gets blocking acq, slaves get non blocking as they are first and so dont get status or error caught when slaves dont get trigger (due to not connected etc) and acq returns with slaves still in waiting status. so check status of all in blocking acq * for all dets with sync, ensure atleast one master when starting acq * docs updated about sync --- docs/src/troubleshooting.rst | 19 +++++++++++++++++++ python/slsdet/detector.py | 5 +++++ slsDetectorSoftware/include/sls/Detector.h | 5 ++++- slsDetectorSoftware/src/CmdProxy.h | 4 +++- slsDetectorSoftware/src/DetectorImpl.cpp | 19 +++++++++++++++---- 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/docs/src/troubleshooting.rst b/docs/src/troubleshooting.rst index 164886f67..ee8904404 100644 --- a/docs/src/troubleshooting.rst +++ b/docs/src/troubleshooting.rst @@ -92,6 +92,9 @@ Common sls_detector_put rx_arping 1 +#. Only the slaves get no data + * Check trigger cabling and trigger configuration + * When you cannot stop Jungfrau slaves in sync mode, refer to :ref:`Cannot stop slaves`. .. _Receiver PC Tuning: @@ -421,3 +424,19 @@ Cannot get multi module data * Comment out this line in the config file: powerchip 1 * Powering on the chip increases the power consumption by a considerable amount. If commenting out this line aids in getting data (strange data due to powered off chip), then it could be the power supply current limit. Fix it (possibly to 8A current limit) and uncomment the powerchip line back in config file. + + +.. _Jungfrau Troubleshooting Sync Slaves Cannot Stop: + +Cannot stop slaves in sync mode +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. If cabling is accessible, ensure termination board and flatband cable between the masters and the slaves are connnected properly. Then try to stop. +#. If cabling is inaccessible, unsync first so that the slaves can get the stop directly from the client using the command. Then, don't use sync mode until the cabling is fixed. + .. code-block:: bash + + # unsync, slaves command will fail as it is still in waiting state + sls_detector_put sync 0 + + # stop should now be successful as master does not determine the stop anymore + sls_detector_put stop diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 95e3593cc..36c5ed0cd 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -1673,6 +1673,11 @@ class Detector(CppDetectorApi): def sync(self): """ [Jungfrau][Moench] Enables or disables synchronization between modules. + + Note + ---- + Sync mode requires at least one master configured. Also requires flatband cabling between master and slave with termination board. + """ return self.getSynchronization() diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 09c15f6cd..7467789aa 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -216,7 +216,10 @@ class Detector { /** [Jungfrau][Moench] **/ Result getSynchronization(Positions pos = {}) const; - /** [Jungfrau][Moench] */ + /** [Jungfrau][Moench] Sync mode requires at least one master configured. + Also requires flatband cabling between master and slave with + termination board. + */ void setSynchronization(bool value); /** [Gotthard2][Mythen3] */ diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index f53cd6407..60f3454c0 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1543,7 +1543,9 @@ class CmdProxy { INTEGER_COMMAND_SET_NOID_GET_ID( sync, getSynchronization, setSynchronization, StringTo, "[0, 1]\n\t[Jungfrau][Moench] Enables or disables " - "synchronization between modules."); + "synchronization between modules. Sync mode requires at least one " + "master configured. Also requires flatband cabling between master and " + "slave with termination board."); INTEGER_COMMAND_VEC_ID(row, getRow, setRow, StringTo, "[value]\n\tSet Detector row (udp header) to value. " diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index 2db04f1f2..c40c163fc 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -1309,13 +1309,24 @@ void DetectorImpl::startAcquisition(const bool blocking, Positions pos) { std::vector masters; std::vector slaves; getMasterSlaveList(pos, masters, slaves); + if (masters.empty()) { + throw RuntimeError("Cannot start acquisition in sync mode. No " + "master module found"); + } if (!slaves.empty()) { Parallel(&Module::startAcquisition, slaves); } - if (!masters.empty()) { - Parallel((blocking ? &Module::startAndReadAll - : &Module::startAcquisition), - masters); + if (blocking) { + Parallel(&Module::startAndReadAll, masters); + // ensure all status normal (slaves not blocking) + // to catch those slaves that are still 'waiting' + auto status = Parallel(&Module::getRunStatus, pos); + if (!status.contains_only(IDLE, STOPPED, RUN_FINISHED)) { + throw RuntimeError("Acquisition not successful. " + "Unexpected detector status"); + } + } else { + Parallel(&Module::startAcquisition, masters); } } // all in parallel