--- /dev/null
+#!/bin/bash
+
+DAQ_TOOLS_PATH=~/trbsoft/daqtools
+USER_DIR=~/trbsoft/daqtools/users/gsi_ee_trb84
+TRB_WEB_DIR=$DAQ_TOOLS_PATH/web
+
+export PATH=$PATH:$DAQ_TOOLS_PATH
+export PATH=$PATH:$DAQ_TOOLS_PATH/tools
+export PATH=$PATH:$USER_DIR
+
+export TRB3_SERVER=trbsc461:26000
+#export TRB3_SERVER=trb061:26000
+export TRBNETDPID=$(pgrep -f "trbnetd -i 61")
+export DAQOPSERVER=localhost:61
+
+echo "- trbnetd pid: $TRBNETDPID"
+
+if [[ -z "$TRBNETDPID" ]]
+then
+ ~/trbsoft/trbnettools/bin/trbnetd -i 61
+fi
+
+#./check_ping.pl --reboot
+
+
+echo "reset"
+trbcmd reset
+#./trbreset_loop.pl
+#sleep 1;
+
+##################################################
+## Set addresses
+##################################################
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3.db $USER_DIR/db/addresses_trb3.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3sc.db $USER_DIR/db/addresses_trb3sc.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich.db $USER_DIR/db/addresses_dirich.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich_concentrator.db $USER_DIR/db/addresses_dirich_concentrator.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_farich_concentrator.db $USER_DIR/db/addresses_farich_concentrator.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_farich.db $USER_DIR/db/addresses_farich.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich5s.db $USER_DIR/db/addresses_dirich5s.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich5d.db $USER_DIR/db/addresses_dirich5d.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb5sc.db $USER_DIR/db/addresses_trb5sc.db
+
+#echo "disable port 6 on hub 0x8841"
+#trbcmd clearbit 0x8841 0xc0 0x40
+#trbcmd clearbit 0x8841 0xc1 0x40
+#trbcmd clearbit 0x8841 0xc3 0x40
+
+
+echo "GbE settings"
+loadregisterdb.pl db/register_configgbe.db
+loadregisterdb.pl db/register_configgbe_ip.db
+
+echo "TDC settings"
+loadregisterdb.pl db/register_configtdc.db
+echo "TDC settings end"
+
+# setup central FPGA - enable peripherial signals
+#switchport.pl 0x8841 6 off
+
+# remove reset
+#trbcmd clearbit 0x16f7 0xcd00 0x1
+
+
+#exit
+
+# pulser to 100kHz and 50kHz
+#trbcmd w 0xc840 0xa156 0x0000270f #10khz pulser 0
+
+
+#trbcmd w 0xc840 0xa150 0x000003e7 #100khz
+#trbcmd w 0xc840 0xa150 0x0001869f #1khz
+#trbcmd w 0xc840 0xa150 0x00001387 #20khz
+#trbcmd w 0xc840 0xa150 0x00000d04 #30khz
+#trbcmd w 0xc840 0xa150 0x000007cf #50khz
+#trbcmd w 0xc840 0xa157 0x0000270f #10khz
+
+#trbcmd setbit 0xc840 0xa101 0x2 #enable pulser 0
+#trbcmd setbit 0xc840 0xa101 0x2 #enable pulser 1
+#trbcmd setbit 0xc840 0xa101 0x20 #enable Addon Multiplexer 1
+#trbcmd setbit 0xc840 0xa101 0x8 #enable CTS Addon 0
+#trbcmd setbit 0xc840 0xa101 0x200 #enable periph fpga input as trigger
+
+
+# trigger on TDC channel 1
+#trbcmd setbit 0x0810 0xcf00 0x1 #direct TDC input to CTS
+#trbcmd setbit 0xc001 0xa14d 0x2 #select F5_COMM input
+#trbcmd setbit 0xc001 0xa101 0x200 #enable input from peripheral TDC to CTS as trigger input
+
+# set correct timeout: off for channel 0, 1, 2sec for 2
+trbcmd w 0xfffe 0xc5 0x50ff
+
+#Dirich-Concentrator: enable reference time from RJ45
+######trbcmd loadbit 0x8300 0xd580 0x6 0x6
+
+echo "pulser"
+# pulser #0 to 10 kHz
+trbcmd w 0xc001 0xa146 0x00000b4 # set pulser frequency to 50kHz
+trbcmd w 0xc001 0xa147 0x00004b4 # set pulser frequency to 50kHz
+trbcmd w 0xc001 0xa148 0x00074b4 # set pulser frequency to 50kHz
+#trbcmd w 0xc001 0xa150 0x0022270f
+
+echo "trigger type"
+# set trigger type to 0x1
+trbcmd setbit 0xc001 0xa14f 0x1
+
+
+#trbcmd clearbit 0x1130 0xc801 0x80000000 # disable window
+#trbcmd w 0x1130 0xc802 0xffff0000 # enable upper 16 channels for padiwa
+#trbcmd w 0x1580 0xc802 0xffffffff # enable upper 16 channels for padiwa
+
+
+#cd ~/trbsoft/daqtools/xml-db
+#./put.pl Readout 0x16eb SetMaxEventSize 500
+#cd $USER_DIR
+
+#trbcmd w 0xfe51 0xdf80 0xffffffff # enable monitor counters
+
+#trbcmd w 0x1133 0xc804 0x11e18 # Erazor TDC
+#trbcmd w 0x1130 0xc804 0x11e18 # Erazor TDC
+#trbcmd clearbit 0x1133 0xc801 0x80000000 # disable window
+#trbcmd clearbit 0x1130 0xc801 0x80000000 # disable window
+
+#trbcmd w 0x1130 0xc802 0x80000000
+#trbcmd w 0x1130 0xc803 0x00000000
+#trbcmd w 0x1133 0xc802 0x00000c03 # enable pulser
+
+#trbcmd setbit 0xc001 0xa101 0x8 # enable external trigger in of CTS
+
+echo "pulser frequency"
+#trbcmd w 0xc001 0xa154 0x3e7 # Pulser 1: 100kHz
+#trbcmd w 0xc001 0xa155 0x3e7 # Pulser 2: 100kHz
+
+
+# only for tdcv4
+
+# ./tdcv4_caltrg_init_new.sh 0xfe53
+# #./tdcv4_caltrg_init.sh 0xfe55
+
+
+
+# trbcmd setbit 0xfe53 0xcd00 0x08000000 # enable TDL of RefChan
+# trbcmd setbit 0xfe55 0xcd00 0x08000000 # enable TDL of RefChan
+# #trbcmd w 0xfe53 0xcd12 0x2801 # enable channels
+# #trbcmd w 0xfe53 0xcd22 0x8002 # enable channels
+# trbcmd clearbit 0xfe53 0xcd00 0x1
+# trbcmd clearbit 0xfe55 0xcd00 0x1
+
+
+# # set Oscillator frequency
+# trbcmd loadbit 0xfe53 0xcd24 0xff000000 0x60000000 # 8 LSBs of oscillator frequency in units of 10kHz
+# trbcmd loadbit 0xfe53 0xcd25 0xff000000 0x6d000000 # 8 MSBs of oscillator frequency in units of 10kHz
+
+# trbcmd loadbit 0xfe55 0xcd24 0xff000000 0x60000000 # 8 LSBs of oscillator frequency in units of 10kHz
+# trbcmd loadbit 0xfe55 0xcd25 0xff000000 0x6d000000 # 8 MSBs of oscillator frequency in units of 10kHz
+
+
+# #enable Hitcounters TDCv4
+# trbcmd setbit 0xfe53 0xcd00 0x200
+# trbcmd clearbit 0xfe53 0xcd00 0x100
+
+# trbcmd setbit 0xfe55 0xcd00 0x200
+# trbcmd clearbit 0xfe55 0xcd00 0x100
+
+
+
+# # Stretcher
+# trbcmd loadbit 0xfe53 0xcd17 0xffff 0xffff # enable Stretcher for Channels 15..0
+# trbcmd loadbit 0xfe53 0xcd27 0xffff 0xffff # enable Stretcher for Channels 31..16
+# trbcmd setbit 0xfe53 0xcd00 0x40000000 # enable Stretcher for Reference Channel
+
+# trbcmd loadbit 0xfe55 0xcd17 0xffff 0xffff # enable Stretcher for Channels 15..0
+# trbcmd loadbit 0xfe55 0xcd27 0xffff 0xffff # enable Stretcher for Channels 31..16
+# trbcmd setbit 0xfe55 0xcd00 0x40000000 # enable Stretcher for Reference Channel
+
+# # Enable
+# #./tdcv4_enable_channels.sh 0xfe53 0x11 0x0 #enable channel 5 and 0
+# ./tdcv4_enable_channels.sh 0xfe53 0xf 0xf #enable channel 5 and 0
+
+# ./tdcv4_enable_channels.sh 0xfe55 0xf 0xf #enable channel 5 and 0
+# end of tdcv4 block
+
+echo "pulser enable"
+trbcmd setbit 0xc001 0xa101 0x2
+# pulser enable
--- /dev/null
+#!/bin/bash
+
+DAQ_TOOLS_PATH=~/trbsoft/daqtools
+USER_DIR=~/trbsoft/daqtools/users/gsi_ee_trb84
+TRB_WEB_DIR=$DAQ_TOOLS_PATH/web
+
+export PATH=$PATH:$DAQ_TOOLS_PATH
+export PATH=$PATH:$DAQ_TOOLS_PATH/tools
+export PATH=$PATH:$USER_DIR
+
+export TRB3_SERVER=trbsc549:26000
+export TRBNETDPID=$(pgrep -f "trbnetd -i 49")
+export DAQOPSERVER=localhost:49
+
+echo "- trbnetd pid: $TRBNETDPID"
+
+if [[ -z "$TRBNETDPID" ]]
+then
+ ~/trbsoft/trbnettools/bin/trbnetd -i 49
+fi
+
+#./check_ping.pl --reboot
+
+
+echo "reset"
+trbcmd reset
+#./trbreset_loop.pl
+#sleep 1;
+
+##################################################
+## Set addresses
+##################################################
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3.db $USER_DIR/db/addresses_trb3.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3sc.db $USER_DIR/db/addresses_trb3sc.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich.db $USER_DIR/db/addresses_dirich.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich_concentrator.db $USER_DIR/db/addresses_dirich_concentrator.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_farich_concentrator.db $USER_DIR/db/addresses_farich_concentrator.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_farich.db $USER_DIR/db/addresses_farich.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich5s.db $USER_DIR/db/addresses_dirich5s.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_dirich5d.db $USER_DIR/db/addresses_dirich5d.db
+merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb5sc.db $USER_DIR/db/addresses_trb5sc.db
+
+#echo "disable port 6 on hub 0x8841"
+#trbcmd clearbit 0x8841 0xc0 0x40
+#trbcmd clearbit 0x8841 0xc1 0x40
+#trbcmd clearbit 0x8841 0xc3 0x40
+
+
+echo "GbE settings"
+loadregisterdb.pl db/register_configgbe.db
+loadregisterdb.pl db/register_configgbe_ip.db
+
+echo "TDC settings"
+loadregisterdb.pl db/register_configtdc.db
+echo "TDC settings end"
+
+# setup central FPGA - enable peripherial signals
+#switchport.pl 0x8841 6 off
+
+# remove reset
+#trbcmd clearbit 0x16f7 0xcd00 0x1
+
+
+#exit
+
+# pulser to 100kHz and 50kHz
+#trbcmd w 0xc840 0xa156 0x0000270f #10khz pulser 0
+
+
+#trbcmd w 0xc840 0xa150 0x000003e7 #100khz
+#trbcmd w 0xc840 0xa150 0x0001869f #1khz
+#trbcmd w 0xc840 0xa150 0x00001387 #20khz
+#trbcmd w 0xc840 0xa150 0x00000d04 #30khz
+#trbcmd w 0xc840 0xa150 0x000007cf #50khz
+#trbcmd w 0xc840 0xa157 0x0000270f #10khz
+
+#trbcmd setbit 0xc840 0xa101 0x2 #enable pulser 0
+#trbcmd setbit 0xc840 0xa101 0x2 #enable pulser 1
+#trbcmd setbit 0xc840 0xa101 0x20 #enable Addon Multiplexer 1
+#trbcmd setbit 0xc840 0xa101 0x8 #enable CTS Addon 0
+#trbcmd setbit 0xc840 0xa101 0x200 #enable periph fpga input as trigger
+
+
+# trigger on TDC channel 1
+#trbcmd setbit 0x0810 0xcf00 0x1 #direct TDC input to CTS
+#trbcmd setbit 0xc001 0xa14d 0x2 #select F5_COMM input
+#trbcmd setbit 0xc001 0xa101 0x200 #enable input from peripheral TDC to CTS as trigger input
+
+# set correct timeout: off for channel 0, 1, 2sec for 2
+trbcmd w 0xfffe 0xc5 0x50ff
+
+#Dirich-Concentrator: enable reference time from RJ45
+######trbcmd loadbit 0x8300 0xd580 0x6 0x6
+
+echo "pulser"
+# pulser #0 to 10 kHz
+trbcmd w 0xc001 0xa146 0x00000b4 # set pulser frequency to 50kHz
+trbcmd w 0xc001 0xa147 0x00004b4 # set pulser frequency to 50kHz
+trbcmd w 0xc001 0xa148 0x00074b4 # set pulser frequency to 50kHz
+#trbcmd w 0xc001 0xa150 0x0022270f
+
+echo "trigger type"
+# set trigger type to 0x1
+trbcmd setbit 0xc001 0xa14f 0x1
+
+
+#trbcmd clearbit 0x1130 0xc801 0x80000000 # disable window
+#trbcmd w 0x1130 0xc802 0xffff0000 # enable upper 16 channels for padiwa
+#trbcmd w 0x1580 0xc802 0xffffffff # enable upper 16 channels for padiwa
+
+
+#cd ~/trbsoft/daqtools/xml-db
+#./put.pl Readout 0x16eb SetMaxEventSize 500
+#cd $USER_DIR
+
+#trbcmd w 0xfe51 0xdf80 0xffffffff # enable monitor counters
+
+#trbcmd w 0x1133 0xc804 0x11e18 # Erazor TDC
+#trbcmd w 0x1130 0xc804 0x11e18 # Erazor TDC
+#trbcmd clearbit 0x1133 0xc801 0x80000000 # disable window
+#trbcmd clearbit 0x1130 0xc801 0x80000000 # disable window
+
+#trbcmd w 0x1130 0xc802 0x80000000
+#trbcmd w 0x1130 0xc803 0x00000000
+#trbcmd w 0x1133 0xc802 0x00000c03 # enable pulser
+
+#trbcmd setbit 0xc001 0xa101 0x8 # enable external trigger in of CTS
+
+echo "pulser frequency"
+#trbcmd w 0xc001 0xa154 0x3e7 # Pulser 1: 100kHz
+#trbcmd w 0xc001 0xa155 0x3e7 # Pulser 2: 100kHz
+
+
+# only for tdcv4
+
+./tdcv4_caltrg_init_new.sh 0xfe55
+# #./tdcv4_caltrg_init.sh 0xfe55
+
+
+
+# trbcmd setbit 0xfe53 0xcd00 0x08000000 # enable TDL of RefChan
+trbcmd setbit 0xfe55 0xcd00 0x08000000 # enable TDL of RefChan
+trbcmd w 0xfe55 0xcd12 0x2801 # enable channels
+trbcmd w 0xfe55 0xcd22 0x8002 # enable channels
+# trbcmd clearbit 0xfe53 0xcd00 0x1
+trbcmd clearbit 0xfe55 0xcd00 0x1
+
+
+# # set Oscillator frequency
+# trbcmd loadbit 0xfe53 0xcd24 0xff000000 0x60000000 # 8 LSBs of oscillator frequency in units of 10kHz
+# trbcmd loadbit 0xfe53 0xcd25 0xff000000 0x6d000000 # 8 MSBs of oscillator frequency in units of 10kHz
+
+trbcmd loadbit 0xfe55 0xcd24 0xff000000 0x60000000 # 8 LSBs of oscillator frequency in units of 10kHz
+trbcmd loadbit 0xfe55 0xcd25 0xff000000 0x6d000000 # 8 MSBs of oscillator frequency in units of 10kHz
+
+
+# #enable Hitcounters TDCv4
+#trbcmd setbit 0xfe53 0xcd00 0x200
+#trbcmd clearbit 0xfe53 0xcd00 0x100
+
+trbcmd setbit 0xfe55 0xcd00 0x200
+trbcmd clearbit 0xfe55 0xcd00 0x100
+
+
+
+# # Stretcher
+# trbcmd loadbit 0xfe53 0xcd17 0xffff 0xffff # enable Stretcher for Channels 15..0
+# trbcmd loadbit 0xfe53 0xcd27 0xffff 0xffff # enable Stretcher for Channels 31..16
+# trbcmd setbit 0xfe53 0xcd00 0x40000000 # enable Stretcher for Reference Channel
+
+trbcmd loadbit 0xfe55 0xcd17 0xffff 0xffff # enable Stretcher for Channels 15..0
+trbcmd loadbit 0xfe55 0xcd27 0xffff 0xffff # enable Stretcher for Channels 31..16
+trbcmd setbit 0xfe55 0xcd00 0x40000000 # enable Stretcher for Reference Channel
+
+# # Enable
+# #./tdcv4_enable_channels.sh 0xfe53 0x11 0x0 #enable channel 5 and 0
+# ./tdcv4_enable_channels.sh 0xfe53 0xf 0xf #enable channel 5 and 0
+
+./tdcv4_enable_channels.sh 0xfe55 0xf 0xf #enable channel 5 and 0
+# end of tdcv4 block
+
+echo "pulser enable"
+#trbcmd setbit 0xc001 0xa101 0x2
+trbcmd setbit 0x2049 0xa101 0x2
+# pulser enable