Files
JFCalibration/BP_scan.sh
T

183 lines
5.1 KiB
Bash

#!/bin/bash
# to run do: bash BP_scan.sh
# prerequisites:
# - the hostname is set
# - source /afs/psi.ch/project/sls_det_software/slsDetectorsPackage/bin/setup_SL6_64bit.sh
# - PATH=$PATH:/afs/psi.ch/project/sls_det_software/slsDetectorsPackage/bin/
# - detector is on
# - waveform generator is on
# - amplifier board is powered +35 V -5 V
# prepare detector as in v0_5/prepare_mpc2012.sh
# set dacs as in setDacs_Fmodule_LCLS.sh
sls_detector_put dac:5 1000
sls_detector_put dac:0 1220
sls_detector_put dac:4 750
sls_detector_put dac:6 480
sls_detector_put dac:7 420
sls_detector_put dac:3 1450
sls_detector_put dac:2 1053
sls_detector_put dac:1 3000
# power on the chips
sls_detector_put reg 0x5e 0x1
# reset_adc
sls_detector_put adcreg 0x08 0x3;sls_detector_put adcreg 0x08 0x0; sls_detector_put adcreg 0x14 0x40;
sls_detector_put adcreg 0x4 0xf
sls_detector_put adcreg 0x5 0x3f
# vrefs
sls_detector_put adcreg 0x18 0x2
# set ADCINVERSionreg (by trial and error)
sls_detector_put reg 0x43 0x453b2a9c
# set adc_pipeline
sls_detector_put reg 0x42 0x20
sls_detector_put reg 0x59 0x1000
sls_detector_put reg 0x4d 0x00100000
sleep 1
# set adc_clock_phase in unit of 1/(52) clock period (by trial and error)
sls_detector_put adcphase 72
# storage cell f
sls_detector_put reg 0x5d 0xf00
# reset mem machine fifos fifos
sls_detector_put reg 0x4f 0x4000
sls_detector_put reg 0x4f 0x0
# reset run control
sls_detector_put reg 0x4f 0x0400;sls_detector_put reg 0x4f 0x0;
# delay
sls_detector_put delay 0
# cycles
sls_detector_put cycles 1
# frames
sls_detector_put frames 100
# period
sls_detector_put period 0.002
# exposure time
sls_detector_put exptime 0.000020
# high voltage
sls_detector_put vhighvoltage 0
# configure for receiver on mpc2012
sls_detector_put 0:rx_udpport 32410
sls_detector_put 0:rx_udpip 10.1.3.105
sls_detector_put 0:rx_udpmac 3C:FD:FE:A2:14:D9
sls_detector_put 0:detectorip 10.1.3.9
sls_detector_put 0:detectormac 00:ab:be:cc:dd:e2
sls_detector_put 0:configuremac 0
# prepare the AGILENT 33250A
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay OUTP OFF
sleep 1
# pulse
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay FUNC PULS
sleep 1
# frequency 1kHz
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay FREQ 1000
sleep 1
# width 40 us
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay PULS:WIDT 0.000040
sleep 1
# amplitude 0.1 V
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT 0.1
sleep 1
# offset 0 V
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT:OFFS 0
sleep 1
# edge 50 ns
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay PULS:TRAN 0.000000050
sleep 1
# triggered burst
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay BURS:MODE TRIG
sleep 1
# cycles 1
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay BURS:NCYC 1
sleep 1
# external trigger source
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay TRIG:SOUR EXT
sleep 1
# delay 1 us
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay TRIG:DEL 0.000001
sleep 1
# slope positive
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay TRIG:SLOP POS
sleep 1
# turn on burst mode
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay BURS:STAT ON
sleep 1
echo "It is now safe to connect the cable between the amplifier board and the readout board"
echo "Please do so and press any key to continue, or press q to exit this script"
read -n 1 -s input
if [ $input = "q" ]; then
echo "Exiting script"
exit 1
fi
# high voltage
sls_detector_put vhighvoltage 200
# output on
# testing /afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay OUTP ON
sleep 1
echo "The current on the amplifier board should be ~0.035 A"
echo "Please check and press any key to continue, or press q to exit this script"
read -n 1 -s input
if [ $input = "q" ]; then
echo "Exiting script"
exit 1
fi
echo "The receiver should be waiting for data"
echo "Please check and press any key to continue, or press q to exit this script"
read -n 1 -s input
if [ $input = "q" ]; then
echo "Exiting script"
exit 1
fi
# the scan
for ivpulse in {10..1000..10}
do
vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l))
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT $vpulse
sleep 1
sls_detector_put status start
sleep 1
done
for ivpulse in {1050..7000..50}
do
vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l))
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT $vpulse
sleep 1
sls_detector_put status start
sleep 1
done
# high voltage
sls_detector_put vhighvoltage 0
# output off
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay OUTP OFF
echo "Finished scan, please wait for capacitor to discharge"
sleep 20
echo "It is now safe to disconnect the cable between the amplifier board and the readout board"
echo "Script finished"