Skip to content

Preliminary configuration

FELIX configuration

Few scripts have been prepared to configure felix:

setFelixStat.sh: script to configure FELIX link general parameters
#!/bin/bash
#!
flx-config -d 0 -E set LPGBT_FEC 0xffff
flx-config -d 0 -E set GBT_RXPOLARITY 0xffff
flx-config -d 0 -E set DECODING_REVERSE_10B 0x1
flx-config -d 1 -E set LPGBT_FEC 0xffff
flx-config -d 1 -E set GBT_RXPOLARITY 0xffff
flx-config -d 1 -E set DECODING_REVERSE_10B 0x1
fgpolarity -c 0 -r -G 0 set
fgpolarity -c 0 -r -G 1 set
fgpolarity -c 0 -r -G 2 set
fgpolarity -c 0 -r -G 3 set
fgpolarity -c 0 -r -G 4 set
fgpolarity -c 0 -r -G 5 set
fgpolarity -c 0 -r -G 6 set
fgpolarity -c 0 -r -G 7 set
fgpolarity -c 0 -r -G 8 set
fgpolarity -c 0 -r -G 9 set
fgpolarity -c 0 -r -G 10 set
fgpolarity -c 0 -r -G 11 set
fgpolarity
setTXRX.sh: script to configure FELIX elinks (elinkconfig can be used as well)

```bash

!/bin/bash

!

LINK_MIN=0 LINK_MAX=11 # total channels / 2

DEC_EGROUP_MIN=0 DEC_EGROUP_MAX=6 ENC_EGROUP_MIN=0 ENC_EGROUP_MAX=3

function setTX() { il2=$(printf '%02d\n' $2) flx-config -d $1 -E set ENCODING_LINK${il2}_EGROUP$3_CTRL_EPATH_ENA $4 flx-config -d $1 -E set ENCODING_LINK${il2}_EGROUP$3_CTRL_EPATH_WIDTH 0x1 flx-config -d $1 -E set ENCODING_LINK${il2}_EGROUP$3_CTRL_PATH_ENCODING 0x0404 }

function setAuroraDecoding() {

$1 = FELIX device $2 LINK number (only even link numbers are valid) $3 Aggregation mode ( 0 = no aggregation, 2,3 or 4 = number of aurora lanes to aggregate)

il2=$(printf '%02d\n' $2) flx-config -d $1 -E set DECODING_LINK_${il2}_CB_CBOPT $3 }

function setRX() { il2=$(printf '%02d\n' $2) flx-config -d $1 -E set DECODING_LINK${il2}_EGROUP$3_CTRL_EPATH_ENA $4 flx-config -d $1 -E set DECODING_LINK${il2}_EGROUP$3_CTRL_EPATH_WIDTH 0x4 flx-config -d $1 -E set DECODING_LINK${il2}_EGROUP$3_CTRL_PATH_ENCODING 0x33 }

for ((id = 0 ; id <= 1 ; id++)); do for ((il = LINK_MIN ; il <= LINK_MAX ; il++)); do setTX $id $il 0 0x0 setTX $id $il 1 0x0 setTX $id $il 2 0x0 setTX $id $il 3 0x0

setRX $id $il 0 0x0
setRX $id $il 1 0x0
setRX $id $il 2 0x0
setRX $id $il 3 0x0
setRX $id $il 4 0x0
setRX $id $il 5 0x0
setRX $id $il 6 0x0

if [ $((il%2)) -eq 0 ];
then
setAuroraDecoding $id $il 0x0
fi

done done

Zaza zif adapter

setTX 0 0 0 0x5

setTX 0 0 1 0x5

setTX 0 0 2 0x5

setTX 0 0 1 0x1

setRX 0 1 0 0x3

setRX 0 1 1 0x3

setRX 0 1 2 0x3

setRX 0 1 3 0x3

setRX 0 1 4 0x3

setRX 0 1 5 0x3

Set aurora lanes groups

setAuroraDecoding 1 0 0x0 setAuroraDecoding 1 2 0x0

Zaza board DP1

setTX 0 2 1 0x4 setRX 0 3 0 0x3 setRX 0 3 1 0x3 setRX 0 3 2 0x3 setRX 0 3 3 0x3

setTX 1 0 1 0x4 setRX 1 1 0 0x3 setRX 1 1 1 0x3 setRX 1 1 2 0x3 setRX 1 1 3 0x3

Zaza board DP2

setTX 0 0 0 0x1

setRX 0 0 0 0x3

setRX 0 0 1 0x3

setRX 0 0 2 0x3

setRX 0 0 3 0x3

setRX 1 0 0 0x3 setRX 1 0 1 0x3 setRX 1 0 2 0x3 setRX 1 0 3 0x3

Zaza board DP3

setTX 0 2 0 0x4

setRX 0 2 4 0x3

setRX 0 2 5 0x3

setRX 0 4 0 0x3

setRX 0 4 1 0x3

setRX 1 0 4 0x3 setRX 1 0 5 0x3 setRX 1 2 0 0x3 setRX 1 2 1 0x3

Zaza board DP4

setTX 0 0 1 0x1

setRX 0 1 4 0x3

setRX 0 1 5 0x3

setRX 0 3 0 0x3

setRX 0 3 1 0x3

Zaza board DP5

setTX 0 0 3 0x4

setRX 0 3 2 0x3

setRX 0 3 3 0x3

setRX 0 3 4 0x3

setRX 0 3 5 0x3

Zaza board DP6

setTX 0 2 2 0x1 ???

setRX 0 4 2 0x3

setRX 0 4 3 0x3

setRX 0 4 4 0x3

setRX 0 4 5 0x3

```

