mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
ctb server: power regulator adjusted for precision
This commit is contained in:
parent
d876cb6da6
commit
775bde76c9
@ -1,6 +1,6 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER #-DDEBUG1 #-DJCTB -DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -DDEBUG1 #-DJCTB -DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lstdc++
|
||||
|
||||
PROGS = ctbDetectorServer
|
||||
|
@ -1215,7 +1215,8 @@ int getADCIndexFromDACIndex(enum DACINDEX ind) {
|
||||
}
|
||||
|
||||
int isPowerValid(int val) {
|
||||
if (val != 0 && (val < POWER_RGLTR_MIN || val > POWER_RGLTR_MAX)) {
|
||||
// not power_rgltr_max because it is allowed only upto vchip max - 200
|
||||
if (val != 0 && (val != LTC2620_PWR_DOWN_VAL) && (val < POWER_RGLTR_MIN || val > (VCHIP_MAX_MV - VCHIP_POWER_INCRMNT))) {//POWER_RGLTR_MAX)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@ -1314,10 +1315,7 @@ void setPower(enum DACINDEX ind, int val) {
|
||||
// convert it to dac (power off is anyway done with power enable)
|
||||
if (val != LTC2620_PWR_DOWN_VAL) {
|
||||
FILE_LOG(logDEBUG1, ("Convert Power of %d mV to dac units\n", val));
|
||||
/*
|
||||
val = (double)val * 0.95;
|
||||
FILE_LOG(logDEBUG1, ("Convert new Power of %d mV to dac units\n", val));
|
||||
*/
|
||||
|
||||
int dacval = -1;
|
||||
// convert voltage to dac
|
||||
if (ConvertToDifferentRange(POWER_RGLTR_MIN, POWER_RGLTR_MAX, LTC2620_MAX_VAL, LTC2620_MIN_VAL,
|
||||
@ -1326,11 +1324,13 @@ void setPower(enum DACINDEX ind, int val) {
|
||||
ind, val, POWER_RGLTR_MIN, vchip - VCHIP_POWER_INCRMNT));
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
||||
if (dacval > LTC2620_MAX_VAL)
|
||||
dacval = LTC2620_MAX_VAL;
|
||||
FILE_LOG(logDEBUG1, ("Converted new dac val: %d\n", dacval));
|
||||
*/
|
||||
if (dacval < LTC2620_MIN_VAL)
|
||||
dacval = LTC2620_MIN_VAL;
|
||||
FILE_LOG(logDEBUG1, ("Adjusted for tolerance, hence within limits, new dac val: %d\n", dacval));
|
||||
|
||||
// set and power on/ update dac
|
||||
FILE_LOG(logINFO, ("Setting P%d (DAC %d): %d dac (%d mV)\n", adcIndex, ind, dacval, val));
|
||||
setDAC(ind, dacval, 0);
|
||||
|
@ -69,10 +69,10 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
|
||||
#define HIGHVOLTAGE_MAX (200) // min dac val
|
||||
#define DAC_MIN_MV (0)
|
||||
#define DAC_MAX_MV (2500)
|
||||
#define VCHIP_MIN_MV (1700)
|
||||
#define VCHIP_MAX_MV (2700) // min dac val
|
||||
#define POWER_RGLTR_MIN (600)
|
||||
#define POWER_RGLTR_MAX (2500) // min dac val
|
||||
#define VCHIP_MIN_MV (1673)
|
||||
#define VCHIP_MAX_MV (2668) // min dac val
|
||||
#define POWER_RGLTR_MIN (636)
|
||||
#define POWER_RGLTR_MAX (2638) // min dac val (not vchip-max) because of dac conversions
|
||||
#define VCHIP_POWER_INCRMNT (200)
|
||||
|
||||
/* Defines in the Firmware */
|
||||
|
@ -38,7 +38,7 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin, int outpu
|
||||
}
|
||||
*outputValue = value;
|
||||
|
||||
FILE_LOG(logDEBUG1, (" Converted Ouput Value: %d\n", *outputValue));
|
||||
FILE_LOG(logDEBUG1, (" Converted Output Value: %d\n", *outputValue));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ int set_dac(int file_des) {
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else if (!isPowerValid(val)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Could not set power. Power regulator %d should be between %d and %d mV\n", ind, POWER_RGLTR_MIN, POWER_RGLTR_MAX);
|
||||
sprintf(mess,"Could not set power. Power regulator %d should be between %d and %d mV\n", ind, POWER_RGLTR_MIN, (VCHIP_MAX_MV - VCHIP_POWER_INCRMNT));
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
setPower(serverDacIndex, val);
|
||||
|
@ -1196,7 +1196,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page settings
|
||||
- <b>v_io [i] mv</b> Sets/gets value for Vio on the new chiptest board. Must be in mV. \c Returns \c (int ["mV"])
|
||||
- <b>v_io [i] mv</b> Sets/gets value for Vio on the new chiptest board. Must be in mV. It should be the first power regulator to be set after server start up (fpga reset). To change again, reset fpga first. \c Returns \c (int ["mV"])
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "v_io"; //
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDAC;
|
||||
|
Loading…
x
Reference in New Issue
Block a user