From 3f721e16ca001089c92e1f2891351fc139ccb7b1 Mon Sep 17 00:00:00 2001 From: Ludwig Maier Date: Wed, 9 Oct 2013 17:17:24 +0200 Subject: [PATCH] added nxyter config dir --- .../config/nxyter/adc_value_delay.txt | 8 ++ users/cosy_test/config/nxyter/disable_all.sh | 28 ++++ .../config/nxyter/disable_channel.sh | 27 ++++ .../config/nxyter/disable_testtrigger.sh | 4 + .../config/nxyter/display_channels.sh | 32 +++++ users/cosy_test/config/nxyter/enable_all.sh | 29 ++++ .../cosy_test/config/nxyter/enable_channel.sh | 28 ++++ .../config/nxyter/enable_testpulse.sh | 13 ++ .../config/nxyter/enable_testtrigger.sh | 15 ++ users/cosy_test/config/nxyter/notes.txt | 2 + users/cosy_test/config/nxyter/nxsetup.dat | 49 +++++++ .../config/nxyter/nxsetup_default.dat | 49 +++++++ users/cosy_test/config/nxyter/nxtrim.dat | 129 ++++++++++++++++++ users/cosy_test/config/nxyter/read_calreg.sh | 11 ++ users/cosy_test/config/nxyter/registers.txt | 1 + users/cosy_test/config/nxyter/setenv.sh | 4 + users/cosy_test/config/nxyter/setup.sh | 47 +++++++ users/cosy_test/config/nxyter/takedata.sh | 6 + .../config/nxyter/test_fifo_flush.sh | 15 ++ users/cosy_test/config/nxyter/turnoffall.sh | 5 + users/cosy_test/config/nxyter/write_calreg.sh | 12 ++ 21 files changed, 514 insertions(+) create mode 100644 users/cosy_test/config/nxyter/adc_value_delay.txt create mode 100755 users/cosy_test/config/nxyter/disable_all.sh create mode 100755 users/cosy_test/config/nxyter/disable_channel.sh create mode 100755 users/cosy_test/config/nxyter/disable_testtrigger.sh create mode 100755 users/cosy_test/config/nxyter/display_channels.sh create mode 100755 users/cosy_test/config/nxyter/enable_all.sh create mode 100755 users/cosy_test/config/nxyter/enable_channel.sh create mode 100755 users/cosy_test/config/nxyter/enable_testpulse.sh create mode 100755 users/cosy_test/config/nxyter/enable_testtrigger.sh create mode 100644 users/cosy_test/config/nxyter/notes.txt create mode 100644 users/cosy_test/config/nxyter/nxsetup.dat create mode 100644 users/cosy_test/config/nxyter/nxsetup_default.dat create mode 100644 users/cosy_test/config/nxyter/nxtrim.dat create mode 100755 users/cosy_test/config/nxyter/read_calreg.sh create mode 120000 users/cosy_test/config/nxyter/registers.txt create mode 100755 users/cosy_test/config/nxyter/setenv.sh create mode 100755 users/cosy_test/config/nxyter/setup.sh create mode 100755 users/cosy_test/config/nxyter/takedata.sh create mode 100755 users/cosy_test/config/nxyter/test_fifo_flush.sh create mode 100755 users/cosy_test/config/nxyter/turnoffall.sh create mode 100755 users/cosy_test/config/nxyter/write_calreg.sh diff --git a/users/cosy_test/config/nxyter/adc_value_delay.txt b/users/cosy_test/config/nxyter/adc_value_delay.txt new file mode 100644 index 0000000..76986f8 --- /dev/null +++ b/users/cosy_test/config/nxyter/adc_value_delay.txt @@ -0,0 +1,8 @@ +0 2340 +1 2340 +2 2340 +3 2340 +4 1609 +5 1609 +6 1609 +7 2404 diff --git a/users/cosy_test/config/nxyter/disable_all.sh b/users/cosy_test/config/nxyter/disable_all.sh new file mode 100755 index 0000000..95af4fb --- /dev/null +++ b/users/cosy_test/config/nxyter/disable_all.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/binlocal:${PATH} + +# first disable test_trigger_ mode to allow reading +REG20=$(trb_i2c r 0x8900 0x08 0x20 | awk '{print $2}') +trb_i2c w 0x8900 0x08 0x20 0x00 + +# Channel Masks +trb_i2c w 0x8900 0x08 0x00 0xff +trb_i2c w 0x8900 0x08 0x01 0xff +trb_i2c w 0x8900 0x08 0x02 0xff +trb_i2c w 0x8900 0x08 0x03 0xff +trb_i2c w 0x8900 0x08 0x04 0xff +trb_i2c w 0x8900 0x08 0x05 0xff +trb_i2c w 0x8900 0x08 0x06 0xff +trb_i2c w 0x8900 0x08 0x07 0xff +trb_i2c w 0x8900 0x08 0x08 0xff +trb_i2c w 0x8900 0x08 0x09 0xff +trb_i2c w 0x8900 0x08 0x0a 0xff +trb_i2c w 0x8900 0x08 0x0b 0xff +trb_i2c w 0x8900 0x08 0x0c 0xff +trb_i2c w 0x8900 0x08 0x0d 0xff +trb_i2c w 0x8900 0x08 0x0e 0xff +trb_i2c w 0x8900 0x08 0x0f 0xff + +# Restore Register 20 +trb_i2c w 0x8900 0x08 0x20 $REG20 diff --git a/users/cosy_test/config/nxyter/disable_channel.sh b/users/cosy_test/config/nxyter/disable_channel.sh new file mode 100755 index 0000000..47a0964 --- /dev/null +++ b/users/cosy_test/config/nxyter/disable_channel.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/binlocal:${PATH} + +if [ -z "$1" ] +then + echo "Usage: $0 ChannelID" + exit 0; +fi + +# first disable test_trigger_ mode to allow reading +REG20=$(trb_i2c r 0x8900 0x08 0x20 | awk '{print $2}') +trb_i2c w 0x8900 0x08 0x20 0x00 + +REGISTER=$(($1/8)) +MASK=$((2**($1-8*$REGISTER))) + +echo "Register: $REGISTER Mask: $MASK" + +CURRENT=$(trb_i2c r 0x8900 0x08 $REGISTER | awk '{print $2}' | base) +NEW=$(($CURRENT|$MASK)) + +echo "$CURRENT -> $NEW" +trb_i2c w 0x8900 0x08 $REGISTER $NEW + +# Restore Register 20 +trb_i2c w 0x8900 0x08 0x20 $REG20 diff --git a/users/cosy_test/config/nxyter/disable_testtrigger.sh b/users/cosy_test/config/nxyter/disable_testtrigger.sh new file mode 100755 index 0000000..c4e2d92 --- /dev/null +++ b/users/cosy_test/config/nxyter/disable_testtrigger.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +#disable Testtrigger +trb_i2c w 0x8900 0x08 0x20 0x00 diff --git a/users/cosy_test/config/nxyter/display_channels.sh b/users/cosy_test/config/nxyter/display_channels.sh new file mode 100755 index 0000000..85ac9fc --- /dev/null +++ b/users/cosy_test/config/nxyter/display_channels.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/binlocal:${PATH} + +# first disable test_trigger_mode to allow reading +#REG20=$(trb_i2c r 0x8900 0x08 0x20 | awk '{print $2}') +#trb_i2c w 0x8900 0x08 0x20 0x00 + +echo " 01234567" +#echo " --------" +for REG in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +do + +VALUE=$(trb_i2c r 0x8900 0x08 $REG | awk '{print $2}' | base) +CHANNEL=$((8*$REG)) +printf "%03d: " $CHANNEL + +for i in 0 1 2 3 4 5 6 7 +do + BIT=$(($VALUE>>$i&1)) + if [ $BIT -eq 0 ] + then + echo -n "*" + else + echo -n "_" + fi +done +echo +done + +# Restore Register 20 +#trb_i2c w 0x8900 0x08 0x20 $REG20 diff --git a/users/cosy_test/config/nxyter/enable_all.sh b/users/cosy_test/config/nxyter/enable_all.sh new file mode 100755 index 0000000..a6a44dc --- /dev/null +++ b/users/cosy_test/config/nxyter/enable_all.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/binlocal:${PATH} + +# first disable test_trigger_ mode to allow reading +REG20=$(trb_i2c r 0x8900 0x08 0x20 | awk '{print $2}') +trb_i2c w 0x8900 0x08 0x20 0x00 + +# Channel Masks +trb_i2c w 0x8900 0x08 0x00 0x00 +trb_i2c w 0x8900 0x08 0x01 0x00 +trb_i2c w 0x8900 0x08 0x02 0x00 +trb_i2c w 0x8900 0x08 0x03 0x00 +trb_i2c w 0x8900 0x08 0x04 0x00 +trb_i2c w 0x8900 0x08 0x05 0x00 +trb_i2c w 0x8900 0x08 0x06 0x00 +trb_i2c w 0x8900 0x08 0x07 0x00 +trb_i2c w 0x8900 0x08 0x08 0x00 +trb_i2c w 0x8900 0x08 0x09 0x00 +trb_i2c w 0x8900 0x08 0x0a 0x00 +trb_i2c w 0x8900 0x08 0x0b 0x00 +trb_i2c w 0x8900 0x08 0x0c 0x00 +trb_i2c w 0x8900 0x08 0x0d 0x00 +trb_i2c w 0x8900 0x08 0x0e 0x00 +trb_i2c w 0x8900 0x08 0x0f 0x00 + +# Restore Register 20 +trb_i2c w 0x8900 0x08 0x20 $REG20 + diff --git a/users/cosy_test/config/nxyter/enable_channel.sh b/users/cosy_test/config/nxyter/enable_channel.sh new file mode 100755 index 0000000..49b29c7 --- /dev/null +++ b/users/cosy_test/config/nxyter/enable_channel.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/binlocal:${PATH} + +if [ -z "$1" ] +then + echo "Usage: $0 ChannelID" + exit 0; +fi + +# first disable test_trigger_ mode to allow reading +REG20=$(trb_i2c r 0x8900 0x08 0x20 | awk '{print $2}') +trb_i2c w 0x8900 0x08 0x20 0x00 + +REGISTER=$(($1/8)) +MASK=$((2**($1-8*$REGISTER))) + +echo "Register: $REGISTER Mask: $MASK" + +CURRENT=$(trb_i2c r 0x8900 0x08 $REGISTER | awk '{print $2}' | base) +NEW=$(($CURRENT^$MASK)) + +echo "$CURRENT -> $NEW" +trb_i2c w 0x8900 0x08 $REGISTER $NEW + +# Restore Register 20 +trb_i2c w 0x8900 0x08 0x20 $REG20 + diff --git a/users/cosy_test/config/nxyter/enable_testpulse.sh b/users/cosy_test/config/nxyter/enable_testpulse.sh new file mode 100755 index 0000000..f25d8ed --- /dev/null +++ b/users/cosy_test/config/nxyter/enable_testpulse.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +#enable Testmode + +trb_i2c w 0x8900 0x08 0x21 0x0d # bit 3: must be 1, + # bit 2: nxyter-polarity 0: negative + # bit 0-1: test puls channels: + # 0: 0,4, 1:1,5, 2:2,6, 3:3,7 + +trb_i2c w 0x8900 0x08 0x20 0x01 # bit3: enable test_trigger + # bit2: test-polarity 0: negative + # bit1: test-pulse synchronise + # bit0: enable test pulse diff --git a/users/cosy_test/config/nxyter/enable_testtrigger.sh b/users/cosy_test/config/nxyter/enable_testtrigger.sh new file mode 100755 index 0000000..49acd15 --- /dev/null +++ b/users/cosy_test/config/nxyter/enable_testtrigger.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +#enable Testmode + +trb_i2c w 0x8900 0x08 0x21 0x0c # bit 3: must be 1, + # bit 2: nxyter-polarity 0: negative + # bit 0-1: test puls channels: + # 0: 0,4, 1:1,5, 2:2,6, 3:3,7 + +trb_i2c w 0x8900 0x08 0x20 0x08 # bit3: enable test_trigger + # bit2: test-polarity 0: negative + # bit1: test-pulse synchronise + # bit0: enable test pulse + +trbcmd w 0x8900 0x8161 1 # Enable Testpulse Signal diff --git a/users/cosy_test/config/nxyter/notes.txt b/users/cosy_test/config/nxyter/notes.txt new file mode 100644 index 0000000..11dc5a2 --- /dev/null +++ b/users/cosy_test/config/nxyter/notes.txt @@ -0,0 +1,2 @@ +# Time from Trogger pulse to first valid timestamp: 400ns + --> maximum correlation window diff --git a/users/cosy_test/config/nxyter/nxsetup.dat b/users/cosy_test/config/nxyter/nxsetup.dat new file mode 100644 index 0000000..397a8d6 --- /dev/null +++ b/users/cosy_test/config/nxyter/nxsetup.dat @@ -0,0 +1,49 @@ +#------------------------------------------ +# Value I2C RegisterAddress +#------------------------------------------ +0x00000000 # 0 Channel Masks BEGIN +0x00000000 # 1 +0x00000000 # 2 +0x00000000 # 3 +0x00000000 # 4 +0x00000000 # 5 +0x00000000 # 6 +0x00000000 # 7 +0x00000000 # 8 +0x00000000 # 9 +0x00000000 # 10 +0x00000000 # 11 +0x00000000 # 12 +0x00000000 # 13 +0x00000000 # 14 +0x00000000 # 15 Channel Masks END +0x000000a0 # 16 +0x000000ff # 17 +0x0000003c # 18 Common Threshold, default 0x80 +0x0000001e # 19 +0x0000005f # 20 +0x00000057 # 21 +0x00000064 # 22 +0x00000089 # 23 +0x000000ff # 24 Testpulse Strength, default 0x80 +0x00000045 # 25 +0x0000000f # 26 +0x00000036 # 27 +0x0000005c # 28 +0x00000045 # 29 +0x000000be # 30 +0x000000be # 31 +0x00000004 # 32 TestTrigger setup etc. , default 0x00 +0x00000008 # 33 clock input 256A, set bit #3, default 0x08 (normal mode) +0x000000be # 34 +0x000000be # 35 +0x000000be # 36 +0x000000be # 37 +0x00000000 # 38 +0x00000000 # 39 +0x000000be # 40 +0x000000be # 41 +0x000000be # 42 Channel shutdown register, FIFO, do not touch +0x00000000 # 43 +0x00000000 # 44 +0x000000ff # 45 diff --git a/users/cosy_test/config/nxyter/nxsetup_default.dat b/users/cosy_test/config/nxyter/nxsetup_default.dat new file mode 100644 index 0000000..4c06dc8 --- /dev/null +++ b/users/cosy_test/config/nxyter/nxsetup_default.dat @@ -0,0 +1,49 @@ +#------------------------------------------ +# Value I2C RegisterAddress +#------------------------------------------ +0x000000aa # 0 Channel Masks BEGIN +0x00000000 # 1 +0x00000000 # 2 +0x00000000 # 3 +0x00000000 # 4 +0x00000000 # 5 +0x00000000 # 6 +0x00000000 # 7 +0x00000000 # 8 +0x00000000 # 9 +0x00000000 # 10 +0x00000000 # 11 +0x00000000 # 12 +0x00000000 # 13 +0x00000000 # 14 +0x00000000 # 15 Channel Masks END +0x00000080 # 16 +0x00000080 # 17 +0x00000030 # 18 Common Threshold, default 0x80 +0x00000080 # 19 +0x00000080 # 20 +0x00000080 # 21 +0x00000080 # 22 +0x00000080 # 23 +0x00000080 # 24 Testpulse Strength, default 0x80 +0x00000080 # 25 +0x00000080 # 26 +0x00000080 # 27 +0x00000080 # 28 +0x00000080 # 29 +0x000000be # 30 +0x000000be # 31 +0x00000000 # 32 TestTrigger setup etc. , default 0x00 +0x00000008 # 33 clock input 256A, set bit #3, default 0x08 (normal mode) +0x000000be # 34 +0x000000be # 35 +0x000000be # 36 +0x000000be # 37 +0x00000000 # 38 +0x00000000 # 39 +0x000000be # 40 +0x000000be # 41 +0x000000be # 42 Channel shutdown register, FIFO, do not touch +0x00000000 # 43 +0x00000000 # 44 +0x000000bb # 45 diff --git a/users/cosy_test/config/nxyter/nxtrim.dat b/users/cosy_test/config/nxyter/nxtrim.dat new file mode 100644 index 0000000..4362c64 --- /dev/null +++ b/users/cosy_test/config/nxyter/nxtrim.dat @@ -0,0 +1,129 @@ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 106 + 107 + 108 + 109 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + 119 + 120 + 121 + 122 + 123 + 124 + 125 + 126 + 127 + 128 + 129 diff --git a/users/cosy_test/config/nxyter/read_calreg.sh b/users/cosy_test/config/nxyter/read_calreg.sh new file mode 100755 index 0000000..edc58fc --- /dev/null +++ b/users/cosy_test/config/nxyter/read_calreg.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +i=0 +while [ $i -lt 129 ] +do + VALUE=$(trb_i2c r 0x8900 0x08 42 | awk '{print $2}') + echo "$i : $VALUE" + trb_i2c w 0x8900 0x08 42 $VALUE + i=$((i+1)) +done + diff --git a/users/cosy_test/config/nxyter/registers.txt b/users/cosy_test/config/nxyter/registers.txt new file mode 120000 index 0000000..651aaa8 --- /dev/null +++ b/users/cosy_test/config/nxyter/registers.txt @@ -0,0 +1 @@ +/home/rich/TRB/nXyter/trb3/nxyter/source/registers.txt \ No newline at end of file diff --git a/users/cosy_test/config/nxyter/setenv.sh b/users/cosy_test/config/nxyter/setenv.sh new file mode 100755 index 0000000..3d9a90a --- /dev/null +++ b/users/cosy_test/config/nxyter/setenv.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/bin:${PATH} + diff --git a/users/cosy_test/config/nxyter/setup.sh b/users/cosy_test/config/nxyter/setup.sh new file mode 100755 index 0000000..d885010 --- /dev/null +++ b/users/cosy_test/config/nxyter/setup.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/bin:${PATH} + +# i2c_sm_reset +trbcmd w 0x8900 0x8100 0x01 +# i2c_reg_reset_start +trbcmd w 0x8900 0x8101 0x01 + +# Write nxsetup.dat to memory and transfer to nx-i2c-registers +trbcmd wm 0x8900 0x8200 0 nxsetup.dat +trbcmd w 0x8900 0x8241 1 + +#enable Testmode +#trb_i2c w 0x8900 0x08 0x20 0x08 # bit0: enable test pulse + # bit2: test-polarity 0: negativ 1:positiv + # bit 3: enable test_trigger +#trb_i2c w 0x8900 0x08 0x21 0x0d # bit3: must be 1, bit 2: nxyter-polarity, + # bit 0-1: test puls channels: 0: 0,4, + # 1:1,5, 2:2,6, 3:3,7 + +# Threshold setting +#trb_i2c w 0x8900 0x08 18 0x80 + +# Setup Trigger Generator +trbcmd w 0x8900 0x8141 200 # 500 * 10ns = 5mus Period +trbcmd w 0x8900 0x8142 1 # one Trigger per cycle +trbcmd w 0x8900 0x8143 16 # 200ns trigger length, disable it +trbcmd w 0x8900 0x8144 0 # reset before trigger + + +# nx_ts_reset_start +trbcmd w 0x8900 0x8102 0x01 + +# reset counters, flush FIFO +echo "clear data fifo" +trbcmd rm 0x8900 0x8600 4000 1 > /dev/null + +# Set readout Mode +trbcmd w 0x8900 0x8180 0x00 # normal mode +trbcmd w 0x8900 0x8182 100 # window width = 100 * 4ns + +# Decoder Settings +trbcmd w 0x8900 0x8120 0 # reset all counters + +# Enable nxyter +trbcmd w 0x8900 0x8103 0 diff --git a/users/cosy_test/config/nxyter/takedata.sh b/users/cosy_test/config/nxyter/takedata.sh new file mode 100755 index 0000000..9f33c50 --- /dev/null +++ b/users/cosy_test/config/nxyter/takedata.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +trbcmd w 0x8900 0x8140 0x01 + +#trbcmd rm 0x8900 0x8600 2000 1 | grep -v '^H:' | head -n -2 | awk '{printf "%s %s\n", $1, $2}' +trbcmd rm 0x8900 0x8600 2000 1 diff --git a/users/cosy_test/config/nxyter/test_fifo_flush.sh b/users/cosy_test/config/nxyter/test_fifo_flush.sh new file mode 100755 index 0000000..dfc0b2e --- /dev/null +++ b/users/cosy_test/config/nxyter/test_fifo_flush.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +export PATH=/home/rich/TRB/trbsoft/trbnettools/binlocal:${PATH} + +./setup.sh +./disable_all.sh +./enable_channel.sh 0 +./enable_channel.sh 1 +./enable_channel.sh 2 +./enable_channel.sh 3 + +trbcmd w 0x8900 0x8180 4 + +./enable_testtrigger.sh +./display_channels.sh diff --git a/users/cosy_test/config/nxyter/turnoffall.sh b/users/cosy_test/config/nxyter/turnoffall.sh new file mode 100755 index 0000000..95573d2 --- /dev/null +++ b/users/cosy_test/config/nxyter/turnoffall.sh @@ -0,0 +1,5 @@ +trbcmd clearbit 0x8111 0xc0 0xe ##trigger off for hub channel 1-3 +trbcmd clearbit 0x8111 0xc1 0xe +trbcmd clearbit 0x8111 0xc3 0xe + +## never turn of bit 1 in hub! diff --git a/users/cosy_test/config/nxyter/write_calreg.sh b/users/cosy_test/config/nxyter/write_calreg.sh new file mode 100755 index 0000000..bf0db7e --- /dev/null +++ b/users/cosy_test/config/nxyter/write_calreg.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +i=0 +while [ $i -lt 129 ] +do + VALUE=$(trb_i2c r 0x8900 0x08 42 | awk '{print $2}') + echo "$i : $VALUE" + trb_i2c w 0x8900 0x08 42 0x20 + #trb_i2c w 0x8900 0x08 42 0x00 + i=$((i+1)) +done + -- 2.43.0