From: Maps Date: Thu, 9 Jun 2016 14:05:05 +0000 (+0200) Subject: Latest changes (testgui.pl, unpacker.cxx) in FFM X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=c45a5e9bb22d570604666ca8f383b1c3c86a51b4;p=mvdsensorcontrol.git Latest changes (testgui.pl, unpacker.cxx) in FFM --- diff --git a/Environment.pm b/Environment.pm index 6b3d977..8f0f1c2 100644 --- a/Environment.pm +++ b/Environment.pm @@ -19,8 +19,8 @@ use constant CONFDIR => JTAGROOTPATH."../mvdconfig/config/"; use constant SPECDIR => JTAGROOTPATH."specs/"; use constant PICTUREPATH => TEMPDIR."prevImgs/"; #path for images on webserver (absolute path) use constant PICTUREPATHREL => "../temp/prevImgs/"; #path for images on webserver relative to tools/ -use constant DUMPPATH => "/tmp/MAPS_PREV/"; #path for small hld dumps -use constant SHAREPATH => JTAGROOTPATH."share/"; #path for icons and misc stuff +use constant DUMPPATH => "/local.1/tmp/MAPS_PREV/"; #path for small hld dumps +use constant SHAREPATH => JTAGROOTPATH."share/"; #path for icons and misc stuff use constant SETUPFILE => SETUPDIR."testsetup.xml"; use constant SHMSYMLINK => JTAGROOTPATH."shm/"; diff --git a/tools/init_setup.pl b/tools/init_setup.pl index a5807b6..7db514b 100755 --- a/tools/init_setup.pl +++ b/tools/init_setup.pl @@ -76,8 +76,12 @@ my $name = $db->getDocumentElement->getAttribute('name'); my $ccu = $dbsys->getDocumentElement->findnodes('ccu')->[0]->getAttribute('address'); print STDERR "Loading setup $name from file $setupFile\n" if $verbose; +print STDERR "Stop CTS trigger source\n" if $verbose; execute("trbcmd clearbit 0x$ccu 0xa101 0x1"); + + + foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) { my $ctrlname = $curctrl->getAttribute('name'); my $ctrlid = $curctrl->getAttribute('id'); @@ -198,7 +202,7 @@ foreach my $ctrladdr (keys %$JtagCommands) { } } execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time -execute("trbcmd setbit 0x$ccu 0xa101 0x1"); +execute("trbcmd setbit 0x$ccu 0xa101 0x1");# enable CTS trigger source execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time diff --git a/tools/init_system.pl b/tools/init_system.pl index 6bc7e3e..1a54f7c 100755 --- a/tools/init_system.pl +++ b/tools/init_system.pl @@ -81,10 +81,6 @@ run(DAQTOOLSPATH."/tools/loadregisterdb.pl ".CONFIGPATH."/network/register_confi trb_write(0xfffe,0x00c5,0x20ff); #Timeouts -#Send arbiter start signal -#trb_write($ccu,0xa000,0x00000001); - - # deactivate all peripheral FPGAs by default in the TrbNet hub # activate peripheral FPGAs only, when you find a entry in system file @@ -97,10 +93,30 @@ trb_write($ccu,0x00c1,0x00f0|$hub_active_mask); trb_write($ccu,0x00c3,0x00f0|$hub_active_mask); -trb_write($_,0x8041,0x8d00) for @roc; +trb_write($_,0x8041,0x8d00) for @roc; #set buffer delete time + +my $systems_w_ccu = { + ProbeStation_scurve => 1, + ProbeStation_readout => 1, + Vacuum_scurve => 1, + Vacuum_readout => 1, + ELab => 1, + PRESTO_readout => 1, + PRESTO_scurve => 1, +}; + +if($systems_w_ccu->{$system}) { + #ProbeStation continues to use the CCU + #Send arbiter start signal + print "System uses the old CCU\n"; + trb_write($ccu,0xa000,0x00000001); +} else { + #newer set-ups use the CTS + print "System uses the new CTS\n"; + trb_write($ccu,0xa150,0x2cff); #115.19us + trb_write($ccu,0xa101,0x00000001); +} -trb_write($ccu,0xa150,0x2cff); #115.19us -trb_write($ccu,0xa101,0x00000001); diff --git a/tools/preview/exec_evtbuild_t.pl b/tools/preview/exec_evtbuild_t.pl index 35eb5ed..599d83c 100755 --- a/tools/preview/exec_evtbuild_t.pl +++ b/tools/preview/exec_evtbuild_t.pl @@ -70,9 +70,9 @@ else { chdir($opt_path); -$thr1 = threads->new(\&execute, "timeout -s SIGINT ".($time+1.5)." daq_evtbuild -m $c -q 32 -d file -x te -Se -S $opt_system"); +$thr1 = threads->new(\&execute, "timeout -k 2 -s SIGINT ".($time+1.5)." daq_evtbuild -m $c -q 32 -d file -x te -Se -S $opt_system"); sleep 1; -$thr2 = threads->new(\&execute, "timeout -s SIGINT ".$time." daq_netmem -m $c -q 32 $portoption -S $opt_system"); +$thr2 = threads->new(\&execute, "timeout -k 2 -s SIGINT ".$time." daq_netmem -m $c -q 32 $portoption -S $opt_system"); $thr1->join(); $thr2->join(); diff --git a/tools/run.pl b/tools/run.pl index ec91bb9..fbb06cf 100755 --- a/tools/run.pl +++ b/tools/run.pl @@ -92,7 +92,7 @@ unless(-e $picPath) { my $dummy; print_exec "date"; -print_exec "./init_setup.pl $setupFile"; +print_exec "./init_setup.pl $setupFile $systemFile"; unless($q->param('startupOnly') eq 'true'){ diff --git a/tools/scurve_control.sh b/tools/scurve_control.sh index a147aa3..112383b 100755 --- a/tools/scurve_control.sh +++ b/tools/scurve_control.sh @@ -5,12 +5,12 @@ ### ------------ Interpret the command line arguments ------------ -usage () { echo -e "\nUsage: ./scurve_control.sh [ELab/Vacuum] [Number of Runs] [Step Size]\n"; } +usage () { echo -e "\nUsage: ./scurve_control.sh [ELab/Vacuum_scurve/ProbeStation_scurve PRESTO_scurve] [Number of Runs] [Step Size]\n"; } if [ -z "$1" ] # check if first parameter is empty then usage - echo Error: Specify the system! Use Vacuum or ELab as first parameter. + echo Error: Specify the system! Use Vacuum, ELab, ProbeStation, or PRESTO_scurve as first parameter. exit -1 fi @@ -21,15 +21,29 @@ then export DAQOPSERVER=localhost:88 JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml SETUP_FILE=/local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml -elif [ $1 == 'Vacuum' ] +elif [ $1 == 'PRESTO_scurve' ] then - PERIPH_ROC='0xd000' - CCU='0x8000' + PERIPH_ROC='0xd882' + CCU='0x8880' + export DAQOPSERVER=localhost:88 + JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml + SETUP_FILE=/local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml +elif [ $1 == 'Vacuum_scurve' ] +then + PERIPH_ROC='0xd011' + CCU='0xc010' + export DAQOPSERVER=localhost:1 + JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensor_Vacuum_scurve.xml + SETUP_FILE=/local.1/htdocs/mvdconfig/setup/Vacuum_scurve.xml +elif [ $1 == 'ProbeStation_scurve' ] +then + PERIPH_ROC='0xd072' + CCU='0xc070' export DAQOPSERVER=localhost:7 - JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve.xml - SETUP_FILE=/local.1/htdocs/mvdconfig/setup/scurve2_setup.xml + JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml + SETUP_FILE=/local.1/htdocs/mvdconfig/setup/ProbeStation_scurve.xml else - echo Error: system unspecified! Use ELab or Vacuum as the first parameter. + echo Error: system unspecified! Use ELab, Vacuum, ProbeStation, or PRESTO_scurve as the first parameter. exit -1 fi @@ -83,10 +97,11 @@ trbcmd w $PERIPH_ROC 0x8001 0x1 # set testmode was 8006 for BANK in 0 1 2 3 do -echo -e "\nBank $BANK" -for i in $(seq 101 $stepsize 255) +echo -e "\nNow scanning bank $BANK" + for i in $(seq 0 $stepsize 255) +# for i in 0 255 do - echo Threshold $i + echo "Setting threshold $i" printf -v threshhex '%02x' $i @@ -111,7 +126,7 @@ do # Start taking data and cycle through runs: for j in $(seq 1 1 $numruns) # for all runs, to gather statistics do - echo "run $j" + echo "Bank $BANK Threshold $i run $j" printf -v runhex '%05x' $j check="0" @@ -119,7 +134,7 @@ do trbcmd w $PERIPH_ROC 0x8002 0x1 # reset the FPGA buffers was 8005 # result=$(trbcmd r $PERIPH_ROC 0x8005) # check=${result:17:1} - echo "attempting soft-reset..." + #echo "attempting soft-reset..." #done trbcmd w $PERIPH_ROC 0x8002 0x0 # clear the previous reset was 8005 trbcmd w $PERIPH_ROC 0x8003 0x$threshhex$BANK$runhex # write current scan parameters to ROC-FPGA (later in data) was 8007 diff --git a/tools/test.txt b/tools/test.txt deleted file mode 100644 index e69de29..0000000 diff --git a/tools/testgui.pl b/tools/testgui.pl index 25e09c0..01b063d 100755 --- a/tools/testgui.pl +++ b/tools/testgui.pl @@ -235,7 +235,7 @@ sub init_html{ print "

