]> jspc29.x-matter.uni-frankfurt.de Git - hades_mdc_settings.git/commitdiff
added helperscripts
authorhadaq <hadaq@hades33.gsi.de>
Fri, 6 Mar 2026 15:35:48 +0000 (16:35 +0100)
committerhadaq <hadaq@hades33.gsi.de>
Fri, 6 Mar 2026 15:35:48 +0000 (16:35 +0100)
helperscripts/clear_MDC_trigger_errors.sh [new file with mode: 0755]
helperscripts/pasttrec_tail_cancel_settings.sh [new file with mode: 0755]
helperscripts/read_1wire_single_sensor.pl [new file with mode: 0755]
helperscripts/set_indiv_threshold.sh [new file with mode: 0755]
helperscripts/set_spikerej_0ns.sh [new file with mode: 0755]
helperscripts/set_spikerej_19ns.sh [new file with mode: 0755]

diff --git a/helperscripts/clear_MDC_trigger_errors.sh b/helperscripts/clear_MDC_trigger_errors.sh
new file mode 100755 (executable)
index 0000000..854064a
--- /dev/null
@@ -0,0 +1 @@
+trbcmd w 0xffff 0x20 0x30
diff --git a/helperscripts/pasttrec_tail_cancel_settings.sh b/helperscripts/pasttrec_tail_cancel_settings.sh
new file mode 100755 (executable)
index 0000000..406a534
--- /dev/null
@@ -0,0 +1,114 @@
+#! /bin/bash
+#####################################
+### gain: 4 mV/fC
+#~ peaking time: 15 ns
+#~ tail cancellation shaper settings:
+#~ TC1C=13.5 pF, TC1R=19 kΩ,
+#~ TC2C=1.5 pF, TC2R=23 kΩ
+#~ trbcmd w 0xfe91 0xa200 0x50011
+#~ trbcmd w 0xfe91 0xa201 0x5012c
+#~ trbcmd w 0xfe91 0xa202 0x50236
+#~ trbcmd w 0xfe91 0xa210 0x50011
+#~ trbcmd w 0xfe91 0xa211 0x5012c
+#~ trbcmd w 0xfe91 0xa212 0x50236
+#~ trbcmd w 0xfe91 0xa220 0x50011
+#~ trbcmd w 0xfe91 0xa221 0x5012c
+#~ trbcmd w 0xfe91 0xa222 0x50236
+#~ trbcmd w 0xfe91 0xa230 0x50011
+#~ trbcmd w 0xfe91 0xa231 0x5012c
+#~ trbcmd w 0xfe91 0xa232 0x50236
+#####################################
+### gain: 4 mV/fC
+#~ peaking time: 10 ns
+#~ tail cancellation shaper settings:
+#~ TC1C=13.5 pF, TC1R=19 kΩ,
+#~ TC2C=1.5 pF, TC2R=23 kΩ
+#~ trbcmd w 0xfe91 0xa200 0x50010
+#~ trbcmd w 0xfe91 0xa201 0x5012c
+#~ trbcmd w 0xfe91 0xa202 0x50236
+#~ trbcmd w 0xfe91 0xa210 0x50010
+#~ trbcmd w 0xfe91 0xa211 0x5012c
+#~ trbcmd w 0xfe91 0xa212 0x50236
+#~ trbcmd w 0xfe91 0xa220 0x50010
+#~ trbcmd w 0xfe91 0xa221 0x5012c
+#~ trbcmd w 0xfe91 0xa222 0x50236
+#~ trbcmd w 0xfe91 0xa230 0x50010
+#~ trbcmd w 0xfe91 0xa231 0x5012c
+#~ trbcmd w 0xfe91 0xa232 0x50236
+#####################################
+#####################################
+### gain: 4 mV/fC
+#~ peaking time: 10 ns
+#~ tail cancellation shaper settings:
+#~ TC1C=6.0 pF, TC1R=23 kΩ,
+#~ TC2C=0.6 pF, TC2R=11 kΩ
+# trbcmd w 0xfe91 0xa200 0x50010
+# trbcmd w 0xfe91 0xa201 0x50105
+# trbcmd w 0xfe91 0xa202 0x50202
+# trbcmd w 0xfe91 0xa210 0x50010
+# trbcmd w 0xfe91 0xa211 0x50105
+# trbcmd w 0xfe91 0xa212 0x50202
+# trbcmd w 0xfe91 0xa220 0x50010
+# trbcmd w 0xfe91 0xa221 0x50105
+# trbcmd w 0xfe91 0xa222 0x50202
+# trbcmd w 0xfe91 0xa230 0x50010
+# trbcmd w 0xfe91 0xa231 0x50105
+# trbcmd w 0xfe91 0xa232 0x50202
+#####################################
+#####################################
+### gain: 4 mV/fC
+#~ peaking time: 10 ns
+#~ tail cancellation shaper settings:
+#~ TC1C=7.5 pF, TC1R=27 kΩ,
+#~ TC2C=0.75 pF, TC2R=17 kΩ
+# trbcmd w 0xfe91 0xa200 0x50010
+# trbcmd w 0xfe91 0xa201 0x5010E
+# trbcmd w 0xfe91 0xa202 0x5020C
+# trbcmd w 0xfe91 0xa210 0x50010
+# trbcmd w 0xfe91 0xa211 0x5010E
+# trbcmd w 0xfe91 0xa212 0x5020C
+# trbcmd w 0xfe91 0xa220 0x50010
+# trbcmd w 0xfe91 0xa221 0x5010E
+# trbcmd w 0xfe91 0xa222 0x5020C
+# trbcmd w 0xfe91 0xa230 0x50010
+# trbcmd w 0xfe91 0xa231 0x5010E
+# trbcmd w 0xfe91 0xa232 0x5020C
+#####################################
+#####################################
+### gain: 4 mV/fC
+#~ peaking time: 10 ns
+#~ tail cancellation shaper settings:
+#~ TC1C=15 pF, TC1R=7 kΩ, --> 50131
+#~ TC2C=0.6 pF, TC2R=8 kΩ --> 50201
+# trbcmd w 0xfe91 0xa200 0x50010
+# trbcmd w 0xfe91 0xa201 0x50131
+# trbcmd w 0xfe91 0xa202 0x50201
+# trbcmd w 0xfe91 0xa210 0x50010
+# trbcmd w 0xfe91 0xa211 0x50131
+# trbcmd w 0xfe91 0xa212 0x50201
+# trbcmd w 0xfe91 0xa220 0x50010
+# trbcmd w 0xfe91 0xa221 0x50131
+# trbcmd w 0xfe91 0xa222 0x50201
+# trbcmd w 0xfe91 0xa230 0x50010
+# trbcmd w 0xfe91 0xa231 0x50131
+# trbcmd w 0xfe91 0xa232 0x50201
+#####################################
+#####DEFUALT black setting #####################
+### gain: 4 mV/fC
+#~ peaking time: 10 ns
+#~ tail cancellation shaper settings:
+#~ TC1C=10.5 pF, TC1R=27 kΩ, --> 5011E
+#~ TC2C=0.9 pF, TC2R= 20 kΩ --> 50215
+trbcmd w 0xfe91 0xa200 0x50010
+trbcmd w 0xfe91 0xa201 0x5011E
+trbcmd w 0xfe91 0xa202 0x50215
+trbcmd w 0xfe91 0xa210 0x50010
+trbcmd w 0xfe91 0xa211 0x5011E
+trbcmd w 0xfe91 0xa212 0x50215
+trbcmd w 0xfe91 0xa220 0x50010
+trbcmd w 0xfe91 0xa221 0x5011E
+trbcmd w 0xfe91 0xa222 0x50215
+trbcmd w 0xfe91 0xa230 0x50010
+trbcmd w 0xfe91 0xa231 0x5011E
+trbcmd w 0xfe91 0xa232 0x50215
+#####################################
\ No newline at end of file
diff --git a/helperscripts/read_1wire_single_sensor.pl b/helperscripts/read_1wire_single_sensor.pl
new file mode 100755 (executable)
index 0000000..4802bc1
--- /dev/null
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+
+use Getopt::Long;
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use Data::Dumper;
+
+
+trb_init_ports() or die trb_strerror();
+
+
+i2c_cmd(0xfe90,0x30,0xd2,0xe1);
+usleep(1000);
+
+i2c_cmd(0xfe90,0x30,,0xb4);
+usleep(2000);
+
+i2c_cmd(0xfe90,0x30,0xa5,0xcc);
+usleep(2000);
+i2c_cmd(0xfe90,0x30,0xa5,0x44);
+usleep(2000);
+
+sleep(1);
+
+i2c_cmd(0xfe90,0x30,,0xb4);
+usleep(2000);
+
+i2c_cmd(0xfe90,0x30,0xa5,0xcc);
+usleep(2000);
+i2c_cmd(0xfe90,0x30,0xa5,0xbe);
+usleep(2000);
+
+i2c_cmd(0xfe90,0x30,0x96);
+usleep(2000);
+i2c_cmd(0xfe90,0x30,0xe1,0xe1);
+usleep(2000);
+my $ret1 = i2c_cmd(0xfe90,0x30,0xe1);
+
+i2c_cmd(0xfe90,0x30,0x96);
+usleep(2000);
+i2c_cmd(0xfe90,0x30,0xe1,0xe1);
+usleep(2000);
+my $ret2 = i2c_cmd(0xfe90,0x30,0xe1);
+
+foreach my $f (keys %$ret1) {
+  next if ($ret1->{$f} == 0xff && $ret2->{$f} == 0xff);
+  printf("%04x\t%2.1f\n",$f,($ret1->{$f}+($ret2->{$f} << 8))/16);
+  }
+
+
+
+sub i2c_cmd {
+  my ($fpga,$addr,$cmd,$byte1,$byte2) = @_;
+  my $reg_data = (($byte2||0) << 24) + (($byte1||0) << 16) + (($cmd||0) << 8) + 0x80 + ($addr >> 1);
+  my $reg_flag = 0;
+  my $word = (defined $byte2)?1:0;
+  
+  if(defined($cmd)) {
+    $reg_flag = $word? 0x001 : 0x000;
+    }
+  else {
+    $reg_flag = $word? 0x011 : 0x010;
+    }
+
+  if(defined($byte1)) {
+    trb_register_write_mem($fpga,0xd681,0,[$reg_flag,$reg_data],2);
+    }
+  else {
+    $reg_flag |= 0x100;
+    trb_register_write_mem($fpga,0xd681,0,[$reg_flag,$reg_data],2);
+    usleep(1000);
+    $reg_return = trb_register_read($fpga,0xd684);
+
+    my $ret;
+    foreach my $f (keys %$reg_return) {
+      $ret->{$f} = $reg_return->{$f}&($word?0xffff:0xff);
+      }
+    return $ret;   
+    }
+  }
+
+
diff --git a/helperscripts/set_indiv_threshold.sh b/helperscripts/set_indiv_threshold.sh
new file mode 100755 (executable)
index 0000000..95df6a3
--- /dev/null
@@ -0,0 +1,45 @@
+THRES=$2
+S=$1
+for mbo in  0 1 2 3 4 5 6 7 8 9 a b c d e f 
+    do 
+    for tdc in  0 1 2 
+        do
+        for PT in  0 1 2 3 
+            do
+            ./pasttrec_set_threshold.pl  -b 0xa$S$mbo$tdc -p $PT $THRES
+            done 
+        done
+    done
+
+# ## II1 MBO A
+# ./pasttrec_set_threshold.pl  -b 0xa7a0 -p 0 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7a0 -p 1 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7a0 -p 2 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7a0 -p 3 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7a1 -p 0 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7a1 -p 1 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7a1 -p 2 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7a1 -p 3 $THRES
+# ## II1 MBO b
+# ./pasttrec_set_threshold.pl  -b 0xa7B0 -p 0 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7B0 -p 1 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7B0 -p 2 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7b0 -p 3 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7b1 -p 0 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7b1 -p 1 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7b1 -p 2 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7b1 -p 3 $THRES
+# 
+# ## II2 MBO E
+# ./pasttrec_set_threshold.pl  -b 0xa8e0 -p 0 50
+# #./pasttrec_set_threshold.pl  -b 0xa7e0 -p 1 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa7e0 -p 2 100
+# ./pasttrec_set_threshold.pl  -b 0xa8e0 -p 3 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e1 -p 0 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e1 -p 1 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e1 -p 2 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e1 -p 3 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e2 -p 0 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e2 -p 1 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e2 -p 2 $THRES
+# ./pasttrec_set_threshold.pl  -b 0xa8e2 -p 3 $THRES
diff --git a/helperscripts/set_spikerej_0ns.sh b/helperscripts/set_spikerej_0ns.sh
new file mode 100755 (executable)
index 0000000..9bed5d3
--- /dev/null
@@ -0,0 +1 @@
+trbcmd w 0xfe91 0xc001 0x14109001
diff --git a/helperscripts/set_spikerej_19ns.sh b/helperscripts/set_spikerej_19ns.sh
new file mode 100755 (executable)
index 0000000..529270e
--- /dev/null
@@ -0,0 +1 @@
+trbcmd w 0xfe91 0xc001 0x14109301