From 95c99d0789497e7d9e97f74aed388d366ef7055d Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 22 Oct 2026 16:30:34 +0200 Subject: [PATCH] 1010/ [Mythen3] Check bad-channel flags before shifting the channel register (#1629) * [Mythen3] Check bad-channel flags before shifting the channel register The bad-channel test in setChannelRegisterChip ran after the register was divided by two, so the mask 0x38 hit the LSB of the counter 0 trim instead of the flags. Every channel with an odd trim value was logged as a bad channel, 1280 lines per module, which made setAllTrimbits about 190 ms slower for odd values. Test the flags where they were set. Also remove an unused message buffer in validate_writePatternWord and log the client pattern file name at debug level instead of printing it on every pattern load. * check is back * m3 binary in * fixed binary versions --------- Co-authored-by: Erik Frojdh Co-authored-by: Erik Frojdh --- slsDetectorServers/mythen3DetectorServer/mythen3.c | 4 ++-- .../slsDetectorServer/src/loadPattern.c | 12 +++++++----- slsSupportLib/include/sls/versionAPI.h | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/slsDetectorServers/mythen3DetectorServer/mythen3.c b/slsDetectorServers/mythen3DetectorServer/mythen3.c index a03fd736d..9ece1637d 100644 --- a/slsDetectorServers/mythen3DetectorServer/mythen3.c +++ b/slsDetectorServers/mythen3DetectorServer/mythen3.c @@ -304,8 +304,6 @@ patternParameters *setChannelRegisterChip(int ichip, char *mask, chanReg |= (0x1 << (3 + icounter)); } } - chanReg /= 2; - // deserialize if (chanReg & CHAN_REG_BAD_CHANNEL_MSK) { LOG(logINFOBLUE, ("badchannel [chanReg:0x%x modCounter:%d, modChan:%d, " @@ -313,6 +311,8 @@ patternParameters *setChannelRegisterChip(int ichip, char *mask, chanReg, ichip * NCHAN + ich * NCOUNTERS, ichip * NCHAN_1_COUNTER + ich, ichip, ich)); } + chanReg /= 2; + // deserialize for (int i = 0; i < 23; i++) { patword = clearBit(SIGNAL_clk, patword); pat->word[iaddr++] = patword; diff --git a/slsDetectorServers/slsDetectorServer/src/loadPattern.c b/slsDetectorServers/slsDetectorServer/src/loadPattern.c index 90ef5b6d4..4d4c9dcdd 100644 --- a/slsDetectorServers/slsDetectorServer/src/loadPattern.c +++ b/slsDetectorServers/slsDetectorServer/src/loadPattern.c @@ -170,10 +170,12 @@ int validate_writePatternWord(char *message, int addr, uint64_t word) { uint64_t retval = readPatternWord(addr); LOG(logDEBUG1, ("Pattern word (addr:0x%x) retval: 0x%llx\n", addr, (long long int)retval)); - char mode[128]; - memset(mode, 0, sizeof(mode)); - sprintf(mode, "set pattern word for addr 0x%x", addr); - validate64(&ret, message, word, retval, "set pattern word", HEX); + // runs for every pattern word: only build the message on a mismatch + if (retval != word) { + char mode[64]; + sprintf(mode, "set pattern word for addr 0x%x", addr); + validate64(&ret, message, word, retval, mode, HEX); + } #endif return ret; } @@ -835,7 +837,7 @@ int loadPattern(char *message, enum TLogLevel printLevel, int ret = OK; memset(clientPatternfile, 0, MAX_STR_LENGTH); memcpy(clientPatternfile, patfname, MAX_STR_LENGTH); - printf("Client Pattern File:%s\n", clientPatternfile); + LOG(logDEBUG1, ("Client Pattern File:%s\n", clientPatternfile)); #ifdef MYTHEN3D trimmingPrint = printLevel; #endif diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 0b86ec503..1199bfb5f 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -9,4 +9,4 @@ #define APIEIGER "10.1.0 0x260807" #define APIXILINXCTB "10.0.0 0x250828" #define APIJUNGFRAU "10.1.0 0x261002" -#define APIMYTHEN3 "10.0.0 0x250828" +#define APIMYTHEN3 "10.1.0 0x261022"