diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer index d3c921dfe..614960290 100755 Binary files a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer and b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c index af5804c82..7bed0d759 100644 --- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c @@ -413,9 +413,16 @@ void setupDetector() { } LOG(logINFOBLUE, ("Powering down all dacs\n")); - for (int idac = 0; idac < NDAC; ++idac) { + for (int idac = 0; idac < NDAC_ONLY; ++idac) { setDAC(idac, LTC2620_D_GetPowerDownValue(), 0); } + for (int idac = NDAC_ONLY; idac < NDAC; ++idac) { + if (idac == D_PWR_EMPTY) + continue; + int min = (idac == D_PWR_IO) ? VIO_MIN_MV : POWER_RGLTR_MIN; + // will not enable power at startup (dacValues = -1) + setPower(idac, min); + } resetFlow(); cleanFifos(); @@ -1296,6 +1303,9 @@ int getPower(enum DACINDEX ind) { } void setPower(enum DACINDEX ind, int val) { + if (val < 0) + return; + // validate index and get bit offset in ctrl register int bitOffset = getBitOffsetFromDACIndex(ind); if (bitOffset == -1) { @@ -1303,10 +1313,6 @@ void setPower(enum DACINDEX ind, int val) { } uint32_t addr = CTRL_REG; uint32_t mask = (1 << bitOffset); - - if (val == -1) - return; - char *powerNames[] = {PWR_NAMES}; int pwrIndex = (int)(ind - D_PWR_D); LOG(logINFO, ("Setting Power V%s to %d mV\n", powerNames[pwrIndex], val)); @@ -1322,16 +1328,10 @@ void setPower(enum DACINDEX ind, int val) { LOG(logDEBUG1, ("Switching off power enable\n")); bus_w(addr, bus_r(addr) & ~(mask)); - // power down dac - LOG(logINFO, ("\tPowering down V%d\n", powerNames[pwrIndex])); - setDAC(ind, LTC2620_D_GetPowerDownValue(), 0); - - //(power off is anyway done with power enable) - if (val == 0) - val = LTC2620_D_GetPowerDownValue(); + int startup = dacValues[ind] == -1 ? 1 : 0; // convert voltage to dac (power off is anyway done with power enable) - if (val != LTC2620_D_GetPowerDownValue()) { + if (val > 0) { int dacval = -1; if (ConvertToDifferentRange( @@ -1339,9 +1339,8 @@ void setPower(enum DACINDEX ind, int val) { LTC2620_D_GetMinInput(), val, &dacval) == FAIL) { LOG(logERROR, ("\tCannot convert Power V%s to dac value. Invalid value of %d " - "mV. Is not between " - "%d and %d mV\n", - powerNames[pwrIndex], val, POWER_RGLTR_MIN, POWER_RGLTR_MAX)); + "mV.n", + powerNames[pwrIndex], val)); return; } @@ -1351,7 +1350,7 @@ void setPower(enum DACINDEX ind, int val) { setDAC(ind, dacval, 0); // if valid, enable power - if (dacval >= 0) { + if (dacval >= 0 && startup == 0) { LOG(logDEBUG1, ("Switching on power enable\n")); bus_w(addr, bus_r(addr) | mask); } diff --git a/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp b/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp index 795937ee1..a36576d7d 100644 --- a/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp +++ b/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp @@ -1046,6 +1046,12 @@ TEST_CASE("v_abcd", "[.cmdcall]") { if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) { auto prev_val = det.getPower(indices[i]); + // this is the first command touching power dacs, should not be + // -100 + if (det_type == defs::XILINX_CHIPTESTBOARD) { + REQUIRE(prev_val.any(-100) == false); + REQUIRE(prev_val.any(-1) == false); + } { std::ostringstream oss; caller.call(cmds[i], {"0"}, -1, PUT, oss); diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 8e7c2d493..245acb823 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -7,6 +7,6 @@ #define APIGOTTHARD2 "0.0.0 0x250909" #define APIMOENCH "0.0.0 0x250909" #define APIEIGER "0.0.0 0x250909" -#define APIXILINXCTB "0.0.0 0x260122" +#define APIXILINXCTB "0.0.0 0x260128" #define APIJUNGFRAU "0.0.0 0x250909" #define APIMYTHEN3 "0.0.0 0x250922"