diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c19ad8c63..39103a84b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2021 Contributors to the SLS Detector Package cmake_minimum_required(VERSION 3.14) project(slsDetectorPackage) -set(PROJECT_VERSION 8.0.1) +set(PROJECT_VERSION 8.0.2) set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") diff --git a/RELEASE.txt b/RELEASE.txt index 7ae24c7bb2..390880d9e5 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -1,7 +1,7 @@ -SLS Detector Package Major Release 8.0.1 released on 16.01.2024 -=============================================================== +SLS Detector Package Bug Fix Release 8.0.2 released on 18.09.2024 +================================================================= -This document describes the differences between v8.0.1 and v8.0.0 +This document describes the differences between v8.0.2 and v8.0.1 @@ -24,19 +24,100 @@ This document describes the differences between v8.0.1 and v8.0.0 ----------- - * Fixed compilation error when building without zmq-devel installed - and removed dependency on zeromq in conda build. + * Rapidjson compilation with gcc 14 + Fixed a compile issue with gcc 14. Same fix in later commits to rapidjson. - * Fixed libzmq compilation error to build the package as a submodule. + Client + ------ - Calibration - ----------- + * getenv("HOME") returning nullptr + When this happens, especially for systemd, it segfaults. Protection + provided by using empty string in this case. + + + * [Mythen3] Bad channel list for multi module + Exception thrown when loading multi module bad channel file skipping + modules in between. Fixed. + + + * [Gotthard2] Stopping a blocking acquisition + A check added in v8.0.0 to catch slaves that might be in waiting forever + also catches Gotthard2 25um slaves that might only be in waiting + temporarily. This is fixed with a 50ms sleep before checking again + (upto 1s). + + + * [Moench] Acquire finished processing call back + New executable 'sls_detector_acquire_zmq' added to listen to all zmq + packets from post processor or external process to signal end of post + processing. Post processor refactoring of zmq socket creation added. + + + Gui / Callback + -------------- + + + * [Gotthard2] Stopping a blocking acquisition + From the previous issue, call back for acquisition finished status gives + error for inconsistent states. Again, a check every 50ms upto 1s is + added to let go the temporarily waiting slave. + + + * Different file paths + Fixes file path resetting when different modules have different fpath set. + + + Receiver + -------- + + + * HDF5 fill value + Fix the fill value to accomodate all datatypes. + + + Firmware + -------- + + + * [Moench] Overflow with exptime of 0 + Fixed overflow when subtracting 1 clock cycle from exptime. + + + On-board Detector Server + ------------------------ + + + * [Moench] Few changes in Server: + - Max shifts of adc clock changed from 240 to 200. + + - Fixed overflow when subtracting 2 clock cycles from exptime of 0ms. + + - Default readout speed to half speed from quarter. + + - Change default ADC phase to 150 for full readout speed. + + - Change default vipre_cds dac from 800 to 1280. + + + * [Mythen3] Change Clk divider from 10 (100MHz) to 20 (50MHz) at startup. + + + * [Jungfrau] Fix for HW v1.0 boards for unreliable ADC 2 + Issues sometimes seen on some HW v 1.0 boards are fixed with phase + relationship of 120 degrees. HW v2.0 boards are not affected. + + + Documentation + ------------- + + * Updated troubleshooting documentaion to check links and disable firewall - * [Moench] Fixed Moench calibration + * Excluded non UTF-8 encoded libzmq documents due to machine dependent + compilation issues. @@ -45,11 +126,11 @@ This document describes the differences between v8.0.1 and v8.0.0 Eiger 8.0.0 - Jungfrau 8.0.0 - Mythen3 8.0.0 + Jungfrau 8.0.2 + Mythen3 8.0.2 Gotthard2 8.0.0 Gotthard 8.0.0 - Moench 8.0.0 + Moench 8.0.2 Ctb 8.0.0 @@ -58,8 +139,6 @@ This document describes the differences between v8.0.1 and v8.0.0 From v6.1.0 (without tftp): Using command 'updatedetectorserver' - From 5.0.0 (with tftp): - Using command 'copydetectorserver' Instructions available at https://slsdetectorgroup.github.io/devdoc/serverupgrade.html @@ -83,7 +162,8 @@ This document describes the differences between v8.0.1 and v8.0.0 Gotthard 08.02.2018 (50um and 25um Master) 09.02.2018 (25 um Slave) - Moench 10.07.2023 (v0.3.2) (updated in 8.0.0, under development) + Moench 26.10.2023 (v0.3.2) (updated in 8.0.2, + under development) Ctb 28.08.2023 (v1.2) (updated in 8.0.0) @@ -104,10 +184,10 @@ This document describes the differences between v8.0.1 and v8.0.0 Except Eiger, upgrade - Using command 'programfpga' or + using command 'programfpga' or udpate both server and firmware simultaneously - Using command 'update' + using command 'update' Instructions available at diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 6ebcfe04a8..82735934dd 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -890,7 +890,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = */docs/* */tests/* */python/* */manual */slsDetectorServers/* */libs/* */integrationTests *README* */slsDetectorGui/* */ctbGui/* */slsDetectorCalibration/* +EXCLUDE_PATTERNS = */docs/* */tests/* */python/* */manual */slsDetectorServers/* */libs/* */integrationTests *README* */slsDetectorGui/* */ctbGui/* */slsDetectorCalibration/* *TobiSchluter* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the diff --git a/docs/src/troubleshooting.rst b/docs/src/troubleshooting.rst index 72a3814f8a..65214846bc 100644 --- a/docs/src/troubleshooting.rst +++ b/docs/src/troubleshooting.rst @@ -22,6 +22,8 @@ Common * Check transeiver and fibers are compatible (all MMF 850nm or all SMF 1030nm) * Check fiber * Check fiber polarity (if short range, unplug the link anywhere, and look at the light/dark pattern: dark has to mate with light) + * For Jungfrau, check if the blue sfp light is blinking rapidly (even when it is not sending data). If so, most likely the link is down and something is wrong with the board. If it connected to a switch, then you do not see it with the ethtool command if link is down. One option is to connect it directly to a pc to see if link is down. + * With nc, try "nc -u -p 50001 -l" in receiving pc, and from another pc try "echo hallo | nc -u 10.1.2.172 50001" to send something to the recieving pc interface to see if the link is up and see if the other nc console receives the hallo. #. Detector is not acquiring (Not Eiger) * Take an acquisition with many images and using the following steps instead of acquire: @@ -47,11 +49,20 @@ Common * Ensure that the interfaces (on NIC and the switch) used in receiver pc have MTU 9000 (jumbo frames) enabled. -#. Check if 'rx_frames' counter in 'ifconfig' do not increment for interface. +#. Check if 'rx packets' counter in 'ifconfig' do not increment for interface. * If no, check switch configuration if present. Port counters of switch can also help to identify problem. * If yes, but receiver software does not see it: * Check no firewall (eg. firewalld) is present or add rules + + .. code-block:: bash + + # Stop and disable firewall + service firewalld stop + systemctl disable firewalld + # Check status + service firewalld status + * Check that selinux is disabled ( or add rules) #. Source UDP IP in config file (Not Eiger) diff --git a/libs/rapidjson/rapidjson/document.h b/libs/rapidjson/rapidjson/document.h index f4073113d3..266f783374 100755 --- a/libs/rapidjson/rapidjson/document.h +++ b/libs/rapidjson/rapidjson/document.h @@ -316,7 +316,8 @@ struct GenericStringRef { GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {} - GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } + // Removed to fix failing build in GCC 14 + // GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } //! implicit conversion to plain CharType pointer operator const Ch *() const { return s; } diff --git a/serverBin/jungfrauDetectorServerv8.0.0 b/serverBin/jungfrauDetectorServerv8.0.0 deleted file mode 120000 index c99269f210..0000000000 --- a/serverBin/jungfrauDetectorServerv8.0.0 +++ /dev/null @@ -1 +0,0 @@ -../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.0 \ No newline at end of file diff --git a/serverBin/jungfrauDetectorServerv8.0.2 b/serverBin/jungfrauDetectorServerv8.0.2 new file mode 120000 index 0000000000..ae1efdca00 --- /dev/null +++ b/serverBin/jungfrauDetectorServerv8.0.2 @@ -0,0 +1 @@ +../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.2 \ No newline at end of file diff --git a/serverBin/moenchDetectorServerv8.0.0 b/serverBin/moenchDetectorServerv8.0.0 deleted file mode 120000 index 1471d89373..0000000000 --- a/serverBin/moenchDetectorServerv8.0.0 +++ /dev/null @@ -1 +0,0 @@ -../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.0 \ No newline at end of file diff --git a/serverBin/moenchDetectorServerv8.0.2 b/serverBin/moenchDetectorServerv8.0.2 new file mode 120000 index 0000000000..7d3e84e8af --- /dev/null +++ b/serverBin/moenchDetectorServerv8.0.2 @@ -0,0 +1 @@ +../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.2 \ No newline at end of file diff --git a/serverBin/mythen3DetectorServerv8.0.0 b/serverBin/mythen3DetectorServerv8.0.0 deleted file mode 120000 index c98a6145e1..0000000000 --- a/serverBin/mythen3DetectorServerv8.0.0 +++ /dev/null @@ -1 +0,0 @@ -../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.0 \ No newline at end of file diff --git a/serverBin/mythen3DetectorServerv8.0.2 b/serverBin/mythen3DetectorServerv8.0.2 new file mode 120000 index 0000000000..1873398967 --- /dev/null +++ b/serverBin/mythen3DetectorServerv8.0.2 @@ -0,0 +1 @@ +../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.2 \ No newline at end of file diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index f69184230c..4582cd1036 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -183,8 +183,8 @@ int main(int argc, char *argv[]) { gainfname = args["gainfile"]; etafname = args["etafilefile"]; - if (atoi(args["nuninterfaces"].c_str())>1){ - cprintf(RED, "Sorry, at the moment only a single interface is supported instead of %d\n",atoi(args["nuninterfaces"].c_str())); + if (atoi(args["numinterfaces"].c_str())>1){ + cprintf(RED, "Sorry, at the moment only a single interface is supported instead of %d\n",atoi(args["numinterfaces"].c_str())); return EXIT_FAILURE; } @@ -272,54 +272,35 @@ int main(int argc, char *argv[]) { sls::ZmqSocket *zmqsocket = NULL; -#ifdef NEWZMQ // receive socket try { -#endif - zmqsocket = new sls::ZmqSocket(socketip.c_str(), portnum); - -#ifdef NEWZMQ } catch (...) { cprintf(RED, - "Error: Could not create Zmq socket on port %d with ip %s\n", - portnum, socketip.c_str()); - delete zmqsocket; - return EXIT_FAILURE; - } -#endif - -#ifndef NEWZMQ - if (zmqsocket->IsError()) { - cprintf(RED, - "Error: Could not create Zmq socket on port %d with ip %s\n", + "Error: Could not create Zmq receiving socket on port %d with ip %s\n", portnum, socketip.c_str()); delete zmqsocket; return EXIT_FAILURE; } -#endif if (zmqsocket->Connect()) { - cprintf(RED, "Error: Could not connect to socket %s\n", + cprintf(RED, "Error: Could not connect to zmq receiving socket %s\n", (zmqsocket->GetZmqServerAddress()).c_str()); delete zmqsocket; return EXIT_FAILURE; } else - printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str()); + + printf("Zmq receiving at %s\n", zmqsocket->GetZmqServerAddress().c_str()); // send socket sls::ZmqSocket *zmqsocket2 = 0; // cout << "zmq2 " << endl; if (send) { -#ifdef NEWZMQ // receive socket try { -#endif - zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str()); - -#ifdef NEWZMQ + zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str()); } catch (...) { cprintf(RED, - "Error: Could not create Zmq socket server on port %d and " + "Error: Could not create Zmq sending socket on port %d and " "ip %s\n", portnum2, socketip2.c_str()); // delete zmqsocket2; @@ -328,28 +309,7 @@ int main(int argc, char *argv[]) { // return EXIT_FAILURE; send = false; } -#endif - -#ifndef NEWZMQ - if (zmqsocket2->IsError()) { - cprintf(RED, - "AAA Error: Could not create Zmq socket server on port %d " - "and ip %s\n", - portnum2, socketip2.c_str()); - // delete zmqsocket2; - // delete zmqsocket; - // return EXIT_FAILURE; - send = false; - } -#endif - if (zmqsocket2->Connect()) { - cprintf(RED, "BBB Error: Could not connect to socket %s\n", - zmqsocket2->GetZmqServerAddress().c_str()); - // delete zmqsocket2; - send = false; - // return EXIT_FAILURE; - } else - printf("Zmq Client at %s\n", + printf("Zmq sending socket at %s\n", zmqsocket2->GetZmqServerAddress().c_str()); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index dc97903bb9..c2df7922b4 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -839,8 +839,8 @@ void qTabMeasurement::UpdateProgress() { int qTabMeasurement::VerifyOutputDirectoryError() { try { auto retval = det->getFilePath(); - for (auto &it : retval) { - det->setFilePath(it); + for (int i = 0; i < static_cast(retval.size()); ++i) { + det->setFilePath(retval[i], {i}); } return slsDetectorDefs::OK; } diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.0 b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.0 deleted file mode 100755 index b66b818e9c..0000000000 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.0 and /dev/null differ diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.2 b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.2 new file mode 100755 index 0000000000..b01abd4dcb Binary files /dev/null and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv8.0.2 differ diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index deabb002a4..73d7ec3f26 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -488,6 +488,7 @@ void setupDetector() { AD9257_SetDefines(ADC_SPI_REG, ADC_SPI_SRL_CS_OTPT_MSK, ADC_SPI_SRL_CLK_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_OFST); + AD9257_Set_Jungfrau_Hardware_Version_1_0(isHardwareVersion_1_0()); AD9257_Disable(); AD9257_Configure(); diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.0 b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.0 deleted file mode 100755 index 88ca14c1a5..0000000000 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.0 and /dev/null differ diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.2 b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.2 new file mode 100755 index 0000000000..75b35dd132 Binary files /dev/null and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.2 differ diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c index e4ec00a8c5..be5abb7905 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c @@ -481,7 +481,6 @@ void setupDetector() { return; } - setReadoutSpeed(DEFAULT_SPEED); cleanFifos(); resetCore(); @@ -495,6 +494,7 @@ void setupDetector() { initReadoutConfiguration(); // Initialization of acquistion parameters + setReadoutSpeed(DEFAULT_SPEED); setSettings(DEFAULT_SETTINGS); setNumFrames(DEFAULT_NUM_FRAMES); setNumTriggers(DEFAULT_NUM_CYCLES); @@ -699,14 +699,12 @@ int setExpTime(int64_t val) { } LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); val *= (1E-3 * CLK_RUN); - val -= ACQ_TIME_MIN_CLOCK; if (val < 0) { val = 0; } set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG); // validate for tolerance - val += ACQ_TIME_MIN_CLOCK; int64_t retval = getExpTime(); val /= (1E-3 * CLK_RUN); if (val != retval) { @@ -716,8 +714,7 @@ int setExpTime(int64_t val) { } int64_t getExpTime() { - return (get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) + - ACQ_TIME_MIN_CLOCK) / + return get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) / (1E-3 * CLK_RUN); } diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h index 4eecb92647..b564f21af1 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h @@ -5,7 +5,7 @@ #include "sls/sls_detector_defs.h" #define REQRD_FRMWRE_VRSN_BOARD2 0x444445 // 1.0 pcb (version = 010) -#define REQRD_FRMWRE_VRSN 0x230710 // 2.0 pcb (version = 011) +#define REQRD_FRMWRE_VRSN 0x231026 // 2.0 pcb (version = 011) #define NUM_HARDWARE_VERSIONS (2) #define HARDWARE_VERSION_NUMBERS \ @@ -58,11 +58,10 @@ /* Defines in the Firmware */ #define MAX_TIMESLOT_VAL (0x1F) #define MAX_THRESHOLD_TEMP_VAL (127999) // millidegrees -#define ACQ_TIME_MIN_CLOCK (2) #define ASIC_FILTER_MAX_RES_VALUE (1) #define MAX_SELECT_CHIP10_VAL (63) -#define MAX_PHASE_SHIFTS (240) +#define MAX_PHASE_SHIFTS (200) #define BIT16_MASK (0xFFFF) #define ADC_DECMT_QUARTER_SPEED (0x3) @@ -71,7 +70,7 @@ #define ADC_PHASE_DEG_QUARTER_SPEED (0) #define ADC_PHASE_DEG_HALF_SPEED (0) -#define ADC_PHASE_DEG_FULL_SPEED (300) +#define ADC_PHASE_DEG_FULL_SPEED (150) #define ADC_OFST_QUARTER_SPEED (0x12) #define ADC_OFST_HALF_SPEED (0x12) @@ -134,7 +133,7 @@ enum DACINDEX { 680, /* MO_VB_SDA */ \ 1428, /* MO_VCASC_SFP */ \ 1200, /* MO_VOUT_CM */ \ - 800, /* MO_VIPRE_CDS */ \ + 1280, /* MO_VIPRE_CDS */ \ 900 /* MO_IBIAS_SFP */ \ }; diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.0 b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.2 similarity index 50% rename from slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.0 rename to slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.2 index bf54ab6815..c01cb64fb1 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.0 and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.2 differ diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 3fcfda045f..ba49a339e1 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -479,6 +479,11 @@ void setupDetector() { READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ); ALTERA_PLL_C10_ResetPLL(READOUT_PLL); ALTERA_PLL_C10_ResetPLL(SYSTEM_PLL); + // change startup clock divider in software + // because firmware only sets max clock divider + setClockDividerWithTimeUpdateOption(READOUT_C0, DEFAULT_READOUT_C0_STARTUP, + 0); + // hv DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME); // dac @@ -2331,6 +2336,7 @@ int setClockDividerWithTimeUpdateOption(enum CLKINDEX ind, int val, return FAIL; } if (val < 2 || val > getMaxClockDivider()) { + LOG(logERROR, ("Invalid clock divider %d\n", val)); return FAIL; } char *clock_names[] = {CLK_NAMES}; diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h index e9e020ca0d..aa57b0f784 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h @@ -64,6 +64,8 @@ #define DEFAULT_SYSTEM_C2 (5) //(200000000) // smp_clk, 200 MHz const #define DEFAULT_TRIMMING_RUN_CLKDIV (40) // (25000000) // 25 MHz +#define DEFAULT_READOUT_C0_STARTUP (20) //(50000000) // rdo_clk, 50 MHz + #define DEFAULT_ASIC_LATCHING_NUM_PULSES (10) #define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20) #define DEFAULT_ADIF_PIPELINE_VAL (8) diff --git a/slsDetectorServers/slsDetectorServer/include/AD9257.h b/slsDetectorServers/slsDetectorServer/include/AD9257.h index 2989e7010d..d0d282c927 100644 --- a/slsDetectorServers/slsDetectorServer/include/AD9257.h +++ b/slsDetectorServers/slsDetectorServer/include/AD9257.h @@ -4,6 +4,10 @@ #include +#ifdef JUNGFRAUD +void AD9257_Set_Jungfrau_Hardware_Version_1_0(int val); +#endif + /** * Set Defines * @param reg spi register diff --git a/slsDetectorServers/slsDetectorServer/src/AD9257.c b/slsDetectorServers/slsDetectorServer/src/AD9257.c index 7d49d4f0e4..6ebf574f4e 100644 --- a/slsDetectorServers/slsDetectorServer/src/AD9257.c +++ b/slsDetectorServers/slsDetectorServer/src/AD9257.c @@ -172,6 +172,14 @@ uint32_t AD9257_DigMask = 0x0; int AD9257_DigOffset = 0x0; int AD9257_VrefVoltage = 0; +#ifdef JUNGFRAUD +int AD9257_is_Jungfrau_Hardware_Version_1_0 = 0; + +void AD9257_Set_Jungfrau_Hardware_Version_1_0(int val) { + AD9257_is_Jungfrau_Hardware_Version_1_0 = val; +} +#endif + void AD9257_SetDefines(uint32_t reg, uint32_t cmsk, uint32_t clkmsk, uint32_t dmsk, int dofst) { AD9257_Reg = reg; @@ -286,8 +294,18 @@ void AD9257_Configure() { AD9257_OUT_BINARY_OFST_VAL | AD9257_OUT_LVDS_IEEE_VAL); // output clock phase +#ifdef JUNGFRAUD + if (AD9257_is_Jungfrau_Hardware_Version_1_0) { + LOG(logINFO, ("\tOutput clock phase: 120\n")); + AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_120_VAL); + } else { + LOG(logINFO, ("\tOutput clock phase: 180\n")); + AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_180_VAL); + } +#else LOG(logINFO, ("\tOutput clock phase: 180\n")); AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_180_VAL); +#endif // all devices on chip to receive next command LOG(logINFO, ("\tAll devices on chip to receive next command\n")); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 2aaa243c3f..e08eb946e1 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -2533,7 +2533,7 @@ int set_exptime(int file_des) { if (gateIndex != -1) { ret = FAIL; sprintf(mess, - "Could not get exposure time. Gate index not implemented " + "Could not set exposure time. Gate index not implemented " "for this detector\n"); LOG(logERROR, (mess)); } else { diff --git a/slsDetectorSoftware/CMakeLists.txt b/slsDetectorSoftware/CMakeLists.txt index 692302d113..8130ed6853 100755 --- a/slsDetectorSoftware/CMakeLists.txt +++ b/slsDetectorSoftware/CMakeLists.txt @@ -79,9 +79,10 @@ if(SLS_USE_TEXTCLIENT) # Loop over list to generate command line binaries set(bin_names "sls_detector_put" "sls_detector_get" - "sls_detector_acquire" + "sls_detector_acquire" + "sls_detector_acquire_zmq" "sls_detector_help") - set(cmd_name "PUT" "GET" "READOUT" "HELP") + set(cmd_name "PUT" "GET" "READOUT" "READOUTZMQ" "HELP") list(LENGTH bin_names len1) math(EXPR len2 "${len1} - 1") diff --git a/slsDetectorSoftware/src/CmdLineApp.cpp b/slsDetectorSoftware/src/CmdLineApp.cpp index c1955f5285..9f75e4dfd1 100644 --- a/slsDetectorSoftware/src/CmdLineApp.cpp +++ b/slsDetectorSoftware/src/CmdLineApp.cpp @@ -30,6 +30,10 @@ int main(int argc, char *argv[]) { int action = slsDetectorDefs::READOUT_ACTION; #endif +#ifdef READOUTZMQ + int action = slsDetectorDefs::READOUT_ZMQ_ACTION; +#endif + #ifdef HELP int action = slsDetectorDefs::HELP_ACTION; #endif @@ -46,7 +50,8 @@ int main(int argc, char *argv[]) { parser.Parse(argc, argv); // If we called sls_detector_acquire, add the acquire command - if (action == slsDetectorDefs::READOUT_ACTION) + if (action == slsDetectorDefs::READOUT_ACTION || + action == slsDetectorDefs::READOUT_ZMQ_ACTION) parser.setCommand("acquire"); if (parser.isHelp()) diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index d56bd0f96e..64688245c3 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -205,6 +205,11 @@ std::string CmdProxy::VirtualServer(int action) { return os.str(); } +void CmdProxy::EmptyDataCallBack(detectorData *data, uint64_t frameIndex, + uint32_t subFrameIndex, void *this_pointer) { + LOG(logDEBUG) << "EmptyDataCallBack to start up zmq sockets"; +} + std::string CmdProxy::Acquire(int action) { std::ostringstream os; if (action == defs::HELP_ACTION) { @@ -226,6 +231,9 @@ std::string CmdProxy::Acquire(int action) { throw RuntimeError("Individual detectors not allowed for readout."); } + if (action == defs::READOUT_ZMQ_ACTION) { + det->registerDataCallback(&(EmptyDataCallBack), this); + } det->acquire(); if (det->getUseReceiverFlag().squash(false)) { diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 60f3454c05..d58c9dce21 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1350,6 +1350,8 @@ class CmdProxy { std::string GapPixels(int action); std::string BadChannels(int action); /* acquisition parameters */ + static void EmptyDataCallBack(detectorData *data, uint64_t frameIndex, + uint32_t subFrameIndex, void *this_pointer); std::string Acquire(int action); std::string Exptime(int action); std::string ReadoutSpeed(int action); diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index c40c163fcf..294af361b2 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -1221,10 +1221,14 @@ int DetectorImpl::acquire() { if (acquisition_finished != nullptr) { // status - runStatus status = IDLE; auto statusList = Parallel(&Module::getRunStatus, {}); - status = statusList.squash(ERROR); - // difference, but none error + // if any slave still waiting, wait up to 1s (gotthard) + for (int i = 0; i != 20 && statusList.any(WAITING); ++i) { + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + statusList = Parallel(&Module::getRunStatus, {}); + } + runStatus status = statusList.squash(ERROR); + // inconsistent status (squash error), but none of them in error if (status == ERROR && (!statusList.any(ERROR))) { // handle jf sync issue (master idle, slaves stopped) if (statusList.contains_only(IDLE, STOPPED)) { @@ -1320,8 +1324,13 @@ void DetectorImpl::startAcquisition(const bool blocking, Positions pos) { 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)) { + auto statusList = Parallel(&Module::getRunStatus, pos); + // if any slave still waiting, wait up to 1s (gotthard) + for (int i = 0; i != 20 && statusList.any(WAITING); ++i) { + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + statusList = Parallel(&Module::getRunStatus, pos); + } + if (!statusList.contains_only(IDLE, STOPPED, RUN_FINISHED)) { throw RuntimeError("Acquisition not successful. " "Unexpected detector status"); } @@ -1977,7 +1986,7 @@ void DetectorImpl::setBadChannels(const std::vector list, Positions pos) { // update to multi values if multi modules if (isAllPositions(pos)) { - std::vector> badchannels; + std::vector> badchannels(modules.size()); int nchan = modules[0]->getNumberOfChannels().x; if (shm()->detType == MYTHEN3) { // assuming single counter @@ -1996,16 +2005,9 @@ void DetectorImpl::setBadChannels(const std::vector list, Positions pos) { std::to_string(badchannel) + " out of bounds."); } - if (badchannels.size() != imod + 1) { - badchannels.push_back(std::vector{}); - } badchannels[imod].push_back(ch); } for (size_t imod = 0; imod != modules.size(); ++imod) { - // add empty vector if no bad channels in this module - if (badchannels.size() != imod + 1) { - badchannels.push_back(std::vector{}); - } Parallel(&Module::setBadChannels, {static_cast(imod)}, badchannels[imod]); } diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 33603c6eaf..075d6f7397 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -3332,7 +3332,13 @@ void Module::initializeModuleStructure(detectorType type) { shm()->numberOfModule.y = 0; shm()->controlPort = DEFAULT_TCP_CNTRL_PORTNO; shm()->stopPort = DEFAULT_TCP_STOP_PORTNO; - strcpy_safe(shm()->settingsDir, getenv("HOME")); + char *home_directory = getenv("HOME"); + if (home_directory != nullptr) + strcpy_safe(shm()->settingsDir, home_directory); + else { + strcpy_safe(shm()->settingsDir, ""); + LOG(logWARNING) << "HOME directory not set"; + } strcpy_safe(shm()->rxHostname, "none"); shm()->rxTCPPort = DEFAULT_TCP_RX_PORTNO + moduleIndex; shm()->useReceiverFlag = false; diff --git a/slsReceiverSoftware/src/HDF5DataFile.cpp b/slsReceiverSoftware/src/HDF5DataFile.cpp index 9e4d48e9e8..2b267f4741 100644 --- a/slsReceiverSoftware/src/HDF5DataFile.cpp +++ b/slsReceiverSoftware/src/HDF5DataFile.cpp @@ -186,7 +186,7 @@ void HDF5DataFile::CreateFile() { // property list H5::DSetCreatPropList plist; H5::DSetCreatPropList plistPara; - int fill_value = -1; + uint64_t fill_value = -1; plist.setFillValue(dataType, &fill_value); // plistPara.setFillValue(dataType, &fill_value); plist.setChunk(DATA_RANK, dimsChunk); diff --git a/slsReceiverSoftware/src/MasterFileUtility.cpp b/slsReceiverSoftware/src/MasterFileUtility.cpp index 10d50fb9cd..793dc777e3 100644 --- a/slsReceiverSoftware/src/MasterFileUtility.cpp +++ b/slsReceiverSoftware/src/MasterFileUtility.cpp @@ -215,7 +215,7 @@ std::string CreateVirtualHDF5File( // property list H5::DSetCreatPropList plist; - int fill_value = -1; + uint64_t fill_value = -1; plist.setFillValue(dataType, &fill_value); std::vector plistPara(paraSize); // ignoring last fill (string) diff --git a/slsSupportLib/include/sls/sls_detector_defs.h b/slsSupportLib/include/sls/sls_detector_defs.h index a90890a904..ac6fa51468 100644 --- a/slsSupportLib/include/sls/sls_detector_defs.h +++ b/slsSupportLib/include/sls/sls_detector_defs.h @@ -215,7 +215,13 @@ typedef struct { /** type of action performed (for text client) */ - enum { GET_ACTION, PUT_ACTION, READOUT_ACTION, HELP_ACTION }; + enum { + GET_ACTION, + PUT_ACTION, + READOUT_ACTION, + HELP_ACTION, + READOUT_ZMQ_ACTION + }; /** dimension indexes diff --git a/slsSupportLib/include/sls/string_utils.h b/slsSupportLib/include/sls/string_utils.h index eec1a0c08a..86a5d0caf5 100644 --- a/slsSupportLib/include/sls/string_utils.h +++ b/slsSupportLib/include/sls/string_utils.h @@ -20,6 +20,7 @@ Still this is better than strcpy and a buffer overflow... */ template void strcpy_safe(char (&destination)[array_size], const char *source) { + assert(source != nullptr); assert(array_size > strlen(source)); strncpy(destination, source, array_size - 1); destination[array_size - 1] = '\0'; diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 519b7f56f1..0f4fed035a 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -1,13 +1,13 @@ // SPDX-License-Identifier: LGPL-3.0-or-other // Copyright (C) 2021 Contributors to the SLS Detector Package /** API versions */ -#define RELEASE "8.0.1" -#define APIRECEIVER "8.0.0 0x231108" +#define RELEASE "8.0.2" #define APICTB "8.0.0 0x231109" #define APIGOTTHARD "8.0.0 0x231109" #define APIGOTTHARD2 "8.0.0 0x231109" -#define APIJUNGFRAU "8.0.0 0x231109" -#define APIMYTHEN3 "8.0.0 0x231109" -#define APIMOENCH "8.0.0 0x231109" #define APIEIGER "8.0.0 0x231109" -#define APILIB "8.0.1 0x240112" +#define APIJUNGFRAU "8.0.2 0x240827" +#define APIMOENCH "8.0.2 0x240827" +#define APIMYTHEN3 "8.0.2 0x240827" +#define APILIB "8.0.2 0x240916" +#define APIRECEIVER "8.0.2 0x240916"