Skip to content
Snippets Groups Projects
Commit d0ae9dc6 authored by Arno Schoenmakers's avatar Arno Schoenmakers
Browse files

TAsk #8913: Updated version of poweruphba.sh

parent 3ac26b77
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
# #
# V3.1, M.J.Norden, 17-11-2015 # V4.0, A.P. Schoenmakers, 07-01-2016
# usage: ./poweruphba.sh 5 (or 6 or 7)
# Power up of the HBA Tiles needs to be slowed down because of high rush-in current. # usage: poweruphba.sh RCUMODE (5, 6 or 7) or
# poweruphba.sh [-a] -m RCUMODE (5, 6, or 7)
#
# Power up of the HBA Tiles.
# for rcumode 6 you need to switch the clock seperately (rspctl --clock=160) # for rcumode 6 you need to switch the clock seperately (rspctl --clock=160)
# from MAC version V2_12 and higher you can directly switch between rcumodes # from MAC version V2_12 and higher you can directly switch between rcumodes
# The setting of hbadelays with 253 is needed for the new HBA-FE that are default off # The setting of hbadelays with 253 is needed for the new HBA-FE that are default off
# #
# - automatic clock switch when needed # - automatic clock switch when needed
# - automatic disble broken tiles from PVSS database # - optionally automatic disble broken tiles from PVSS database
SyntaxError()
{
Msg=$1
clock=`rspctl --clock 2>&1|grep "Sample frequency"|sed -e 's/.*clock=\(...\)MHz/\1/'` [ -z "${Msg}" ] || echo "ERROR: ${Msg}"
echo ""
echo "Syntax: $(basename $0) [-a] [-m RCU mode] or $(basename $0) [RCU mode]"
echo "-a: Power up all RCUs, do not check broken tile info"
echo "-m: RCU mode to use (5,6 or 7)"
echo ""
echo "If only one argument provided, that is interpreted as the requested RCU mode."
echo "No check for broken tile info will occur then."
echo ""
exit 0
}
HandleArgs()
{
# Handle arguments
if [ "$#" -eq 0 ]; then
SyntaxError
fi
while getopts "am:" flag
do
case "$flag" in
a)
checkbroken=0
;;
m)
hbamode=$OPTARG
;;
h)
SyntaxError
;;
*)
SyntaxError
;;
esac
done
}
# --- MAIN ---
if [ "$1" != "" ]; then # first check if swlevel < 6, otherwise this script will not funstion properly
if [ $1 -lt 5 ]; then level=`swlevel -S`
echo -e "Usage: ./poweruphba.sh 5 (or 6 or 7)\n"
exit if [ $level -lt 2 -o $level -gt 5 ]; then
elif [ $1 -gt 7 ]; then echo "First set swlevel between 2 and 5 (current is $level)"
echo -e "Usage: ./poweruphba.sh 5 (or 6 or 7)\n" exit 0
exit fi
else
if [ $clock = "160" ]; then #Initialize parameters
echo "wait 30 seconds for 200MHz clock switch" checkbroken=1
rspctl --clock=200 hbamode=0
sleep 30
fi if [ "$#" -eq 1 ]; then
hbamode=$1 hbamode=$1
fi checkbroken=0
else else
echo -e "Usage: ./poweruphba.sh 5 (or 6 or 7)\n" HandleArgs $*
exit fi
if [ $hbamode -lt 5 -o $hbamode -gt 7 ]; then
echo "RCUMode must be 5,6, or 7"
exit 0
fi fi
if [ $hbamode -eq 6 ]; then # Find current clock setting
if [ $clock = "200" ]; then clock=`rspctl --clock 2>&1|grep "Sample frequency"|sed -e 's/.*clock=\(...\)MHz/\1/'`
echo "wait 30 seconds for 160MHz clock switch"
rspctl --clock=160 # Set clock to proper value
sleep 30 if [ $hbamode -eq 6 ]; then
fi if [ "$clock" == "200" ]; then
fi echo "wait 30 seconds for 160MHz clock switch"
rspctl --clock=160
sleep 30
fi
else
if [ "$clock" == "160" ]; then
echo "wait 30 seconds for 200MHz clock switch"
rspctl --clock=200
sleep 30
fi
fi
# Set selected mode and switch on HBAs
rspctl --rcumode=$hbamode rspctl --rcumode=$hbamode
sleep 1 sleep 1
rspctl --rcuenable=1 rspctl --rcuenable=1
sleep 1 sleep 1
DISABLED_RCU_LIST=`/opt/lofar/sbin/disabledRCUlist $hbamode 2</dev/null` # Determine broken tiles
if test "$DISABLED_RCU_LIST" == ""; then DISABLED_RCU_LIST=""
echo "no disabled HBA tiles" if [ $checkbroken -eq 1 ]; then
if [ -e /opt/lofar/sbin/disabledRCUlist ]; then
DISABLED_RCU_LIST=`/opt/lofar/sbin/disabledRCUlist $hbamode 2</dev/null`
else
echo "Cannot determine broken RCUs; missing /opt/lofar/sbin/disabledRCUlist"
fi
fi
# Switch off broken tiles (if any)
if [ "$DISABLED_RCU_LIST" == "" ]; then
echo "No disabled HBA tiles found"
else else
rspctl --rcumode=0 --sel=$DISABLED_RCU_LIST rspctl --rcumode=0 --select=$DISABLED_RCU_LIST
sleep 1 sleep 1
rspctl --rcuenable=0 --select=$DISABLED_RCU_LIST rspctl --rcuenable=0 --select=$DISABLED_RCU_LIST
sleep 1 sleep 1
fi fi
# Set delay values
rspctl --hbadelays=253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253 rspctl --hbadelays=253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253
sleep 1
# Set spectral Inversion properly
if [ $hbamode -eq 5 ]; then if [ $hbamode -eq 5 ]; then
rspctl --specinv=1 rspctl --specinv=1
else else
rspctl --specinv=0 rspctl --specinv=0
fi fi
sleep 1
echo "Done"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment