Moench dacs defaults (#788)

* merge fix from 7.0.2: new jungfrau fw versions, incremented binary, hdf5 and json versions

* moench: changed dac names and default values to old moench values

* moench: remove interface clk polarity at start up

* moench: default speed is half speed, default values for adc offset and adc phase for different speeds (only half speed confirmed), adc vref voltage to 2.0 like G1

* moench: connected adc pipeline to client

* moench: receiver- default frames per file is 100k and discard partial frames as default

* moench binary in

* using tostring in gui for dacs

* moved frame discard policy as a parameter to be configured with a default depending on detector

* moench: 300 degrees for adc phase in full speed
This commit is contained in:
2023-07-31 14:02:30 +02:00
committed by GitHub
parent 565858b6c6
commit 1873cc9310
29 changed files with 260 additions and 502 deletions

View File

@@ -1615,12 +1615,6 @@ class Detector {
/** [CTB] in MHZ */
Result<int> getSYNCClock(Positions pos = {}) const;
/** [CTB] */
Result<int> getADCPipeline(Positions pos = {}) const;
/** [CTB] */
void setADCPipeline(int value, Positions pos = {});
/** gets list of voltage enums */
std::vector<defs::dacIndex> getVoltageList() const;
@@ -1959,6 +1953,12 @@ class Detector {
* *
* ************************************************/
/** [CTB][Moench] */
Result<int> getADCPipeline(Positions pos = {}) const;
/** [CTB][Moench] */
void setADCPipeline(int value, Positions pos = {});
/** [Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2]
* Advanced user Function!
* Program firmware from command line, after which detector controller is

View File

@@ -2992,6 +2992,8 @@ std::string CmdProxy::PatternWaitTime(int action) {
return os.str();
}
/* Advanced */
std::string CmdProxy::AdditionalJsonHeader(int action) {
std::ostringstream os;
os << cmd << ' ';
@@ -3067,8 +3069,6 @@ std::string CmdProxy::JsonParameter(int action) {
return os.str();
}
/* Advanced */
std::string CmdProxy::ProgramFpga(int action) {
std::ostringstream os;
os << cmd << ' ';

View File

@@ -1233,7 +1233,6 @@ class CmdProxy {
{"adcclk", &CmdProxy::adcclk},
{"runclk", &CmdProxy::runclk},
{"syncclk", &CmdProxy::syncclk},
{"adcpipeline", &CmdProxy::adcpipeline},
{"v_limit", &CmdProxy::v_limit},
{"adcenable", &CmdProxy::adcenable},
{"adcenable10g", &CmdProxy::adcenable10g},
@@ -1296,10 +1295,11 @@ class CmdProxy {
{"patternstart", &CmdProxy::patternstart},
/* Moench */
{"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader},
{"rx_jsonpara", &CmdProxy::JsonParameter},
/* Advanced */
{"adcpipeline", &CmdProxy::adcpipeline},
{"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader},
{"rx_jsonpara", &CmdProxy::JsonParameter},
{"programfpga", &CmdProxy::ProgramFpga},
{"resetfpga", &CmdProxy::resetfpga},
{"updatedetectorserver", &CmdProxy::UpdateDetectorServer},
@@ -2425,10 +2425,6 @@ class CmdProxy {
GET_COMMAND(syncclk, getSYNCClock,
"[n_clk in MHz]\n\t[Ctb] Sync clock in MHz.");
INTEGER_COMMAND_VEC_ID(adcpipeline, getADCPipeline, setADCPipeline,
StringTo<int>,
"[n_value]\n\t[Ctb] Pipeline for ADC clock.");
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, StringTo<int>,
defs::V_LIMIT,
"[n_value]\n\t[Ctb] Soft limit for power "
@@ -2587,6 +2583,10 @@ class CmdProxy {
/* Moench */
/* Advanced */
INTEGER_COMMAND_VEC_ID(
adcpipeline, getADCPipeline, setADCPipeline, StringTo<int>,
"[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock.");
EXECUTE_SET_COMMAND(resetfpga, resetFPGA,
"\n\t[Jungfrau][Moench][Ctb] Reset FPGA.");

View File

@@ -718,7 +718,6 @@ std::vector<defs::dacIndex> Detector::getDacList() const {
defs::VREF_DS, defs::VCASCN_PB, defs::VCASCP_PB, defs::VOUT_CM,
defs::VCASC_OUT, defs::VIN_CM, defs::VREF_COMP, defs::IB_TESTC};
case defs::JUNGFRAU:
case defs::MOENCH:
return std::vector<defs::dacIndex>{
defs::VB_COMP, defs::VDD_PROT, defs::VIN_COM, defs::VREF_PRECH,
defs::VB_PIXBUF, defs::VB_DS, defs::VREF_DS, defs::VREF_COMP};
@@ -736,6 +735,10 @@ std::vector<defs::dacIndex> Detector::getDacList() const {
defs::VCAS, defs::VRPREAMP, defs::VCAL_N, defs::VIPRE,
defs::VISHAPER, defs::VCAL_P, defs::VTRIM, defs::VDCSH,
defs::VTHRESHOLD};
case defs::MOENCH:
return std::vector<defs::dacIndex>{
defs::VBP_COLBUF, defs::VIPRE, defs::VIN_CM, defs::VB_SDA,
defs::VCASC_SFP, defs::VOUT_CM, defs::VIPRE_CDS, defs::IBIAS_SFP};
case defs::CHIPTESTBOARD:
for (int i = 0; i != 18; ++i) {
retval.push_back(static_cast<defs::dacIndex>(i));
@@ -2048,14 +2051,6 @@ Result<int> Detector::getSYNCClock(Positions pos) const {
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::SYNC_CLOCK);
}
Result<int> Detector::getADCPipeline(Positions pos) const {
return pimpl->Parallel(&Module::getADCPipeline, pos);
}
void Detector::setADCPipeline(int value, Positions pos) {
pimpl->Parallel(&Module::setADCPipeline, pos, value);
}
std::vector<defs::dacIndex> Detector::getVoltageList() const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Voltage list not implemented for this detector");
@@ -2533,6 +2528,8 @@ void Detector::startPattern(Positions pos) {
pimpl->Parallel(&Module::startPattern, pos);
}
// Json Header specific
Result<std::map<std::string, std::string>>
Detector::getAdditionalJsonHeader(Positions pos) const {
return pimpl->Parallel(&Module::getAdditionalJsonHeader, pos);
@@ -2556,6 +2553,14 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
// Advanced
Result<int> Detector::getADCPipeline(Positions pos) const {
return pimpl->Parallel(&Module::getADCPipeline, pos);
}
void Detector::setADCPipeline(int value, Positions pos) {
pimpl->Parallel(&Module::setADCPipeline, pos, value);
}
void Detector::programFPGA(const std::string &fname,
const bool forceDeleteNormalFile, Positions pos) {
LOG(logINFO) << "Updating Firmware...";

View File

@@ -91,7 +91,7 @@ std::string GetHelpDac(std::string dac) {
}
if (dac == "vref_ds") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau][Moench] Dac for ??");
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "vcascn_pb") {
return std::string(
@@ -103,7 +103,7 @@ std::string GetHelpDac(std::string dac) {
}
if (dac == "vout_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??");
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 5");
}
if (dac == "vcasc_out") {
return std::string(
@@ -111,11 +111,11 @@ std::string GetHelpDac(std::string dac) {
}
if (dac == "vin_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??");
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 2");
}
if (dac == "vref_comp") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau][Moench] Dac for ??");
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "ib_test_c") {
return std::string(
@@ -129,7 +129,7 @@ std::string GetHelpDac(std::string dac) {
if (dac == "vipre") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's input transistor current.");
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
}
if (dac == "vdcsh") {
return std::string(
@@ -225,7 +225,7 @@ std::string GetHelpDac(std::string dac) {
if (dac == "vref_prech") {
return std::string(
"[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard2][Jungfrau][Moench] "
"\n\t[Gotthard2][Jungfrau] "
"Dac for reference votlage for precharing the preamplifier.");
}
if (dac == "vref_l_adc") {
@@ -256,38 +256,43 @@ std::string GetHelpDac(std::string dac) {
}
if (dac == "vb_ds") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau][Moench] Dac for ??");
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_comp") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau][Moench] Dac for ??");
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_pixbuf") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau][Moench] Dac for ??");
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vin_com") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau][Moench] Dac for ??");
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vdd_prot") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau][Moench] Dac for ??");
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vbp_colbuf") {
return std::string("[dac or mV value][(optional unit) mV] \n");
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
}
if (dac == "vb_sda") {
return std::string("[dac or mV value][(optional unit) mV] \n");
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
}
if (dac == "vcasc_sfp") {
return std::string("[dac or mV value][(optional unit) mV] \n");
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
}
if (dac == "vipre_cds") {
return std::string("[dac or mV value][(optional unit) mV] \n");
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
}
if (dac == "ibias_sfp") {
return std::string("[dac or mV value][(optional unit) mV] \n");
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
}
// clang-format off

View File

@@ -2370,14 +2370,6 @@ void Module::setNumberOfAnalogSamples(int value) {
}
}
int Module::getADCPipeline() const {
return sendToDetector<int>(F_GET_ADC_PIPELINE);
}
void Module::setADCPipeline(int value) {
sendToDetector(F_SET_ADC_PIPELINE, value, nullptr);
}
uint32_t Module::getADCEnableMask() const {
return sendToDetector<uint32_t>(F_GET_ADC_ENABLE_MASK);
}
@@ -2630,6 +2622,8 @@ void Module::setPatternBitMask(uint64_t mask) {
void Module::startPattern() { sendToDetector(F_START_PATTERN); }
// Json Header specific
std::map<std::string, std::string> Module::getAdditionalJsonHeader() const {
// TODO, refactor this function with a more robust sending.
// Now assuming whitespace separated key value
@@ -2718,6 +2712,15 @@ void Module::setAdditionalJsonParameter(const std::string &key,
}
// Advanced
int Module::getADCPipeline() const {
return sendToDetector<int>(F_GET_ADC_PIPELINE);
}
void Module::setADCPipeline(int value) {
sendToDetector(F_SET_ADC_PIPELINE, value, nullptr);
}
void Module::programFPGA(std::vector<char> buffer,
const bool forceDeleteNormalFile) {
switch (shm()->detType) {

View File

@@ -502,8 +502,6 @@ class Module : public virtual slsDetectorDefs {
* ************************************************/
int getNumberOfAnalogSamples() const;
void setNumberOfAnalogSamples(int value);
int getADCPipeline() const;
void setADCPipeline(int value);
uint32_t getADCEnableMask() const;
void setADCEnableMask(uint32_t mask);
uint32_t getTenGigaADCEnableMask() const;
@@ -557,7 +555,7 @@ class Module : public virtual slsDetectorDefs {
/**************************************************
* *
* Moench *
* Json Header specific *
* *
* ************************************************/
std::map<std::string, std::string> getAdditionalJsonHeader() const;
@@ -572,6 +570,8 @@ class Module : public virtual slsDetectorDefs {
* Advanced *
* *
* ************************************************/
int getADCPipeline() const;
void setADCPipeline(int value);
void programFPGA(std::vector<char> buffer,
const bool forceDeleteNormalFile);
void resetFPGA();

View File

@@ -727,41 +727,6 @@ TEST_CASE("syncclk", "[.cmd]") {
}
}
TEST_CASE("adcpipeline", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getADCPipeline();
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 1\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 0\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 15\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {}, -1, GET, oss);
REQUIRE(oss.str() == "adcpipeline 15\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setADCPipeline(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcpipeline", {}, -1, GET));
}
}
TEST_CASE("v_limit", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);

View File

@@ -3055,6 +3055,41 @@ TEST_CASE("zmqhwm", "[.cmd]") {
/* Advanced */
TEST_CASE("adcpipeline", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getADCPipeline();
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 1\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 0\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 15\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {}, -1, GET, oss);
REQUIRE(oss.str() == "adcpipeline 15\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setADCPipeline(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcpipeline", {}, -1, GET));
}
}
TEST_CASE("programfpga", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);