README.md 22.1 KB
Newer Older
Mini-Me's avatar
Mini-Me committed
1
# CMS Ph2 ACF (Acquisition & Control Framework)
Georg Auzinger's avatar
Georg Auzinger committed
2

Mauro Dinardo's avatar
Mauro Dinardo committed
3

Mauro Dinardo's avatar
Mauro Dinardo committed
4
### Contains:
Georg Auzinger's avatar
Georg Auzinger committed
5

6
- A middleware API layer, implemented in C++, which wraps the firmware calls and handshakes into abstracted functions
Mauro Dinardo's avatar
Mauro Dinardo committed
7
- A C++ object-based library describing the system components (CBCs, RD53, Hybrids, Boards) and their properties (values, status)
Mauro Dinardo's avatar
Mauro Dinardo committed
8

Mauro Dinardo's avatar
Mauro Dinardo committed
9

10
11
12
13
14
15
###  A short guide to write the GoldenImage to the SD card

1. Connect the SD card
2. Download the golden firmware from https://indico.cern.ch/event/842824/attachments/1920624/3178547/sdgoldenimage.img
3. `sudo fdisk -l` - find the name of the SD card (for example, /dev/mmcblk0)
4. `sudo chmod 744 /dev/sd_card_name` - to be able to play with it
Mauro Dinardo's avatar
Mauro Dinardo committed
16
17
5. `./imgtool /dev/sd_card_name format Firmware` - to format the SD card
6. Go to the folder were you saved the sdgoldenimage.img file
18
7. `dd if=sdgoldenimage.img of=/dev/sd_card_name bs=512` - to write the image to the SD card
Mauro Dinardo's avatar
Mauro Dinardo committed
19
8. Once the previous command is done, you can list the SD card: `./imgtool /dev/sd_card_name list` - there should be a GoldenImage.bin, with 20MB block size
20
21
9. Insert the SD card into the FC7

