Project

General

Profile

Starting and using TDUControl » History » Version 9

Thomas Dealtry, 01/30/2015 05:41 AM

1 6 Thomas Dealtry
{{toc}}
2 1 Kurt Biery
3 6 Thomas Dealtry
h1. Getting help
4 6 Thomas Dealtry
5 6 Thomas Dealtry
Email Tom Dealtry - thomas.dealtry@physics.ox.ac.uk
6 6 Thomas Dealtry
7 6 Thomas Dealtry
h1. Overview
8 6 Thomas Dealtry
9 6 Thomas Dealtry
The following are instructions on how to communicate with the NOvA timing distrubution unit (TDU). The TDU distributes timing information throughout the system, handles synchronisation between boards, and includes automatic propagation delay calculation & compensation.
10 6 Thomas Dealtry
11 6 Thomas Dealtry
There are various ways to communicate:
12 6 Thomas Dealtry
13 6 Thomas Dealtry
* Through lbnerc & daqinterface (coming soon)
14 6 Thomas Dealtry
* Booting up an xmlrpc server & commuicating through this
15 6 Thomas Dealtry
* Communicating with the TDU directly
16 6 Thomas Dealtry
17 8 Thomas Dealtry
h1. Communication with the TDU
18 8 Thomas Dealtry
19 8 Thomas Dealtry
The following will get Python 2.7.8, and set the environment (the code lives in lbnerc, located at /data/lbnedaq/tdu/lbnerc/)
20 8 Thomas Dealtry
(Note when the feature/tdu branch is merged into the develop branch, the normal fireup instructions at https://cdcvs.fnal.gov/redmine/projects/lbne-daq/wiki/Running_DAQ_Interface will work)
21 8 Thomas Dealtry
22 8 Thomas Dealtry
<pre>
23 8 Thomas Dealtry
source /data/lbnedaq/daqarea/lbne-artdaq-base/setupLBNEARTDAQ
24 8 Thomas Dealtry
cd /data/lbnedaq/tdu/
25 8 Thomas Dealtry
source fireup_tdu
26 8 Thomas Dealtry
</pre>
27 8 Thomas Dealtry
28 9 Thomas Dealtry
$LBNERCROOT refers to the root path of your lbnerc install (it's not actually a variable that's set!)
29 9 Thomas Dealtry
30 8 Thomas Dealtry
h2. Communication via xmlrpc server
31 8 Thomas Dealtry
32 9 Thomas Dealtry
The first step is to initialise the xmlrpc server (if it hasn't been already). The options -T and -P refer to the TDU host & port respectively (the master in this example). The optiosn -H and -r refer to the host & port the xmlrpc server is being created on.
33 9 Thomas Dealtry
<pre>
34 9 Thomas Dealtry
tdu -T 192.168.100.201 -P 10001 -H localhost -r 50008
35 9 Thomas Dealtry
</pre>
36 8 Thomas Dealtry
37 9 Thomas Dealtry
Next, you can use call the xmlrpc server to communicate with the TDU.
38 9 Thomas Dealtry
<pre>
39 9 Thomas Dealtry
python rc/tdu/testing_scripts/tdu_control_via_xmlrpcserver.py -T localhost -p 50008
40 9 Thomas Dealtry
</pre>
41 9 Thomas Dealtry
This will print out a list of commands and exit. To actually do something, add one (or more) switches
42 9 Thomas Dealtry
<pre>
43 9 Thomas Dealtry
-s    calls <code>do_time_sync()</code>
44 9 Thomas Dealtry
-d    calls <code>do_delay_calc()</code>
45 9 Thomas Dealtry
-P    calls <code>do_ping()</code>
46 9 Thomas Dealtry
-g    calls <code>get_status()</code>
47 9 Thomas Dealtry
</pre>
48 9 Thomas Dealtry
If you want to do something else, then you can either add in a new option, or write a new script based on tdu_control_via_xmlrpcserver.py
49 8 Thomas Dealtry
50 9 Thomas Dealtry
h2. Communication with TDU directly
51 9 Thomas Dealtry
52 9 Thomas Dealtry
<pre>
53 9 Thomas Dealtry
python rc/tdu/testing_scripts/tdu_control_via_client.py -T 192.168.100.201 -p 10001
54 9 Thomas Dealtry
</pre>
55 9 Thomas Dealtry
By default this will <code>do_ping()</code>, and if successful <code>do_time_sync()</code>.
56 9 Thomas Dealtry
A couple of switches allow you to do more:
57 9 Thomas Dealtry
<pre>
58 9 Thomas Dealtry
-d    calls <code>do_delay_calc()</code>
59 9 Thomas Dealtry
-t    calls <code>debug_read_all_registers()</code>
60 9 Thomas Dealtry
</pre>
61 9 Thomas Dealtry
If you want to do something else, then you can either add in a new option, or write a new script based on tdu_control_via_client.py
62 9 Thomas Dealtry
63 9 Thomas Dealtry
h2. Running an emulator
64 9 Thomas Dealtry
65 9 Thomas Dealtry
If you don't have access to the hardware, you can run on a (very basic) emulator.
66 9 Thomas Dealtry
67 9 Thomas Dealtry
<pre>
68 9 Thomas Dealtry
python $LBNERCROOT/rc/tdu/testing_scripts/tdu_emulator.py -T localhost -P 50007
69 9 Thomas Dealtry
</pre>
70 9 Thomas Dealtry
71 6 Thomas Dealtry
h1. List of commands (to be expanded)
72 1 Kurt Biery
73 8 Thomas Dealtry
All 'get', 'do', and 'read' commands return an error code with a common numbering scheme. 'get' commands also return additional information.
74 6 Thomas Dealtry
75 6 Thomas Dealtry
h2. 'get' commands
76 6 Thomas Dealtry
77 6 Thomas Dealtry
* <code>get_status()</code>
78 6 Thomas Dealtry
Returns [error_code, ready_to_do]. When ready_to_do is True, the control register can be modified (i.e. a 'do' command can be performed)
79 6 Thomas Dealtry
80 6 Thomas Dealtry
h2. 'do' commands
81 6 Thomas Dealtry
82 6 Thomas Dealtry
* <code>do_ping()</code>
83 6 Thomas Dealtry
ping the TDU
84 6 Thomas Dealtry
85 6 Thomas Dealtry
* <code>do_time_sync()</code>
86 6 Thomas Dealtry
Perform a time synchronisation (this calls <code>get_status()</code> internally)
87 6 Thomas Dealtry
88 6 Thomas Dealtry
* <code>do_delay_calc()</code>
89 6 Thomas Dealtry
Perform a propagation delay calculation (this calls <code>get_status()</code> internally)
90 6 Thomas Dealtry
91 6 Thomas Dealtry
* <code>do_send_sync_pulse()</code>
92 6 Thomas Dealtry
Send a sync pulse (this calls <code>get_status()</code> internally)
93 6 Thomas Dealtry
94 6 Thomas Dealtry
* <code>debug_do_write_control_reg(data_to_or)</code>
95 6 Thomas Dealtry
Write the control register to perform a none standard operation (this calls <code>get_status()</code> internally)
96 6 Thomas Dealtry
97 6 Thomas Dealtry
h2. 'read' commands
98 6 Thomas Dealtry
99 6 Thomas Dealtry
* <code>read_tdu_id()</code>
100 6 Thomas Dealtry
Read out the TDU version & ID numbers
101 6 Thomas Dealtry
102 6 Thomas Dealtry
* <code>read_tdu_status()</code>
103 6 Thomas Dealtry
Read out the TDU's current operating conditions (current, voltage, temperature, fan status, FPGA status)
104 6 Thomas Dealtry
105 6 Thomas Dealtry
* <code>read_gps_status()</code>
106 6 Thomas Dealtry
Read out the GPS status (faults, timeouts, sat count, etc. + current UTC time)
107 6 Thomas Dealtry
108 6 Thomas Dealtry
* <code>read_error_registers()</code>
109 6 Thomas Dealtry
Read out the error registers
110 6 Thomas Dealtry
111 6 Thomas Dealtry
* <code>read_control_reg()</code>
112 6 Thomas Dealtry
Read out the control register
113 6 Thomas Dealtry
114 6 Thomas Dealtry
* <code>debug_read_all_registers()</code>
115 6 Thomas Dealtry
Read out all the registers. Also comes with some hints on what the 'default' for normal operating conditions is.
116 6 Thomas Dealtry
117 6 Thomas Dealtry
h2. Other commands
118 6 Thomas Dealtry
119 6 Thomas Dealtry
* <code>close_socket()</code>
120 7 Thomas Dealtry
Safely close the connection to the TDU
121 6 Thomas Dealtry
122 6 Thomas Dealtry
* print_log
123 6 Thomas Dealtry
Will be made private
124 6 Thomas Dealtry
125 6 Thomas Dealtry
h2. Error codes
126 1 Kurt Biery
127 7 Thomas Dealtry
<pre>
128 7 Thomas Dealtry
100-120    Wrong number of bytes received
129 7 Thomas Dealtry
-200/-201  Invalid register/data on receive
130 7 Thomas Dealtry
+200/+201  Invalid register/data on send
131 7 Thomas Dealtry
300        Cannot perform a 'do' command (get_status() returns ready_to_do=False after 10 attempts including 2 seconds of sleep)
132 7 Thomas Dealtry
301        Not ready to sync (TDU status error)
133 7 Thomas Dealtry
302        Not ready to sync (GPS status error)
134 7 Thomas Dealtry
400        Error found in error registers
135 7 Thomas Dealtry
</pre>
136 6 Thomas Dealtry
137 6 Thomas Dealtry
h1. List of TDU IP addresses (to be expanded)
138 6 Thomas Dealtry
139 6 Thomas Dealtry
* Master: 192.168.100.201
140 6 Thomas Dealtry
* Slave: 192.168.100.202
141 6 Thomas Dealtry
142 9 Thomas Dealtry
The port is ALWAYS 10001 (unless you're communciating with an emulator)
143 9 Thomas Dealtry
144 6 Thomas Dealtry
h1. Using the NOvA GUI (TDUControl) - OLD & BROKEN
145 6 Thomas Dealtry
146 1 Kurt Biery
To start TDUControl, use the following steps:
147 6 Thomas Dealtry
148 5 Thomas Dealtry
# log into the <code>lbnedaq</code> account on <code>lbne35t-gateway01</code>
149 6 Thomas Dealtry
# <code>source /data/lbnedaq/novadaq/setup/setup_novadaq_nt1.sh</code>
150 6 Thomas Dealtry
# <code>TDUControl -m</code>
151 5 Thomas Dealtry
# enter the IP address of the Master TDU into the GUI (192.168.100.201)
152 1 Kurt Biery
153 6 Thomas Dealtry
Alternatively for steps 3 & 4, you can run <code>TDUControl -m -t 192.168.100.201</code>
154 9 Thomas Dealtry
155 9 Thomas Dealtry
[[Starting_and_using_TDUControl|top]]