USRP Software Radio

cancel
Showing results for 
Search instead for 
Did you mean: 

usrp x410 initial error

Solved!
Go to solution
Hello everyone, my question is when I run the code, I am getting the error saying that I am requesting the invalid sampling rate.
 
For this problem, my idea is that the master clock rate is 500e6 and it is possible that the sampling decimation would work.
Code:

import numpy as np
import matplotlib.pyplot as plt
import uhd
import threading, time

plt.close()
Nperiod=400
sig_freq=10e6
Fs = 20e6 # 20MHz sampling rate

n=np.arange(Nperiod/sig_freq * Fs)
Ns=len(n)
ts = n/Fs

debug = False
tx_flag=True
xs = np.exp(2j*np.pi*sig_freq*ts).astype('complex64')

def tx_func():
global xs, tx_flag
tx_cnt=0
while tx_cnt<400:
num_tx_samps = tx_streamer.send(xs,tx_metadata)
tx_cnt += 1
tx_flag=False
print('TxSent')

rf_freq = 2.62e9 # 2.62GHz carrier frequency
tx_channel = 0
txGain = 0 # dB
rx_channel = 0
rxGain = 0 # dB


# dev = uhd.libpyuhd.types.device_addr("addr=192.168.10.2")
myusrp = uhd.usrp.MultiUSRP("addr=192.168.10.2, master_clock_rate=500e6")
num_samps = Ns
# myusrp.set
myusrp.set_tx_antenna("TX/RX0")
myusrp.set_tx_rate(Fs)
myusrp.set_tx_bandwidth(Fs)
myusrp.set_tx_freq(uhd.libpyuhd.types.tune_request(rf_freq), tx_channel)
myusrp.set_tx_gain(txGain)

myusrp.set_rx_antenna("RX1")
myusrp.set_rx_rate(Fs)
myusrp.set_rx_bandwidth(Fs)
myusrp.set_rx_freq(uhd.libpyuhd.types.tune_request(rf_freq), rx_channel)
myusrp.set_rx_gain(rxGain)

 

Error:

