diff --git a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h index 4da6dea3f..cb1ac8428 100644 --- a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h +++ b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h @@ -149,6 +149,10 @@ #define ASIC_CONFIG_CURRENT_SRC_EN_MSK (0x00000001 << ASIC_CONFIG_CURRENT_SRC_EN_OFST) #define ASIC_CONFIG_RST_DAC_OFST (15) #define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST) +#define ASIC_CONFIG_DOUT_RDY_SRC_OFST (16) +#define ASIC_CONFIG_DOUT_RDY_SRC_MSK (0x0000000F << ASIC_CONFIG_DOUT_RDY_SRC_OFST) +#define ASIC_CONFIG_DOUT_RDY_DLY_OFST (20) +#define ASIC_CONFIG_DOUT_RDY_DLY_MSK (0x000000FF << ASIC_CONFIG_DOUT_RDY_DLY_OFST) #define ASIC_CONFIG_DONE_OFST (31) #define ASIC_CONFIG_DONE_MSK (0x00000001 << ASIC_CONFIG_DONE_OFST) diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 17d5175bc..0920aa394 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -472,8 +472,7 @@ void setupDetector() { // power on chip powerChip(1); - // default asic value (masks? what do they mean? TODO) - bus_w(ASIC_CONFIG_REG, DEFAULT_ASIC_CONFIG_VALUE); + setASICDefaults(); setPhase(READOUT_C1, DEFAULT_CLK1_PHASE_DEG, 1); setDBITPipeline(DEFAULT_DBIT_PIPELINE); @@ -509,6 +508,24 @@ void setupDetector() { setVetoAlgorithm(DEFAULT_ALGORITHM, ETHERNET_10GB); } +void setASICDefaults() { + uint32_t addr = ASIC_CONFIG_REG; + + // dout ready source + bus_w(addr, bus_r(addr) & ~ASIC_CONFIG_DOUT_RDY_SRC_MSK); + bus_w(addr, bus_r(addr) | ((DEFAULT_ASIC_DOUT_RDY_SRC + << ASIC_CONFIG_DOUT_RDY_SRC_OFST) & + ASIC_CONFIG_DOUT_RDY_SRC_MSK)); + // dout ready delay + bus_w(addr, bus_r(addr) & ~ASIC_CONFIG_DOUT_RDY_DLY_MSK); + bus_w(addr, bus_r(addr) | ((DEFAULT_ASIC_DOUT_RDY_DLY + << ASIC_CONFIG_DOUT_RDY_DLY_OFST) & + ASIC_CONFIG_DOUT_RDY_DLY_MSK)); + // config done + bus_w(addr, bus_r(addr) | ASIC_CONFIG_DONE_MSK); + LOG(logINFO, ("Setting ASIC Defaults (0x%x)\n", bus_r(addr))); +} + int resetToDefaultDacs(int hardReset) { // reset defaults to hardcoded defaults if (hardReset) { diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index c84b10e03..6046fba9e 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -67,7 +67,8 @@ #define DEFAULT_CLK1_PHASE_DEG (270) #define DEFAULT_DBIT_PIPELINE (1) -#define DEFAULT_ASIC_CONFIG_VALUE (0x80350000) +#define DEFAULT_ASIC_DOUT_RDY_SRC (0x5) +#define DEFAULT_ASIC_DOUT_RDY_DLY (0x3) #define VETO_DATA_SIZE (160) typedef struct { diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index 4bf1a0cd8..cc0a97938 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -128,8 +128,10 @@ int resetToDefaultDacs(int hardReset); int getDefaultDac(enum DACINDEX index, enum detectorSettings sett, int *retval); int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value); #endif -#ifdef MYTHEN3D +#if defined(MYTHEN3D) || defined(GOTTHARD2D) void setASICDefaults(); +#endif +#ifdef MYTHEN3D void setADIFDefaults(); #endif #if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)