mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
gotthard2: gain updated
This commit is contained in:
parent
2e78484b61
commit
e746256653
@ -124,6 +124,10 @@
|
||||
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||
#define ASIC_CONFIG_GAIN_OFST (4)
|
||||
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
|
||||
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_FIX_GAIN_1_VAL ((0x1 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_FIX_GAIN_2_VAL ((0x2 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_RESERVED_VAL ((0x3 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_RST_DAC_OFST (15)
|
||||
#define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST)
|
||||
#define ASIC_CONFIG_DONE_OFST (31)
|
||||
|
Binary file not shown.
@ -36,6 +36,7 @@ int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
#endif
|
||||
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0, 0, 0};
|
||||
uint32_t clkFrequency[NUM_CLOCKS] = {0, 0, 0, 0, 0, 0};
|
||||
int highvoltage = 0;
|
||||
@ -344,6 +345,7 @@ void setupDetector() {
|
||||
detPos[0] = 0;
|
||||
detPos[1] = 0;
|
||||
|
||||
thisSettings = UNINITIALIZED;
|
||||
highvoltage = 0;
|
||||
injectedChannelsOffset = 0;
|
||||
injectedChannelsIncrement = 0;
|
||||
@ -432,7 +434,8 @@ void setupDetector() {
|
||||
// set burst mode will take in burstType and also set it
|
||||
burstType = DEFAULT_BURST_TYPE;
|
||||
setBurstMode(DEFAULT_BURST_MODE);
|
||||
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
@ -904,6 +907,70 @@ int64_t getMeasurementTime() {
|
||||
return get64BitReg(START_FRAME_TIME_LSB_REG, START_FRAME_TIME_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
}
|
||||
|
||||
|
||||
/* parameters - module, settings */
|
||||
enum detectorSettings setSettings(enum detectorSettings sett){
|
||||
if(sett == UNINITIALIZED)
|
||||
return thisSettings;
|
||||
|
||||
// set settings
|
||||
uint32_t addr = ASIC_CONFIG_REG;
|
||||
uint32_t mask = ASIC_CONFIG_GAIN_MSK;
|
||||
if(sett != GET_SETTINGS) {
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_DYNAMIC_GAIN_VAL);
|
||||
FILE_LOG(logINFO, ("Set settings - Dyanmic Gain, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
case FIXGAIN1:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_1_VAL);
|
||||
FILE_LOG(logINFO, ("Set settings - Fix Gain 1, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
case FIXGAIN2:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_2_VAL);
|
||||
FILE_LOG(logINFO, ("Set settings - Fix Gain 2, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett));
|
||||
return -1;
|
||||
}
|
||||
thisSettings = sett;
|
||||
}
|
||||
|
||||
return getSettings();
|
||||
}
|
||||
|
||||
|
||||
enum detectorSettings getSettings(){
|
||||
uint32_t regval = bus_r(ASIC_CONFIG_REG);
|
||||
uint32_t val = regval & ASIC_CONFIG_GAIN_MSK;
|
||||
FILE_LOG(logDEBUG1, ("Getting Settings\n Reading val :0x%x\n", val));
|
||||
|
||||
switch(val) {
|
||||
case ASIC_CONFIG_RESERVED_VAL:
|
||||
case ASIC_CONFIG_DYNAMIC_GAIN_VAL:
|
||||
thisSettings = DYNAMICGAIN;
|
||||
FILE_LOG(logDEBUG1, ("Settings read: Dynamic Gain. val: 0x%x\n", val));
|
||||
break;
|
||||
case ASIC_CONFIG_FIX_GAIN_1_VAL:
|
||||
thisSettings = FIXGAIN1;
|
||||
FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 1. val: 0x%x\n", val));
|
||||
break;
|
||||
case ASIC_CONFIG_FIX_GAIN_2_VAL:
|
||||
thisSettings = FIXGAIN2;
|
||||
FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 2. val: 0x%x\n", val));
|
||||
break;
|
||||
default:
|
||||
thisSettings = UNDEFINED;
|
||||
FILE_LOG(logERROR, ("Settings read: Undefined. val: 0x%x\n", val));
|
||||
}
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
|
||||
/* parameters - dac, hv */
|
||||
int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val) {
|
||||
char* names[] = {ONCHIP_DAC_NAMES};
|
||||
|
@ -38,6 +38,7 @@
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||
#define DEFAULT_READOUT_C0 (144444448) // rdo_clk, 144 MHz
|
||||
#define DEFAULT_READOUT_C1 (144444448) // rdo_x2_clk, 144 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (144444448) // run_clk, 144 MHz
|
||||
|
@ -239,9 +239,11 @@ int64_t getMeasurementTime();
|
||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D)) && (!defined(GOTTHARD2D))
|
||||
int setModule(sls_detector_module myMod, char* mess);
|
||||
int getModule(sls_detector_module *myMod);
|
||||
#endif
|
||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D))
|
||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||
#endif
|
||||
#if !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||
#if !defined(MYTHEN3D)
|
||||
enum detectorSettings getSettings();
|
||||
#endif
|
||||
|
||||
|
@ -1658,7 +1658,7 @@ int set_settings(int file_des) {
|
||||
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
||||
@ -1682,12 +1682,16 @@ int set_settings(int file_des) {
|
||||
case LOWGAIN:
|
||||
case MEDIUMGAIN:
|
||||
case VERYHIGHGAIN:
|
||||
#elif GOTTHARD2D
|
||||
case DYNAMICGAIN:
|
||||
case FIXGAIN1:
|
||||
case FIXGAIN2:
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
if (myDetectorType == EIGER) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Cannot set settings via SET_SETTINGS, use SET_MODULE\n");
|
||||
sprintf(mess, "Cannot set settings via SET_SETTINGS, use SET_MODULE (set threshold)\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else
|
||||
modeNotImplemented("Settings Index", (int)isett);
|
||||
@ -1700,6 +1704,7 @@ int set_settings(int file_des) {
|
||||
FILE_LOG(logDEBUG1, ("Settings: %d\n", retval));
|
||||
validate((int)isett, (int)retval, "set settings", DEC);
|
||||
#if defined(JUNGFRAUD) || defined (GOTTHARDD)
|
||||
// gotthard2 does not set default dacs
|
||||
if (ret == OK && isett >= 0) {
|
||||
ret = setDefaultDacs();
|
||||
if (ret == FAIL) {
|
||||
|
@ -95,10 +95,13 @@ class Detector {
|
||||
*/
|
||||
void setDetectorSize(const defs::xy value);
|
||||
|
||||
/** [Jungfrau][Gotthard] */
|
||||
/** [Jungfrau][Gotthard][Gotthard2] */
|
||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau][Gotthard] */
|
||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
||||
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||
*/
|
||||
void setSettings(defs::detectorSettings value, Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
|
@ -758,11 +758,8 @@ std::string CmdProxy::Threshold(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[eV] [(optinal settings) standard, fast, highgain, dynamicgain, "
|
||||
"lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, "
|
||||
"fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] Threshold in "
|
||||
"eV"
|
||||
<< '\n';
|
||||
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, verylowgain]"
|
||||
"\n\t[Eiger] Threshold in eV" << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
@ -793,10 +790,8 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[eV] [(optional settings) standard, fast, highgain, "
|
||||
"dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, "
|
||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] "
|
||||
"Threshold in eV set without setting trimbits"
|
||||
os << "[eV] [(optional settings) standard, lowgain, veryhighgain, verylowgain]"
|
||||
"\n\t[Eiger] Threshold in eV set without setting trimbits"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("cannot get");
|
||||
|
@ -998,7 +998,11 @@ class CmdProxy {
|
||||
"\n\tSerial number or MAC of detector (hex).");
|
||||
|
||||
INTEGER_COMMAND(settings, getSettings, setSettings, sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Jungfrau][Gotthard] Detector Settings.\n\t[Eiger] Use threshold or thresholdnotb.");
|
||||
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain]"
|
||||
"\n\t[Jungfrau] - Detector Settings [dynamicgain | dynamichg0 | fixgain1 | fixgain2 | forceswitchg1 | forceswitchg2]"
|
||||
"\n\t[Gotthard] - Detector Settings [dynamicgain | highgain | lowgain | mediumgain | veryhighgain]"
|
||||
"\n\t[Gotthard2] - Detector Settings [dynamicgain | fixgain1 | fixgain2]"
|
||||
"\n\t[Eiger] Use threshold or thresholdnotb.");
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
|
@ -389,13 +389,10 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
detectorSettings getSettings();
|
||||
|
||||
/**
|
||||
* Load detector settings from the settings file picked from the
|
||||
* trimdir/settingsdir Eiger only stores in shared memory ( a get will
|
||||
* overwrite this) For Eiger, one must use threshold Gotthard, Propix,
|
||||
* Jungfrau and Moench only sends the settings enum to the detector
|
||||
* @param isettings settings
|
||||
* @returns current settings
|
||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
||||
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||
* [Eiger] Only stores them locally in shm Options: STANDARD, HIGHGAIN, LOWGAIN, VERYHIGHGAIN, VERYLOWGAIN
|
||||
*/
|
||||
detectorSettings setSettings(detectorSettings isettings);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user