Compare commits

...

11 Commits

Author SHA1 Message Date
f377e1aae2 fill value in hdf5 according to actual datatype of dataset 2024-08-08 17:38:50 +02:00
8d185988c1 8.0.2.rc: m3 clkdiv0 20 (#923)
* m3: clk 0 changed from 10 to 20 (100MHz to 50MHz)

* g2: startup clk div back to 10 as in firmware but setting in software startup to 20
2024-07-25 17:17:20 +02:00
61e9437842 fix to rapidjson for build with gcc 14 (#928) 2024-07-25 17:15:03 +02:00
2d177924eb 8.0.2.rc: client: blocking acquire stop with slave temporarily in waiting (#925)
* client: stopping a blocking acquire of multi modules checks status to catch slaves that might still be in waiting. Problem is (gotthard2 25um at least) slave is in waiting only temporarily before going go idle/stopped. So a 50ms sleep is necessary ot not throw an unnecessary error

* client: when stopping blocking acquire, wait up to 1s in 50ms increments for slave to stop waiting temporarily
2024-07-16 15:43:14 +02:00
4eb8e52360 client bug fix: m3 multi module bad channel file throws bad allocation when modules skipped, needed to add vectors in 2d vector of bad channel list (#919) 2024-07-16 11:58:39 +02:00
2c278b1933 moench server: changed default values of adcphase for full speed from 300 to 150 and dac vipre_cds from 800 to 1280 (#921) 2024-07-15 12:31:27 +02:00
e4c52bde1d moench: min exptime and also a firmware update required (#911) 2024-02-07 10:22:46 +01:00
6251dc1b71 Protect from getenv("HOME") returning nullptr (#907)
* Protect from getenv("HOME") returning nullptr (e.g., in case running in systemd)

* Write proper warning in Module.cpp
2024-02-07 09:35:50 +01:00
aa173d3a87 802/moench default speed (#910)
* moench:change default speed to half speed
2024-02-06 12:10:42 +01:00
62c428320f moench server name and version renaming 2024-02-06 11:45:55 +01:00
70f467a3cd moench: changed max shifts of adc clk from 240 to 200 (#909) 2024-02-06 11:34:17 +01:00
18 changed files with 77 additions and 41 deletions

View File

@ -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; }

View File

@ -1 +0,0 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.0

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv8.0.2

View File

@ -1 +0,0 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.0

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv8.0.2

View File

@ -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);
}

View File

@ -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 */ \
};

View File

@ -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};

View File

@ -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)

View File

@ -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 {

View File

@ -742,9 +742,8 @@ void DetectorImpl::readFrameFromReceiver() {
}
}
LOG(logDEBUG) << "Call Back Info:"
<< "\n\t nDetPixelsX: " << nDetPixelsX
<< "\n\t nDetPixelsY: " << nDetPixelsY
LOG(logDEBUG) << "Call Back Info:" << "\n\t nDetPixelsX: "
<< nDetPixelsX << "\n\t nDetPixelsY: " << nDetPixelsY
<< "\n\t databytes: " << multisize
<< "\n\t dynamicRange: " << dynamicRange;
@ -762,8 +761,8 @@ void DetectorImpl::readFrameFromReceiver() {
callbackImage = multigappixels;
imagesize = n;
}
LOG(logDEBUG) << "Image Info:"
<< "\n\tnDetActualPixelsX: " << nDetActualPixelsX
LOG(logDEBUG) << "Image Info:" << "\n\tnDetActualPixelsX: "
<< nDetActualPixelsX
<< "\n\tnDetActualPixelsY: " << nDetActualPixelsY
<< "\n\timagesize: " << imagesize
<< "\n\tdynamicRange: " << dynamicRange;
@ -798,8 +797,7 @@ void DetectorImpl::readFrameFromReceiver() {
int DetectorImpl::insertGapPixels(char *image, char *&gpImage, bool quadEnable,
int dr, int &nPixelsx, int &nPixelsy) {
LOG(logDEBUG) << "Insert Gap pixels:"
<< "\n\t nPixelsx: " << nPixelsx
LOG(logDEBUG) << "Insert Gap pixels:" << "\n\t nPixelsx: " << nPixelsx
<< "\n\t nPixelsy: " << nPixelsy
<< "\n\t quadEnable: " << quadEnable << "\n\t dr: " << dr;
@ -884,12 +882,10 @@ int DetectorImpl::insertGapPixels(char *image, char *&gpImage, bool quadEnable,
<< "nMod1Pixelsy: " << nMod1Pixelsy << "\n\t"
<< "nMod1GapPixelsx: " << nMod1GapPixelsx << "\n\t"
<< "nMod1GapPixelsy: " << nMod1GapPixelsy << "\n\t"
<< "nChipy: " << nChipy << "\n\t"
<< "nChipx: " << nChipx << "\n\t"
<< "nModx: " << nModx << "\n\t"
<< "nMody: " << nMody << "\n\t"
<< "nTotx: " << nTotx << "\n\t"
<< "nToty: " << nToty << "\n\t"
<< "nChipy: " << nChipy << "\n\t" << "nChipx: " << nChipx
<< "\n\t" << "nModx: " << nModx << "\n\t"
<< "nMody: " << nMody << "\n\t" << "nTotx: " << nTotx
<< "\n\t" << "nToty: " << nToty << "\n\t"
<< "bytesPerPixel: " << bytesPerPixel << "\n\t"
<< "imagesize: " << imagesize << "\n\t"
<< "nChipBytesx: " << nChipBytesx << "\n\t"
@ -1321,6 +1317,11 @@ void DetectorImpl::startAcquisition(const bool blocking, Positions pos) {
// ensure all status normal (slaves not blocking)
// to catch those slaves that are still 'waiting'
auto status = Parallel(&Module::getRunStatus, pos);
// if any slave still waiting, wait up to 1s
for (int i = 0; i != 20 && status.any(WAITING); ++i) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
status = Parallel(&Module::getRunStatus, pos);
}
if (!status.contains_only(IDLE, STOPPED, RUN_FINISHED)) {
throw RuntimeError("Acquisition not successful. "
"Unexpected detector status");
@ -1977,7 +1978,7 @@ void DetectorImpl::setBadChannels(const std::vector<int> list, Positions pos) {
// update to multi values if multi modules
if (isAllPositions(pos)) {
std::vector<std::vector<int>> badchannels;
std::vector<std::vector<int>> badchannels(modules.size());
int nchan = modules[0]->getNumberOfChannels().x;
if (shm()->detType == MYTHEN3) {
// assuming single counter
@ -1996,16 +1997,9 @@ void DetectorImpl::setBadChannels(const std::vector<int> list, Positions pos) {
std::to_string(badchannel) +
" out of bounds.");
}
if (badchannels.size() != imod + 1) {
badchannels.push_back(std::vector<int>{});
}
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<int>{});
}
Parallel(&Module::setBadChannels, {static_cast<int>(imod)},
badchannels[imod]);
}

View File

@ -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;

View File

@ -215,12 +215,42 @@ std::string CreateVirtualHDF5File(
// property list
H5::DSetCreatPropList plist;
int fill_value = -1;
plist.setFillValue(dataType, &fill_value);
uint8_t u8 = -1;
uint16_t u16 = -1;
uint32_t u32 = -1;
uint64_t u64 = -1;
void* fill_value;
if (dataType == H5::PredType::STD_U8LE) {
fill_value = &u8;
} else if (dataType == H5::PredType::STD_U16LE) {
fill_value = &u16;
} else if (dataType == H5::PredType::STD_U32LE) {
fill_value = &u32;
} else if (dataType == H5::PredType::STD_U64LE) {
fill_value = &u64;
} else {
throw RuntimeError("Unsupported data type for virtual HDF5 file");
}
plist.setFillValue(dataType, fill_value);
//uint64_t fill_value = -1;
//plist.setFillValue(dataType, &fill_value);
std::vector<H5::DSetCreatPropList> plistPara(paraSize);
// ignoring last fill (string)
for (unsigned int i = 0; i != plistPara.size() - 1; ++i) {
plistPara[i].setFillValue(parameterDataTypes[i], &fill_value);
if (parameterDataTypes[i] == H5::PredType::STD_U8LE) {
fill_value = &u8;
} else if (parameterDataTypes[i] == H5::PredType::STD_U16LE) {
fill_value = &u16;
} else if (parameterDataTypes[i] == H5::PredType::STD_U32LE) {
fill_value = &u32;
} else if (parameterDataTypes[i] == H5::PredType::STD_U64LE) {
fill_value = &u64;
} else {
throw RuntimeError("Unsupported data type for virtual HDF5 file");
}
plistPara[i].setFillValue(parameterDataTypes[i], fill_value);
}
// hyperslab (files)

View File

@ -20,6 +20,7 @@ Still this is better than strcpy and a buffer overflow...
*/
template <size_t array_size>
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';

View File

@ -7,7 +7,7 @@
#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 APIMOENCH "8.0.2 0x240703"
#define APIMYTHEN3 "8.0.2 0x240715"