]> jspc29.x-matter.uni-frankfurt.de Git - mimosis_chain.git/commitdiff
clean up
authorBenedikt Gutsche <b.gutsche@gsi.de>
Mon, 27 Feb 2023 13:18:48 +0000 (14:18 +0100)
committerBenedikt Gutsche <b.gutsche@gsi.de>
Mon, 27 Feb 2023 13:18:48 +0000 (14:18 +0100)
20 files changed:
scripts/Mimosis.pm
scripts/basicsettings.pl
scripts/basicsettings_read.pl [new file with mode: 0755]
scripts/basicsettings_write.pl [new file with mode: 0755]
scripts/conf/CONF_1out.pl [moved from scripts/CONF_1out.pl with 100% similarity]
scripts/conf/CONF_TEMPLATE.pl [moved from scripts/CONF_TEMPLATE.pl with 100% similarity]
scripts/conf/CONF_VCAS_2.pl [moved from scripts/CONF_VCAS_2.pl with 100% similarity]
scripts/conf/CONF_allregisters.pl [moved from scripts/CONF_allregisters.pl with 100% similarity]
scripts/conf/CONF_noise_M4.pl [moved from scripts/CONF_noise_M4.pl with 100% similarity]
scripts/conf/CONF_seq.pl [moved from scripts/CONF_seq.pl with 100% similarity]
scripts/conf/CONF_testmode_enable.pl [moved from scripts/CONF_testmode_enable.pl with 100% similarity]
scripts/dac_scan/dac_scan.pl
scripts/dac_scan/img/2023-02-21_13-32-29.png [new file with mode: 0644]
scripts/dac_scan/img/2023-02-21_14-50-13.png [new file with mode: 0644]
scripts/dac_scan/img/2023-02-21_14-51-13.png [new file with mode: 0644]
scripts/dac_scan/img/2023-02-24_14-44-15.png [new file with mode: 0644]
scripts/dac_scan/img/2023-02-25_17-22-55.png [new file with mode: 0644]
scripts/dac_scan/img/2023-02-25_17-27-35.png [new file with mode: 0644]
scripts/legacy/i2c_cmd.pl [new file with mode: 0755]
scripts/mimosis_i2c_cmd.pl

index c6145b38cf747067d79c0666b3c337bb49f7db06..1ab8731d76a20978c0633b690cccf39bb37bb467 100644 (file)
@@ -6,7 +6,7 @@ use HADES::TrbNet;
 use Time::HiRes qw(usleep);
 
 #use FileHandle;
-#use Data::Dumper;
+use Data::Dumper;
 
 sub adc_i2c_command {
 
@@ -47,6 +47,8 @@ sub mimosis_i2c_command {
             [ $reg_flag, $reg_data, 0x1 ], 3 );
         usleep(1000);
         my $reg_return = trb_register_read( $fpga, 0xde04 );
+
+        # print Dumper $reg_return;
         return $reg_return->{$fpga} & 0xffff;
     }
 }
@@ -66,20 +68,15 @@ sub mimosis_register_write {
 
 sub mimosis_register_read {
     my ( $fpga, $mimosis_reg ) = @_;
-    my ( $addr, $cmd, $data );
 
-    $addr = 0x12;
-    $cmd  = ( $mimosis_reg >> 8 );
-    $data = ( $mimosis_reg & 0xff );
-    mimosis_i2c_command( $fpga, $addr, $cmd, $data, 0, 0, 0 );
+    my $cmd  = ( $mimosis_reg >> 8 );
+    my $data = ( $mimosis_reg & 0xff );
 
-    # printf( "%x %x %x %x\n", $fpga, $addr, $cmd, $data );
-    usleep(1000);
-    $addr = 0x15;
-    $val  = mimosis_i2c_command( $fpga, $addr, 0, 0, 1, 1, 0 );
+    mimosis_i2c_command( $fpga, 0x12, 0x0, $mimosis_reg, 0, 1, 1 );
 
-    # printf( "%x\n", $val );
-    return $val;
+    # printf( "%x %x %x\n", $fpga, $cmd, $data );
+    usleep(1000);
+    return mimosis_i2c_command( $fpga, 0x15, 0x0, 0x0, 1, 1, 0 );
 }
 
 1;
index 6263644db6e13c5b64348641416c55d6991ab3d3..f48f910c046c05419aa7556a3aad9ddc186240c9 100755 (executable)
@@ -39,8 +39,22 @@ foreach my $a (@config) {
 
         Mimosis::mimosis_register_write( $fpga, @$a[0], @$a[1] );
 
-        usleep(1000);
+        usleep(1000);
 
         # printf( "%x %x %x\n", $fpga, @$a[0], @$a[1] );
     }
 }