advanced options

"; - print "
"; + print "
"; print "
advanced options
"; print "
"; @@ -255,7 +255,7 @@ sub init_html{ print "

show debug output

"; - print "
"; + print "
"; print "
debug output
"; print "
[the \"console\"]
"; print "
"; @@ -342,6 +342,13 @@ sub print_sensorArea { my $sensorPosition = $sensor->findnodes("./position")->shift(); my $sensorDescription = $sensor->findvalue("./description"); + my $adcmon_info = { + FPGA => $controllerAddress, + DAQOPSERVER => $daqopserver, + CB => $chain->findvalue("./\@id"), + chip => $sensor->findvalue("./\@id") + }; + $sensorAreaId = $sensorId; print "
"; @@ -352,11 +359,10 @@ sub print_sensorArea { print ""; print "
$sensorName (id=$sensorId)
"; print "
[not run yet]
"; - print ""; $quickEditAreaId = "quickEdit_".$sensorId; print ""; - print_quickEditArea($sensorConfig); + print_quickEditArea($sensorConfig,$adcmon_info); print ""; print ""; @@ -372,7 +378,7 @@ sub print_sensorArea { sub print_quickEditArea { my $argumentConfigFile = $_[0]; - + my $adcmon_info = $_[1]; parseConfigAndSpec($argumentConfigFile); @@ -381,8 +387,28 @@ sub print_quickEditArea { print ""; setEditorRefreshCommand("reloadQuickEditArea(\"".getConfigFileName()."\",\"$quickEditAreaId\")"); print_registers(getConfigFile()); - - + print "
"; +# print "

DAQOPSERVER: ". +# $adcmon_info->{DAQOPSERVER} +# ."

"; +# print "

FPGA: ". +# $adcmon_info->{FPGA} +# ."

"; +# print "

CB: ". +# $adcmon_info->{CB} +# ."

"; +# print "

CHIP: ". +# $adcmon_info->{chip} +# ."

"; + + print "
ADC monitor"; + print q% - %; + print "
"; } diff --git a/tools/unpacker/unpacker.cxx b/tools/unpacker/unpacker.cxx index 6bd2d94..fb7fda4 100644 --- a/tools/unpacker/unpacker.cxx +++ b/tools/unpacker/unpacker.cxx @@ -14,6 +14,7 @@ unsigned pixelMap[MAX_SENSORS][576][1152] = {{0}}; unsigned pixelcount[MAX_SENSORS][1153] = {{0}}; unsigned statistics[MAX_SENSORS][4] = {{0}}; unsigned numSensors = 0; +unsigned long numSubevents = 0; unsigned countMarkedFrames = 0; unsigned sensors[MAX_SENSORS]; @@ -61,9 +62,11 @@ unsigned getSensor(unsigned sensorId) { void readSubEvents(hadaq::RawEvent* evnt) { hadaq::RawSubevent* sub = 0; while ((sub=evnt->NextSubevent(sub))!=0) { + numSubevents++; unsigned trbSubEvSize = sub->GetSize() / 4 - 4; -#if DEBUG>=2 - printf("Subevent Size\t%08x\n", +#if DEBUG>=1 + printf("Subevent no. %d Size\t%08x\n", + numSubevents, trbSubEvSize); #endif unsigned pos = 0; @@ -186,13 +189,15 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen, #endif if (sub->Data(pdata) != 0x55555555) { +#if DEBUG>=1 printf("ERROR: Sensor Header (0x55555555) Not Found! (got: %08x)\n",sub->Data(pdata)); +#endif continue; } unsigned sensorIsValid = 0; if (v1 == 1){ - if(frame_status == 0xf000000f) { + if((frame_status & 0xf000000f) == 0xf000000f) { sensorIsValid = 1; } else{ @@ -210,13 +215,13 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen, } } else if (v3 == 1){ - if (frame_status == 0x0) { - sensorIsValid = 1; - } - else{ + if (frame_status & ((1<<14) | (1<<1) | (1<<2) | (1<<3) | (1<<4))) { sensorIsValid = 0; statistics[mySensor][FRBROKEN]++; } + else{ + sensorIsValid = 1; + } } if(sensorIsValid && frame_length>0x0){ @@ -268,7 +273,7 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen, } } - #if DEBUG>=2 + #if DEBUG>=3 printf("\tdx >>> %04x\n",d); #endif @@ -281,7 +286,7 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen, else { pixels = (d & 0x3); column = (d >> 2) & 0x7FF; - #if DEBUG>=2 + #if DEBUG>=3 printf("\t%d, %d x %d\n",line,column,pixels+1); #endif pixelcount[mySensor][column] += pixels+1; @@ -373,7 +378,7 @@ signed analyzeData(hadaq::RawSubevent* sub, unsigned ix, unsigned datalen, unsig //Something is really wrong with data. Skip SubEvent! printf("Broken Sensor Header\n"); statistics[mySensor][FRREALBROKEN]++; - #if DEBUG==0 + #if DEBUG>=0 printf("Head\t%08x\tID\t%08x\tStatus\t%08x\tError\t%08x\tDebug\t%08x\n", sensorHead, sensorId, sensorStatus, sensorError, sensorDebug); #endif