Dev/m3 readout speed (#985)

* added readoutspeed command to m3 (fullspeed - 10, half speed - 20, quarter speed - 40), removed reaodut pll, moved up system pll clock indices, leaving pll index in common altera code, default speed is half speed, allow only system_c0 to be set, the others can be obtained, same for clkphase, maxclkphaseshift, clkfreq. added to readoutspeedlist commands, updated help and updated tests

* updated readoutspeedlist command
This commit is contained in:
2024-09-30 17:22:24 +02:00
committed by GitHub
parent 5b832cb6aa
commit 8a7ed30676
12 changed files with 140 additions and 78 deletions

View File

@ -2904,7 +2904,7 @@ exptime3:
value: 2
readoutspeed:
help: "\n\t[0 or full_speed|1 or half_speed|2 or quarter_speed]\n\t[Eiger][Jungfrau][Moench] Readout speed of chip.\n\t[Eiger][Moench] Default speed is full_speed.\n\t[Jungfrau] Default speed is half_speed. full_speed option only available from v2.0 boards and is recommended to set number of interfaces to 2. Also overwrites adcphase to recommended default.\n\t [144|108]\n\t\t[Gotthard2] Readout speed of chip in MHz. Default is 108."
help: "\n\t[0 or full_speed|1 or half_speed|2 or quarter_speed]\n\t[Eiger][Jungfrau][Moench][Mythen3] Readout speed of chip.\n\t[Eiger][Moench] Default speed is full_speed.\n\t[Jungfrau][Mythen3] Default speed is half_speed. \n\t[Jungfrau] full_speed option only available from v2.0 boards and is recommended to set number of interfaces to 2. Also overwrites adcphase to recommended default.\n\t [144|108]\n\t\t[Gotthard2] Readout speed of chip in MHz. Default is 108."
actions:
GET:
extra_variables:
@ -3044,7 +3044,7 @@ dbitphase:
output: [ 'args[0]',"' '", 'args[1]' ]
clkfreq:
help: "[n_clock (0-5)] [freq_in_Hz]\n\t[Gotthard2][Mythen3] Frequency of clock n_clock in Hz. Use clkdiv to set frequency."
help: "[n_clock] [freq_in_Hz]\n\t[Gotthard2][Mythen3] Frequency of clock n_clock in Hz. Use clkdiv to set frequency.\n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0"
actions:
GET:
extra_variables:
@ -3063,7 +3063,7 @@ clkfreq:
output: [ OutString(t) ]
clkphase:
help: "[n_clock (0-5)] [phase] [deg (optional)]\n\t[Gotthard2][Mythen3] Phase of clock n_clock. If deg, then phase shift in degrees, else absolute phase shift values."
help: "[n_clock] [phase] [deg (optional)]\n\t[Gotthard2][Mythen3] Phase of clock n_clock. If deg, then phase shift in degrees, else absolute phase shift values.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0"
actions:
GET:
extra_variables:
@ -3118,7 +3118,7 @@ clkphase:
output: [ 'args[1]', '" "', 'args[2]' ]
maxclkphaseshift:
help: "[n_clock (0-5)]\n\t[Gotthard2][Mythen3] Absolute Maximum Phase shift of clock n_clock."
help: "[n_clock]\n\t[Gotthard2][Mythen3] Absolute Maximum Phase shift of clock n_clock.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0"
actions:
GET:
extra_variables:
@ -3137,7 +3137,7 @@ maxclkphaseshift:
function: getMaxClockPhaseShift
clkdiv:
help: "[n_clock (0-5)] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1."
help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0"
actions:
GET:
extra_variables:

View File

@ -363,11 +363,11 @@ class Detector {
/** list of possible timing modes for this detector */
std::vector<defs::timingMode> getTimingModeList() const;
/** [Eiger][Jungfrau][Moench][Gotthard2] */
/** [Eiger][Jungfrau][Moench][Gotthard2][Mythen3] */
Result<defs::speedLevel> getReadoutSpeed(Positions pos = {}) const;
/** [Eiger][Jungfrau][Moench][Gotthard2]
* [Jungfrau] Options: FULL_SPEED, HALF_SPEED (Default),
* [Jungfrau][Mythen3] Options: FULL_SPEED, HALF_SPEED (Default),
* QUARTER_SPEED \n [Moench] Options: FULL_SPEED (Default) \n [Eiger]
* Options: FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED \n [Gotthard2]
* Options: G2_108MHZ (Default), G2_144MHZ \n [Jungfrau][Moench] FULL_SPEED
@ -429,7 +429,8 @@ class Detector {
/** [Mythen3][Gotthard2] */
Result<int> getClockPhase(int clkIndex, Positions pos = {});
/** [Mythen3][Gotthard2] absolute phase shift */
/** [Mythen3][Gotthard2] absolute phase shift \n
* [Gotthard2] clkIndex: 0-5, [Mythen3] clkIndex 0 only */
void setClockPhase(int clkIndex, int value, Positions pos = {});
/** [Mythen3][Gotthard2] */
@ -438,13 +439,15 @@ class Detector {
/** [Mythen3][Gotthard2] */
Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {});
/** [Mythen3][Gotthard2] */
/** [Mythen3][Gotthard2] \n
* [Gotthard2] clkIndex: 0-5, [Mythen3] clkIndex 0 only */
void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {});
/** [Mythen3][Gotthard2] */
Result<int> getClockDivider(int clkIndex, Positions pos = {});
/** [Mythen3][Gotthard2] Must be greater than 1. */
/** [Mythen3][Gotthard2] Must be greater than 1. \n
* [Gotthard2] clkIndex: 0-5, [Mythen3] clkIndex 0 only */
void setClockDivider(int clkIndex, int value, Positions pos = {});
Result<int> getHighVoltage(Positions pos = {}) const;

View File

@ -533,6 +533,7 @@ std::vector<defs::speedLevel> Detector::getReadoutSpeedList() const {
case defs::EIGER:
case defs::JUNGFRAU:
case defs::MOENCH:
case defs::MYTHEN3:
return std::vector<defs::speedLevel>{defs::FULL_SPEED, defs::HALF_SPEED,
defs::QUARTER_SPEED};
case defs::GOTTHARD2:

View File

@ -1101,14 +1101,16 @@ TEST_CASE("CALLER::readoutspeed", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU ||
det_type == defs::MOENCH || det_type == defs::GOTTHARD2) {
det_type == defs::MOENCH || det_type == defs::GOTTHARD2 ||
det_type == defs::MYTHEN3) {
auto prev_val = det.getReadoutSpeed();
// full speed for jungfrau/moench only works for new boards (chipv1.1 is
// with new board [hw1.0 and chipv1.0 not tested here])
if (((det_type == defs::JUNGFRAU) &&
det.getChipVersion().squash() * 10 == 11) ||
(det_type == defs::EIGER) || (det_type == defs::MOENCH)) {
det_type == defs::EIGER || det_type == defs::MOENCH ||
det_type == defs::MYTHEN3) {
std::ostringstream oss1, oss2, oss3, oss4;
caller.call("readoutspeed", {"0"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "readoutspeed full_speed\n");
@ -1121,7 +1123,7 @@ TEST_CASE("CALLER::readoutspeed", "[.cmdcall]") {
}
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU ||
det_type == defs::MOENCH) {
det_type == defs::MOENCH || det_type == defs::MYTHEN3) {
{
std::ostringstream oss1, oss2, oss3, oss4;
caller.call("readoutspeed", {"1"}, -1, PUT, oss1);
@ -1189,7 +1191,8 @@ TEST_CASE("CALLER::readoutspeedlist", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU ||
det_type == defs::MOENCH || det_type == defs::EIGER) {
det_type == defs::MOENCH || det_type == defs::EIGER ||
det_type == defs::MYTHEN3) {
REQUIRE_NOTHROW(caller.call("readoutspeedlist", {}, -1, GET));
REQUIRE_THROWS(caller.call("readoutspeedlist", {}, -1, PUT));
} else {
@ -1301,6 +1304,12 @@ TEST_CASE("CALLER::clkfreq", "[.cmdcall]") {
REQUIRE_THROWS(caller.call("clkfreq", {}, -1, GET));
REQUIRE_THROWS(caller.call("clkfreq", {"7"}, -1, GET));
REQUIRE_NOTHROW(caller.call("clkfreq", {"0"}, -1, GET));
// other clocks removed for m3 (setting not supported)
if (det_type == defs::MYTHEN3) {
REQUIRE_NOTHROW(caller.call("clkfreq", {"1"}, -1, GET));
REQUIRE_NOTHROW(caller.call("clkfreq", {"2"}, -1, GET));
REQUIRE_THROWS(caller.call("clkfreq", {"3"}, -1, GET));
}
} else {
REQUIRE_THROWS(caller.call("clkfreq", {"0"}, -1, GET));
}
@ -1339,6 +1348,18 @@ TEST_CASE("CALLER::clkphase", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) {
det.setClockPhase(0, prev_val[i], {i});
}
// other clocks removed for m3 (setting not supported)
if (det_type == defs::MYTHEN3) {
REQUIRE_THROWS(
caller.call("clkphase", {"1", s_deg_val, "deg"}, -1, PUT));
REQUIRE_NOTHROW(caller.call("clkphase", {"1"}, -1, GET));
REQUIRE_THROWS(
caller.call("clkphase", {"2", s_deg_val, "deg"}, -1, PUT));
REQUIRE_NOTHROW(caller.call("clkphase", {"2"}, -1, GET));
REQUIRE_THROWS(
caller.call("clkphase", {"3", s_deg_val, "deg"}, -1, PUT));
REQUIRE_THROWS(caller.call("clkphase", {"3"}, -1, GET));
}
} else {
REQUIRE_THROWS(caller.call("clkphase", {"0"}, -1, GET));
}
@ -1365,6 +1386,15 @@ TEST_CASE("CALLER::clkdiv", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) {
det.setClockDivider(0, prev_val[i], {i});
}
// other clocks removed for m3 (setting not supported)
if (det_type == defs::MYTHEN3) {
REQUIRE_THROWS(caller.call("clkdiv", {"1", "2"}, -1, PUT));
REQUIRE_NOTHROW(caller.call("clkdiv", {"1"}, -1, GET));
REQUIRE_THROWS(caller.call("clkdiv", {"2", "2"}, -1, PUT));
REQUIRE_NOTHROW(caller.call("clkdiv", {"2"}, -1, GET));
REQUIRE_THROWS(caller.call("clkdiv", {"3", "2"}, -1, PUT));
REQUIRE_THROWS(caller.call("clkdiv", {"3"}, -1, GET));
}
} else {
REQUIRE_THROWS(caller.call("clkdiv", {"0"}, -1, GET));
}
@ -1379,6 +1409,12 @@ TEST_CASE("CALLER::maxclkphaseshift", "[.cmdcall]") {
REQUIRE_THROWS(caller.call("maxclkphaseshift", {}, -1, GET));
REQUIRE_THROWS(caller.call("maxclkphaseshift", {"7"}, -1, GET));
REQUIRE_NOTHROW(caller.call("maxclkphaseshift", {"0"}, -1, GET));
// other clocks removed for m3 (setting not supported)
if (det_type == defs::MYTHEN3) {
REQUIRE_NOTHROW(caller.call("maxclkphaseshift", {"1"}, -1, GET));
REQUIRE_NOTHROW(caller.call("maxclkphaseshift", {"2"}, -1, GET));
REQUIRE_THROWS(caller.call("maxclkphaseshift", {"3"}, -1, GET));
}
} else {
REQUIRE_THROWS(caller.call("maxclkphaseshift", {"0"}, -1, GET));
}