[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 500.000 MHz
Actual TX Rate: 500.0 MHz
Actual RX Rate: 500.0 MHz
[WARNING] [0/Radio#0] Requesting invalid sampling rate from device: 20 MHz. Actual rate is: 500 MHz.
[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 500.000 MHz
[WARNING] [0/Radio#1] Requesting invalid sampling rate from device: 20 MHz. Actual rate is: 500 MHz.
[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 500.000 MHz
[WARNING] [0/Radio#1] Requesting invalid sampling rate from device: 20 MHz. Actual rate is: 500 MHz.
[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 500.000 MHz
[WARNING] [0/Radio#0] Invalid analog bandwidth: 20 MHz.
[WARNING] [0/Radio#0] Requesting invalid sampling rate from device: 20 MHz. Actual rate is: 500 MHz.
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 500.000 MHz
[WARNING] [0/Radio#0] Requesting invalid sampling rate from device: 20 MHz. Actual rate is: 500 MHz.
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 500.000 MHz
[WARNING] [0/Radio#1] Requesting invalid sampling rate from device: 20 MHz. Actual rate is: 500 MHz.
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 500.000 MHz
[WARNING] [0/Radio#1] Requesting invalid sampling rate from device: 20 MHz. Actual rate is: 500 MHz.
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 500.000 MHz
[WARNING] [0/Radio#0] Invalid analog bandwidth: 20 MHz.

 
 
0 Kudos
Message 1 of 10
(5,173 Views)

Hi yonghoon1999@gmail.com,

 

based on the master_clock_rate argument value, I am assuming you are using a bitfile with 400MHz bandwidth (CG_400). If this is true, then unfortunately the sampling decimation option via FPGA based DDC is not available. Please see section 'FPGA Image Flavors' in UHD Manual, which lists the onboard DDC/DUC feature being only available in the 200MHz bandwidth images.

0 Kudos
Message 2 of 10
(5,161 Views)

Thank you GDEV for answering my question.

You were right. I was using the CG fpga. I converted the fpga to x4_200.
However, the core problem of this question is not solved. 

When I run the code, I am still getting the following error.

Am I misunderstanding the concept of master clock rate, sampling rate and bandwidth?

 

code : 

import numpy as np
import matplotlib.pyplot as plt
import uhd
import threading, time

plt.close()
Nperiod=400
sig_freq=10e6
Fs = 20e6 # 20MHz sampling rate

n=np.arange(Nperiod/sig_freq * Fs)
Ns=len(n)
ts = n/Fs

debug = False
tx_flag=True
xs = np.exp(2j*np.pi*sig_freq*ts).astype('complex64')

def tx_func():
global xs, tx_flag
tx_cnt=0
while tx_cnt<400:
num_tx_samps = tx_streamer.send(xs,tx_metadata)
tx_cnt += 1
tx_flag=False
print('TxSent')

rf_freq = 2.62e9 # 2.62GHz carrier frequency
tx_channel = 0
txGain = 0 # dB
rx_channel = 0
rxGain = 0 # dB


# dev = uhd.libpyuhd.types.device_addr("addr=192.168.10.2")
myusrp = uhd.usrp.MultiUSRP("addr=192.168.10.2, master_clock_rate=250e6")
num_samps = Ns
# myusrp.set
myusrp.set_tx_antenna("TX/RX0")
myusrp.set_tx_rate(Fs)
myusrp.set_tx_bandwidth(Fs)
myusrp.set_tx_freq(uhd.libpyuhd.types.tune_request(rf_freq), tx_channel)
myusrp.set_tx_gain(txGain)

myusrp.set_rx_antenna("RX1")
myusrp.set_rx_rate(Fs)
myusrp.set_rx_bandwidth(Fs)
myusrp.set_rx_freq(uhd.libpyuhd.types.tune_request(rf_freq), rx_channel)
myusrp.set_rx_gain(rxGain)

Error:
[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [MULTI_USRP] Could not set TX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [0/Radio#0] Invalid analog bandwidth: 20 MHz.
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [MULTI_USRP] Could not set RX rate to 20.000 MHz. Actual rate is 20.833 MHz
[WARNING] [0/Radio#0] Invalid analog bandwidth: 20 MHz.

0 Kudos
Message 3 of 10
(5,137 Views)

Hi yonghoon1999@gmail.com,

 

The error you are getting when using set_rx_bandwidth is likely a misconception.
The x410 does not have a configurable rf bandwidth and calling get_rx_bandwidth will also only return a single configurable bandwidth (400e6). On the x410 the analog rf bandwidth is fixed and a property of the daughterboard hardware design. When using the X4_200 bitfile the usable digital rf bandwidth is determined by the iq data rate, which is configured via set_rx_rate. The master_clock_rate on the x410 only supports few choices and effects the achievable iq rates given that the DDC/DUC is limited to decimal dividers (see also coercion warning in your print-out).

 

P.S. Typical digital bandwidth of a DDC/DUC is 80% iq rate. For a desired bandwidth of 20MHz, a iq rate of at least 25MHz should be chosen.

 

Message 4 of 10
(5,125 Views)

Thanks GDEV

 

So you mean, in X410 I cannot modify the analog bandwidth. Even though I read the manual but never realized that it was fixed. Thank you so much.

 

I am very new to this area and I am not familiar with these words. I would appreciate if you help me understand these words.

What is the difference between the analog RF bandwidth and  the digital RF bandwidth? As I assume from your reply, the analog RF bandwidth is the ZBX daughter board which is always 400MHz, and the digital RF bandwidth is the DDC and DUC. What is the relationship between the DDC, DUC and the digital RF bandwidth.

Another question is the iq data rate. Is it safe to think that the iq data rate is the sampling rate? And your P.S, could you elaborate the " For a desired bandwidth of 20MHz, a iq rate of at least 25MHz should be chosen."

 

Last question is when I remove the "myusrp.set_rx_bandwidth(Fs)", I do not see the error anymore. However, I see another error saying "[WARNING] [0/Radio#0] Attempting to set tick rate to 0. Skipping." I think this error comes from the another error. 

 

You helped me a lot to breakthrough all the problem that I faced so far.

I really appreciate your work!

 

Thank you 
Yonghoon Chung

0 Kudos
Message 5 of 10
(5,111 Views)
Solution
Accepted by topic author yonghoon1999@gmail.com

Hi Yonghoon,

 

I assume from your reply, the analog RF bandwidth is the ZBX daughter board which is always 400MHz

--> Correct

 

the digital RF bandwidth is the DDC and DUC

--> yes, that digital bandwidth is determined by the DSP in the FPGA
--> on the CG_400 image, which does not have a configurable DDC/DUC, the digital bandwidth is equal to the analog bandwidth
--> on the X4_200 image, the digital bandwidth is determined by the selected DDC/DUC divider

 

Another question is the iq data rate. Is it safe to think that the iq data rate is the sampling rate?

--> yes, the iq data rate is the sampling rate of the complex data after the DDC (or before the DUC).

 

And your P.S, could you elaborate the " For a desired bandwidth of 20MHz, a iq rate of at least 25MHz should be chosen."

-->  I intended to hint that bandwidth and sampling rate can not be identical and in order to achieve a certain bandwidth requirement one may need to use a little higher sampling rate than simply 1.25 * bandwidth. UHD coerces the configured sampling rate to the nearest possible rate, which could result in the next lower rate and a minimal smaller digital bandwidth than desired.

 

However, I see another error saying "[WARNING] [0/Radio#0] Attempting to set tick rate to 0. Skipping." I think this error comes from the another error.

--> This is a warning and should ordinarily be ignorable.

Message 6 of 10
(5,107 Views)

Thank you GDEV,

 

I would like to ask one more question.
How do I handle the 'U' (underrun)? https://uhd.readthedocs.io/en/latest/page_general.html this document says that the data has not produced fast enough, however, is this related to the the minimum buffer that I am sending? 

 

Suppose, B210, I think it's maximum sample per packet is 2048 and X310 is about 8000. I assume that the X410 would be really large. 

Does the underrun occurs when the buffer is not filled correctly?

 

0 Kudos
Message 7 of 10
(5,060 Views)

Hi Yonghoon,

 

the setting 'maximum samples per packet' depends to a large extent on the network interface used to stream data between the host and the usrp. The standard transport method of the x410 uses UDP sockets, for details please see https://uhd.readthedocs.io/en/latest/page_transport.html.

In addition, the streaming performance is effected by the capabilities of the computer and what other things are happening on it. Also keep in mind that while uhd supports multiple data formats on the host (i.e. CPU data formats) it converts data prior to streaming to the 'over the wire' data format, which for the x410 is sc16 (Complex-valued signed 16-bit integer data). See also https://uhd.readthedocs.io/en/latest/page_configuration.html#config_stream_args.

 

You may also find this knowledge base article helpful, that also applies to the x410: https://kb.ettus.com/USRP_Host_Performance_Tuning_Tips_and_Tricks

 

Regards,

 

0 Kudos
Message 8 of 10
(5,049 Views)

Thank you for replying my question, GDEV! I am learning a lot from you.

 

From you first answer, I checked the transport. From this page, since I am using the 100GigE, the maximum frame sizes are 8000. 

yonghoon1999gmailcom_0-1705503148670.png

From the second answer, I checked the configuration of the streamer's data format that cpu is fc32 and otw is sc16. I guess I am following the correct way but why am I still getting the 'U' as underflow?

 

## Tx Streamer
txstream_args = uhd.usrp.StreamArgs('fc32', 'sc16')
# txstream_args.args = f'spp={2000}' # samples per packet
tx_streamer = myusrp.get_tx_stream(txstream_args)

 

Lastly, this could be another question, when I set the spp as 2000 for both tx and rx, I believe that spp makes the tx and rx uses the buffer size of 2000. Tx transmits only 2000 samples and rx receives only 2000 samples no matter what the size of data I send. 

For example, I created the 12000 samples of the data and try to send it to the receiver under the same configuration. Will the tx send only the first 2000 of the data? As I took an experiment, I received way more than my spp value. 

 

The way of my writing seems broken. Please let me know.

Thank you.

 

 

0 Kudos
Message 9 of 10
(5,034 Views)

Hi Yonghoon1999,

 

Ultimately, TX underflows mean your host can not send data in time (or fast enough) for the USRP to consume.

I recommend you look at the shipping uhd examples, which demonstrate this core functionality.

 

Lastly, this could be another question, when I set the spp as 2000 for both tx and rx, I believe that spp makes the tx and rx uses the buffer size of 2000. Tx transmits only 2000 samples and rx receives only 2000 samples no matter what the size of data I send. 

For example, I created the 12000 samples of the data and try to send it to the receiver under the same configuration. Will the tx send only the first 2000 of the data? As I took an experiment, I received way more than my spp value.

Keep in mind "spp" specifies samples per package. If you give the TX streamer more samples than fits into a single package then the streamer will automatically split the data into multiple packages (checkout the example /usr/lib/uhd/examples/python/tx_waveform.py). On the usrp packages are consumed one after another.

 

Regards,

 

0 Kudos
Message 10 of 10
(5,029 Views)