From 37f02a66ac8f12c3cce10437cb388df26d708b3d Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Fri, 3 Nov 2017 13:36:59 +0000
Subject: [PATCH] Account for dual pol or single pol for flash decision. Use -n
 20 -r 6 command to set default ADUH attenuation to 6 dB for both ADC.

---
 .../apertif/commissioning/dish_commands.sh      | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/applications/apertif/commissioning/dish_commands.sh b/applications/apertif/commissioning/dish_commands.sh
index 5a8e6211f1..c2b03aac03 100755
--- a/applications/apertif/commissioning/dish_commands.sh
+++ b/applications/apertif/commissioning/dish_commands.sh
@@ -110,11 +110,11 @@ python $UPE/peripherals/util_system_info.py --unb $UNBS --fn 0:3 --bn 0:3 -n 4
 # Print the user firmware image design names
 python $UPE/peripherals/util_system_info.py --unb $UNBS --fn 0:3 --bn 0:3 -n 2
 
-# Get number of required images actually running on BN
+# Get number of required images actually running on BN (32 for dual pol, 16 for single pol)
 ACT_IMAGE_FB=$(python $UPE/peripherals/util_system_info.py --unb $UNBS --bn 0:3 -n 2 | grep -c $IMAGE_FB_RBFNAME)
 echo -n "BN image $IMAGE_FB_RBFNAME found running on $ACT_IMAGE_FB back nodes: "
 
-if [ "$ACT_IMAGE_FB" == "32" ]; then
+if [ "$ACT_IMAGE_FB" == "32" ] || [ "$ACT_IMAGE_FB" == "16" ]; then
     echo Continuing without BN reflash
     FLASH_BN=FALSE
 else
@@ -122,11 +122,11 @@ else
     FLASH_BN=TRUE
 fi
 
-# Get number of required images actually running on FN
+# Get number of required images actually running on FN (32 for dual pol, 16 for single pol)
 ACT_IMAGE_BF=$(python $UPE/peripherals/util_system_info.py --unb $UNBS --fn 0:3 -n 2 | grep -c $IMAGE_BF_RBFNAME)
 echo -n "FN image $IMAGE_BF_RBFNAME found running on $ACT_IMAGE_BF front nodes: "
 
-if [ "$ACT_IMAGE_BF" == "32" ]; then
+if [ "$ACT_IMAGE_BF" == "32" ] || [ "$ACT_IMAGE_BF" == "16" ]; then
     echo Continuing without FN reflash
     FLASH_FN=FALSE
 else
@@ -202,8 +202,13 @@ python $UPE/peripherals/util_adu_i2c_commander.py --unb $UNBS --bn 0:3 --sp 0:3
 
 # Update ADU I2C sequences
 python $UPE/apps/apertif_beamformer/util_apertif_beamformer.py --unb $UNBS --bn 0:3 --fn 0:3 --sp 0:3 -v 3 --cmd 39
-# Set ADU ADC[1,0] to 0 dB
-python $UPE/peripherals/util_adu_i2c_commander.py --unb $UNBS --bn 0:3 --sp 0:3 -n 5
+# Set ADU ADC[1,0] attenuation to -r dB.
+# * using -n 20 -r 6 is equivalent to using util_adu_i2c_commander.py -n 6
+# * using -n 20 -r 0 is not equivalent to util_adu_i2c_commander.py -n 5, because
+#   util_adu_i2c_commander.py -n 5 sets ADC 0 to 6 dB and ADC 1 to 0 dB
+#python $UPE/peripherals/util_adu_i2c_commander.py --unb $UNBS --bn 0:3 --sp 0:3 -n 5
+python $UPE/peripherals/util_adu_i2c_commander.py --unb $UNBS --bn 0:3 --sp 0:3 -n 20 -r 6
+
 # Set ADU led on
 python $UPE/peripherals/util_adu_i2c_commander.py --unb $UNBS --bn 0:3 --sp 0:3 -n 31
 
-- 
GitLab