mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-17 23:55:52 +01:00
G2: reconfigure chip (#927)
* changed common.c readADCFromFile to make it more general and move temperature calculation for Eiger out of this function and inside whereever it is called. * g2 and m2: gethighvoltage was just a variable set in server, it is now moved to a get inside DAC5671 implementation (but not reading a measured value, instead what is set from a file), high voltage variable used inside DAC5671 for virtual servers * g2: switching off hv (ifrom non zero to zero value) will wait for 10s; powering on chip reconfigures chip; powering off chip unconfigures chip; powering off chip also includes check if hv = 0, if not throw exception; chip configuration checked before acquring; at start up: hv switched off and chip powered on, so does not wait 10s to switch off hv; * included test to check powering off chip when hv is on should throw an exception * g2: check if chip configured before acquiring * nios: read hv value set from file and virtual still goes into DAC5671 for conversions to and fro dac to V, change common readadc to readparameter to generalize, make sethighvoltage into a get and set to catch errors in get as well, g2: if not at startup, remmeber hv value before setting it and after check if value was being switched off (from a non zero value) and wait 10s if it was (10s wait only for switching off from non zero and not at startup)
This commit is contained in:
Binary file not shown.
@@ -63,7 +63,6 @@ int32_t clkPhase[NUM_CLOCKS] = {};
|
||||
uint32_t clkDivider[NUM_CLOCKS] = {};
|
||||
|
||||
enum TLogLevel trimmingPrint = logINFO;
|
||||
int highvoltage = 0;
|
||||
int detPos[2] = {};
|
||||
int64_t exptimeReg[NCOUNTERS] = {0, 0, 0};
|
||||
int64_t gateDelayReg[NCOUNTERS] = {0, 0, 0};
|
||||
@@ -462,7 +461,6 @@ void setupDetector() {
|
||||
clkDivider[SYSTEM_C1] = DEFAULT_SYSTEM_C1;
|
||||
clkDivider[SYSTEM_C2] = DEFAULT_SYSTEM_C2;
|
||||
|
||||
highvoltage = 0;
|
||||
trimmingPrint = logINFO;
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
@@ -496,7 +494,13 @@ void setupDetector() {
|
||||
cleanFifos();
|
||||
|
||||
// defaults
|
||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
initError = setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
if (initError == FAIL) {
|
||||
sprintf(initErrorMessage, "Could not set high voltage to %d\n",
|
||||
DEFAULT_HIGH_VOLTAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
setASICDefaults();
|
||||
setADIFDefaults();
|
||||
|
||||
@@ -1675,10 +1679,12 @@ int getMaxDacSteps() { return LTC2620_D_GetMaxNumSteps(); }
|
||||
|
||||
int getADC(enum ADCINDEX ind, int *value) {
|
||||
LOG(logDEBUG1, ("Reading FPGA temperature...\n"));
|
||||
if (readADCFromFile(TEMPERATURE_FILE_NAME, value) == FAIL) {
|
||||
if (readParameterFromFile(TEMPERATURE_FILE_NAME, "temperature", value) ==
|
||||
FAIL) {
|
||||
LOG(logERROR, ("Could not get temperature\n"));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Temperature: %.2f °C\n", (double)(*value) / 1000.00));
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1688,15 +1694,12 @@ int setHighVoltage(int val) {
|
||||
val = HV_SOFT_MAX_VOLTAGE;
|
||||
}
|
||||
|
||||
// setting hv
|
||||
if (val >= 0) {
|
||||
LOG(logINFO, ("Setting High voltage: %d V\n", val));
|
||||
if (DAC6571_Set(val) == OK)
|
||||
highvoltage = val;
|
||||
}
|
||||
return highvoltage;
|
||||
LOG(logINFO, ("Setting High voltage: %d V\n", val));
|
||||
return DAC6571_Set(val);
|
||||
}
|
||||
|
||||
int getHighVoltage(int *retval) { return DAC6571_Get(retval); }
|
||||
|
||||
/* parameters - timing */
|
||||
|
||||
int isMaster(int *retval) {
|
||||
|
||||
Reference in New Issue
Block a user