Added optional histogram output in chip test

This commit is contained in:
2016-12-05 14:03:06 +01:00
parent bcc7e30369
commit 118ded9ac0
3 changed files with 37 additions and 9 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ void print_help()
puts("board <i>|<i1> <i2>|all Address individual board/range/all boards");
puts("calib [dir] Response Calibration. Use dir=\"area\" for MEG");
puts("chn [n] Set number of channels: 8, 4, 2, 1");
puts("ct Chip Test");
puts("ct [histo] Chip Test [show histo]");
puts("del <0|1> Switch delayed start on/off");
puts("dir Show CF directory");
puts("dmode <0|1> Set Domino mode 0=single, 1=cont.");
@@ -1333,7 +1333,7 @@ void cmd_loop()
else {
puts("Press 'q' to quit, any other key to repeat test.\n");
do {
b->ChipTest();
b->ChipTest(param[1][0] > 0);
b->SetStandbyMode(1);
for (i=0 ; i<8 ; i++)
b->SetDAC(i, 0);
+1 -1
View File
@@ -622,7 +622,7 @@ public:
int GetTransport() const { return fTransport; }
void RegisterTest(void);
int RAMTest(int flag);
int ChipTest();
int ChipTest(int flag);
unsigned int GetCtrlReg(void);
unsigned short GetConfigReg(void);
unsigned int GetStatusReg(void);
+34 -6
View File
@@ -3031,7 +3031,7 @@ int DRSBoard::RAMTest(int flag)
/*------------------------------------------------------------------*/
int DRSBoard::ChipTest()
int DRSBoard::ChipTest(int flag)
{
int i, j, tc, n_error, test_board, t;
double freq, real_freq, max_freq;
@@ -3206,12 +3206,20 @@ int DRSBoard::ChipTest()
GetWave(0, i, wf1[i], false, tc, 0, true);
// check if more than 500 mV lost
for (i=0 ; i<9 ; i++)
for (j=0 ; j<1024 ; j++) {
if (wf1[i][j] < 0 && lc[i][j] == 0) {
lc[i][j] = 0.15 * (wf0[i][j]-wf1[i][j])/t; // lc = C * delta_u / delta_t in [pA]
if (test_board) {
for (i=0 ; i<9 ; i++)
for (j=0 ; j<1024 ; j++) {
if (wf1[i][j] < 0 && lc[i][j] == 0) {
lc[i][j] = 0.15 * (wf0[i][j]-wf1[i][j])/t; // lc = C * delta_u / delta_t in [pA]
}
}
}
} else {
for (i=0 ; i<8 ; i+=2)
for (j=0 ; j<1024 ; j++)
if (wf1[i][j] < 0 && lc[i][j] == 0) {
lc[i][j] = 0.15 * (wf0[i][j]-wf1[i][j])/t; // lc = C * delta_u / delta_t in [pA]
}
}
// check if all cells drained
if (test_board) {
@@ -3236,10 +3244,19 @@ int DRSBoard::ChipTest()
// calculate statistics over leakage current
double sum = 0, lcmax = 0;
int n = 0, imax, jmax;
int histo[100];
memset(histo, 0, sizeof(histo));
for (i=0 ; i<9 ; i++)
for (j=0 ; j<1024 ; j++)
if (lc[i][j] > 0) {
int bin = (int)lc[i][j];
if (bin == 0)
bin = 0;
if (bin > 99)
bin = 99;
histo[bin]++;
sum += lc[i][j];
n++;
if (lc[i][j] > lcmax) {
@@ -3249,6 +3266,17 @@ int DRSBoard::ChipTest()
}
}
printf("Leakage current [pA]: %1.1lf average, %1.1lf max [%d/%d]\n", sum/n, lcmax, imax, jmax);
if (flag) {
printf("Distrubtuion [pA-pA] N:\n");
for (i=99 ; i>0 ; i--)
if (histo[i])
break;
int hmax = i;
for (i=0 ; i<=hmax ; i++) {
printf("%d %d\n", i, histo[i]);
}
}
}
/* count errors */