diff --git a/slsDetectorSoftware/commonFiles/versionAPI.h b/slsDetectorSoftware/commonFiles/versionAPI.h index d25a1e5c3..0a255246c 100644 --- a/slsDetectorSoftware/commonFiles/versionAPI.h +++ b/slsDetectorSoftware/commonFiles/versionAPI.h @@ -2,4 +2,4 @@ #define APIRECEIVER 0x180823 #define APIEIGER 0x181130 #define APIJUNGFRAU 0x190107 -#define APIGOTTHARD 0x190130 +#define APIGOTTHARD 0x190201 diff --git a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c index b904b6ab4..261c58da4 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c @@ -887,7 +887,7 @@ int64_t get64BitReg(int aLSB, int aMSB){ return v64; } -int64_t setFrames(int64_t value){ +int64_t setFrames(int64_t value){printf("setting frames to %lld\n", (long long int)value); return set64BitReg(value, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); } @@ -895,7 +895,7 @@ int64_t getFrames(){ return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG); } -int64_t setExposureTime(int64_t value){ +int64_t setExposureTime(int64_t value){printf("setting exptime to %lld ns\n", (long long int)value); /* time is in ns */ if (value!=-1) { value = (value * 1E-3 * CLK_FREQ ) + 0.5; @@ -909,7 +909,7 @@ int64_t getExposureTime(){ (1E-3 * CLK_FREQ)) + 0.5; } -int64_t setGates(int64_t value){ +int64_t setGates(int64_t value){printf("setting gates to %lld\n", (long long int)value); return set64BitReg(value, SET_GATES_LSB_REG, SET_GATES_MSB_REG); } @@ -917,7 +917,7 @@ int64_t getGates(){ return get64BitReg(GET_GATES_LSB_REG, GET_GATES_MSB_REG); } -int64_t setPeriod(int64_t value){ +int64_t setPeriod(int64_t value){printf("setting period to %lld ns\n", (long long int)value); /* time is in ns */ if (value!=-1) { value = (value * 1E-3 * CLK_FREQ ) + 0.5; @@ -931,7 +931,7 @@ int64_t getPeriod(){ (1E-3 * CLK_FREQ)) + 0.5; } -int64_t setDelay(int64_t value){ +int64_t setDelay(int64_t value){printf("setting delay to %lld ns\n", (long long int)value); /* time is in ns */ if (value!=-1) { if (masterflags == IS_MASTER) { @@ -955,7 +955,7 @@ int64_t getDelay(){ (1E-3 * CLK_FREQ)) + 0.5; } -int64_t setTrains(int64_t value){ +int64_t setTrains(int64_t value){printf("setting cycles to %lld\n", (long long int)value); return set64BitReg(value, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG); } @@ -1449,20 +1449,34 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d uint64_t oldExptime = setExposureTime(-1); // set to basic parameters - printf("Setting basic parameters\n"); + cprintf(BLUE,"Setting basic parameters\n" + "\tTiming: auto, frames: 1, cycles: 1, period: 1s, exptime: 900ms\n"); setTiming(AUTO_TIMING); setFrames(1); setTrains(1); - setPeriod(1e6); - setExposureTime(1e5); + setPeriod(1e9); // important to keep this until we have to wait for acquisition to start + setExposureTime(900 * 1000); // take an image + if (masterflags == IS_MASTER) + usleep(1 * 1000 * 1000); // required to ensure master starts acquisition only after slave has changed to basic parameters and is waiting + + int loop = 0; startStateMachine(); + // wait for acquisition to start (trigger from master) + printf(" Waiting for acquisition to start\n"); + while(!runBusy()) { + usleep(0); + ++loop; + } + + cprintf(MAGENTA, "waited %d loops to start\n", loop); + cprintf(BLUE, " Waiting for acquisition to end (frames left: %lld)\n", (long long int)getFrames()); waitForAcquisitionFinish(); // set to previous parameters - printf("Setting previous parameters: " - "Timing: %d, " + cprintf(BLUE,"Setting previous parameters:\n" + "\tTiming: %d, " "frames: %lld, " "cycles: %lld, " "period: %lld ns, " @@ -1484,6 +1498,7 @@ int getAdcConfigured(){ u_int32_t runBusy(void) { u_int32_t s = bus_r(STATUS_REG) & RUN_BUSY_BIT; + //printf("runBusy: 0x%08x\n", s); return s; } @@ -1515,6 +1530,7 @@ int startStateMachine(){ //#ifdef VERBOSE cprintf(GREEN,"*******Starting State Machine*******\n"); + cprintf(GREEN,"Number of frames to acquire:%lld\n", (long long int)setFrames(-1)); //#endif cleanFifo(); // fifoReset(); @@ -1595,28 +1611,29 @@ u_int32_t fifo_full(void) void waitForAcquisitionFinish(){ - volatile u_int32_t t = bus_r(LOOK_AT_ME_REG); + volatile u_int32_t t = bus_r(LOOK_AT_ME_REG); #ifdef VERBOSE - printf("lookatmereg=x%x\n",t); + printf("lookatmereg=x%x\n",t); #endif - while((t&0x1)==0) { - if (runBusy()==0) { - t = bus_r(LOOK_AT_ME_REG); - if ((t&0x1)==0) { + while((t&0x1)==0) { + if (runBusy() == 0) { + t = bus_r(LOOK_AT_ME_REG); + if ((t&0x1)==0) { #ifdef VERBOSE - printf("no frame found - exiting "); - printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG)); + printf("no frame found - exiting "); + printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG)); #endif - return; - } else { + return; + } else { #ifdef VERBOSE - printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState()); + printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState()); #endif - break; - } - } - t = bus_r(LOOK_AT_ME_REG); - } + break; + } + } + + t = bus_r(LOOK_AT_ME_REG); + } } diff --git a/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt b/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt index 0d3bdfa87..54d150ceb 100644 --- a/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt +++ b/slsDetectorSoftware/gotthardDetectorServer/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git -Repsitory UUID: 12f8166d257e14485cc37392689d03ed8ec6dbb9 -Revision: 246 +Repsitory UUID: 2f11681d3f2bd2e437cd23fa28dc618dbbd39c68 +Revision: 247 Branch: 4.0.1-rc Last Changed Author: Dhanya_Thattil -Last Changed Rev: 4056 -Last Changed Date: 2019-01-30 18:21:07.000000002 +0100 ./firmware_funcs.c +Last Changed Rev: 4057 +Last Changed Date: 2019-02-01 11:47:52.000000002 +0100 ./firmware_funcs.c diff --git a/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h b/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h index 6512575d7..0d87c914e 100644 --- a/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h +++ b/slsDetectorSoftware/gotthardDetectorServer/gitInfoGotthard.h @@ -1,6 +1,6 @@ #define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" -#define GITREPUUID "12f8166d257e14485cc37392689d03ed8ec6dbb9" +#define GITREPUUID "2f11681d3f2bd2e437cd23fa28dc618dbbd39c68" #define GITAUTH "Dhanya_Thattil" -#define GITREV 0x4056 -#define GITDATE 0x20190130 +#define GITREV 0x4057 +#define GITDATE 0x20190201 #define GITBRANCH "4.0.1-rc" diff --git a/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.3 b/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.3 deleted file mode 100755 index 4b8cfb7a1..000000000 Binary files a/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.3 and /dev/null differ diff --git a/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.4 b/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.4 new file mode 100755 index 000000000..8c97ee254 Binary files /dev/null and b/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.4 differ diff --git a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c index c1959c5a4..3fe6591e5 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c @@ -1829,7 +1829,7 @@ int get_run_status(int file_des) { #endif retval= runState(); - printf("\n\nSTATUS=%08x\n",retval); + printf("STATUS=%08x\n",retval); //stopped (external stop, also maybe fifo full) @@ -2046,9 +2046,9 @@ int set_timer(int file_des) { printf(mess); } -//#ifdef VERBOSE +#ifdef VERBOSE printf("setting timer %d to %lld ns\n",ind,tns); -//#endif +#endif if (ret==OK) { if (differentClients==1 && lockStatus==1 && tns!=-1) { diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 0aa4529f4..b8be4ff33 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -1235,10 +1235,10 @@ void multiSlsDetector::setDetectorOffset(dimension d, int off, int pos) { void multiSlsDetector::updateOffsets() { //cannot paralllize due to slsdetector calling this via parentdet-> -#ifdef VERBOSE +//#ifdef VERBOSE cout << endl << "Updating Multi-Detector Offsets" << endl; -#endif +//#endif int offsetX = 0, offsetY = 0, numX = 0, numY = 0, maxX = 0, maxY = 0; int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X]; int maxChanY = thisMultiDetector->maxNumberOfChannelsPerDetector[Y]; @@ -1298,9 +1298,9 @@ void multiSlsDetector::updateOffsets() { maxY_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(Y); ++thisMultiDetector->numberOfDetector[X]; ++thisMultiDetector->numberOfDetector[Y]; -#ifdef VERBOSE +//#ifdef VERBOSE cout << "incrementing in both direction" << endl; -#endif +//#endif } //incrementing in y direction @@ -1315,10 +1315,12 @@ void multiSlsDetector::updateOffsets() { numY_gp += detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y); maxY += detectors[idet]->getMaxNumberOfChannels(Y); maxY_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(Y); - ++thisMultiDetector->numberOfDetector[Y]; -#ifdef VERBOSE + // increment in y again only in the first column (else you double increment) + if (thisMultiDetector->numberOfDetector[X] == 1) + ++thisMultiDetector->numberOfDetector[Y]; +//#ifdef VERBOSE cout << "incrementing in y direction" << endl; -#endif +//#endif } //incrementing in x direction @@ -1346,9 +1348,9 @@ void multiSlsDetector::updateOffsets() { maxX += detectors[idet]->getMaxNumberOfChannels(X); maxX_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(X); ++thisMultiDetector->numberOfDetector[X]; -#ifdef VERBOSE +//#ifdef VERBOSE cout << "incrementing in x direction" << endl; -#endif +//#endif } double bytesperchannel = (double)detectors[idet]->getDataBytes() / @@ -1381,7 +1383,7 @@ void multiSlsDetector::updateOffsets() { if (maxY_gp > thisMultiDetector->maxNumberOfChannelInclGapPixels[Y]) thisMultiDetector->maxNumberOfChannelInclGapPixels[Y] = maxY_gp; } -#ifdef VERBOSE +//#ifdef VERBOSE cout << "Number of Channels in X direction:" << thisMultiDetector->numberOfChannel[X] << endl; cout << "Number of Channels in Y direction:" << thisMultiDetector->numberOfChannel[Y] << endl << endl; @@ -1390,7 +1392,7 @@ void multiSlsDetector::updateOffsets() { cout << "Number of Channels in Y direction with Gap Pixels:" << thisMultiDetector->numberOfChannelInclGapPixels[Y] << endl << endl; -#endif +//#endif } @@ -5065,7 +5067,7 @@ void multiSlsDetector::readFrameFromReceiver() { nPixelsX = doc["shape"][0].GetUint(); nPixelsY = doc["shape"][1].GetUint(); -#ifdef VERBOSE +//#ifdef VERBOSE cprintf(BLUE, "(Debug) One Time Header Info:\n" "size: %u\n" "multisize: %u\n" @@ -5075,7 +5077,7 @@ void multiSlsDetector::readFrameFromReceiver() { "nPixelsY: %u\n", size, multisize, dynamicRange, bytesPerPixel, nPixelsX, nPixelsY); -#endif +//#endif } // each time, parse rest of header currentFileName = doc["fname"].GetString(); @@ -5084,12 +5086,12 @@ void multiSlsDetector::readFrameFromReceiver() { currentFileIndex = doc["fileIndex"].GetUint64(); currentSubFrameIndex = doc["expLength"].GetUint(); coordY = doc["row"].GetUint(); - coordX = doc["column"].GetUint(); + coordX = doc["column"].GetUint();cprintf(BLUE, "row:%d, col:%d,ny:%d\n", coordY, coordX, nY); if (eiger) coordY = (nY - 1) - coordY; //cout << "X:" << doc["row"].GetUint() <<" Y:"<