EttusResearch / uhd

The USRP™ Hardware Driver Repository
http://uhd.ettus.com
Other
1k stars 666 forks source link

Add a pulse-train stream mode (for RFNoC) #787

Open andsunds opened 1 month ago

andsunds commented 1 month ago

Issue Description

I need to be able to transmit and receive a large number (~1000) of pulses in a regular sequence, with a pulse repetition frequency of at least >~10 kHz (<~100 us between Tx/Rx burst starts).

If I try to issue these commands as timed command in advance, I get RfnocError: OpFailed: [Replay] Play command queue is full after the ~32 first commands. This error message stems from the Tx command replay_Tx.issue_stream_cmd(stream_cmd_Tx, 0). Interestingly I don't get an error message when I only issue the Rx command radio_chan_Rx.issue_stream_cmd(stream_cmd_Rx, 0), even though the recording has clearly stopped after the first ~32 pulses.

Would it be possible to add a pulse-train stream mode functionality to the RFNoC modules? The stream command could look something like:

stream_mode               = uhd.types.StreamMode.pulse_train
stream_cmd                = uhd.types.StreamCMD(stream_mode)
stream_cmd.num_samps      = <num_samps>
stream_cmd.num_pulses     = <number_of_pulses_in_train>
stream_cmd.pulse_interval = <interval_between_pulses_in_sec>
stream_cmd.stream_now     = False
stream_cmd.time_spec      = <time_spec_of_first_pulse>

Alternatively, a list of pulse start times could be given.

Current queue length

If such a stream mode would be too hard to implement, can you implement a method of getting the current length of the command queue? Something like:

<number_of commands_in_queue>=replay.get_command_queue(<port>)

Setup Details

I'm using the X440 with the factory x4_400 fpga image flavor, through the python UHD package v4.6.0.0 (50fa3baa2) on Ubuntu 22.04. The interface is the standard RJ45 ethernet cable.

mbr0wn commented 1 month ago

Hey @andsunds, this is a reasonable use case. Some comments and questions:

If you're tx/rx'ing 100ms worth of signal, that's really a small amount of data even at high rates (even at 2Gsps, that would be around 800MB out of our 4 GiB of onboard DRAM). So if you're using the replay block, you have plenty of space to capture the full pulse train without requiring start/stopping the radio.

Note that it's unlikely that we'll change the streaming API for this, at least, as long as we can't find an easy alternative route (that's because the streaming API is very basic by design, and works the same way across a bunch of devices).

andsunds commented 1 month ago

Hi, thanks for the comments. In response to your questions:

Hope this helps!

If it's of any value, we will also be running everything from the x440's onboard ARM processor as sort of stand-alone system.

mbr0wn commented 1 month ago

Thanks, the comment on the ATR pins is good to know. It's possible to trigger those pins directly in a timed fashion, but I can't say off the top of my head if you then don't have the same issue when sending all the GPIO on/off commands.

If it's of any value, we will also be running everything from the x440's onboard ARM processor as sort of stand-alone system.

That should not be an issue in this case.