+
+foreach my $a (@config) {
+    if ( defined( @$a[1] ) )
+    {
+      my $val = Mimosis::mimosis_register_read $fpga, @$a[0];
+      usleep(1000);
+      unless(($val & 0xff) == @$a[1])
+        {
+          my $reg_return = trb_register_read $fpga, 0xde04;
+          my $status = ($reg_return->{$fpga} >> 16 ) & 0xff;
+          printf "%x %x    Status: %x\n", @$a[0], $val, $status;
+        }
+    }
+}
diff --git a/scripts/basicsettings_read.pl b/scripts/basicsettings_read.pl
new file mode 100755 (executable)
index 0000000..bd2ba8a
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+use warnings;
+use Getopt::Long;
+use HADES::TrbNet;
+use lib ".";
+use Mimosis;
+use Time::HiRes qw(usleep);
+
+my $fpga   = 0xa000;
+my @config = do $ARGV[0];
+
+Getopt::Long::Configure(qw(gnu_getopt));
+GetOptions(
+    "fpga|f=s" => \$fpga,
+    "file|d=s" => \$file,
+    "help|h"   => \$help,
+);
+
+if ($help) {
+    my $message = <<'END_MESSAGE';
+-f, --fpga          ->  Hex address of the FPGA. Must be provided, should not be a broadcast address.
+-d, --file          ->  File with configurations. Must be provided.
+-h, --help          ->  Print this help.
+END_MESSAGE
+    print $message;
+    exit();
+}
+
+defined($fpga) ? $fpga = hex($fpga) : die print("Must provide FPGA address.\n");
+defined($file)
+  ? @config = do $file
+  : die print("Must provide path to config file.\n");
+
+trb_init_ports() or die trb_strerror();
+
+foreach my $a (@config) {
+    if ( defined( @$a[1] ) )
+    {
+      my $val = Mimosis::mimosis_register_read $fpga, @$a[0];
+      usleep(1000);
+      my $reg_return = trb_register_read $fpga, 0xde04;
+      my $status = ($reg_return->{$fpga} >> 16 ) & 0xff;
+      usleep(1000);
+      if ( ($val & 0xff) != @$a[1] )
+      {
+        printf "%x %x %x\n", @$a[0], $val, $status;
+      }
+      else
+      {
+        printf "%x %x\n", @$a[0], $val;
+      }
+    }
+}
diff --git a/scripts/basicsettings_write.pl b/scripts/basicsettings_write.pl
new file mode 100755 (executable)
index 0000000..ea08dec
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+use warnings;
+use Getopt::Long;
+use HADES::TrbNet;
+use lib ".";
+use Mimosis;
+use Time::HiRes qw(usleep);
+
+my $fpga   = 0xa000;
+my @config = do $ARGV[0];
+
+Getopt::Long::Configure(qw(gnu_getopt));
+GetOptions(
+    "fpga|f=s" => \$fpga,
+    "file|d=s" => \$file,
+    "help|h"   => \$help,
+);
+
+if ($help) {
+    my $message = <<'END_MESSAGE';
+-f, --fpga          ->  Hex address of the FPGA. Must be provided, should not be a broadcast address.
+-d, --file          ->  File with configurations. Must be provided.
+-h, --help          ->  Print this help.
+END_MESSAGE
+    print $message;
+    exit();
+}
+
+defined($fpga) ? $fpga = hex($fpga) : die print("Must provide FPGA address.\n");
+defined($file)
+  ? @config = do $file
+  : die print("Must provide path to config file.\n");
+
+trb_init_ports() or die trb_strerror();
+
+foreach my $a (@config) {
+    if ( defined( @$a[1] ) ) {
+        Mimosis::mimosis_register_write( $fpga, @$a[0], @$a[1] );
+        usleep(1000);
+    }
+}
similarity index 100%
rename from scripts/CONF_seq.pl
rename to scripts/conf/CONF_seq.pl
index 1c9e08749b8cbbad537f78c129d74ee838359f13..29e7c4fe35628c5101b8a83578c6c8525e35d587 100755 (executable)
@@ -67,6 +67,8 @@ open( v_FH, '>', $vmon_file ) or die $!;
 #MONVOLT
 for my $dac ( sort keys %vdac ) {    #loop over voltage DACs
 
+    printf "Scan: %x\n", $vdac{$dac};
+
     Mimosis::mimosis_register_write( $fpga, 0x0026, $dac );
     usleep(1000);
 
@@ -97,6 +99,8 @@ open( i_FH, '>', $imon_file ) or die $!;
 #MONCURR
 for my $dac ( sort keys %idac ) {    #loop over current DACs
 
+    printf "Scan: %x\n", $idac{$dac};
+
     Mimosis::mimosis_register_write( $fpga, 0x0025, $dac );
     usleep(1000);
 
@@ -126,6 +130,8 @@ open( o_FH, '>', $other_file ) or die $!;
 #MONVOLT_others
 for my $dac ( sort keys %odac ) {
 
+    printf "Scan: %x\n", $odac{$dac};
+
     Mimosis::mimosis_register_write( $fpga, 0x0026, $dac );
     usleep(1000);
 
diff --git a/scripts/dac_scan/img/2023-02-21_13-32-29.png b/scripts/dac_scan/img/2023-02-21_13-32-29.png
new file mode 100644 (file)
index 0000000..8ce133d
Binary files /dev/null and b/scripts/dac_scan/img/2023-02-21_13-32-29.png differ
diff --git a/scripts/dac_scan/img/2023-02-21_14-50-13.png b/scripts/dac_scan/img/2023-02-21_14-50-13.png
new file mode 100644 (file)
index 0000000..57974cc
Binary files /dev/null and b/scripts/dac_scan/img/2023-02-21_14-50-13.png differ
diff --git a/scripts/dac_scan/img/2023-02-21_14-51-13.png b/scripts/dac_scan/img/2023-02-21_14-51-13.png
new file mode 100644 (file)
index 0000000..236e022
Binary files /dev/null and b/scripts/dac_scan/img/2023-02-21_14-51-13.png differ
diff --git a/scripts/dac_scan/img/2023-02-24_14-44-15.png b/scripts/dac_scan/img/2023-02-24_14-44-15.png
new file mode 100644 (file)
index 0000000..5d22a7b
Binary files /dev/null and b/scripts/dac_scan/img/2023-02-24_14-44-15.png differ
diff --git a/scripts/dac_scan/img/2023-02-25_17-22-55.png b/scripts/dac_scan/img/2023-02-25_17-22-55.png
new file mode 100644 (file)
index 0000000..57ac4bb
Binary files /dev/null and b/scripts/dac_scan/img/2023-02-25_17-22-55.png differ
diff --git a/scripts/dac_scan/img/2023-02-25_17-27-35.png b/scripts/dac_scan/img/2023-02-25_17-27-35.png
new file mode 100644 (file)
index 0000000..96258ed
Binary files /dev/null and b/scripts/dac_scan/img/2023-02-25_17-27-35.png differ
diff --git a/scripts/legacy/i2c_cmd.pl b/scripts/legacy/i2c_cmd.pl
new file mode 100755 (executable)
index 0000000..11720fc
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -I.
+
+use warnings;
+use Getopt::Long;
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use lib ".";
+use Mimosis;
+
+my ( $fpga, $addr, $cmd, $cmd_t, $data, $data_t, $word );
+
+Getopt::Long::Configure(qw(gnu_getopt));
+GetOptions(
+    "fpga|f=s" => \$fpga,
+    "addr|a=s" => \$addr,
+    "cmd|c=s"  => \$cmd_t,
+    "data|d=s" => \$data_t,
+    "word|w"   => \$word,
+    "help|h"   => \$help_t,
+);
+
+if ($help_t) {
+    print("Usage:\n");
+    print("-f, --fpga:\n");
+    print("-a, --addr:\n");
+    print("-c, --cmd:\n");
+    print("-d, --data:\n");
+    print("-w, --word:\n");
+    print("-h, --help:\n");
+}
+
+trb_init_ports() or die trb_strerror();
+
+defined($fpga) ? $fpga = hex($fpga) : die print("Must provide FPGA address.\n");
+defined($addr) ? $addr = hex($addr) : die print("Must provide I2C address.\n");
+$cmd  = defined($cmd_t)  ? hex($cmd_t)  : 0x0;
+$data = defined($data_t) ? hex($data_t) : 0x0;
+
+$val = Mimosis::send_i2c_command( $fpga, $addr, $cmd, $data, !defined($data_t),
+    !defined($cmd_t), defined($word) );
+if ( not defined($data_t) ) {
+    printf( "%x\n", $val );
+}
index 8d9127a26eac5ec66eb330d403832fad7a697ac2..3165d214c6a8a320712b9966dfe3bfdde1fefcc9 100755 (executable)
@@ -29,8 +29,8 @@ END_MESSAGE
 }
 
 if ( defined $fpga_t && defined $reg_t) {
-       $fpga_t = hex $fpga_t  if ( $fpga_t =~ /^0x/ );
-       $reg_t  = hex $reg_t if ( $reg_t =~ /^0x/ );
+       $fpga_t = hex $fpga_t if ( $fpga_t =~ /^0x/ );
+       $reg_t  = hex $reg_t  if ( $reg_t =~ /^0x/ );
 }
 else {die print "Must provide FPGA address and register.\n";}