diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index dc9fbcfcb..aab345f1d 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -1783,21 +1783,25 @@ void configureSyncFrequency(enum CLKINDEX ind) { int configure = 0; - // sync is greater than current + // find the smallest frequency + int min = (aFreq < bFreq) ? aFreq : bFreq; + min = (retval < min) ? retval : min; + + // sync is greater than min if (syncFreq > retval) { FILE_LOG(logINFO, ("\t--Configuring Sync Clock\n")); configure = 1; } - // the others are both greater than current - else if ((aFreq > retval && bFreq > retval)) { + // sync is smaller than min + else if (syncFreq < min) { FILE_LOG(logINFO, ("\t++Configuring Sync Clock\n")); configure = 1; } // configure sync to current if (configure) - configureFrequency(SYNC_CLK, retval); + configureFrequency(SYNC_CLK, min); } void setAdcOffsetRegister(int adc, int val) {