From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

USRP Software Radio

cancel
Showing results for 
Search instead for 
Did you mean: 

Avoid underflow and overflow

Solved!
Go to solution

Hello all,

 

Let's assume that we have a USRP-2943R (120MHz) and we want to transmit and receive a signal continuously. I have two questions:

 

1- How we can avoid overflow and underflow in the USRP? What should be the relationship between IQ data rate, number of samples and waveform size to avoid underflow and overflow? Or, overall what parameters affect overflow and underflow in general?

 

2- How we can transmit exactly for 100ms and not transmit for 50ms continuously? Is there any VI examples or technics that one can use to implement this scenario?

 

Thank you.

Message 1 of 12
(18,753 Views)

Hi Amir, 

 

It is difficult to state a relationship between IQ Data Rate, Number of Samples, and your Waveform size to avoid underflow and overflow. Typically, for transmit, you want to ensure that you always have samples available for your USRP (IE, decrease number of samples and write more samples at one time, slow down IQ data), but there is no exact formula to determine if you will underflow as the write process is dependent on your software execution speed.

 

One general recommendation is to use the Producer/Consumer architecture to read from the USRP at a maximum rate, and minimize the amount of data processing you are performing in your loops in which you are writing/reading from your USRP.

 

Are you experiencing overflow/underflow errors? If you are a little more specific about what you are doing, there may be additional insight we can offer into how to improve your code.

 

 

0 Kudos
Message 2 of 12
(18,708 Views)
Solution
Accepted by topic author Amir2

Hello! Sorry, I think I misread your question. Ettus's manual provides some useful information, in the section under "overflow/underflow notes." 

 

When receiving, the device produces samples at a constant rate. Overflows occurs when the host does not consume data fast enough.

 

When transmitting, the device consumes samples at a constant rate. Underflow occurs when the host does not produce data fast enough.

 

Hence, by doing either

 

A) Your loop time is not fast enough to produce data for the device (Underflow)

B) Your loop time is not fast enough to consume data from your device (Overflow) 

 

then you will receive an error. So, in order to understand if you are getting an overflow/underflow, you have to determine if you are producing/consuming data fast enough. 

Message 3 of 12
(18,699 Views)

Hello  Chantastic,

Thank you for the explanation. 

Yes. Now I see why I was getting underflow! That was because, I put a wait in the while loop and set the waiting time to more than the required  time for transmitting the data.  So the case (A) is applied to my code. I corrected it. Thanks!

I appreciate your help. 

Amir

0 Kudos
Message 4 of 12
(18,695 Views)

Hello Amir,

 

How did you determine the time of your ''wait'' please ? 

Thank you,

 

Gallyket

0 Kudos
Message 5 of 12
(18,692 Views)

Hello gallyket,

 

I assume IQ data rate =1M and Waveform size = 100000. Then the size of the data will be 100ms.

With these set up parameters, I saw that when I put the wait time in the while loop more than 100ms then I get underfollow error. 

 

Please correct me if I am wrong somewhere. 

 

Thank you.

 

0 Kudos
Message 6 of 12
(18,664 Views)
Solution
Accepted by topic author Amir2

Hi Amir,

 

That is correct! If anyone else is not using a wait but want to know the execution time of their loop, I would recommend this link.

0 Kudos
Message 7 of 12
(18,662 Views)

Hi Amir,

I tried this but I still have the underflow problem. If someone can suggest me an other solution this can help me a lot. I also tried to modify the FastSendDatagramThreshold register as suggested in an other post but when I go to  ** HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\AFD\Parameters\, I don't see any "FastSendDatagramThreshold".

 

Thank you in advance for your help

 

0 Kudos
Message 8 of 12
(18,657 Views)

Hi gallyket, 

 

Can you post

 

1) Your IQ Data Rate

2) Your Waveform size

3) Your loop execution time? 

0 Kudos
Message 9 of 12
(18,646 Views)

Hi Chantastic!

 

My IQ is 400k, my Waveform size is 10000 but I don't know how to evaluate my (While) loop execution. I also attached my vi, so that you can take a look. 

 

Thank youk,
Gallyket

0 Kudos
Message 10 of 12
(18,641 Views)