mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
gotthard2: reversing order of adc channels to chip
This commit is contained in:
parent
410f38c804
commit
df3ae7f409
Binary file not shown.
@ -1757,8 +1757,9 @@ int setInjectChannel(int offset, int increment) {
|
|||||||
char buffer[17];
|
char buffer[17];
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
int startCh = 4; // 4 due to padding
|
int startCh = 4; // 4 due to padding
|
||||||
for (int ich = startCh + offset; ich < startCh + NCHAN;
|
// reversing the channels sent (offset 0 is 127, 50 is 77 etc..)
|
||||||
ich = ich + increment) {
|
for (int ich = startCh + NCHAN - 1 - offset; ich >= startCh;
|
||||||
|
ich -= increment) {
|
||||||
int byteIndex = ich / 8;
|
int byteIndex = ich / 8;
|
||||||
int bitIndex = ich % 8;
|
int bitIndex = ich % 8;
|
||||||
buffer[byteIndex] |= (1 << (8 - 1 - bitIndex));
|
buffer[byteIndex] |= (1 << (8 - 1 - bitIndex));
|
||||||
@ -1829,6 +1830,12 @@ int configureASICVetoReference(int chipIndex, int *values) {
|
|||||||
const int lenTotalBits = padding + lenBits + ASIC_ADDR_MAX_BITS; // 1800
|
const int lenTotalBits = padding + lenBits + ASIC_ADDR_MAX_BITS; // 1800
|
||||||
const int len = lenTotalBits / 8; // 225
|
const int len = lenTotalBits / 8; // 225
|
||||||
|
|
||||||
|
// reversing the values sent to the chip
|
||||||
|
int revValues[NCHAN] = {};
|
||||||
|
for (int i = 0; i < NCHAN; ++i) {
|
||||||
|
revValues[i] = values[NCHAN - 1 - i];
|
||||||
|
}
|
||||||
|
|
||||||
// assign each bit into 4 + 1792 into byte array
|
// assign each bit into 4 + 1792 into byte array
|
||||||
uint8_t commandBytes[lenTotalBits];
|
uint8_t commandBytes[lenTotalBits];
|
||||||
memset(commandBytes, 0, sizeof(commandBytes));
|
memset(commandBytes, 0, sizeof(commandBytes));
|
||||||
@ -1837,7 +1844,7 @@ int configureASICVetoReference(int chipIndex, int *values) {
|
|||||||
// loop through all bits in a value
|
// loop through all bits in a value
|
||||||
for (int iBit = 0; iBit < lenDataBitsPerchannel; ++iBit) {
|
for (int iBit = 0; iBit < lenDataBitsPerchannel; ++iBit) {
|
||||||
commandBytes[offset++] =
|
commandBytes[offset++] =
|
||||||
((values[ich] >> (lenDataBitsPerchannel - 1 - iBit)) & 0x1);
|
((revValues[ich] >> (lenDataBitsPerchannel - 1 - iBit)) & 0x1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1861,7 +1868,7 @@ int configureASICVetoReference(int chipIndex, int *values) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all chips
|
// all chips (saving unreversed values)
|
||||||
if (chipIndex == -1) {
|
if (chipIndex == -1) {
|
||||||
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
||||||
for (int ichip = 0; ichip < NCHIP; ++ichip) {
|
for (int ichip = 0; ichip < NCHIP; ++ichip) {
|
||||||
@ -1956,10 +1963,10 @@ int setADCConfiguration(int chipIndex, int adcIndex, int value) {
|
|||||||
chipmin = chipIndex;
|
chipmin = chipIndex;
|
||||||
chipmax = chipIndex + 1;
|
chipmax = chipIndex + 1;
|
||||||
}
|
}
|
||||||
// specific adc
|
// specific adc (reversing adc when sending to chip)
|
||||||
if (adcIndex != -1) {
|
if (adcIndex != -1) {
|
||||||
adcmin = adcIndex;
|
adcmin = NADC - 1 - adcIndex;
|
||||||
adcmax = adcIndex + 1;
|
adcmax = NADC - adcIndex;
|
||||||
}
|
}
|
||||||
// update values
|
// update values
|
||||||
for (int i = chipmin; i < chipmax; ++i) {
|
for (int i = chipmin; i < chipmax; ++i) {
|
||||||
@ -2037,10 +2044,10 @@ int getADCConfiguration(int chipIndex, int adcIndex) {
|
|||||||
chipmin = chipIndex;
|
chipmin = chipIndex;
|
||||||
chipmax = chipIndex + 1;
|
chipmax = chipIndex + 1;
|
||||||
}
|
}
|
||||||
// specific adc
|
// specific adc (reversing adc when sending to chip)
|
||||||
if (adcIndex != -1) {
|
if (adcIndex != -1) {
|
||||||
adcmin = adcIndex;
|
adcmin = NADC - 1 - adcIndex;
|
||||||
adcmax = adcIndex + 1;
|
adcmax = NADC - adcIndex;
|
||||||
}
|
}
|
||||||
int val = adcConfiguration[chipmin][adcmin];
|
int val = adcConfiguration[chipmin][adcmin];
|
||||||
|
|
||||||
@ -2178,8 +2185,7 @@ int configureASICGlobalSettings() {
|
|||||||
value |= ASIC_EXT_TIMING_MSK;
|
value |= ASIC_EXT_TIMING_MSK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG(logINFO,
|
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
||||||
("\tSending Global Chip settings:0x%x (filter:%d, "
|
|
||||||
"cdsgain:%d)\n",
|
"cdsgain:%d)\n",
|
||||||
value, filter, cdsGain));
|
value, filter, cdsGain));
|
||||||
|
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
#define APIMYTHEN3 0x200723
|
#define APIMYTHEN3 0x200723
|
||||||
#define APIMOENCH 0x200722
|
#define APIMOENCH 0x200722
|
||||||
#define APIEIGER 0x200723
|
#define APIEIGER 0x200723
|
||||||
#define APIGOTTHARD2 0x200723
|
|
||||||
#define APIJUNGFRAU 0x200728
|
#define APIJUNGFRAU 0x200728
|
||||||
|
#define APIGOTTHARD2 0x200728
|
||||||
|
Loading…
x
Reference in New Issue
Block a user