Mauro Dinardo's avatar
Mauro Dinardo committed
22
Use the guide (https://gitlab.cern.ch/cms_tk_ph2/d19c-firmware/blob/master/doc/IPAddress_Tutorial.md) to find the MAC address of the FC7 (Wireshark option) and to set the proper IP <br/>
23
More informations can be found at https://indico.cern.ch/event/842824/attachments/1920624/3177632/PreparingFC7.pdf
Mauro Dinardo's avatar
Mauro Dinardo committed
24
<hr>
Mauro Dinardo's avatar
Mauro Dinardo committed
25

Mauro Dinardo's avatar
Mauro Dinardo committed
26

Mauro Dinardo's avatar
Mauro Dinardo committed
27
## Middleware for the Inner-Tracker (IT) system
Mauro Dinardo's avatar
Mauro Dinardo committed
28
```diff
Mauro Dinardo's avatar
Mauro Dinardo committed
29
+ Last change made to this section: 14/12/2020
Mauro Dinardo's avatar
Mauro Dinardo committed
30
31
```

Mauro Dinardo's avatar
Mauro Dinardo committed
32
**Suggested software and firmware versions:**
Mauro Dinardo's avatar
Mauro Dinardo committed
33
- Software git branch / tag : `master` / `IT-v3.9.9`
Mauro Dinardo's avatar
Mauro Dinardo committed
34
- Firmware tag: `3.4`
Mauro Dinardo's avatar
Mauro Dinardo committed
35
- Mattermost forum: `cms-it-daq` (https://mattermost.web.cern.ch/cms-it-daq/)
Mauro Dinardo's avatar
Mauro Dinardo committed
36

Mauro Dinardo's avatar
Mauro Dinardo committed
37
**FC7 setup:**
38
1. Install `wireshark` in order to figure out which is the MAC address of your FC7 board (`sudo yum install wireshark`, then run `sudo tshark -i ethernet_card`, where `ethernet_card` is the name of the ethernet card of your PC to which the FC7 is connected to)
Mauro Dinardo's avatar
Mauro Dinardo committed
39
40
2. In `/etc/ethers` put `mac_address fc7.board.1` and in `/etc/hosts` put `192.168.1.80 fc7.board.1`
3. Restart the network: `sudo /etc/init.d/network restart`
Mauro Dinardo's avatar
Mauro Dinardo committed
41
42
4. Install the rarpd daemon (version for CENTOS6 should work just fine even for CENTOS7): `sudo yum install rarp_file_name.rpm` from https://centos.pkgs.org/6/epel-x86_64/rarpd-ss981107-42.el6.x86_64.rpm.html
5. Start the rarpd daemon: `sudo systemctl start rarpd` or `rarp -e -A` (to start rarpd automatically after bootstrap: `sudo systemctl enable rarpd`)
Mauro Dinardo's avatar
Mauro Dinardo committed
43

Mauro Dinardo's avatar
Mauro Dinardo committed
44
More details on the hardware needed to setup the system can be bound here: https://espace.cern.ch/Tracker-Upgrade/DAQ/SitePages/Home.aspx
Mauro Dinardo's avatar
Mauro Dinardo committed
45

Mauro Dinardo's avatar
Mauro Dinardo committed
46
**Firmware setup:**
Mauro Dinardo's avatar
Mauro Dinardo committed
47
48
1. Check whether the DIP switches on FC7 board are setup for the use of a microSD card (`out-in-in-in-out-in-in-in`)
2. Insert a microSD card in the PC and run `/sbin/fdisk -l` to understand to which dev it's attached to (`/dev/sd_card_name`)
Mauro Dinardo's avatar
Mauro Dinardo committed
49
3. Upload a golden firmware* on the microSD card (read FC7 manual or run `dd if=sdgoldenimage.img of=/dev/sd_card_name bs=512`)
Mauro Dinardo's avatar
Mauro Dinardo committed
50
4. Download the proper IT firmware version from https://gitlab.cern.ch/cmstkph2-IT/d19c-firmware/-/releases
Mauro Dinardo's avatar
Mauro Dinardo committed
51
5. Plug the microSD card in the FC7
Mauro Dinardo's avatar
Mauro Dinardo committed
52
53
6. From Ph2_ACF use the command `fpgaconfig` to upload the proper IT firmware (see instructions: `IT-DAQ setup and run` before running this command)

Mauro Dinardo's avatar
Mauro Dinardo committed
54
*A golden firmware is any stable firmware either from IT or OT, and it's needed just to initialize the IPbus communication at bootstrap (in order to create and image of the microSD card you can use the command: `dd if=/dev/sd_card_name conv=sync,noerror bs=128K | gzip -c > sdgoldenimage.img.gz`) <br />
Mauro Dinardo's avatar
Mauro Dinardo committed
55
56
A golden firmware can be downloaded from here: https://cernbox.cern.ch/index.php/s/5tUCio08PEfTf0a <br />
A detailed manual about the firmware can be found here: https://gitlab.cern.ch/cmstkph2-IT/d19c-firmware/blob/master/doc/IT-uDTC_fw_manual_v1.0.pdf
Mauro Dinardo's avatar
Mauro Dinardo committed
57

Mauro Dinardo's avatar
Mauro Dinardo committed
58
**IT-DAQ setup and run:**
Mauro Dinardo's avatar
Mauro Dinardo committed
59
60
1. `sudo yum install pugixml-devel` (if necesary run `sudo yum install epel-release` before point 1.)
2. Install: `boost` by running `sudo yum install boost-devel`, `CERN ROOT` from https://root.cern.ch, and `IPbus` from http://ipbus.web.cern.ch/ipbus (either using `sudo yum` or from source)
Mauro Dinardo's avatar
Mauro Dinardo committed
61
3. Checkout the DAQ code from git: `git clone https://gitlab.cern.ch/cmsinnertracker/Ph2_ACF.git`
Mauro Dinardo's avatar
Mauro Dinardo committed
62
4. `cd Ph2_ACF; source setup.sh; mkdir myBuild; cd myBuild; cmake ..; make -j4; cd ..`
Mini-Me's avatar
Minor    
Mini-Me committed
63
64
65
66
67
5. `mkdir choose_a_name`
6. `cp settings/RD53Files/CMSIT_RD53.txt choose_a_name`
7. `cp settings/CMSIT.xml choose_a_name`
8. `cd choose_a_name`
9. Edit the file `CMSIT.xml` in case you want to change some parameters needed for the calibrations or for configuring the chip
Mini-Me's avatar
Minor    
Mini-Me committed
68
10. Run the command: `CMSITminiDAQ -f CMSIT.xml -r` to reset the FC7 (just once)
Mauro Dinardo's avatar
Mauro Dinardo committed
69
70
11. Run the command: `CMSITminiDAQ -f CMSIT.xml -c name_of_the_calibration` (or `CMSITminiDAQ --help` for help)

Mauro Dinardo's avatar
Mauro Dinardo committed
71
**N.B.:** a skeleton/template file to build your own IT mini DAQ can be found in `src/templateCMSITminiDAQ.cc`
Mauro Dinardo's avatar
Mauro Dinardo committed
72

Mauro Dinardo's avatar
Mauro Dinardo committed
73
**Basic list of commands for the `fpgaconfig` program (run from the `choose_a_name` directory):**
Mauro Dinardo's avatar
Mauro Dinardo committed
74
75
- Run the command: `fpgaconfig -c CMSIT.xml -l` to check which firmware is on the microSD card
- Run the command: `fpgaconfig -c CMSIT.xml -f firmware_file_name_on_the_PC -i firmware_file_name_on_the_microSD` to upload a new firmware to the microSD card
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
76
- Run the command: `fpgaconfig -c CMSIT.xml -i firmware_file_name_on_the_microSD` to load a new firmware from the microSD card to the FPGA
Mauro Dinardo's avatar
Mauro Dinardo committed
77
- Run the command: `fpgaconfig --help` for help
Mauro Dinardo's avatar
Mauro Dinardo committed
78

Mini-Me's avatar
Minor    
Mini-Me committed
79
80
The program `CMSITminiDAQ` is the portal for all calibrations and for data taking.
Through `CMSITminiDAQ`, and with the right command line option, you can run the following scans/ calibrations/ operation mode:
Mauro Dinardo's avatar
Mauro Dinardo committed
81
82
83
84
85
86
87
88
89
```
1. Latency scan
2. PixelAlive
3. Noise scan
4. SCurve scan
5. Gain scan
6. Threshold equalization
7. Gain optimization
8. Threshold minimization
Mauro Dinardo's avatar
Mauro Dinardo committed
90
91
92
93
9. Threshold adjustment
10. Injection delay scan
11. Clock delay scan
12. Physics
Mauro Dinardo's avatar
Mauro Dinardo committed
94
```
Mauro Dinardo's avatar
Mauro Dinardo committed
95
Here you can find a detailed description of the various calibrations: https://cernbox.cern.ch/index.php/s/O07UiVaX3wKiZ78
Mauro Dinardo's avatar
Mauro Dinardo committed
96
97

It might be useful to create one `CMSIT.xml` file for each "set" of calibrations. In the following it's reported the suggested sequence of calibrations, implemented in bash shell script:
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
98
```
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
99
#!/bin/bash
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
100
101
if [ $# -ne 1 ]
then
Mini-Me's avatar
Minor    
Mini-Me committed
102
    echo "You should provide one, and only one, argument [step1, step2, step3, step4, step5, help]"
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
103
elif [ $1 == "step1" ]
Mauro Dinardo's avatar
Mauro Dinardo committed
104
then
Mini-Me's avatar
Minor    
Mini-Me committed
105
    CMSITminiDAQ -f CMSIT_noise.xml -c noise # Masks noisy pixels
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
106
    echo "noise" >> calibDone.txt
Mauro Dinardo's avatar
Mauro Dinardo committed
107

Mini-Me's avatar
Minor    
Mini-Me committed
108
    CMSITminiDAQ -f CMSIT_scurve.xml -c pixelalive # Masks dead pixels
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
109
    echo "pixelalive" >> calibDone.txt
Mauro Dinardo's avatar
Mauro Dinardo committed
110

Mini-Me's avatar
Minor    
Mini-Me committed
111
    CMSITminiDAQ -f CMSIT_noise.xml -c thrmin
Mauro Dinardo's avatar
Mauro Dinardo committed
112
113
    echo "thrmin" >> calibDone.txt

Mauro Dinardo's avatar
Mauro Dinardo committed
114
    echo "Choose whether to accept new threshold (i.e. copy it into the xml file(s))"
Mauro Dinardo's avatar
Mauro Dinardo committed
115
116
117
118
    read -p "Press any key to continue... " -n1 -s
    echo
elif [ $1 == "step2" ]
then
Mini-Me's avatar
Minor    
Mini-Me committed
119
    CMSITminiDAQ -f CMSIT_scurve.xml -c threqu
Mini-Me's avatar
Mini-Me committed
120
    echo "scurve" >> calibDone.txt
Mauro Dinardo's avatar
Mauro Dinardo committed
121
122
    echo "threqu" >> calibDone.txt

Mini-Me's avatar
Minor    
Mini-Me committed
123
    CMSITminiDAQ -f CMSIT_scurve.xml -c scurve
Mauro Dinardo's avatar
Mauro Dinardo committed
124
125
    echo "scurve" >> calibDone.txt

Mini-Me's avatar
Minor    
Mini-Me committed
126
    CMSITminiDAQ -f CMSIT_noise.xml -c noise # Masks noisy pixels @ new threshold
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
127
128
    echo "noise" >> calibDone.txt

Mini-Me's avatar
Minor    
Mini-Me committed
129
    CMSITminiDAQ -f CMSIT_noise.xml -c thrmin
Mauro Dinardo's avatar
Mauro Dinardo committed
130
131
    echo "thrmin" >> calibDone.txt

Mauro Dinardo's avatar
Mauro Dinardo committed
132
    echo "Choose whether to accept new threshold (i.e. copy it into the xml file(s))"
Mauro Dinardo's avatar
Mauro Dinardo committed
133
134
135
136
    read -p "Press any key to continue... " -n1 -s
    echo
elif [ $1 == "step3" ]
then
Mini-Me's avatar
Minor    
Mini-Me committed
137
    CMSITminiDAQ -f CMSIT_scurve.xml -c scurve
Mauro Dinardo's avatar
Mauro Dinardo committed
138
    echo "scurve" >> calibDone.txt
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
139

Mini-Me's avatar
Minor    
Mini-Me committed
140
    CMSITminiDAQ -f CMSIT_gain.xml -c gain
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
141
142
    echo "gain" >> calibDone.txt

Mini-Me's avatar
Minor    
Mini-Me committed
143
    CMSITminiDAQ -f CMSIT_gain.xml -c gainopt
Mauro Dinardo's avatar
Minor    
Mauro Dinardo committed
144
    echo "gainopt" >> calibDone.txt
Mini-Me's avatar
Minor    
Mini-Me committed
145

146
    echo "Choose whether to accept new Krummenacher current (i.e. copy it into the xml file(s))"
147
148
    echo "- Set nTRIGxEvent = 1 and DoFast = 1 in the xml file(s)"
    echo "- Set VCAL_HIGH to MIP value in the xml file(s)"
Mini-Me's avatar
Minor    
Mini-Me committed
149
    read -p "Press any key to continue... " -n1 -s
Mini-Me's avatar
Mini-Me committed
150
151
    echo
elif [ $1 == "step4" ]
Mini-Me's avatar
Minor    
Mini-Me committed
152
then
Mini-Me's avatar
Minor    
Mini-Me committed
153
    CMSITminiDAQ -f CMSIT_scurve.xml -c injdelay
Mini-Me's avatar
Mini-Me committed
154
    echo "latency" >> calibDone.txt
Mini-Me's avatar
Minor    
Mini-Me committed
155
    echo "injdelay" >> calibDone.txt
156

Mini-Me's avatar
Mini-Me committed
157
    echo "Choose whether to accept new LATENCY_CONFIG and INJECTION_SELECT (i.e. copy them into the xml file(s))"
158
    echo "- Set DoFast to whatever value you prefer in the xml files(s)"
Mini-Me's avatar
Minor    
Mini-Me committed
159
160
161
162
    read -p "Press any key to continue... " -n1 -s
    echo
elif [ $1 == "step5" ]
then
Mini-Me's avatar
Minor    
Mini-Me committed
163
    CMSITminiDAQ -f CMSIT_scurve.xml -c scurve
Mini-Me's avatar
Minor    
Mini-Me committed
164
    echo "scurve" >> calibDone.txt
Mini-Me's avatar
Minor    
Mini-Me committed
165
166
elif [ $1 == "help" ]
then
Mini-Me's avatar
Minimal    
Mini-Me committed
167
168
    echo "Available options are:"
    echo "- step1 [noise + pixelalive + thrmin]"
Mauro Dinardo's avatar
Mauro Dinardo committed
169
    echo "- step2 [(pixelalive)threqu + scurve + noise + thrmin]"
Mini-Me's avatar
Minimal    
Mini-Me committed
170
    echo "- step3 [scurve + gain + gainopt]"
171
    echo "- step4 [(latency)injdelay]"
Mini-Me's avatar
Minor    
Mini-Me committed
172
    echo "- step5 [scurve]"
Mini-Me's avatar
Minor    
Mini-Me committed
173
174
else
    echo "Argument not recognized: $1"
Mauro Dinardo's avatar
Mauro Dinardo committed
175
176
fi
```
Mauro Dinardo's avatar
Mauro Dinardo committed
177
**N.B.:** steps **4** and **5** are meant to measure the so called "in-time threshold", to be compared with the threshold measured at step **3**, which is the so called "absoulte threshold"
Mauro Dinardo's avatar
Mauro Dinardo committed
178
### ~=-=~ End of Inner-Tracker section ~=-=~
Mauro Dinardo's avatar
Mauro Dinardo committed
179
180
<hr>

Mauro Dinardo's avatar
Mauro Dinardo committed
181

Mauro Dinardo's avatar
Mauro Dinardo committed
182
183
184
### Setup

Firmware for the FC7 can be found in /firmware. Since the "old" FMC flavour is deprecated, only new FMCs (both connectors on the same side) are supported.
Mauro Dinardo's avatar
Mauro Dinardo committed
185
186
You'll need Xilinx Vivado and a Xilinx Platform Cable USB II (http://uk.farnell.com/xilinx/hw-usb-ii-g/platform-cable-configuration-prog/dp/1649384)
For more information on the firmware, please check the doc directory of https://gitlab.cern.ch/cms_tk_ph2/d19c-firmware
Mauro Dinardo's avatar
Mauro Dinardo committed
187

Mauro Dinardo's avatar
Mauro Dinardo committed
188

Fabio Ravera's avatar
Fabio Ravera committed
189
190
191
192
193
194
195
196
197
198
### Gitlab CI setup for Developers (required to submit merge requests!!!)

1. Add predefined variables

    i. from your fork go to `Ph2_ACF > settings > CI/CD`

    ii. expand the `Variables` section

    iii. click the `Add variable` button

Fabio Ravera's avatar
Fabio Ravera committed
199
        - add key: USER_NAME and value: <your CERN user name>
Fabio Ravera's avatar
Fabio Ravera committed
200
201
202
203

    iv. click the `Add variable` button

        - select the flag `Mask variable`
Fabio Ravera's avatar
Fabio Ravera committed
204
        - add key: USER_PASS and value: <your CERN password encoded to base64>
Fabio Ravera's avatar
Fabio Ravera committed
205
206
207
208
209
210
211
212
          e.g encode "thisword": printf "thisword" | base64

2. Enable shared Runners (if not enabled)

    i. from `settings > CI/CD` expand the `Runners` section

    ii. click the `Allow shared Runners` button

Fabio Ravera's avatar
Fabio Ravera committed
213
214
215
216
217
218
3. Enable specific Runners (if not enabled)

    i. from `settings > CI/CD` expand the `Runners` section

    ii. in the section `Available specific runners` click button `Enable for this project` for the Ph2_ACF runner with the `FNAL`

Mauro Dinardo's avatar
Mauro Dinardo committed
219

Fabio Ravera's avatar
Fabio Ravera committed
220
221
### clang-format (required to submit merge requests!!!)
1. install 7.0 llvm toolset:
Fabio Ravera's avatar
Fabio Ravera committed
222

Fabio Ravera's avatar
Fabio Ravera committed
223
        $> yum install llvm-toolset-7.0
Fabio Ravera's avatar
Fabio Ravera committed
224

Fabio Ravera's avatar
Fabio Ravera committed
225
2. if you already sourced the environment, you should be able to run the command to format the Ph2_ACF (to be done before each merge request!!!):
Fabio Ravera's avatar
Fabio Ravera committed
226

Fabio Ravera's avatar
Fabio Ravera committed
227
        $> formatAll
Mauro Dinardo's avatar
Mauro Dinardo committed
228

Fabio Ravera's avatar
Fabio Ravera committed
229

Mauro Dinardo's avatar
Mauro Dinardo committed
230
### Setup on CC7 (scroll down for instructions on setting up on SLC6)
Nikkie Deelen's avatar
Nikkie Deelen committed
231
232
233
234
235

1. Check which version of gcc is installed on your CC7, it should be > 4.8 (could be the default on CC7):

        $> gcc --version

Fabio Ravera's avatar
Fabio Ravera committed
236
2. On CC7 you also need to install boost v1.53 headers (default on this system) and pugixml as they don't ship with uHAL any more:
Nikkie Deelen's avatar
Nikkie Deelen committed
237
238

        $> sudo yum install boost-devel
Fabio Ravera's avatar
Fabio Ravera committed
239
        $> sudo yum install pugixml-devel
Nikkie Deelen's avatar
Nikkie Deelen committed
240

241
2. Install uHAL. SW tested with uHAL version up to 2.7.1
Nikkie Deelen's avatar
Nikkie Deelen committed
242

243
244
        Follow instructions from 
        https://ipbus.web.cern.ch/ipbus/doc/user/html/software/install/yum.html
Nikkie Deelen's avatar
Nikkie Deelen committed
245

246
3. Install CERN ROOT
Nikkie Deelen's avatar
Nikkie Deelen committed
247
248

        $> sudo yum install root
249
250
        $> sudo yum install root-net-http root-net-httpsniff  root-graf3d-gl root-physics root-montecarlo-eg root-graf3d-eve root-geom libusb-devel xorg-x11-xauth.x86_64

Nikkie Deelen's avatar
Nikkie Deelen committed
251
252
253
254

5. Install CMAKE > 2.8:

        $> sudo yum install cmake
Mauro Dinardo's avatar
Mauro Dinardo committed
255

Mauro Dinardo's avatar
Mauro Dinardo committed
256

Mauro Dinardo's avatar
Mauro Dinardo committed
257
### Setup on SLC6
npierre's avatar
npierre committed
258

259
1. Install a gcc compiler version > 4.8 - on scientific linux you can obtain this by installing devtoolset-2 or devtoolset-2.1:
Georg Auzinger's avatar
Georg Auzinger committed
260

261
        $> sudo wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
Georg Auzinger's avatar
Georg Auzinger committed
262
        $> sudo yum install devtoolset-2
263
        $> . /opt/rh/devtoolset-2/enable   # add this to your .bashrc
264
        $> sudo ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
Georg Auzinger's avatar
Georg Auzinger committed
265
        $> hash -r
Georg Auzinger's avatar
Georg Auzinger committed
266

Basil Schneider's avatar
Basil Schneider committed
267
    This should give you a more recent gcc (e.g. gcc 4.8.2)
npierre's avatar
npierre committed
268

Georg Auzinger's avatar
Georg Auzinger committed
269
        $> gcc --version
Georg Auzinger's avatar
Georg Auzinger committed
270

Nikkie Deelen's avatar
Nikkie Deelen committed
271
    Alternatively you can use a gcc version > 4.8 from AFS
272

Nikkie Deelen's avatar
Nikkie Deelen committed
273
2. Install uHAL. The uHAL version should be 2.5 or lower. Version 2.6 does not work with the middleware at the moment! 
Georg Auzinger's avatar
Georg Auzinger committed
274

Nikkie Deelen's avatar
Nikkie Deelen committed
275
    First create a new ipbus repo for yum:
Georg Auzinger's avatar
Georg Auzinger committed
276

Nikkie Deelen's avatar
Nikkie Deelen committed
277
278
279
280
281
282
        $> sudo cat > /etc/yum.repos.d/ipbus-sw.repo << EOF
        $> [ipbus-sw-base]
        $> name=IPbus software repository
        $> baseurl=http://www.cern.ch/ipbus/sw/release/2.5/centos7_x86_64/base/RPMS
        $> enabled=1
        $> gpgcheck=0
npierre's avatar
npierre committed
283

Nikkie Deelen's avatar
Nikkie Deelen committed
284
285
286
287
288
        $> [ipbus-sw-updates]
        $> name=IPbus software repository updates
        $> baseurl=http://www.cern.ch/ipbus/sw/release/2.5/centos7_x86_64/updates/RPMS
        $> enabled=1
        $> gpgcheck=0
Georg Auzinger's avatar
Georg Auzinger committed
289

Nikkie Deelen's avatar
Nikkie Deelen committed
290
    Then install uHAL as follows:
Georg Auzinger's avatar
Georg Auzinger committed
291

Georg Auzinger's avatar
Georg Auzinger committed
292
293
        $> sudo yum clean all
        $> sudo yum groupinstall uhal
Georg Auzinger's avatar
Georg Auzinger committed
294

Nikkie Deelen's avatar
Nikkie Deelen committed
295
3. Install CERN ROOT version 5.34.32 [Instructions](http://root.cern.ch/drupal/content/installing-root-source) - make sure to use "fixed location installation" when building yourself. If root is installed on a CERN computer of virtual machine you can use:
296
       
297
        $> sudo yum install root
298
        $> sudo yum install root-net-http root-graf3d-gl root-physics root-montecarlo-eg root-graf3d-eve root-geom libusb-devel xorg-x11-xauth.x86_64
299

Nikkie Deelen's avatar
Nikkie Deelen committed
300
4. Install CMAKE > 2.8. On SLC6 the default is cmake 2.8
301

302
        $> sudo yum install cmake
Georg Auzinger's avatar
Georg Auzinger committed
303

Mauro Dinardo's avatar
Mauro Dinardo committed
304

Mauro Dinardo's avatar
Mauro Dinardo committed
305
### The Ph2_ACF software
nipierre's avatar
nipierre committed
306

Georg Auzinger's avatar
Georg Auzinger committed
307
Follow these instructions to install and compile the libraries:
308
(provided you installed the latest version of gcc, µHal,  mentioned above).
npierre's avatar
npierre committed
309

310
1. Clone the GitHub repo and run cmake
Georg Auzinger's avatar
Georg Auzinger committed
311
  
Fabio Ravera's avatar
Fabio Ravera committed
312
        $> git clone https://:@gitlab.cern.ch:8443/fravera/Ph2_ACF.git
313
314
315
        $> cd Ph2_ACF
        $> source setup.sh
        $> cd build 
316
        $> cmake ..
317

318
2. Do a `make -jN` in the build/ directory or alternatively do `make -C build/ -jN` in the Ph2_ACF root directory.
319

320
3. Don't forget to `source setup.sh` to set all the environment variables correctly.
321

322
4. Launch 
323

Georg Auzinger's avatar
Georg Auzinger committed
324
        $> systemtest --help
325

Basil Schneider's avatar
Basil Schneider committed
326
    command if you want to test the parsing of the HWDescription.xml file.
npierre's avatar
npierre committed
327

328
5. Launch
Georg Auzinger's avatar
Georg Auzinger committed
329

Georg Auzinger's avatar
Georg Auzinger committed
330
        $> datatest --help
331

Basil Schneider's avatar
Basil Schneider committed
332
    command if you want to test if you can correctly read data
Georg Auzinger's avatar
Georg Auzinger committed
333

334
6. Launch
Georg Auzinger's avatar
Georg Auzinger committed
335

Georg Auzinger's avatar
Georg Auzinger committed
336
        $> calibrate --help
Georg Auzinger's avatar
Georg Auzinger committed
337

Basil Schneider's avatar
Basil Schneider committed
338
    to calibrate a hybrid,
Georg Auzinger's avatar
Georg Auzinger committed
339

Georg Auzinger's avatar
Georg Auzinger committed
340
        $> hybridtest --help
Georg Auzinger's avatar
Georg Auzinger committed
341

Basil Schneider's avatar
Basil Schneider committed
342
    to test a hybird's I2C registers and input channel connectivity
343

344
          $> cmtest --help
345

Basil Schneider's avatar
Basil Schneider committed
346
    to run the CM noise study
347

348
          $> pulseshape --help
Georg Auzinger's avatar
Georg Auzinger committed
349

Basil Schneider's avatar
Basil Schneider committed
350
    to measure the analog pulseshape of the cbc
Georg Auzinger's avatar
Georg Auzinger committed
351

352
          $> configure --help
Georg Auzinger's avatar
Georg Auzinger committed
353

Basil Schneider's avatar
Basil Schneider committed
354
    to apply a configuration to the CBCs
Georg Auzinger's avatar
Georg Auzinger committed
355

356
7. Launch
357

358
          $> commission --help
359

Basil Schneider's avatar
Basil Schneider committed
360
    to do latency & threshold scans
361

362
8. Launch 
363

364
          $> fpgaconfig --help
365

Basil Schneider's avatar
Basil Schneider committed
366
    to upload a new FW image to the GLIB
367

368
9. Launch
369

370
          $> miniDAQ --help
371

Basil Schneider's avatar
Basil Schneider committed
372
    to save binary data from the GLIB to file
373

374
10. Launch
375

376
          $> miniDQM --help
377

Basil Schneider's avatar
Basil Schneider committed
378
    to run the DQM code from the June '15 beamtest
npierre's avatar
npierre committed
379
380


Mauro Dinardo's avatar
Mauro Dinardo committed
381
### Nota Bene
Mauro Dinardo's avatar
Mauro Dinardo committed
382

Georg Auzinger's avatar
Georg Auzinger committed
383
When you write a register in the Glib or the Cbc, the corresponding map of the HWDescription object in memory is also updated, so that you always have an exact replica of the HW Status in the memory.
Georg Auzinger's avatar
Georg Auzinger committed
384

Georg Auzinger's avatar
Georg Auzinger committed
385
386
387
Register values are:
  - 8-bit unsigend integers for the CBCs that should be edited in hex notation, i.e. '0xFF'
  - 32-bit unsigned integers for the GLIB: decimal values
npierre's avatar
npierre committed
388

Georg Auzinger's avatar
Georg Auzinger committed
389
For debugging purpose, you can activate DEV_FLAG in the sources or in the Makefile and also activate the uHal log in RegManager.cc.
nipierre's avatar
nipierre committed
390

npierre's avatar
npierre committed
391

Mauro Dinardo's avatar
Mauro Dinardo committed
392
### External clock and trigger
Mauro Dinardo's avatar
Mauro Dinardo committed
393

394
Please see the D19C FW  [documentation](https://gitlab.cern.ch/cms_tk_ph2/d19c-firmware/blob/master/doc/Middleware_Short_Guide.md) for instructions on how to use external clock and trigger with the various FMCs (DIO5 and CBC3 FMC)
Georg Auzinger's avatar
Georg Auzinger committed
395
396


Mauro Dinardo's avatar
Mauro Dinardo committed
397
### Example HWDescription.xml file with DIO5 support
Georg Auzinger's avatar
Georg Auzinger committed
398

Georg Auzinger's avatar
Georg Auzinger committed
399
```xml
400
<?xml version="1.0" encoding="utf-8"?>
401
402
<HwDescription>
  <BeBoard Id="0" boardType="D19C" eventType="VR">
403
      <connection id="board" uri="chtcp-2.0://localhost:10203?target=192.168.1.81:50001" address_table="file://settings/address_tables/d19c_address_table.xml" />
404

405
    <Hybrid FeId="0" FMCId="0" HybridId="0" Status="1">
406
407
408
409
410
411
412
        <Global>
            <Settings threshold="550" latency="26"/>
            <TestPulse enable="0" polarity="0" amplitude="0xFF" channelgroup="0" delay="0" groundothers="1"/>
            <ClusterStub clusterwidth="4" ptwidth="3" layerswap="0" off1="0" off2="0" off3="0" off4="0"/>
            <Misc analogmux="0b00000" pipelogic="0" stublogic="0" or254="1" tpgclock="1" testclock="1" dll="4"/>
            <ChannelMask disable=""/>
        </Global>
413
        <CBC_Files path="./settings/CbcFiles/" />
414
415
        <CBC Id="0" configfile="CBC3_default.txt" />
        <CBC Id="1" configfile="CBC3_default.txt" />
416
    </Hybrid>
417
418
419

    <SLink>
        <DebugMode type="FULL"/>
420
        <ConditionData type="I2C" Register="VCth1" FeId="0" CbcId="0"/>
421
422
423
424
425
426
        <ConditionData type="User" UID="0x80" FeId="0" CbcId="0"> 0x22 </ConditionData>
        <ConditionData type="HV" FeId="0" Sensor="2"> 250 </ConditionData>
        <ConditionData type="TDC" FeId="0xFF"/>
    </SLink>

    <!--CONFIG-->
427
    <Register name="clock_source">3</Register> <!-- 3 - default (internal oscillator), 2 - backplane, 0 - AMC13 -->
428
    <Register name="fc7_daq_cnfg">
429
430
431
432
433
434
435
436
	<!-- Clock control -->
	<Register name="clock">
	    <Register name="ext_clk_en"> 0 </Register>
	</Register>
        <!-- TTC -->
        <Register name="ttc">
            <Register name="ttc_enable"> 0 </Register>
        </Register>
437
438
        <!-- Fast Command Block -->
        <Register name="fast_command_block">
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
		<Register name="triggers_to_accept"> 0 </Register>
		<Register name="trigger_source"> 3 </Register>
		<Register name="user_trigger_frequency"> 1 </Register>
		<Register name="stubs_mask"> 1 </Register>
                <!--this is the delay for the stub trigger-->
		<Register name="stub_trigger_delay_value"> 0 </Register>
                <Register name="stub_trigger_veto_length"> 0 </Register>
		<Register name="test_pulse">
			<Register name="delay_after_fast_reset"> 50 </Register>
			<Register name="delay_after_test_pulse"> 200 </Register>
			<Register name="delay_before_next_pulse"> 400 </Register>
			<Register name="en_fast_reset"> 1 </Register>
			<Register name="en_test_pulse"> 1 </Register>
			<Register name="en_l1a"> 1 </Register>
		</Register>
                <Register name="ext_trigger_delay_value"> 50 </Register>
                <Register name="antenna_trigger_delay_value"> 200 </Register>
                <Register name="delay_between_two_consecutive"> 10 </Register>
                <Register name="misc">
                        <Register name="backpressure_enable"> 1 </Register>
                        <Register name="stubOR"> 1 </Register>
                        <Register name="initial_fast_reset_enable"> 0 </Register>
                </Register>
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
        </Register>
	<!-- I2C manager -->
        <Register name="command_processor_block">
	</Register>
	<!-- Phy Block -->
	<Register name="physical_interface_block">
		<Register name="i2c">
                	<Register name="frequency"> 4 </Register>
		</Register>
	</Register>
	<!-- Readout Block -->
    	<Register name="readout_block">
            <Register name="packet_nbr"> 99 </Register>
            <Register name="global">
		    <Register name="data_handshake_enable"> 1 </Register>
                    <Register name="int_trig_enable"> 0 </Register>
                    <Register name="int_trig_rate"> 0 </Register>
                    <Register name="trigger_type"> 0 </Register>
                    <Register name="data_type"> 0 </Register>
481
                    <!--this is what is commonly known as stub latency-->
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
                    <Register name="common_stubdata_delay"> 194 </Register>
            </Register>
    	</Register>
	<!-- DIO5 Block -->
	<Register name="dio5_block">
	    <Register name="dio5_en"> 0 </Register>
            <Register name="ch1">
                <Register name="out_enable"> 1 </Register>
                <Register name="term_enable"> 0 </Register>
                <Register name="threshold"> 0 </Register>
            </Register>
	    <Register name="ch2">
                <Register name="out_enable"> 0 </Register>
                <Register name="term_enable"> 1 </Register>
                <Register name="threshold"> 50 </Register>
            </Register>
	    <Register name="ch3">
                <Register name="out_enable"> 1 </Register>
                <Register name="term_enable"> 0 </Register>
                <Register name="threshold"> 0 </Register>
            </Register>
	    <Register name="ch4">
                <Register name="out_enable"> 0 </Register>
                <Register name="term_enable"> 1 </Register>
                <Register name="threshold"> 50 </Register>
            </Register>
	    <Register name="ch5">
                <Register name="out_enable"> 0 </Register>
                <Register name="term_enable"> 1 </Register>
                <Register name="threshold"> 50 </Register>
            </Register>
	</Register>
	<!-- TLU Block -->
	<Register name="tlu_block">
		<Register name="handshake_mode"> 2 </Register>
517
		<Register name="tlu_enabled"> 0 </Register>
518
519
520
521
522
	</Register>
    </Register>
  </BeBoard>

<Settings>
523
524
525

    <!--[>Calibration<]-->
    <Setting name="TargetVcth">0x78</Setting>
526
527
528
529
530
531
    <Setting name="TargetOffset">0x50</Setting>
    <Setting name="Nevents">50</Setting>
    <Setting name="TestPulsePotentiometer">0x00</Setting>
    <Setting name="HoleMode">0</Setting>
    <Setting name="VerificationLoop">1</Setting>

532
533
534
535
536
    <!--Signal Scan Fit-->
	  <Setting name="InitialVcth">0x78</Setting>
	  <Setting name="SignalScanStep">2</Setting>
    <Setting name="FitSignal">0</Setting>

537
</Settings>
538
</HwDescription>
Georg Auzinger's avatar
Georg Auzinger committed
539
```
540

541

Mauro Dinardo's avatar
Mauro Dinardo committed
542
### Known issues
543

Mauro Dinardo's avatar
Mauro Dinardo committed
544
uHAL exceptions and UDP timeouts when reading larger packet sizes from the GLIB board: this can happen for some users (cause not yet identified) but can be circumvented by changing the line
545

546
"ipbusudp-2.0://192.168.000.175:50001"
547

548
in the connections.xml file to
549

550
"chtcp-2.0://localhost:10203?target=192.168.000.175:50001"
551

Mauro Dinardo's avatar
Mauro Dinardo committed
552
and then launching the CACTUS control hub by the command:
553

Mauro Dinardo's avatar
Mauro Dinardo committed
554
`/opt/cactus/bin/controlhub_start`
555

556
This uses TCP protocol instead of UDP which accounts for packet loss but decreases the performance.
557

558

Mauro Dinardo's avatar
Mauro Dinardo committed
559
### Support, suggestions?
npierre's avatar
npierre committed
560

Nikkie Deelen's avatar
Nikkie Deelen committed
561
For any support/suggestions, mail to fabio.raveraSPAMNOT@cern.ch, mauro.dinardoSPAMNOT@cern.ch
562
563


Mauro Dinardo's avatar
Mauro Dinardo committed
564
### Firmware repository for OT tracker:
565
https://udtc-ot-firmware.web.cern.ch/