Imported Upstream version 3.0
[debian/gnuradio] / gr-usrp / README_MULTI_USRP.txt
1 Multi usrp
2
3 With this code you can connect two or more usrps (with a locked clock) and get synchronised samples.
4 You must connect a (flat)cable between a dboard on the master in RXA and a dboard on the slave in RXA.
5 You then put one usrp in master mode, put the other in slave mode.
6
7 For a quick start using the examples look at gnuradio-examples/python/multi_usrp/README
8
9 Use the usrp_multi block which is installed by gr-usrp.
10 instantiate in the following way:
11
12         self.multi=usrp_multi.multi_source_align( fg=self, master_serialno=options.master_serialno, decim=options.decim, nchan=options.nchan )
13
14 nchan should be 2 or 4.
15
16 You determine which is the master by master_serialno (this is a text string a hexadecimal number).
17 If you enter a serial number which is not found it will print the serial numbers which are available.
18 If you give no serial number  (master_serialno=None), the code will pick a Master for you.
19
20 You can get a reference to the master and the slave usrp in the following way:
21
22         self.um=self.multi.get_master_usrp()
23         self.us=self.multi.get_slave_usrp()
24
25 You only need these references for setting freqs/gains or getting info about daughterboards.
26 Don't use the output directly but use the aligned output from multi.get_master_source_c() and multi.get_slave_source_c()
27
28 You get references to the aligned output samples in the following way:
29 aligned_master_source_c=self.multi.get_master_source_c()
30 aligned_slave_source_c=self.multi.get_slave_source_c()
31
32 These blocks have multiple outputs.
33 output 0 is the sample counter (high bits in I, low bits in Q)
34 You normally don't need the samplecounters so you can ignore output 0
35
36 output 1 is the first aligend output channel (if you enable 2 or 4 channels)
37 output 2 is the second output channel (only if you enable 4 channels)
38
39 so the usefull 4 channels are:
40 self.aligned_master_chan1=(self.multi.get_master_source_c(),1)
41 self.aligned_master_chan2=(self.multi.get_master_source_c(),2)
42 self.aligned_slave_chan1=(self.multi.get_slave_source_c(),1)
43 self.aligned_slave_chan2=(self.multi.get_slave_source_c(),2)
44
45 The two samplecounters are:
46 self.aligned_master_samplecounter=(self.multi.get_master_source_c(),0)
47 self.aligned_slave_samplecounter=(self.multi.get_slave_source_c(),0)
48
49 You can set the gain or tune the frequency for all 4 receive daughetrboards at once:
50         self.multi.set_gain_all_rx(options.gain)
51         result,r1,r2,r3,r4 = self.multi.tune_all_rx(options.freq)
52
53 This will only work reliably when you have all the same daughterboards.
54 Otherwise set all freqs and gains individually.
55
56 You must call self.multi.sync() at least once AFTER the flowgraph has started running.
57 (This will synchronise the streams of the two usrps)
58
59 This work was funded by Toby Oliver at Sensus Analytics / Path Intelligence.
60 Many Thanks for making this possible.
61
62 It was written by Martin Dudok van Heel at Olifantasia.
63
64 Quick start multi-usrp:
65 Unpack, build and install usrp, gnuradio-core and gr-usrp
66 Versions need to be more recent then 2.7cvs/svn 11 may 2006
67
68 Make sure usrp/fpga/rbf/rev2/multi*.rbf is installed in /usr/local/share/usrp/rev2/
69 Make sure usrp/fpga/rbf/rev4/multi*.rbf is installed in /usr/local/share/usrp/rev4/
70 (If in doubt, copy manually)
71  
72 build and install gr-wxgui gr-audio-xxx  and so on.
73
74 unpack gnuradio-examples.
75
76 There is a gnuradio-examples/python/multi_usrp directory which contains examples and a README
77
78
79 Put at least a basic RX or dbsrx board in RXA of the master and RXA of the slave board.
80 Make sure that the usrps have a serial or unique identifier programmed in their eeprom.
81 (All new rev 4.1 boards have this)
82 You can do without a serial but then you never know which usrp is the master and which is the slave.
83
84
85 CONNECTING THE CABLES
86 Now connect the 64MHz clocks between the boards with a short sma coax cable.
87 (See the wiki on how to enable clock-out and clock-in 
88 http://comsec.com/wiki?USRPClockingNotes )
89
90 You need one board with a clock out and one board with a clock in.
91
92 You can choose any of the two boards as master or slave, this is not dependant on which board has the clock-out or in.
93 In my experiments I had fewer problems when the board that has the clock-in will be the master board.
94
95 You can use a standard 16-pole flatcable to connect tvrx, basic-rx or dbsrx boards.
96 Of this 16pin flatcable only two pins are used (io15 and ground)
97 For all new daughterboards which use up a lot of io pins you have to use a cable with fewer connections.
98 The savest is using a 2pin headercable connected to io15,gnd (a cable like the ones used to connect frontpanel leds to the mainboard of a PC)
99
100 If using basic rx board:
101   Connect a 16-pole flatcable from J25 on basicrx/dbs_rx in rxa of the master usrp to J25 on basicrx/dbsrx in RXA of the slave usrp
102   Don't twist the cable (Make sure the pin1 marker (red line on the flatcable) is on the same side of the connector (at io-8 on the master and at io8 on the slave.))
103   For basic_rx this means the marker should be on the side of the dboard with the sma connectors. 
104   For dbs_rx this means the marker should be on the side of the dboard with the two little chips.
105   In other words, don't twist the cable, you will burn your board if you do.
106
107 You can also connect a flatcable with multiple connectors from master-J25 to slave1-J25 to slave2-J25 to ...
108 You will however have to think of something to create a common 64Mhz clock for more then two usrps.
109
110 For all other daughterboards, connect a 2wire cable from masterRXA J25 io15,gnd to slaveRXA J25 io15,gnd 
111
112
113 So now the hardware is setup, software is setup. Lets do some tests.
114
115 Connect power to both usrps.
116 unpack the gnuradio_examples somewhere (cvs version later then 11 may 2006) 
117 go to the gnuradio-examples/python/multi_usrp folder.
118
119 Now run 
120  ./multi_usrp_oscope.py -x 12345678
121
122 It should tell you that usrp 12345678 is not found and tell you which serials are available.
123
124 Now run  ./multi_usrp_oscope.py -x actualserialnum 
125 You should now get an oscope with two channels, one is from the master and one is from the slave
126 It will which show the I-signal from channel 0 of the master usrp and I-signal from channel 0 of the slave usrp.
127 (For testing connect the same signal source to the inputs of both boards)
128 The signals should be aligned.
129 If you click the sync button, it will resync the master and slave (should never be needed)
130
131 Now run
132 ./multi_usrp_oscope.py --help
133 To see all available options.
134
135
136 Now you are ready to do phase-locked aligned signal processing.
137
138 You can also capture to file with:
139 ./multi_usrp_rx_cfile.py 
140
141 run ./multi_usrp_rx_cfile.py --help to see all available options.
142
143
144 Here follows a brief of the new blocks and (changes)functionality for multi-usrp.
145 You can also look at the generated documentation in  
146 /usr/local/share/doc/gnuradio-core-X.X
147 /usr/local/share/doc/usrp-X.X
148 (Make sure to build and install the documentation, go to the doc directory of the sourcetree and issue make doc; make install)
149  
150
151 gnuradio-examples:
152 new/changed files:
153 multi_usrp/multi_usrp_oscope.py
154 multi_usrp/multi_usrp_rx_cfile.py
155
156
157 gnuradio-core:
158 gr.align_on_samplenumbers_ss (int nchan,int align_interval) 
159
160 align several complex short (interleaved short) input channels with corresponding unsigned 32 bit sample_counters (provided as interleaved 16 bit values)
161
162 Parameters:
163         nchan   number of complex_short input channels (including the 32 bit counting channel)
164         align_interval  interval at which the samples are aligned, ignored for now.
165
166 Pay attention on how you connect this block It expects a minimum of 2 usrp_source_s with nchan number of channels and as mode  usrp_prims.bmFR_MODE_RX_COUNTING_32BIT enabled. This means that the first complex_short channel is an interleaved 32 bit counter. The samples are aligned by dropping samples untill the samplenumbers match.
167
168 files:
169 gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc
170 gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h
171 gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i
172
173
174 gr-usrp
175    added _write_fpga_reg_masked
176    added usrp_multi.py
177   new usrp_multi block which can instantiate two linked usrps as master and slave and alignes their output.
178   It has a sync() function which should be called AFTER the flowgraph has started running.
179   bool sync();
180      \brief Call this on a master usrp to sync master and slave by outputing a sync pulse on rx_a_io[15].
181         The 32 bit samplecounter of master and slave will be reset to zero and all phase and buffer related things in the usrps are reset.
182         Call this only after the flowgraph has been started, otherwise there will be no effect since everything is kept in reset state as long as the flowgraph is not running.
183      \returns true if successfull.
184
185 files:
186 configure.ac
187 src/Makefile.am
188 src/usrp1.i
189 src/usrp1_source_base.cc
190 src/usrp1_source_base.h
191 src/usrp_multi.py
192
193 usrp-0.11cvsmulti:
194 usrp:
195    new constant bmFR_MODE_RX_COUNTING_32BIT    (could also be added as extra mode like FPGA_MODE_COUNTING_32BIT)
196    Use this for the mode parameter when creating a usrp when you want to use the master/slave setup or if you want to use the 32 bit counter for other things, like testing with gr.check_counting_s(True)
197
198   added register FR_RX_MASTER_SLAVE
199   added bitno and bitmaskes:
200    bmFR_MODE_RX_COUNTING_32BIT
201
202    bitnoFR_RX_SYNC 
203    bitnoFR_RX_SYNC_MASTER
204    bitnoFR_RX_SYNC_SLAVE
205
206    bitnoFR_RX_SYNC_INPUT_IOPIN 15
207    bmFR_RX_SYNC_INPUT_IOPIN  (1<<bitnoFR_RX_SYNC_INPUT_IOPIN)
208    bitnoFR_RX_SYNC_OUTPUT_IOPIN 15
209    bmFR_RX_SYNC_OUTPUT_IOPIN (1<<bitnoFR_RX_SYNC_OUTPUT_IOPIN)
210  
211    added _write_fpga_reg_masked()
212    added new toplevel folder usrp_multi
213    added usrp_multi.v and master_control_multi.v
214    added new MULTI_ON and COUNTER_32BIT_ON defines
215       If these are turned off usrp_multi.v will behave exactly as usrp_std.v
216
217    added setting_reg_masked.v
218    changed reset behaviour of phase_acc.v and rx_buffer.v
219
220    changed generate_regs.py to handle bm and bitno defines
221
222
223 files:
224 firmware/include/fpga_regs_standard.v
225 firmware/include/fpga_regs_common.h
226 firmware/include/generate_regs.py
227 firmware/include/fpga_regs_standard.h
228 host/lib/usrp_basic.h
229 host/lib/usrp_basic.cc
230 host/lib/usrp_standard.h
231 fpga/rbf/Makefile.am
232 fpga/toplevel/usrp_std/usrp_std.v
233 fpga/toplevel/usrp_multi/usrp_multi.esf
234 fpga/toplevel/usrp_multi/usrp_multi.vh
235 fpga/toplevel/usrp_multi/usrp_std.vh
236 fpga/toplevel/usrp_multi/usrp_multi_config_2rxhb_0tx.vh
237 fpga/toplevel/usrp_multi/usrp_multi_config_2rxhb_2tx.vh
238 fpga/toplevel/usrp_multi/usrp_multi.v
239 fpga/toplevel/usrp_multi/usrp_multi.qpf
240 fpga/toplevel/usrp_multi/usrp_multi.psf
241 fpga/toplevel/usrp_multi/usrp_multi_config_2rx_0tx.vh
242 fpga/toplevel/usrp_multi/usrp_multi.qsf
243 fpga/toplevel/usrp_multi/usrp_multi_config_4rx_0tx.vh
244 fpga/toplevel/usrp_multi/usrp_multi.csf
245 fpga/toplevel/usrp_multi/.cvsignore
246 fpga/sdr_lib/rx_buffer.v
247 fpga/sdr_lib/master_control_multi.v
248 fpga/sdr_lib/phase_acc.v
249 fpga/sdr_lib/setting_reg_masked.v
250
251