From: Hades User Date: Wed, 25 Oct 2017 09:10:32 +0000 (+0200) Subject: current status, mt X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=5c5809ce28aab37d5d2b5b751b28d15738bd8381;p=daqtools.git current status, mt --- diff --git a/base/serials_dirich_concentrator.db b/base/serials_dirich_concentrator.db index ed97313..d805085 100644 --- a/base/serials_dirich_concentrator.db +++ b/base/serials_dirich_concentrator.db @@ -2,5 +2,5 @@ 0010 0xca00000712ac3228 0020 0x3c00000711e47628 0030 0xfd00000712ac3328 - + 0999 0x7400000712a1eb28 diff --git a/thresholds/run_thresh_on_system.pl b/thresholds/run_thresh_on_system.pl index 2018d0d..c2ae259 100755 --- a/thresholds/run_thresh_on_system.pl +++ b/thresholds/run_thresh_on_system.pl @@ -20,6 +20,7 @@ my $opt_polarity = 0; my $opt_32channel = 0; my $opt_finetune = false; my $opt_sequential = false; +my $mode = "padiwa"; my $opt_verb; my $tool = "./thresholds_automatic.pl"; #my $tool = "./thresholds_automatic_jan.pl"; @@ -33,10 +34,16 @@ GetOptions ('h|help' => \$opt_help, 'f|finetune' => \$opt_finetune, 's|sequential' => \$opt_sequential, 't|tool=s' => \$tool, + 'm|mode=s' => \$mode, 'v|verb' => \$opt_verb); my $endpoints = get_ranges(\@opt_endpoints); + +if ($mode eq "dirich2") { + @opt_chains=(0); +} + my $chains = get_ranges(\@opt_chains); if( $opt_help ) { @@ -45,8 +52,8 @@ if( $opt_help ) { } -#print Dumper $endpoints; -#print Dumper $chains; +print Dumper $endpoints; +print Dumper $chains; if($opt_32channel == 1) { $opt_32channel="--32channel"; @@ -72,7 +79,7 @@ my %pids; foreach my $endpoint (@$endpoints) { foreach my $chain (@$chains) { my $endpoint = sprintf("0x%04x", $endpoint); - $command = "$tool -e $endpoint -o $opt_offset -c $chain -p $opt_polarity $opt_32channel $opt_finetune"; + $command = "$tool --endpoint $endpoint --offset $opt_offset --chain $chain --polarity $opt_polarity --mode=$mode $opt_32channel $opt_finetune"; print "command: $command\n"; if($opt_sequential) { diff --git a/thresholds/thresholds_automatic.pl b/thresholds/thresholds_automatic.pl index d8e229a..7fab87e 100755 --- a/thresholds/thresholds_automatic.pl +++ b/thresholds/thresholds_automatic.pl @@ -30,7 +30,7 @@ my $USE_LOCK = 0; my $hitregister = 0xc001; -my @valid_interval = (0x5000, 0xc000); +my @valid_interval = (0x4000, 0xc000); my $interval_step = ($valid_interval[1] - $valid_interval[0])/2; my $start_value = int ( ($valid_interval[1] + $valid_interval[0])/2 ); @@ -123,13 +123,13 @@ $logger->info($startup_str); trb_init_ports() or die trb_strerror(); -my @current_thresh = ($start_value) x 16; -my @best_thresh = (0) x 16; -my @hit_diff = (0) x 16; -my @crossed_thresh = (0) x 16; -my @interval_step = ($interval_step) x 16; +my @current_thresh = ($start_value) x 32; +my @best_thresh = (0) x 32; +my @hit_diff = (0) x 32; +my @crossed_thresh = (0) x 32; +my @interval_step = ($interval_step) x 32; -if (defined $opt_skip && $opt_skip < 15) { +if (defined $opt_skip && $opt_skip < 32) { $best_thresh[$opt_skip] = 0x7000; } @@ -152,11 +152,12 @@ my $old_rh_res; my $outermost_channel_loop_counter = 0; #set default values -my @zero_array = (0) x 16; +my @zero_array = ($mode eq "dirich2") ? (0) x 32 : (0) x 16 ; + write_thresholds($mode, $chain, \@zero_array); if($channel_by_channel == true) { - $outermost_channel_loop_counter = 15; + $outermost_channel_loop_counter = ($mode eq "dirich2") ? 31 : 15 ; } my @outermost_channel_loop = (0); @@ -198,7 +199,7 @@ while ($number_of_steps < $number_of_iterations || #print Dumper $rh_res; #print Dumper $old_rh_res; - my @iterate_loop = (0..15); + my @iterate_loop = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15); if($channel_by_channel) { @iterate_loop = ($current_channel_outer_loop); } @@ -275,12 +276,12 @@ while ($number_of_steps < $number_of_iterations || map { $_-= ($offset * $default_direction) } @best_thresh; write_thresholds($mode, $chain, \@best_thresh, $channel_to_set); -my $uid; +my $uid = 0; foreach my $i (reverse (0 .. 3)) { #print "send command: $endpoint , i: $i\n"; # read uids - $rh_res = Dmon::PadiwaSendCmd(0x10000000 | $i * 0x10000, $endpoint, $chain); - $uid .= sprintf("%04x", $rh_res->{$endpoint} &0xffff); + #$rh_res = Dmon::PadiwaSendCmd(0x10000000 | $i * 0x10000, $endpoint, $chain); + #$uid .= sprintf("%04x", $rh_res->{$endpoint} &0xffff); #print $uid; } @@ -289,7 +290,7 @@ my $str; #$logger_data->info(sprintf "endpoint: %04x, chain: %02d, uid: $uid", $endpoint, $chain); #$logger_data->info("\t".time); -my @range = (0 .. 15); +my @range = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15); if($channel_by_channel) { @range = ($current_channel_outer_loop .. $current_channel_outer_loop); @@ -334,7 +335,8 @@ sub read_thresholds { my $rh_res; # $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain); - foreach my $current_channel (0 .. 15) { + my @range = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15); + foreach my $current_channel (@range) { my $command; my $fixed_bits; @@ -382,10 +384,11 @@ sub write_thresholds { } ### old and wrong way #my $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain); - my @range = (0 .. 15); - if (defined $channel_to_set && $channel_to_set <16 ) { - @range = ($channel_to_set .. $channel_to_set); - #print "range: \n"; + my @range = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15); + + if (defined $channel_to_set && $channel_to_set <32 ) { + @range = ($channel_to_set .. $channel_to_set); + #print "range: \n"; } #print Dumper \@range; @@ -407,13 +410,24 @@ sub write_thresholds { $channel_shift = 16; } elsif ($mode eq "dirich2") { - $fixed_bits = 0x00800000; + $fixed_bits = 0x8 << 20; $shift_bits = 0; $channel_shift = 24; } $command = $fixed_bits | ($current_channel << $channel_shift) | ($ra_thresh->[$current_channel] << $shift_bits); - Dmon::PadiwaSendCmd($command,$endpoint, $chain); + + if ($mode eq "dirich2") { + if ($current_channel<16) { + Dmon::PadiwaSendCmd($command,$endpoint, 0); + } else { + Dmon::PadiwaSendCmd($command,$endpoint, 1); + } + + } elsif ($mode eq "padiwa") { + Dmon::PadiwaSendCmd($command,$endpoint, $chain); + } + } #sleep 10 if($current_channel == 15 && $chain==1); @@ -421,7 +435,6 @@ sub write_thresholds { if($USE_LOCK) { $share->unlock(); } - } sub send_command { diff --git a/tools/dirich_power_switch_serdes_polarity_and_default_dirich_off.txt b/tools/dirich_power_switch_serdes_polarity_and_default_dirich_off.txt index 10f1d7b..9da786d 100644 --- a/tools/dirich_power_switch_serdes_polarity_and_default_dirich_off.txt +++ b/tools/dirich_power_switch_serdes_polarity_and_default_dirich_off.txt @@ -1,2 +1,2 @@ 0xb6c1 2 -0xd580 0xffffffff +#0xd580 0xffffffff diff --git a/tools/power_cycle b/tools/power_cycle index 19b44b0..329d0e2 100755 --- a/tools/power_cycle +++ b/tools/power_cycle @@ -13,7 +13,7 @@ my $ra_setup = [ { host => "wiznet02:5000", ##idn => "HAMEG,HMP4040,021527872,HW50020001/SW2.41", idn => "HAMEG,HMP4040,103161,HW50020001/SW2.51", channels => [ 'clock', 'TDB', 'TBD', 'dirich'], - commands => {status => 'OUTPUT:STATE?', off => 'OUTPUT:SEL OFF', on => 'OUTPUT:SEL ON'} + commands => {status => 'OUTPUT:STATE?', off => 'OUTPUT:SEL OFF', on => 'OUTPUT:SEL ON', select_channel => 'INST OUT4'} }, { host => "wiznet03:5000", idn => "RIGOL TECHNOLOGIES,DP712,DP7B182500302,00.01.02", @@ -59,6 +59,9 @@ sub main { my $current_status = write_and_read($actual_setup->{commands}->{status}); print "current status: $current_status\n"; + print "select channel if appropriate for the device\n"; + write_and_read($actual_setup->{commands}->{select_channel}) if (defined $actual_setup->{commands}->{select_channel}); + print "turn off power supply channel\n"; write_and_read($actual_setup->{commands}->{off}); diff --git a/web/htdocs/tdc/tdc.htm b/web/htdocs/tdc/tdc.htm index 8b0a1f7..f01a42d 100644 --- a/web/htdocs/tdc/tdc.htm +++ b/web/htdocs/tdc/tdc.htm @@ -138,9 +138,9 @@ function update(data) { for(j=0;j"; else