diff --git a/slsDetectorServers/ctbDetectorServer/Makefile b/slsDetectorServers/ctbDetectorServer/Makefile index b26f833d1..57505e19b 100755 --- a/slsDetectorServers/ctbDetectorServer/Makefile +++ b/slsDetectorServers/ctbDetectorServer/Makefile @@ -1,7 +1,7 @@ CROSS = bfin-uclinux- CC = $(CROSS)gcc CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -DDEBUG1 #-DJCTB -DVERBOSEI #-DVERBOSE -LDLIBS += -lm -lstdc++ +LDLIBS += -lm -lstdc++ PROGS = ctbDetectorServer DESTDIR ?= bin diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index 90e50f437..66a693c59 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index 1880a0c6a..8a7fcaab6 100755 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -10,6 +10,7 @@ #include "MAX1932.h" // hv #include "INA226.h" // i2c #include "ALTERA_PLL.h" // pll +#include #ifndef VIRTUAL #include "programfpga.h" #else @@ -2351,8 +2352,14 @@ void readSample(int ns) { // read strobe to all analog fifos bus_w(addr, bus_r(addr) | DUMMY_ANLG_FIFO_RD_STRBE_MSK); bus_w(addr, bus_r(addr) & (~DUMMY_ANLG_FIFO_RD_STRBE_MSK)); - // wait as it is connected directly to fifo running on a different clock - //usleep(WAIT_TIME_FIFO_RD_STROBE); + + // wait for 1 us to latch different clocks of read and read strobe + { + int i = 0; + for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i) + ; + } + if (!(ns%1000)) { FILE_LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x Status:0x%x\n", ns, nSamples, bus_r(FIFO_EMPTY_REG), bus_r(FIFO_FULL_REG), bus_r(STATUS_REG))); @@ -2391,6 +2398,14 @@ void readSample(int ns) { // read strobe to digital fifo bus_w(addr, bus_r(addr) | DUMMY_DGTL_FIFO_RD_STRBE_MSK); bus_w(addr, bus_r(addr) & (~DUMMY_DGTL_FIFO_RD_STRBE_MSK)); + + // wait for 1 us to latch different clocks of read and read strobe + { + int i = 0; + for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i) + ; + } + // wait as it is connected directly to fifo running on a different clock if (!(ns%1000)) { FILE_LOG(logDEBUG1, ("Reading sample ns:%d of %d DEmtpy:%d DFull:%d Status:0x%x\n", @@ -2399,7 +2414,7 @@ void readSample(int ns) { ((bus_r(FIFO_DIN_STATUS_REG) & FIFO_DIN_STATUS_FIFO_FULL_MSK) >> FIFO_DIN_STATUS_FIFO_FULL_OFST), bus_r(STATUS_REG))); } - + // read fifo and write it to current position of data pointer *((uint64_t*)now_ptr) = get64BitReg(FIFO_DIN_LSB_REG, FIFO_DIN_MSB_REG); now_ptr += 8; diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h index 580f09290..71428a242 100755 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h @@ -85,7 +85,7 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, #define WAIT_TIME_US_STP_ACQ (100) #define WAIT_TIME_CONFIGURE_MAC (500 * 1000) #define WAIT_TIME_PATTERN_READ (10) -#define WAIT_TIME_FIFO_RD_STROBE (10) +#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin /* MSB & LSB DEFINES */ #define MSB_OF_64_BIT_REG_OFST (32) diff --git a/slsSupportLib/include/versionAPI.h b/slsSupportLib/include/versionAPI.h index 02a42a3f0..4057ba425 100644 --- a/slsSupportLib/include/versionAPI.h +++ b/slsSupportLib/include/versionAPI.h @@ -7,4 +7,4 @@ #define APIRECEIVER 0x190405 #define APIGUI 0x190405 #define APIEIGER 0x190418 -#define APICTB 0x190418 +#define APICTB 0x190423