Thanks Marcus,

for your fast reply.

On Sat, Apr 26, 2025 at 4:08 AM Marcus D. Leech <patchvonbr...@gmail.com>
wrote:

> On 25/04/2025 20:50, Nikos Balkanas wrote:
>
> Hello,
>
> I need to buy a new NIC. What would you suggest?
> The one I use is an old Mellanox 10 Gbs, before the Connect-4 series.
> It can only do 1996 S/s, need 19960 (10x more) to work with latest uhd.
> Using Ubuntu 24.04 and uhd 4.6.0
>
> So, 1.996ksps vs 19.960ksps?   You hardly need a 10Gbit link to support
> that.  So, perhaps something
>   is being lost here in your requirements?
>

True. Can't explain it in terms of bandwidth. 16 * 1996 = 31.936 Kbps, 16 *
19960 = 319.360 Kbps well short of a 10 Gbps line:(
Does a complex pair count as 1 sample, or 2?
I have followed all the instructions in
https://kb.ettus.com/USRP_Host_Performance_Tuning_Tips_and_Tricks,
Even installed the DPDK drivers. My Mellanox is too old to use their OFED
drivers:(

>
> On a related question. it seems that the streamer doesn't crash anymore
> when receiving less than MAXSPS samples, instead it reads 0:(
> This was due to the sse2 code not aligned in convert.
> I change my stream args to cpu_format=sc16, otw=sc16, so no conversion
> required.
> Streamer still doesn't read anything. Is there a reason for it?
>
> You'd need to share more of your code.  This should just work as far as I
> can tell.
>
> Thanks. these are just the usrp code:

int main()
{
      uhd_stream_args_t stream_args =
                                                           {
                                                              .cpu_format =
"sc16",
                                                              .otw_format =
"sc16",
                                                              .args = "",
                                                              .n_channels =
1,

 .channel_list = &channel
                                                             };
..uhd_stream_cmd_t stream_cmd =
                                                             {
                                                               .stream_mode
= UHD_STREAM_MODE_NUM_SAMPS_AND_DONE,
                                                                .stream_now
= true
                                                              };

    if (uhd_init(0, 0, gain)) do_exit(20);
>     if ((err = uhd_usrp_get_rx_stream(dev[0], &stream_args,
> rx_streamer[0])))
>     {
>          uhd_get_last_error(errmsg, 127);
>          error(log, "Failed to get streamer[0] (%d). %s.\n", 0, FL, LN,
> FN, err, errmsg);
>         uhd_rx_streamer_free(&rx_streamer[0]);
>          rx_streamer[0] = NULL;
>          uhd_rx_metadata_free(&md[0]);
>         md[0] = NULL;
>         do_exit(30);
>     }
>      if ((err = uhd_rx_streamer_max_num_samps(rx_streamer[0], &maxsamps)))
>
     {
>          uhd_get_last_error(errmsg, 127);
>          error(log, "Failed to get max samples/buffer[0] (%d). %s.\n", 0,
> FL, LN, FN, err,
>            ..errmsg);
>         do_exit(35);
>     }
>     if (maxsamps != MAXSMPS)
>         warn(log, "Incorrect maxsamples (%ld). Expected %d.\n", 0, FL,
> LN, FN, maxsamps,
>               MAXSMPS);
>      info(log, "Max samples/buffer[0]: %ld\n", 0, maxsamps);
>
>     if ((err = uhd_rx_streamer_issue_stream_cmd(rx_streamer[0],
> &stream_cmd)))
>
    {
>         uhd_get_last_error(errmsg, 127);
>         error(log, "Failed to start streamer[0] (%d). %s.\n", 0, FL, LN,
> FN, err, errmsg);
>        do_exit(40);
>      }
>
         [...]
         do_exit(0)
     }


> bool uhd_init(size_t channel, double srate, double gain)
> {
>     double tmp;
>     uhd_rx_metadata_error_code_t err;
>
>      if ((err = uhd_set_thread_priority(uhd_default_thread_priority,
> true)))
>             warn(log, "Unable to set  main thread priority (%d). %s.\n",
> 0, FL, LN, FN,
>                   err, uhdError(err));
>       /* Create USRP */
>       f ((err = uhd_usrp_make(&dev[channel], "type=x300")))
>       {
>           error(log, "Failed to create USRP (%d). %s.\n", 0, FL, LN, FN,
> err,
>                uhdError(err));
>            dev[channel] = NULL;
>             return(FAIL);
>
         }
>          info(stderr, "Created USRP with args\n", 0);
>
>     /* Create RX streamer */
>     if ((err = uhd_rx_streamer_make(&rx_streamer[channel])))
>     {
>         error(log, "Failed to create rx_streamer[%d] (%d). %s.\n", 0, FL,
> LN, FN,
>             channel, err, uhdError(err));
>          return(FAIL);
>     }
>     /* Create RX metadata */
>     if ((err = uhd_rx_metadata_make(&md[channel])))
>    {
>        error(log, "Failed to create md[%d] (%d). %s.\n", 0, FL, LN, FN,
> channel,
>            err, uhdError(err));
>         return(FAIL);
>      }
>
>     /* Get master clock rate */
>      if ((err = uhd_usrp_get_master_clock_rate(dev[channel], 0, &tmp)))
>
      {
>            error(log, "Failed to set master clock to %.0lf Mhz (%d).
> %s.\n", 0, FL,
>                LN, FN, tmp/1000000, err, uhdError(err));
>             return(FAIL);
>       }
>       info(stderr, "Master clock is at %.0lf Mhz\n", 0, tmp/1000000);
>       /* Set the sample rate */
>      if (srate && !uhd_set_rx_rate_check(channel, srate)) return(FAIL);
>      /* Set the tuner gain SBX-120 is 0-31.5 in .5 db steps */
>
       if ((err = uhd_usrp_set_rx_gain(dev[channel], gain, channel, "")))
>        {
>             error(log, "Failed to set tuner[%d] gain to %.0lf db (%d).
> %s.\n", 0, FL,
>                  LN, FN, channel, gain, err, uhdError(err));
>             return(FAIL);
>          }
>          if (!(err = uhd_usrp_get_rx_gain(dev[channel], channel, "",
> &tmp)))
>               info(log, "Tuner[%d] gain set to %.0lf (%.0lf) dB\n", 0,
> channel, tmp, gain);
>
        ./* Set channel bw to conserve tuner resources. Not needed, set by
srate */
             uhd_usrp_set_rx_bandwidth(dev[channel], srate, channel);
         ./* Disable subtracting constant averaged background. Signal looks
cleaner */
            if ((err = uhd_usrp_set_rx_dc_offset_enabled(dev[channel],
false, channel)))
             {
                 warn(log, "Failed to disable FPGA DC offset on channel
%d(%d). %s.\n", 0,
                     FL, LN, FN, channel, err, uhdError(err));
               }
               info(stderr, "Disabled FPGA DC offset on channel %d\n", 0,
channel);
               return(SUCCESS);
         }

This is the generated output:

[INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300;
UHD_4.6.0.0+ds1-5.1ubuntu0.24.04.1
[INFO] [X300] X300 initialization sequence...
[INFO] [X300] Maximum frame size: 8000 bytes.
[INFO] [X300] Radio 1x clock: 200 MHz
Sat Apr 26 03:33:48 2025 [00] [+] Created USRP with args
Sat Apr 26 03:33:48 2025 [00] [+] Master clock is at 200 Mhz
Sat Apr 26 03:33:48 2025 [00] [+] Tuner[0] gain set to 30 (30) dB
Sat Apr 26 03:33:48 2025 [00] [*] scanner.l:1446:main Incorrect maxsamples
(1996). Expected 19960.
Sat Apr 26 03:33:48 2025 [00] [+] Max samples/buffer[0]: 1996
[WARNING] [0/Radio#0] Ignoring stream command for finite acquisition of
zero samples
I hope this reads OK. Maybe next time I should attach the code:)

> TIA
> Nikos
>
> _______________________________________________
> USRP-users mailing list -- usrp-users@lists.ettus.com
> To unsubscribe send an email to usrp-users-le...@lists.ettus.com
>
>
>
_______________________________________________
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