Project

General

Profile

Starting and using TDUControl » History » Version 12

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