Thank you for your response, but as I have mentioned I  already tried to
set SPP to match FFT_size for Rx_radio. I also tried to set spp with py
script.  It shows the same error as GNu radio which is:





*[ERROR] [RxStreamer#0] Cannot resolve spp! Must be a multiple of 512 but
max value is 256Traceback (most recent call last):  File "FFT_test.py",
line 47, in <module>    fft.set_length(fft_length)RuntimeError: ValueError:
Samples per packet is incompatible with atomic item size!*

I have attached my py script for your reference.* Is there any reference
code (GNU radio or python or CPP) which works with FFT size = 1024/2048? *Is
it even possible to get this FFT length (1024 and 2048 ) with USRP x300?
Also, I have only twin RX in my design so no TX.

Another thing I noticed is if I set fft|_length before committing the
graph, the max spp value is *364 *whereas after commit if I set fft_length
the max SPP size is *256*. Can anyone please explain what is the reason for
this.


On Wed, Oct 23, 2024 at 6:59 PM Wade Fife <wade.f...@ettus.com> wrote:

> With this FFT block, you need to set the SPP to match the FFT size for it
> to work correctly. I'm not very familiar with GNU Radio but I think there
> is an SPP parameter on the RX radio. I don't know how to set it for TX.
>
> Wade
>
>
> On Wed, Oct 23, 2024 at 5:45 AM Nidhi Panda <nidhi.pa...@cyronics.com>
> wrote:
>
>> Hello,
>>
>> I am having USRP X300 device with following tool versions:
>>
>> Vivado 2021.1 - AR76780n,
>> GNU radio version - v3.11.0.0git-820-g2adbd4ea
>> UHD version - UHD_4.7.0.0-84-gbdada1ed
>>
>> I have added FFT and Spliter RFNoC blocks in my bit file. The
>> "uhd_usrp_probe" command shows correct connection in the blocks.
>>
>> | | RFNoC blocks on this device:
>> | |
>> | | * 0/DDC#0
>> | | * 0/FFT#0
>> | | * 0/Radio#0
>> | | * 0/Replay#0
>> | | * 0/SplitStream#0
>> | _____________________________________________________
>> | /
>> | | Static connections on this device:
>>
>> | | * 0/Radio#0:0==>0/DDC#0:0
>> | | * 0/Radio#0:1==>0/DDC#0:1
>> | | * 0/DDC#0:1==>0/SEP#0:0
>> | | * 0/DDC#0:0==>0/SplitStream#0:0
>> | | * 0/SplitStream#0:1==>0/FFT#0:0
>> | | * 0/SplitStream#0:0==>0/SEP#2:0
>> | | * 0/FFT#0:0==>0/SEP#1:0
>> | | * 0/SEP#3:0==>0/Replay#0:0
>> | | * 0/Replay#0:0==>0/SEP#3:0
>> | | * 0/SEP#4:0==>0/Replay#0:1
>> | | * 0/Replay#0:1==>0/SEP#4:0
>>
>> However, on running example code available on GNURADIO
>> *"rfnoc_split_stream.grc"*. I get following error:
>>
>> *1. When FFT size = 1024 (as in the example given in gnu radio)*
>>
>>
>>
>> *--------------------------------------------------------------------------------------------------------------------------*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *[ERROR] [RxStreamer#0] Cannot resolve spp! Must be a multiple of 1024
>> but max value is 364Traceback (most recent call last):  File
>> "/home/quasar/gnuradio/gr-uhd/examples/grc/rfnoc_split_stream.py", line
>> 347, in <module>    main()  File
>> "/home/quasar/gnuradio/gr-uhd/examples/grc/rfnoc_split_stream.py", line
>> 326, in main    tb.start()  File
>> "/usr/local/lib/python3.8/dist-packages/gnuradio/gr/top_block.py", line
>> 116, in start    top_block_start_unlocked(self._impl,
>> max_noutput_items)RuntimeError: ValueError: Samples per packet is
>> incompatible with atomic item size!*
>>
>>
>> *--------------------------------------------------------------------------------------------------------------------------*
>> How to know what is atomic size and how can I set it. On searching for
>> this error I came across following link:
>>
>> *https://github.com/EttusResearch/uhd/commit/f163af41a47ab4c702ffbdb10352cf875d604d74
>> <https://github.com/EttusResearch/uhd/commit/f163af41a47ab4c702ffbdb10352cf875d604d74>*
>>
>> This says rx stream is having a bug and AIS is in unit bytes, and spp in
>> unit items. It was a response of two years back with the uhd version
>> v4.3.0.0-rc1
>> <https://github.com/EttusResearch/uhd/releases/tag/v4.3.0.0-rc1>. Does
>> this explanation still hold? What is the max FFT size I can use? I want to
>> use *2048*, what changes need to be done for it.
>>
>> *1. When FFT size = 256*
>>
>>
>> *--------------------------------------------------------------------------------------------------------------------------*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *[ERROR] [RFNOC::GRAPH::DETAIL] The following properties could not be
>> resolved:[ERROR] [RFNOC::GRAPH::DETAIL] Dirty: RxStreamer#1[INPUT_EDGE:0
>> atomic_item_size]Traceback (most recent call last):  File
>> "/home/quasar/gnuradio/gr-uhd/examples/grc/rfnoc_split_stream.py", line
>> 347, in <module>    main()  File
>> "/home/quasar/gnuradio/gr-uhd/examples/grc/rfnoc_split_stream.py", line
>> 326, in main    tb.start()  File
>> "/usr/local/lib/python3.8/dist-packages/gnuradio/gr/top_block.py", line
>> 116, in start    top_block_start_unlocked(self._impl,
>> max_noutput_items)RuntimeError: RfnocError: ResolveError: Could not resolve
>> properties.*
>>
>>
>> *--------------------------------------------------------------------------------------------------------------------------*
>>
>> Am I doing anything wrong in the yml script because the connection seems
>> correct in the uhd_usrp_probe command. On further searching I found that
>> SPP i.e. sample per packet must be the same for all the blocks. Tried doing
>> it in gnu radio by assigning the args option with f"spp={fft_size}". Is
>> this correct? It gives no change in error howver I get additional warning
>> as
>>
>> [WARNING] [0/FFT#0] set_properties() cannot set property `spp': No such
>> property.
>> [WARNING] [0/DDC#0] set_properties() cannot set property `spp': No such
>> property.
>>
>>
>> Please help me to solve these errors.
>>
>> --
>> Regards,
>> *Nidhi Panda*
>>
>> *Cyronics Innovation Labs Pvt Ltd*
>> #11, Electronics Co-op Estate
>> Satara Road, Pune - 411009
>>
>> _______________________________________________
>> USRP-users mailing list -- usrp-users@lists.ettus.com
>> To unsubscribe send an email to usrp-users-le...@lists.ettus.com
>>
>

-- 
Regards,
*Nidhi Panda*

*Cyronics Innovation Labs Pvt Ltd*
#11, Electronics Co-op Estate
Satara Road, Pune - 411009
import uhd
import argparse
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import cmath
import scipy
from scipy import signal
matplotlib.rcParams['figure.figsize'] = [15,5]

graph = uhd.rfnoc.RfnocGraph('addr = 192.168.10.2')

FFT_noc_block = graph.get_block('0/FFT#0')
## FFT BLOCK CONFIGURATION
# fft_length = 512
# fft_magnitude = uhd.libpyuhd.rfnoc.fft_magnitude.COMPLEX
# fft_direction = uhd.libpyuhd.rfnoc.fft_direction.FORWARD
# fft_shift = uhd.libpyuhd.rfnoc.fft_shift.NORMAL

# fft = uhd.rfnoc.FftBlockControl(FFT_noc_block)
# fft.set_length(fft_length)
# fft.set_magnitude(fft_magnitude)
# fft.set_direction(fft_direction)
# fft.set_shift_config(fft_shift)

# Stream Arguments
sa = uhd.usrp.StreamArgs('fc32','sc16')

radio_noc_block = graph.get_block("0/Radio#0")


graph.connect("0/Radio#0", 0, "0/DDC#0", 0, True)
rx_streamer = graph.create_rx_streamer(1, sa)

graph.connect("0/DDC#0", 0, '0/FFT#0', 0, True)
graph.connect('0/FFT#0', 0, rx_streamer, 0, True)
graph.commit()


fft_length = 512
fft_magnitude = uhd.libpyuhd.rfnoc.fft_magnitude.COMPLEX
fft_direction = uhd.libpyuhd.rfnoc.fft_direction.FORWARD
fft_shift = uhd.libpyuhd.rfnoc.fft_shift.NORMAL

fft = uhd.rfnoc.FftBlockControl(FFT_noc_block)
fft.set_length(fft_length)
fft.set_magnitude(fft_magnitude)
fft.set_direction(fft_direction)
fft.set_shift_config(fft_shift)

sa.args = "spp=" + str(fft_length)

radio_block = uhd.rfnoc.RadioControl(radio_noc_block)

radio_block.set_rx_frequency(853e6, 0)
radio_block.set_rx_gain(65, 0)
radio_block.set_rx_antenna("RX1", 0)
radio_block.set_rate(200e6)
radio_block.set_properties(f'spp={fft_length}', 0)

ddc_block = uhd.rfnoc.DdcBlockControl(graph.get_block("0/DDC#0"))
ddc_block.set_input_rate(200e6, 0)
ddc_block.set_output_rate(5e6, 0)




num_samples = fft_length  # Number of samples to receive at a time
radio_data = np.zeros((1, num_samples), dtype="complex64")  # Keep the buffer outside

# Initialize streaming command for continuous data reception
stream_cmd = uhd.types.StreamCMD(uhd.types.StreamMode.start_cont)
stream_cmd.stream_now = True
rx_streamer.issue_stream_cmd(stream_cmd)  # Start streaming

# Set up the plot
fig, ax = plt.subplots()
x_data = np.linspace(-0.5, 0.5, fft_length)
y_data = np.zeros(fft_length)
line, = ax.semilogy(x_data, np.abs(y_data))  # Initial empty plot

# Update function for the animation
def update_plot(frame):
    metadata = uhd.types.RXMetadata()

    # Receive new samples from the radio
    num_samples_received = rx_streamer.recv(radio_data, metadata, timeout=0.5)

    # Check for overflows or underflows
    if metadata.error_code == uhd.types.RXMetadataErrorCode.none:
        # Ensure that valid samples are received
        if num_samples_received > 0:
            # Update the y-data with the magnitude of the newly received samples
            line.set_ydata(np.abs(radio_data[0]))  # Update y-axis with new radio data
            
            # Adjust plot to fit new data if necessary
            ax.relim()
            ax.autoscale_view()
    else:
        print(f"Metadata error: {metadata.error_code}")

    return line,
while True: 
    # Set up the animation to update the plot continuously
    ani = animation.FuncAnimation(fig, update_plot, interval=100, blit=False)  # Update every 100 ms
    # Display the plot
    plt.show()


# Stop streaming when done (optional)
rx_streamer.issue_stream_cmd(uhd.types.StreamCMD(uhd.types.StreamMode.stop_cont))
_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com

Reply via email to