config_CalTrigSeq.sh: script to configure FELIX firmware trigger
#e.g: ./config_CalTrigSeq.sh 3 2 #3=DIGSCANSEQB, 2 is device number

SCANTYPE=$1 #1=digitalA, 2=analogA, 3=digitalB 4=analogB                                          

DIGSCANSEQA=("817e" "6969" "6363" "a971" "a66a" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "566a" "566c" "5671" "5672" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969")
ANASCANSEQA=("817e" "6969" "6363" "a66a" "716a" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "566a" "566c" "5671" "5672" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6969" "6363" "a96a" "6a6a" "6969") #diff analog scan
DIGSCANSEQB=("817e" "817e" "aaaa" "63a6" "a66c" "936a" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "4e6a" "566c" "5671" "5672" "2e74" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa")
ANASCANSEQB=("817e" "817e" "aaaa" "63a6" "6a6a" "716a" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "4e6a" "566c" "5671" "5672" "2e74" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "63a6" "a66a" "6a6a" "aaaa")

if [[ $SCANTYPE -eq 1 ]]
then
    echo "Digital Scan A"
    SEQ=("${DIGSCANSEQA[@]}")
elif [[ $SCANTYPE -eq 2 ]]
then
    echo "Analog Scan A"
    SEQ=("${ANASCANSEQA[@]}")
elif [[ $SCANTYPE -eq 3 ]]
then
    echo "Digital Scan B"
    SEQ=("${DIGSCANSEQB[@]}")
elif [[ $SCANTYPE -eq 4 ]]
then
    echo "Analog Scan B"
    SEQ=("${ANASCANSEQB[@]}")
else
    echo "SCANTYPE=$SCANTYPE not supported"
    exit 1
fi

#write into FPGA memory       
flx-config -E -d$2 set YARR_FROMHOST_CALTRIGSEQ_WE=0x1

for ((i = 0 ; i < 32 ; i++)); do
    addr=$(printf '%x\n' $i)
    echo "flx-config -d $2 set YARR_FROMHOST_CALTRIGSEQ_WRADDR=0x${addr}"
    echo "flx-config -d $2 set YARR_FROMHOST_CALTRIGSEQ_WRDATA=0x${SEQ[i]}"
    flx-config -E -d$2 set YARR_FROMHOST_CALTRIGSEQ_WRADDR=0x${addr}
    flx-config -E -d$2 set YARR_FROMHOST_CALTRIGSEQ_WRDATA=0x${SEQ[i]}
done

#turn off WE
flx-config -E -d$2 set YARR_FROMHOST_CALTRIGSEQ_WE=0x0

To configure FELIX, use the following sequence before starting felix-star (or felixcore) (with recent versions of felix-distribution it is no longer necessary to stop felix-star to operate the scripts thanks to the -E switch of the flx-config command allowing to set register even if the resource is locked):

flx-init
setFelixStat.sh
setTXRX.sh
config_CalTrigSeq.sh 3 0 # or 4 0 for analog scans

Start felixcore or felix-star

Felixcore can be started with the following command:

For felix-star, a script has been prepared:

#!/bin/bash
#
if [ $1 == "start" ]
then
    felix-tohost -d 0 --daq-tcp --free-cmem --bus-dir ${ITK_DAQ_BASE}/bus --bus-groupname FELIX --did 0x00 --cid 0x0000 --ip localhost -v --stats-out ${ITK_DAQ_BASE}/bus/stats &> ${ITK_DAQ_BASE}/logs/felix-tohost-0.log &
    felix-tohost -d 1 --daq-tcp --free-cmem --bus-dir ${ITK_DAQ_BASE}/bus --bus-groupname FELIX --did 0x00 --cid 0x0001 --ip localhost -v --stats-out ${ITK_DAQ_BASE}/bus/stats &> ${ITK_DAQ_BASE}/logs/felix-tohost-1.log &
    felix-toflx -d 0 --rawtcp --free-cmem --bus-dir ${ITK_DAQ_BASE}/bus --bus-groupname FELIX --did 0x00 --cid 0x0000 --ip localhost -v --stats-out ${ITK_DAQ_BASE}/bus/stats &> ${ITK_DAQ_BASE}/logs/felix-toflx-0.log &
    felix-toflx -d 1 --rawtcp --free-cmem --bus-dir ${ITK_DAQ_BASE}/bus --bus-groupname FELIX --did 0x00 --cid 0x0001 --ip localhost -v --stats-out ${ITK_DAQ_BASE}/bus/stats &> ${ITK_DAQ_BASE}/logs/felix-toflx-1.log &
    felix-register --bus-dir ${ITK_DAQ_BASE}/bus --bus-groupname FELIX lo 0 0x00 0x000 1 0x00 0x0001 &> ${ITK_DAQ_BASE}/logs/felix-register.log &
elif [ $1 == "stop" ]
then
    /usr/bin/kill felix-register
    /usr/bin/kill felix-toflx
    /usr/bin/kill felix-tohost
else
    echo "Usage : felixctrl start|stop"
fi  

It can be used to start or stop felix-star processes:

felixctrl start
felixctrl stop

Optoboard configuration

The optoboard_felix package comes with a dump of the production DB thath gives the details of each optoboard based on it's serial number. So, to build a default configuration file for an optoboard you can copy a default config, like 30000000._test_lpgbtv1_vtrxv1_3.json (you can find it find in the optobord_felix installation folder) and change the numbers at the beginning to reflect your setup:

"Optoboard":
    {
        "serial": "30000000",
        "flx_G": 0,
        "flx_d": 0,
        "vtrx_v": "1.3"
    }
The serial number is normally written on the optoboard itself. flx_G is the downlink to be used to communicate with the lpGBT master and flx_d is the FELIX device number.

Depending on the low level IC communication tool you wan to use, one of the following commands can be used to configure your optoboard using the json config file you just created:

InitOpto --config_path configs/optoGE1.json --configure 1 --commToolName itk-ic-over-netio-next
InitOpto --config_path configs/optoGE1.json --configure 1 --commToolName lpgbt-com
InitOpto --config_path configs/optoGE1.json --configure 1 --commToolName ic-over-netio