eiger server workaround fix for fw stop done signal (#571)

- eiger server: fix for fw workaround where stop acquisition processing done signal does not come up, by removing reset in stop acquisition and waiting for2 seconds for feb done processing signal to go down, if it doesnt, throw if status is not idle.
- error messages not setup for some eiger server errors
- quad fix (chip signals to trim quad, both left and right registers can be different)
- minor logical error of no consequence (stop acquisition returns a different enum than expected)
This commit is contained in:
Dhanya Thattil 2022-11-07 12:42:54 +01:00 committed by GitHub
parent 9f906a779e
commit 615d66d493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 60 additions and 25 deletions

View File

@ -107,6 +107,11 @@ This document describes the differences between v7.0.0 and v6.x.x
- ctb, moench, jungfrau (pll reset at start fixed, before no defines)
- pybind built into package, no need to update submodule when previous release had different pybind version
- adcvpp moved from dac.. and api added (ctb, moench)
- eiger server fix (eiger server: fix for fw workaround where stop acquisition processing done signal does not come up, by removing reset in stop acquisition and waiting for2 seconds for feb done processing signal to go down, if it doesnt, throw if status is not idle.
error messages not setup for some eiger server errors
quad fix (chip signals to trim quad, both left and right registers can be different)
minor logical error of no consequence (stop acquisition returns a different enum than expected))
-
2. Resolved Issues
==================

View File

@ -690,7 +690,7 @@ int Feb_Control_ProcessingInProgress() {
unsigned int regr = 0, regl = 0;
// deactivated should return end of processing
if (!Feb_Control_activated)
return IDLE;
return STATUS_IDLE;
if (!Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS,
&regr)) {
@ -704,8 +704,9 @@ int Feb_Control_ProcessingInProgress() {
"processing status\n"));
return STATUS_ERROR;
}
LOG(logDEBUG1, ("regl:0x%x regr:0x%x\n", regl, regr));
// processing done
if ((regr | regl) & FEB_REG_STATUS_ACQ_DONE_MSK) {
if (regr & regl & FEB_REG_STATUS_ACQ_DONE_MSK) {
return STATUS_IDLE;
}
// processing running
@ -1030,6 +1031,7 @@ int Feb_Control_StopAcquisition() {
// wait for feb processing to be done
int is_processing = Feb_Control_ProcessingInProgress();
int check_error = 0;
int check_stuck = 0;
while (is_processing != STATUS_IDLE) {
usleep(500);
is_processing = Feb_Control_ProcessingInProgress();
@ -1041,12 +1043,28 @@ int Feb_Control_StopAcquisition() {
break;
check_error++;
} // reset check_error for next time
else
else {
check_error = 0;
}
// check stuck only 2000 times (1s)
if (is_processing == STATUS_RUNNING) {
if (check_stuck == 2000) {
LOG(logERROR, ("Unable to get feb processing done signal\n"));
// at least it is idle
if (Feb_Control_AcquisitionInProgress() == STATUS_IDLE) {
return 1;
}
LOG(logERROR, ("Unable to get acquisition done signal\n"));
return 0;
}
check_stuck++;
} // reset check_stuck for next time
else {
check_stuck = 0;
}
}
LOG(logINFO, ("Feb: Processing done (to stop acq)\n"));
return 0;
}
return 1;
}
@ -1606,7 +1624,9 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
LOG(logINFO, ("%s chip signals to trim quad\n",
enable ? "Enabling" : "Disabling"));
unsigned int regval = 0;
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, &regval)) {
// right fpga only
uint32_t righOffset = DAQ_REG_HRDWRE + Feb_Control_rightAddress;
if (!Feb_Control_ReadRegister(righOffset, &regval)) {
LOG(logERROR, ("Could not set chip signals to trim quad\n"));
return 0;
}
@ -1616,7 +1636,7 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
}
if (!Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval)) {
if (!Feb_Control_WriteRegister(righOffset, regval)) {
LOG(logERROR, ("Could not set chip signals to trim quad\n"));
return 0;
}
@ -1652,19 +1672,19 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
int run[2] = {0, 0};
// both registers
if (offset < 0x100) {
if (offset < Feb_Control_leftAddress) {
run[0] = 1;
run[1] = 1;
}
// right registers only
else if (offset >= 0x200) {
else if (offset >= Feb_Control_rightAddress) {
run[0] = 1;
actualOffset = offset - 0x200;
actualOffset = offset - Feb_Control_rightAddress;
}
// left registers only
else {
run[1] = 1;
actualOffset = offset - 0x100;
actualOffset = offset - Feb_Control_leftAddress;
}
for (int iloop = 0; iloop < 2; ++iloop) {
@ -1702,19 +1722,19 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
uint32_t value[2] = {0, 0};
int run[2] = {0, 0};
// both registers
if (offset < 0x100) {
if (offset < Feb_Control_leftAddress) {
run[0] = 1;
run[1] = 1;
}
// right registers only
else if (offset >= 0x200) {
else if (offset >= Feb_Control_rightAddress) {
run[0] = 1;
actualOffset = offset - 0x200;
actualOffset = offset - Feb_Control_rightAddress;
}
// left registers only
else {
run[1] = 1;
actualOffset = offset - 0x100;
actualOffset = offset - Feb_Control_leftAddress;
}
for (int iloop = 0; iloop < 2; ++iloop) {
@ -1735,11 +1755,11 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
}
}
}
// Inconsistent values
if (value[0] != value[1]) {
// Inconsistent values when reading both registers
if ((run[0] & run[1]) & (value[0] != value[1])) {
LOG(logERROR,
("Inconsistent values read from left 0x%x and right 0x%x\n",
value[0], value[1]));
("Inconsistent values read from %s 0x%x and %s 0x%x\n",
side[0], value[0], side[1], value[1]));
return 0;
}
return 1;

View File

@ -2185,6 +2185,8 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, set M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(1)) {
sprintf(mess, "Could not set module. Could not enable chip signals to set trimbits\n");
LOG(logERROR, (mess));
sharedMemory_unlockLocalLink();
return FAIL;
}
@ -2198,6 +2200,8 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sprintf(mess, "Could not set module. Could not disable chip signals to set trimbits\n");
LOG(logERROR, (mess));
sharedMemory_unlockLocalLink();
return FAIL;
}
@ -2208,6 +2212,8 @@ int setTrimbits(int *chanregs, char *mess) {
// if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sprintf(mess, "Could not set module. Could not disable chip signals to set trimbits\n");
LOG(logERROR, (mess));
sharedMemory_unlockLocalLink();
return FAIL;
}
@ -2787,7 +2793,7 @@ int stopStateMachine() {
#else
sharedMemory_lockLocalLink();
// sends last frames from fifo and wait for feb processing done
if ((Feb_Control_StopAcquisition() != STATUS_IDLE)) {
if (!Feb_Control_StopAcquisition()) {
LOG(logERROR, ("failed to stop acquisition\n"));
sharedMemory_unlockLocalLink();
return FAIL;
@ -2810,7 +2816,8 @@ int stopStateMachine() {
// reset feb and beb
sharedMemory_lockLocalLink();
Feb_Control_Reset();
// uncommenting this out as it randomly does not set the processing bit to high
//Feb_Control_Reset();
sharedMemory_unlockLocalLink();
if (!Beb_StopAcquisition()) {
LOG(logERROR, ("failed to stop acquisition\n"));
@ -2903,7 +2910,8 @@ void waitForAcquisitionEnd(int *ret, char *mess) {
sharedMemory_lockLocalLink();
if (Feb_Control_WaitForFinishedFlag(5000, 1) == STATUS_ERROR) {
sharedMemory_unlockLocalLink();
LOG(logERROR, ("Waiting for finished flag\n"));
strcpy(mess, "Could not wait for finished flag\n");
LOG(logERROR, (mess));
*ret = FAIL;
return;
}
@ -2919,6 +2927,7 @@ void waitForAcquisitionEnd(int *ret, char *mess) {
sharedMemory_unlockLocalLink();
if (i == STATUS_ERROR) {
strcpy(mess, "Could not read feb processing done register\n");
LOG(logERROR, (mess));
*ret = (int)FAIL;
return;
}
@ -2930,6 +2939,7 @@ void waitForAcquisitionEnd(int *ret, char *mess) {
// wait for beb to send out all packets
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
strcpy(mess, "Could not read delay counters\n");
LOG(logERROR, (mess));
*ret = (int)FAIL;
return;
}

View File

@ -1527,7 +1527,7 @@ int write_register(int file_des) {
} else {
if (readRegister(addr, &retval) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not read register 0x%x.\n", addr);
sprintf(mess, "Could not read register 0x%x or inconsistent values. Try to read +0x100 for only left and +0x200 for only right.\n", addr);
LOG(logERROR, (mess));
}
}
@ -1565,7 +1565,7 @@ int read_register(int file_des) {
#elif EIGERD
if (readRegister(addr, &retval) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not read register 0x%x.\n", addr);
sprintf(mess, "Could not read register 0x%x or inconsistent values. Try +0x100 for only left and +0x200 for only right..\n", addr);
LOG(logERROR, (mess));
}
#else

View File

@ -10,5 +10,5 @@
#define APIGOTTHARD2 0x221018
#define APIJUNGFRAU 0x221018
#define APIMOENCH 0x221018
#define APIEIGER 0x221018
#define APIMYTHEN3 0x221107
#define APIEIGER 0x221107