mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
jungfrau: special dacs have defined values for settings. getsettings give undefined if different values for special dacs
This commit is contained in:
@ -370,7 +370,7 @@ class Detector(CppDetectorApi):
|
|||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
[Moench] Default is disabled. \n
|
[Moench] Default is disabled. \n
|
||||||
[Jungfrau] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (if chipv1.1 and board v2.0).\n
|
[Jungfrau] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1).\n
|
||||||
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
|
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
|
||||||
"""
|
"""
|
||||||
return self.getPowerChip()
|
return self.getPowerChip()
|
||||||
|
Binary file not shown.
@ -387,6 +387,7 @@ void setupDetector() {
|
|||||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||||
clkPhase[i] = 0;
|
clkPhase[i] = 0;
|
||||||
}
|
}
|
||||||
|
chipConfigured = 0;
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStatus(IDLE);
|
sharedMemory_setStatus(IDLE);
|
||||||
#endif
|
#endif
|
||||||
@ -883,21 +884,28 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
if (sett == UNINITIALIZED)
|
if (sett == UNINITIALIZED)
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
|
|
||||||
int *specialDacValues[] = 0;
|
const int specialDynamicDacValues[NSPECIALDACS] =
|
||||||
|
SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS;
|
||||||
|
const int specialDynamicHG0DacValues[NSPECIALDACS] =
|
||||||
|
SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS;
|
||||||
|
int specialDacValues[NSPECIALDACS] = {};
|
||||||
|
|
||||||
// set settings
|
// set settings
|
||||||
switch (sett) {
|
switch (sett) {
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||||
specialDacValues = SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS;
|
memcpy(specialDacValues, specialDynamicDacValues,
|
||||||
|
NSPECIALDACS * sizeof(int));
|
||||||
break;
|
break;
|
||||||
case DYNAMICHG0:
|
case DYNAMICHG0:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
|
||||||
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
|
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
|
||||||
bus_r(DAQ_REG)));
|
bus_r(DAQ_REG)));
|
||||||
specialDacValues = SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS;
|
memcpy(specialDacValues, specialDynamicHG0DacValues,
|
||||||
|
NSPECIALDACS * sizeof(int));
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
case FIXGAIN1:
|
case FIXGAIN1:
|
||||||
@ -934,9 +942,10 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
thisSettings = sett;
|
thisSettings = sett;
|
||||||
|
|
||||||
// set special dacs to defined values
|
// set special dacs to defined values
|
||||||
int *specialDacs[] = {SPECIALDACINDEX};
|
LOG(logINFO, ("Setting spcial dacs\n"));
|
||||||
|
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
setDAC(specialDacs[i], specialDacValues[i], 0);
|
setDAC(specialDacs[i], specialDacValues[i], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if chip 1.1, and power chip on, configure chip
|
// if chip 1.1, and power chip on, configure chip
|
||||||
@ -947,6 +956,41 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
return getSettings();
|
return getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void validateSettings() {
|
||||||
|
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||||
|
int specialDacValues[NUMSETTINGS][NSPECIALDACS] = {
|
||||||
|
SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS,
|
||||||
|
SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS};
|
||||||
|
int settList[NUMSETTINGS] = {DYNAMICGAIN, DYNAMICHG0};
|
||||||
|
|
||||||
|
enum detectorSettings sett = UNDEFINED;
|
||||||
|
for (int isett = 0; isett != NUMSETTINGS; ++isett) {
|
||||||
|
// dont overwrite if settings is correct
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// assume it matches current setting in list
|
||||||
|
sett = settList[isett];
|
||||||
|
for (int ival = 0; ival < NSPECIALDACS; ++ival) {
|
||||||
|
// if one value does not match, undefined
|
||||||
|
if (getDAC(specialDacs[ival], 0) != specialDacValues[isett][ival]) {
|
||||||
|
sett = UNDEFINED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// update settings
|
||||||
|
if (thisSettings != sett) {
|
||||||
|
LOG(logINFOBLUE,
|
||||||
|
("Validated settings to %s (%d)\n",
|
||||||
|
(sett == DYNAMICGAIN
|
||||||
|
? "dynamicgain"
|
||||||
|
: (sett == DYNAMICHG0 ? "dynamichg0" : "undefined")),
|
||||||
|
sett));
|
||||||
|
thisSettings = sett;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum detectorSettings getSettings() {
|
enum detectorSettings getSettings() {
|
||||||
|
|
||||||
uint32_t regval = bus_r(DAQ_REG);
|
uint32_t regval = bus_r(DAQ_REG);
|
||||||
@ -988,7 +1032,7 @@ enum detectorSettings getSettings() {
|
|||||||
thisSettings = UNDEFINED;
|
thisSettings = UNDEFINED;
|
||||||
LOG(logERROR, ("Settings read: Undefined. DAQ Reg: 0x%x\n", regval));
|
LOG(logERROR, ("Settings read: Undefined. DAQ Reg: 0x%x\n", regval));
|
||||||
}
|
}
|
||||||
|
validateSettings();
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,11 +1042,10 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
char *dac_names[] = {DAC_NAMES};
|
char *dac_names[] = {DAC_NAMES};
|
||||||
LOG(logINFO, ("Setting DAC %s\n", dac_names[ind]));
|
|
||||||
LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
|
||||||
val, (mV ? "mV" : "dac units")));
|
|
||||||
int dacval = val;
|
int dacval = val;
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||||
|
val, (mV ? "mV" : "dac units")));
|
||||||
if (!mV) {
|
if (!mV) {
|
||||||
dacValues[ind] = val;
|
dacValues[ind] = val;
|
||||||
}
|
}
|
||||||
@ -1011,6 +1054,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
dacValues[ind] = dacval;
|
dacValues[ind] = dacval;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
LOG(logINFO, ("Setting DAC %s\n", dac_names[ind]));
|
||||||
if (LTC2620_SetDACValue((int)ind, val, mV, &dacval) == OK) {
|
if (LTC2620_SetDACValue((int)ind, val, mV, &dacval) == OK) {
|
||||||
dacValues[ind] = dacval;
|
dacValues[ind] = dacval;
|
||||||
if (ind == J_VREF_COMP &&
|
if (ind == J_VREF_COMP &&
|
||||||
@ -1023,6 +1067,12 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
if ((int)ind == specialDacs[i]) {
|
||||||
|
validateSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDAC(enum DACINDEX ind, int mV) {
|
int getDAC(enum DACINDEX ind, int mV) {
|
||||||
@ -1458,9 +1508,12 @@ int isChipConfigured() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void configureChip() {
|
void configureChip() {
|
||||||
LOG(logINFOBLUE, ("Configuring chip\n"));
|
// only for chipv1.1
|
||||||
bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG) & CONFIG_V11_WR_CHIP_CNFG_MSK);
|
if (chipVersion == 11) {
|
||||||
chipConfigured = 1;
|
LOG(logINFOBLUE, ("Configuring chip\n"));
|
||||||
|
bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG) & CONFIG_V11_WR_CHIP_CNFG_MSK);
|
||||||
|
chipConfigured = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
|
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x210621 // 1.0 pcb
|
#define REQRD_FRMWRE_VRSN_BOARD2 0x210621 // 1.0 pcb (version = 010)
|
||||||
#define REQRD_FRMWRE_VRSN 0x210622 // 2.0 pcb
|
#define REQRD_FRMWRE_VRSN 0x210622 // 2.0 pcb (version = 011)
|
||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
@ -63,10 +63,13 @@ enum DACINDEX {
|
|||||||
420 /* J_VREF_COMP */ \
|
420 /* J_VREF_COMP */ \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NUMSETTINGS (2)
|
||||||
#define NSPECIALDACS (3)
|
#define NSPECIALDACS (3)
|
||||||
#define SPECIALDACINDEX {J_VB_COMP, J_VREF_DS, J_VREF_COMP};
|
#define SPECIALDACINDEX {J_VB_COMP, J_VREF_DS, J_VREF_COMP};
|
||||||
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS {1000, 500, 400};
|
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
|
||||||
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS {1500, 550, 450};
|
{ 1000, 500, 400 }
|
||||||
|
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
|
||||||
|
{ 1500, 550, 450 }
|
||||||
|
|
||||||
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
||||||
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||||
|
@ -294,7 +294,7 @@ int getAllTrimbits();
|
|||||||
#ifndef CHIPTESTBOARDD
|
#ifndef CHIPTESTBOARDD
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
#if defined(MYTHEN3D) || defined(JUNGFRAUD)
|
||||||
void validateSettings();
|
void validateSettings();
|
||||||
#endif
|
#endif
|
||||||
enum detectorSettings getSettings();
|
enum detectorSettings getSettings();
|
||||||
|
@ -1687,7 +1687,8 @@ int acquire(int blocking, int file_des) {
|
|||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
if (!isChipConfigured()) {
|
// chipv1.1 has to be configured before acquisition
|
||||||
|
if (getChipVersion() == 11 && !isChipConfigured()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,
|
strcpy(mess,
|
||||||
"Could not start acquisition. Chip is not configured.\n");
|
"Could not start acquisition. Chip is not configured.\n");
|
||||||
|
@ -382,7 +382,7 @@ class Detector {
|
|||||||
* [Moench] Default is disabled. \n
|
* [Moench] Default is disabled. \n
|
||||||
* [Jungfrau] Default is disabled. Get will return power status. Can be off
|
* [Jungfrau] Default is disabled. Get will return power status. Can be off
|
||||||
* if temperature event occured (temperature over temp_threshold with
|
* if temperature event occured (temperature over temp_threshold with
|
||||||
* temp_control enabled. Will configure chip (if chipv1.1 and board v2.0)\n [Mythen3][Gotthard2] Default is 1. If module not
|
* temp_control enabled. Will configure chip (only chip v1.1)\n [Mythen3][Gotthard2] Default is 1. If module not
|
||||||
* connected or wrong module, powerchip will fail.
|
* connected or wrong module, powerchip will fail.
|
||||||
*/
|
*/
|
||||||
void setPowerChip(bool on, Positions pos = {});
|
void setPowerChip(bool on, Positions pos = {});
|
||||||
|
@ -1314,7 +1314,7 @@ class CmdProxy {
|
|||||||
"the chip. \n\t[Moench] Default is 0. \n\t[Jungfrau] Default is 0. Get "
|
"the chip. \n\t[Moench] Default is 0. \n\t[Jungfrau] Default is 0. Get "
|
||||||
"will return power status. Can be off if temperature event occured "
|
"will return power status. Can be off if temperature event occured "
|
||||||
"(temperature over temp_threshold with temp_control "
|
"(temperature over temp_threshold with temp_control "
|
||||||
"enabled. Will configure chip (if chipv1.1 and board v2.0)\n\t[Mythen3][Gotthard2] Default is 1. If module not "
|
"enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default is 1. If module not "
|
||||||
"connected or wrong module, powerchip will fail.");
|
"connected or wrong module, powerchip will fail.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
Reference in New Issue
Block a user