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
+REG20=$(trb_i2c r 0x3800 0x08 0x20 | awk '{print $2}')
+trb_i2c w 0x3800 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
+trb_i2c w 0x3800 0x08 0x00 0xff
+trb_i2c w 0x3800 0x08 0x01 0xff
+trb_i2c w 0x3800 0x08 0x02 0xff
+trb_i2c w 0x3800 0x08 0x03 0xff
+trb_i2c w 0x3800 0x08 0x04 0xff
+trb_i2c w 0x3800 0x08 0x05 0xff
+trb_i2c w 0x3800 0x08 0x06 0xff
+trb_i2c w 0x3800 0x08 0x07 0xff
+trb_i2c w 0x3800 0x08 0x08 0xff
+trb_i2c w 0x3800 0x08 0x09 0xff
+trb_i2c w 0x3800 0x08 0x0a 0xff
+trb_i2c w 0x3800 0x08 0x0b 0xff
+trb_i2c w 0x3800 0x08 0x0c 0xff
+trb_i2c w 0x3800 0x08 0x0d 0xff
+trb_i2c w 0x3800 0x08 0x0e 0xff
+trb_i2c w 0x3800 0x08 0x0f 0xff
# Restore Register 20
-trb_i2c w 0x8900 0x08 0x20 $REG20
+trb_i2c w 0x3800 0x08 0x20 $REG20
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
+REG20=$(trb_i2c r 0x3800 0x08 0x20 | awk '{print $2}')
+trb_i2c w 0x3800 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)
+CURRENT=$(trb_i2c r 0x3800 0x08 $REGISTER | awk '{print $2}' | base)
NEW=$(($CURRENT|$MASK))
echo "$CURRENT -> $NEW"
-trb_i2c w 0x8900 0x08 $REGISTER $NEW
+trb_i2c w 0x3800 0x08 $REGISTER $NEW
# Restore Register 20
-trb_i2c w 0x8900 0x08 0x20 $REG20
+trb_i2c w 0x3800 0x08 0x20 $REG20
#!/bin/sh
#disable Testtrigger
-trb_i2c w 0x8900 0x08 0x20 0x00
+trb_i2c w 0x3800 0x08 0x20 0x00
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
+#REG20=$(trb_i2c r 0x3800 0x08 0x20 | awk '{print $2}')
+#trb_i2c w 0x3800 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)
+VALUE=$(trb_i2c r 0x3800 0x08 $REG | awk '{print $2}' | base)
CHANNEL=$((8*$REG))
printf "%03d: " $CHANNEL
done
# Restore Register 20
-#trb_i2c w 0x8900 0x08 0x20 $REG20
+#trb_i2c w 0x3800 0x08 0x20 $REG20
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
+REG20=$(trb_i2c r 0x3800 0x08 0x20 | awk '{print $2}')
+trb_i2c w 0x3800 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
+trb_i2c w 0x3800 0x08 0x00 0x00
+trb_i2c w 0x3800 0x08 0x01 0x00
+trb_i2c w 0x3800 0x08 0x02 0x00
+trb_i2c w 0x3800 0x08 0x03 0x00
+trb_i2c w 0x3800 0x08 0x04 0x00
+trb_i2c w 0x3800 0x08 0x05 0x00
+trb_i2c w 0x3800 0x08 0x06 0x00
+trb_i2c w 0x3800 0x08 0x07 0x00
+trb_i2c w 0x3800 0x08 0x08 0x00
+trb_i2c w 0x3800 0x08 0x09 0x00
+trb_i2c w 0x3800 0x08 0x0a 0x00
+trb_i2c w 0x3800 0x08 0x0b 0x00
+trb_i2c w 0x3800 0x08 0x0c 0x00
+trb_i2c w 0x3800 0x08 0x0d 0x00
+trb_i2c w 0x3800 0x08 0x0e 0x00
+trb_i2c w 0x3800 0x08 0x0f 0x00
# Restore Register 20
-trb_i2c w 0x8900 0x08 0x20 $REG20
+trb_i2c w 0x3800 0x08 0x20 $REG20
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
+REG20=$(trb_i2c r 0x3800 0x08 0x20 | awk '{print $2}')
+trb_i2c w 0x3800 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)
+CURRENT=$(trb_i2c r 0x3800 0x08 $REGISTER | awk '{print $2}' | base)
NEW=$(($CURRENT^$MASK))
echo "$CURRENT -> $NEW"
-trb_i2c w 0x8900 0x08 $REGISTER $NEW
+trb_i2c w 0x3800 0x08 $REGISTER $NEW
# Restore Register 20
-trb_i2c w 0x8900 0x08 0x20 $REG20
+trb_i2c w 0x3800 0x08 0x20 $REG20
#enable Testmode
-trb_i2c w 0x8900 0x08 0x21 0x0d # bit 3: must be 1,
+trb_i2c w 0x3800 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
+trb_i2c w 0x3800 0x08 0x20 0x01 # bit3: enable test_trigger
# bit2: test-polarity 0: negative
# bit1: test-pulse synchronise
# bit0: enable test pulse
#enable Testmode
-trb_i2c w 0x8900 0x08 0x21 0x0c # bit 3: must be 1,
+trb_i2c w 0x3800 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
+trb_i2c w 0x3800 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
+trbcmd w 0x3800 0x8161 1 # Enable Testpulse Signal
i=0
while [ $i -lt 129 ]
do
- VALUE=$(trb_i2c r 0x8900 0x08 42 | awk '{print $2}')
+ VALUE=$(trb_i2c r 0x3800 0x08 42 | awk '{print $2}')
echo "$i : $VALUE"
- trb_i2c w 0x8900 0x08 42 $VALUE
+ trb_i2c w 0x3800 0x08 42 $VALUE
i=$((i+1))
done
+++ /dev/null
-/home/rich/TRB/nXyter/trb3/nxyter/source/registers.txt
\ No newline at end of file
--- /dev/null
+-- Control Register
+0x8100 : w w: reset I2C State Machine
+0x8101 : w w: reset I2C all Register
+0x8102 : w w: Reset and Sync Timestamps (nXyter and FPGA)
+0x8103 : r/w Put nxyter into offline mode
+
+-- NX I2C Setup Handler
+0x8200 : r/w I2C Memeory Register (Depth: 0 - 45 ... 0x822c)
+0x8260 : r/w DAC Register Memory (Depth: 0 - 128 ... 0x82e0)
+0x8240 : w Read all I2C Registers into Memory
+0x8241 : w Write all Memory to I2C Registers
+0x8242 : w Read Trim DAC Register(129 deep FIFO) to Memory
+0x8243 : w Write Memory to Trim DAC Register(129 deep FIFO)
+
+-- Trigger Generator
+0x8140 : w If writing just start trigger cycle, keep current setting
+0x8141 : r/w Bit 15-0 : periodic time (in 10ns)
+0x8142 : r/w Bit0 7-0 : number of triggers to be sent consecutive
+0x8143 : r/w Bit 15-0 : Length of trigger pulse (in 10ns), if 0: skip it
+0x8144 : r/w Bit0 : 1: send timestamp-reset before trigger
+0x8145 : r : Testpulse Rate (in Hz)
+
+-- Trigger Handler
+0x8160 : r/w Bit 7-0 : Delay Testpulse Signal after Trigger (10ns)
+0x8161 : r/w Bit 0 : Enable Testpulse Signal (default: off)
+0x8162 : r : Accepted Trigger Rate (in Hz)
+
+-- NX Data Receiver
+0x8500 : r current Timestamp FIFO value
+0x8501 : r/w r: FIFO Status
+ 0: fifo_full
+ 1: fifo_empty
+ 2: fifo_almost_empty
+ 3..29: ignore
+ 31: nx_frame_synced
+ w: adc reset
+0x8502 : r/w r: Resync Counter(12bit)
+ w: clear Resync Counter
+0x8503 : r/w r: Parity Error Counter (12bit)
+ w: clear Parity Error Counter
+0x8505 : r/w ADC CLK Delay 4ns steps (3Bit: range 0..7)
+ 0: 4ns after frame_valid
+ 1: 8ns -------"---------
+ ...... -------"---------
+ 6: 28ns -------"---------
+ 7: 32ns -------"--------- <= this shoud be correct
+ i.e. 2ns before new frame clock
+0x8506 : r ADC Reset Counter
+0x8507 : r/w Debug Multiplexer:
+ 0: no ADC Values, normal Debug
+ 1: ADC Value Nxyter
+ 2: ADC Value Testchannel
+ 3: ADC Reset Handler
+0x8508 : r current ADC FIFO value
+
+-- NX Data Delay
+0x8130 : r FIFO Delay, i.e. Trigger Delay (7Bit, in 32ns, Range 1..120)
+
+-- NX Data Validate
+0x8120 : r/w Invalid Frame Counter (16 bit) / w: clear all counters
+0x8121 : r Overflow Counter (16 bit)
+0x8122 : r Pileup Counter (16 bit)
+0x8123 : r Parity Error Counter (16 bit)
+0x8124 : r Trigger Rate (in Hz)
+0x8125 : r Frame Rate (in Hz)
+
+-- NX Trigger Validate
+0x8180 : r/w Readout Mode (0:Ref + valid + window, 1: Ref + Valid
+ 3: Raw and TimeStamp + valid,
+ 4: Raw, 5: Raw + Valid )
+0x8181 : r/w Trigger Window Delay (12 bit, in 4ns)
+0x8182 : r/w Trigger Window Width (12 bit, in 4ns)
+0x8183 : r/w CTS Trigger Delay (12 bit, in 4ns)
+0x8184 : r/w Readout Time Max (12 bit, in 10ns)
+
+0x8185 : r Busy Time Counter (12 bit, in 10ns)
+0x8186 : r timestamp_ref
+0x8187 : r window_lower_thr
+0x8188 : r window_upper_thr
+0x8189 : r data_fifo_delay (7 bit, in 32ns)
+0x818a : r done counter ch 0..31
+0x818b : r done counter ch 32..63
+0x818c : r done counter ch 94..95
+0x818d : r done counter ch 96..127
+
+-- Event Data Buffer
+0x8600 : r read FIFO buffer
+0x8601 : r FIFO write counter
+0x8602 : r FIFO flush counter
+0x8603 : r read FIFO status
+
+--- DEBUG ------------------------------------------------------------
+
+-- I2C Master
+0x8040 : Access to I2C Interface
+ Chip Ids: 0x08 : nXyter
+ 0x29 : AD7991-1
+ 0x50 : EEPROM
+-- SPI Master
+0x8060 : Access to SPI Interface
+
+-- Histogram Handler
+0x8800 : r/w r: Read Channel Statistic (128 channel in a row)
+ w: reset all Histograms
+0x8880 : r Read Channel Trigger Rate (128 channel in a row, 1/s)
+0x3800 : r Read Channel ADC Value (128 channel in a row)
+
+-- Debug Multiplexer
+0x8020 : r/w Select Debug Entity
+ 0: nxyter_registers
+ 1: nx_setup
+ 2: nx_i2c_master
+ 3: adc_spi_master
+ 4: nx_fpga_timestamp
+ 5: nx_trigger_handler
+ 6: nx_trigger_generator
+ 7: nx_data_receiver
+ 8: nx_data_delay
+ 9: nx_data_validate
+ 10: nx_trigger_validate
+ 11: nx_event_buffer
+ 12: nx_histograms
+
export PATH=/home/rich/TRB/trbsoft/trbnettools/bin:${PATH}
# i2c_sm_reset
-trbcmd w 0x8900 0x8100 0x01
+trbcmd w 0x3800 0x8100 0x01
# i2c_reg_reset_start
-trbcmd w 0x8900 0x8101 0x01
+trbcmd w 0x3800 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
+trbcmd wm 0x3800 0x8200 0 nxsetup.dat
+trbcmd w 0x3800 0x8241 1
#enable Testmode
-#trb_i2c w 0x8900 0x08 0x20 0x08 # bit0: enable test pulse
+#trb_i2c w 0x3800 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,
+#trb_i2c w 0x3800 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
+#trb_i2c w 0x3800 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
+trbcmd w 0x3800 0x8141 200 # 500 * 10ns = 5mus Period
+trbcmd w 0x3800 0x8142 1 # one Trigger per cycle
+trbcmd w 0x3800 0x8143 16 # 200ns trigger length, disable it
+trbcmd w 0x3800 0x8144 0 # reset before trigger
# nx_ts_reset_start
-trbcmd w 0x8900 0x8102 0x01
+trbcmd w 0x3800 0x8102 0x01
# reset counters, flush FIFO
echo "clear data fifo"
-trbcmd rm 0x8900 0x8600 4000 1 > /dev/null
+trbcmd rm 0x3800 0x8600 4000 1 > /dev/null
# Set readout Mode
-trbcmd w 0x8900 0x8180 0x00 # normal mode
-trbcmd w 0x8900 0x8182 100 # window width = 100 * 4ns
+trbcmd w 0x3800 0x8180 0x00 # normal mode
+trbcmd w 0x3800 0x8182 100 # window width = 100 * 4ns
# Decoder Settings
-trbcmd w 0x8900 0x8120 0 # reset all counters
+trbcmd w 0x3800 0x8120 0 # reset all counters
# Enable nxyter
-trbcmd w 0x8900 0x8103 0
+trbcmd w 0x3800 0x8103 0
#!/bin/sh
-trbcmd w 0x8900 0x8140 0x01
+trbcmd w 0x3800 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
+#trbcmd rm 0x3800 0x8600 2000 1 | grep -v '^H:' | head -n -2 | awk '{printf "%s %s\n", $1, $2}'
+trbcmd rm 0x3800 0x8600 2000 1
./enable_channel.sh 2
./enable_channel.sh 3
-trbcmd w 0x8900 0x8180 4
+trbcmd w 0x3800 0x8180 4
./enable_testtrigger.sh
./display_channels.sh
i=0
while [ $i -lt 129 ]
do
- VALUE=$(trb_i2c r 0x8900 0x08 42 | awk '{print $2}')
+ VALUE=$(trb_i2c r 0x3800 0x08 42 | awk '{print $2}')
echo "$i : $VALUE"
- trb_i2c w 0x8900 0x08 42 0x20
- #trb_i2c w 0x8900 0x08 42 0x00
+ trb_i2c w 0x3800 0x08 42 0x20
+ #trb_i2c w 0x3800 0x08 42 0x00
i=$((i+1))
done