aboutsummaryrefslogtreecommitdiffstats
path: root/host/docs/usrp2.rst
blob: aff0d0454974527438808e2cc2456fe5af63347c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
========================================================================
UHD - USRP2 Application Notes
========================================================================

.. contents:: Table of Contents

------------------------------------------------------------------------
Building firmware and FPGA images
------------------------------------------------------------------------

^^^^^^^^^^^^^^^^^^
FPGA Image
^^^^^^^^^^^^^^^^^^
Xilinx ISE 10.1 is required to build the FPGA image for the USRP2
(newer version of ISE are known to build buggy images).
The build requires that you have a unix-like environment with make.
Make sure that xtclsh from the Xilinx ISE bin directory is in your $PATH.

Run the following commands:
::

    cd <uhd-repo-path>/fpga/usrp2/top/u2_rev3
    make -f Makefile.udp bin

*The image file will be ./build/u2_rev3.bin*

^^^^^^^^^^^^^^^^^^
Firmware Image
^^^^^^^^^^^^^^^^^^
The Microblaze GCC compiler from the Xilinx EDK is required to build the firmware.
The build requires that you have a unix-like environment with autotools and make.
Make sure that mb-gcc from the Xilinx EDK/microblaze directory is in your $PATH.

Run the following commands:
::

    cd <uhd-repo-path>/firmware/microblaze
    ./boostrap
    ./configure --host=mb
    make

*The image file will be ./apps/txrx_uhd.bin*

------------------------------------------------------------------------
Load the images onto the SD card
------------------------------------------------------------------------
**Warning!**
Use the usrp2_card_burner.py with caution. If you specify the wrong device node,
you could overwrite your hard drive. Make sure that --dev= specifies the SD card.

Use the *--list* option to get a list of possible raw devices.
The list result will filter out disk partitions and devices too large to be the sd card.
The list option has been implemented on Linux, Mac OS X, and Windows.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Use the card burner tool (unix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::

    sudo <prefix>/share/uhd/utils/usrp2_card_burner_gui.py

    -- OR --

    cd <prefix>/share/uhd/utils
    sudo ./usrp2_card_burner.py --dev=/dev/sd<XXX> --fpga=<path_to_fpga_image>
    sudo ./usrp2_card_burner.py --dev=/dev/sd<XXX> --fw=<path_to_firmware_image>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Use the card burner tool (windows)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::

    <path_to_python.exe> <prefix>/share/uhd/utils/usrp2_card_burner_gui.py


------------------------------------------------------------------------
Setup networking
------------------------------------------------------------------------
The USRP2 only supports gigabit ethernet, and
will not work with a 10/100 Mbps interface.
Because the USRP2 uses gigabit ethernet pause frames for flow control,
you cannot use multiple USRP2s with a switch or a hub.
It is recommended that each USRP2 be plugged directly into its own
dedicated gigabit ethernet interface on the host computer.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Setup the host interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The USRP2 communicates at the IP/UDP layer over the gigabit ethernet.
The default IP address of the USRP2 is **192.168.10.2**
You will need to configure the host's ethernet interface with a static IP address to enable communication.
An address of **192.168.10.1** is recommended.

**Note:**
When using the UHD, if an IP address for the USRP2 is not specified,
the software will use UDP broadcast packets to locate the USRP2.
On some systems, the firewall will block UDP broadcast packets.
It is recommended that you change or disable your firewall settings. 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Change the USRP2's IP address
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You may need to change the USRP2's IP address for several reasons:

* to satisfy your particular network configuration
* to use multiple USRP2s on the same host computer
* to set a known IP address into USRP2 (in case you forgot)

**Method 1:**
To change the USRP2's IP address
you must know the current address of the USRP2,
and the network must be setup properly as described above.
Run the following commands:
::

    cd <prefix>/share/uhd/utils
    ./usrp_addr_burner --addr=192.168.10.2 --new-ip=192.168.10.3

**Method 2 (Linux Only):**
This method assumes that you do not know the IP address of your USRP2.
It uses raw ethernet packets to bypass the IP/UDP layer to communicate with the USRP2.
Run the following commands:
::

    cd <prefix>/share/uhd/utils
    ./usrp2_recovery.py --ifc=eth0 --new-ip=192.168.10.3

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Debugging networking problems
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Disable the firewall:**
If uhd_find_devices gives you nothing
but uhd_find_devices --args addr=192.168.10.2 yeilds a discovered device,
then your firewall may be blocking replies to UDP broadcast packets.

**Ping the USRP2:**
The USRP2 will reply to icmp echo requests.
::

    ping 192.168.10.2

**Monitor the USRP2:**
You can read the serial port on the rear of the USRP2
to get debug verbose from the embedded microcontroller.
Use a standard USB to tty-level serial converter at 230400 baud.
The microcontroller prints useful information about IP addresses,
MAC addresses, control packets, and fast-path settings.

**Monitor the host network traffic:**
Use wireshark to monitor packets sent to and received from the USRP2.

------------------------------------------------------------------------
Resize the send and receive buffers
------------------------------------------------------------------------
It may be useful increase the size of the socket buffers to
move the burden of buffering samples into the kernel, or to
buffer incoming samples faster than they can be processed.
However, if you application cannot process samples fast enough,
no amount of buffering can save you.

By default, the UHD will try to request a reasonably large buffer size for both send and receive.
A warning will be printed on instantiation if the actual buffer size is insufficient.
See the OS specific notes below:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OS specific notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
On linux, the maximum buffer sizes are capped by the sysctl values
**net.core.rmem_max** and **net.core.wmem_max**.
To change the maximum values, run the following commands:
::

    sudo sysctl -w net.core.rmem_max=<new value>
    sudo sysctl -w net.core.wmem_max=<new value>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Device address params
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To manually set the size of the buffers,
the usrp2 will accept two optional parameters in the device address.
Each parameter will accept a numeric value for the number of bytes.

* recv_buff_size
* send_buff_size

Example, set the args string to the following:
::

    addr=192.168.10.2, recv_buff_size=100e6