From 9c525b755723d0cdd6e54db6fd8a278eeeeb9dc2 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Tue, 2 Sep 2014 17:08:41 +0200 Subject: [PATCH] more cleanup of scurve.sh --- s-curves/scurve.sh | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/s-curves/scurve.sh b/s-curves/scurve.sh index 9c9b407..3931600 100755 --- a/s-curves/scurve.sh +++ b/s-curves/scurve.sh @@ -60,29 +60,32 @@ else fi -### ------------ setting up the sensor ------------ +### ------------------------------------------------------------------ + +# Setting up general properties of the ROC: # trbcmd w $trbaddr 0x8002 0xaaa0aaa0 # set sensor ID for sensor 0 # trbcmd w $trbaddr 0x8402 0xbbb0bbb0 # set sensor ID for sensor 1 trbcmd w $trbaddr 0x8006 0x1 # set testmode -### ------------ start data taking ------------ - +# Starting the configuration / readout cycles for BANK in A B C D do -echo $BANK -for i in `seq 0 $stepsize 255` +echo -e "\nBank $BANK" +for i in $(seq 0 $stepsize 255) do - trbcmd w $trbaddr 0x8005 0x1 # set soft reset to 1 (skip run 0) - echo Iteration $i - printf -v hex '%04x' $i + echo Threshold $i + + printf -v threshhex '%04x' $i printf -v param '%04x' 0 - trbcmd w $trbaddr 0x8007 0x$hex$param # write external info to FPGA (ROC) which is the pair "threshold - run" + + trbcmd w $trbaddr 0x8005 0x1 # set soft reset to 1 (skip run 0) + trbcmd w $trbaddr 0x8007 0x$threshhex$param # write current scan parameters to ROC-FPGA (later in data) + + # change sensor settings, i.e. thresholds to $i if [ "$BANK" = "A" ]; then - # so I know the scanning parameters for every frame - # TEST DISCRI A ONLY: echo "DAC_BIAS/IVDREF1A=$i;DAC_BIAS/IVDREF1B=255;DAC_BIAS/IVDREF1C=255;DAC_BIAS/IVDREF1D=255" | ./changeConfigVal.pl -c /local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml #echo "DAC_BIAS/IVDREF1A=$i;DAC_BIAS/IVDREF1B=$i;DAC_BIAS/IVDREF1C=$i;DAC_BIAS/IVDREF1D=$i;DIS_DISCRI/DisDiscri=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000" | ./changeConfigVal.pl -c /local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml echo "DAC_BIAS/IVDREF1A=$i;DAC_BIAS/IVDREF1B=255;DAC_BIAS/IVDREF1C=255;DAC_BIAS/IVDREF1D=255" | ./changeConfigVal.pl -c /local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml elif [ "$BANK" = "B" ]; then @@ -92,23 +95,25 @@ do elif [ "$BANK" = "D" ]; then echo "DAC_BIAS/IVDREF1A=255;DAC_BIAS/IVDREF1B=255;DAC_BIAS/IVDREF1C=255;DAC_BIAS/IVDREF1D=$i" | ./changeConfigVal.pl -c /local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml fi - # change sensor settings, i.e. thresholds to $i + # programming the sensor via JTAG if [ $1 == 'Vacuum' ] then -# ./init_setup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup.xml # program the JTAG parameters to the sensor and start once - ./startup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup.xml # program the JTAG parameters to the sensor and start once + #./init_setup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup.xml + ./startup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup.xml elif [ $1 == 'ELab' ] then -# ./init_setup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml # program the JTAG parameters to the sensor and start once - ./startup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml # program the JTAG parameters to the sensor and start once + #./init_setup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml + ./startup.pl /local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml fi sleep 0.3 # wait until the run is finished (throw away data, because dirty) - for j in `seq 1 1 $numruns` # for all runs, to gather statistics + # Start taking data and cycle through runs: + for j in $(seq 1 1 $numruns) # for all runs, to gather statistics do echo "run $j" - printf -v run '%04x' $j + + printf -v runhex '%04x' $j check="0" while [ "$check" -eq "0" ]; do trbcmd w $trbaddr 0x8005 0x1 # reset the FPGA buffers @@ -117,7 +122,8 @@ do echo "attempting soft-reset..." done trbcmd w $trbaddr 0x8005 0x0 # clear the previous reset - trbcmd w $trbaddr 0x8007 0x$hex$run # write current scan parameters to FPGA (later in data) + trbcmd w $trbaddr 0x8007 0x$threshhex$runhex # write current scan parameters to ROC-FPGA (later in data) + trbcmd w $trbaddr 0xb00b 0x1 # start the next run in the s-curve mode sleep 0.3 # wait until run is finished done -- 2.43.0