usrp-users@lists.ettus.com

Discussion and technical support related to USRP, UHD, RFNoC

View all threads

Underflow reported on first packet

EG
Eugene Grayver
Mon, Jan 20, 2025 11:26 PM

Hi,

Using UHD4.6.0 on ubuntu 22.04 with X310 (same issue on N320).  Using a custom C++ UHD application.  The stream start command is timed (about 30s in the future).

size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1);

As expected, I get a bunch of CODE_TIMEOUT while waiting for the stream to start.

About every 3rd time the very non-TIMEOUT response I get is zero-length with the md.error_code set to OVERFLOW.  This seems like a UHD error — how could it have overflowed without sending me any samples?

Thanks,
Eugene


uhd::rx_metadata_t md;
bool waiting_for_first_samples = true;
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
stream_cmd.stream_now = false;
stream_cmd.time_spec = uhd::time_spec_t(start_time_s, 0.0);
rx_stream->issue_stream_cmd(stream_cmd);
auto len = rx_stream->get_max_num_samps();
zmq_sample_t buf[len]; // NOLINT
uint64_t total_samples = 0;

while (!stop){
size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1);

if (cbuf->enqueue(buf, num_rx_samps) == 2) // Aborting
break;
total_samples += num_rx_samps;

switch (md.error_code) { //handle the error codes
case uhd::rx_metadata_t::ERROR_CODE_NONE:
break;
case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
// The data may not start flowing for a while after we come up
// However, after we get the first samples, there should never
// be a timeout. Even at the lowest sample rate of 200 kHz,
// we expect to get plenty of samples during the 0.1 timeout
if (!waiting_for_first_samples)
LOG_WARN("Timeout on ch {} at {:10.2}s, last_report at {:10.2}s",
ch, tw[ch].current_time, tw[ch].prev_report_time);
break;
case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
overflows[ch] ++;
LOG_WARN("Overflow on ch {} at {:10.2}s, last_report at {:10.2}s. Total {}",
ch, tw[ch].current_time, tw[ch].prev_report_time, overflows[ch]);
LOG_WARN("total {}, rx {}", total_samples, num_rx_samps);
break;
default:
LOG_ERROR("Got error code on ch {} {:#x}:{}, exiting loop...",
ch, md.error_code, md.strerror());
stop = true;
break;
}

if (num_rx_samps != 0) // got some samples
waiting_for_first_samples = false;
}

Hi, Using UHD4.6.0 on ubuntu 22.04 with X310 (same issue on N320). Using a custom C++ UHD application. The stream start command is timed (about 30s in the future). size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1); As expected, I get a bunch of CODE_TIMEOUT while waiting for the stream to start. About every 3rd time the very non-TIMEOUT response I get is zero-length with the md.error_code set to OVERFLOW. This seems like a UHD error — how could it have overflowed without sending me any samples? Thanks, Eugene ---------------- uhd::rx_metadata_t md; bool waiting_for_first_samples = true; uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); stream_cmd.stream_now = false; stream_cmd.time_spec = uhd::time_spec_t(start_time_s, 0.0); rx_stream->issue_stream_cmd(stream_cmd); auto len = rx_stream->get_max_num_samps(); zmq_sample_t buf[len]; // NOLINT uint64_t total_samples = 0; while (!stop){ size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1); if (cbuf->enqueue(buf, num_rx_samps) == 2) // Aborting break; total_samples += num_rx_samps; switch (md.error_code) { //handle the error codes case uhd::rx_metadata_t::ERROR_CODE_NONE: break; case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: // The data may not start flowing for a while after we come up // However, after we get the first samples, there should never // be a timeout. Even at the lowest sample rate of 200 kHz, // we expect to get plenty of samples during the 0.1 timeout if (!waiting_for_first_samples) LOG_WARN("Timeout on ch {} at {:10.2}s, last_report at {:10.2}s", ch, tw[ch].current_time, tw[ch].prev_report_time); break; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: overflows[ch] ++; LOG_WARN("Overflow on ch {} at {:10.2}s, last_report at {:10.2}s. Total {}", ch, tw[ch].current_time, tw[ch].prev_report_time, overflows[ch]); LOG_WARN("total {}, rx {}", total_samples, num_rx_samps); break; default: LOG_ERROR("Got error code on ch {} {:#x}:{}, exiting loop...", ch, md.error_code, md.strerror()); stop = true; break; } if (num_rx_samps != 0) // got some samples waiting_for_first_samples = false; } ---------------------
RK
Rob Kossler
Tue, Jan 21, 2025 4:10 PM

Hi Eugene,
Is it possible that the overflow occurs because of the previous command
still being in the queue such that at 30 seconds it starts streaming with
nothing to catch it?
Rob

On Mon, Jan 20, 2025 at 6:26 PM Eugene Grayver eugene.grayver@aero.org
wrote:

Hi,

Using UHD4.6.0 on ubuntu 22.04 with X310 (same issue on N320).  Using a
custom C++ UHD application.  The stream start command is timed (about 30s
in the future).

size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1);

As expected, I get a bunch of CODE_TIMEOUT while waiting for the stream to
start.

About every 3rd time the very non-TIMEOUT response I get is zero-length
with the md.error_code set to OVERFLOW.  This seems like a UHD error — how
could it have overflowed without sending me any samples?

Thanks,
Eugene


uhd::rx_metadata_t md;
bool waiting_for_first_samples = true;
uhd::stream_cmd_t
stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
stream_cmd.stream_now = false;
stream_cmd.time_spec = uhd::time_spec_t(start_time_s, 0.0);
rx_stream->issue_stream_cmd(stream_cmd);
auto len = rx_stream->get_max_num_samps();
zmq_sample_t buf[len]; // NOLINT
uint64_t total_samples = 0;

while (!stop){
size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1);

if (cbuf->enqueue(buf, num_rx_samps) == 2) // Aborting
break;
total_samples += num_rx_samps;

switch (md.error_code) { //handle the error codes
case uhd::rx_metadata_t::ERROR_CODE_NONE:
break;
case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
// The data may not start flowing for a while after we come up
// However, after we get the first samples, there should never
// be a timeout. Even at the lowest sample rate of 200 kHz,
// we expect to get plenty of samples during the 0.1 timeout
if (!waiting_for_first_samples)
LOG_WARN("Timeout on ch {} at {:10.2}s, last_report at {:10.2}s",
ch, tw[ch].current_time, tw[ch].prev_report_time);
break;
case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
overflows[ch] ++;
LOG_WARN("Overflow on ch {} at {:10.2}s, last_report at {:10.2}s. Total
{}",
ch, tw[ch].current_time, tw[ch].prev_report_time, overflows[ch]);
LOG_WARN("total {}, rx {}", total_samples, num_rx_samps);
break;
default:
LOG_ERROR("Got error code on ch {} {:#x}:{}, exiting loop...",
ch, md.error_code, md.strerror());
stop = true;
break;
}

if (num_rx_samps != 0) // got some samples
waiting_for_first_samples = false;
}


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com

Hi Eugene, Is it possible that the overflow occurs because of the previous command still being in the queue such that at 30 seconds it starts streaming with nothing to catch it? Rob On Mon, Jan 20, 2025 at 6:26 PM Eugene Grayver <eugene.grayver@aero.org> wrote: > Hi, > > Using UHD4.6.0 on ubuntu 22.04 with X310 (same issue on N320). Using a > custom C++ UHD application. The stream start command is timed (about 30s > in the future). > > size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1); > > > As expected, I get a bunch of CODE_TIMEOUT while waiting for the stream to > start. > > About every 3rd time the very non-TIMEOUT response I get is zero-length > with the md.error_code set to OVERFLOW. This seems like a UHD error — how > could it have overflowed without sending me any samples? > > Thanks, > Eugene > > ---------------- > > uhd::rx_metadata_t md; > bool waiting_for_first_samples = true; > uhd::stream_cmd_t > stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); > stream_cmd.stream_now = false; > stream_cmd.time_spec = uhd::time_spec_t(start_time_s, 0.0); > rx_stream->issue_stream_cmd(stream_cmd); > auto len = rx_stream->get_max_num_samps(); > zmq_sample_t buf[len]; // NOLINT > uint64_t total_samples = 0; > > while (!stop){ > size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1); > > if (cbuf->enqueue(buf, num_rx_samps) == 2) // Aborting > break; > total_samples += num_rx_samps; > > switch (md.error_code) { //handle the error codes > case uhd::rx_metadata_t::ERROR_CODE_NONE: > break; > case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: > // The data may not start flowing for a while after we come up > // However, after we get the first samples, there should never > // be a timeout. Even at the lowest sample rate of 200 kHz, > // we expect to get plenty of samples during the 0.1 timeout > if (!waiting_for_first_samples) > LOG_WARN("Timeout on ch {} at {:10.2}s, last_report at {:10.2}s", > ch, tw[ch].current_time, tw[ch].prev_report_time); > break; > case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: > overflows[ch] ++; > LOG_WARN("Overflow on ch {} at {:10.2}s, last_report at {:10.2}s. Total > {}", > ch, tw[ch].current_time, tw[ch].prev_report_time, overflows[ch]); > LOG_WARN("total {}, rx {}", total_samples, num_rx_samps); > break; > default: > LOG_ERROR("Got error code on ch {} {:#x}:{}, exiting loop...", > ch, md.error_code, md.strerror()); > stop = true; > break; > } > > if (num_rx_samps != 0) // got some samples > waiting_for_first_samples = false; > } > --------------------- > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com >
EG
Eugene Grayver
Tue, Jan 21, 2025 4:12 PM

I don’t think that is a possibility because we start streaming with a single command after initializing the device. I.E.right after the multi US SRP instance is created There are no other commands issued.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Rob Kossler rkossler@nd.edu
Sent: Tuesday, January 21, 2025 8:10:28 AM
To: Eugene Grayver eugene.grayver@aero.org
Cc: usrp-users usrp-users@lists.ettus.com
Subject: [EXTERNAL] Re: [USRP-users] Underflow reported on first packet

Do not open links or attachments unless you recognize the sender. If unsure, click the Report Phish button or forward the email to OPSEC.

Hi Eugene,
Is it possible that the overflow occurs because of the previous command still being in the queue such that at 30 seconds it starts streaming with nothing to catch it?
Rob

On Mon, Jan 20, 2025 at 6:26 PM Eugene Grayver <eugene.grayver@aero.orgmailto:eugene.grayver@aero.org> wrote:
Hi,

Using UHD4.6.0 on ubuntu 22.04 with X310 (same issue on N320).  Using a custom C++ UHD application.  The stream start command is timed (about 30s in the future).

size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1);

As expected, I get a bunch of CODE_TIMEOUT while waiting for the stream to start.

About every 3rd time the very non-TIMEOUT response I get is zero-length with the md.error_code set to OVERFLOW.  This seems like a UHD error — how could it have overflowed without sending me any samples?

Thanks,
Eugene


uhd::rx_metadata_t md;
bool waiting_for_first_samples = true;
uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
stream_cmd.stream_now = false;
stream_cmd.time_spec = uhd::time_spec_t(start_time_s, 0.0);
rx_stream->issue_stream_cmd(stream_cmd);
auto len = rx_stream->get_max_num_samps();
zmq_sample_t buf[len]; // NOLINT
uint64_t total_samples = 0;

while (!stop){
size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1);

if (cbuf->enqueue(buf, num_rx_samps) == 2) // Aborting
break;
total_samples += num_rx_samps;

switch (md.error_code) { //handle the error codes
case uhd::rx_metadata_t::ERROR_CODE_NONE:
break;
case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
// The data may not start flowing for a while after we come up
// However, after we get the first samples, there should never
// be a timeout. Even at the lowest sample rate of 200 kHz,
// we expect to get plenty of samples during the 0.1 timeout
if (!waiting_for_first_samples)
LOG_WARN("Timeout on ch {} at {:10.2}s, last_report at {:10.2}s",
ch, tw[ch].current_time, tw[ch].prev_report_time);
break;
case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
overflows[ch] ++;
LOG_WARN("Overflow on ch {} at {:10.2}s, last_report at {:10.2}s. Total {}",
ch, tw[ch].current_time, tw[ch].prev_report_time, overflows[ch]);
LOG_WARN("total {}, rx {}", total_samples, num_rx_samps);
break;
default:
LOG_ERROR("Got error code on ch {} {:#x}:{}, exiting loop...",
ch, md.error_code, md.strerror());
stop = true;
break;
}

if (num_rx_samps != 0) // got some samples
waiting_for_first_samples = false;
}


USRP-users mailing list -- usrp-users@lists.ettus.commailto:usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.commailto:usrp-users-leave@lists.ettus.com

I don’t think that is a possibility because we start streaming with a single command after initializing the device. I.E.right after the multi US SRP instance is created There are no other commands issued. Get Outlook for iOS<https://aka.ms/o0ukef> ________________________________ From: Rob Kossler <rkossler@nd.edu> Sent: Tuesday, January 21, 2025 8:10:28 AM To: Eugene Grayver <eugene.grayver@aero.org> Cc: usrp-users <usrp-users@lists.ettus.com> Subject: [EXTERNAL] Re: [USRP-users] Underflow reported on first packet Do not open links or attachments unless you recognize the sender. If unsure, click the Report Phish button or forward the email to OPSEC. Hi Eugene, Is it possible that the overflow occurs because of the previous command still being in the queue such that at 30 seconds it starts streaming with nothing to catch it? Rob On Mon, Jan 20, 2025 at 6:26 PM Eugene Grayver <eugene.grayver@aero.org<mailto:eugene.grayver@aero.org>> wrote: Hi, Using UHD4.6.0 on ubuntu 22.04 with X310 (same issue on N320). Using a custom C++ UHD application. The stream start command is timed (about 30s in the future). size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1); As expected, I get a bunch of CODE_TIMEOUT while waiting for the stream to start. About every 3rd time the very non-TIMEOUT response I get is zero-length with the md.error_code set to OVERFLOW. This seems like a UHD error — how could it have overflowed without sending me any samples? Thanks, Eugene ---------------- uhd::rx_metadata_t md; bool waiting_for_first_samples = true; uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); stream_cmd.stream_now = false; stream_cmd.time_spec = uhd::time_spec_t(start_time_s, 0.0); rx_stream->issue_stream_cmd(stream_cmd); auto len = rx_stream->get_max_num_samps(); zmq_sample_t buf[len]; // NOLINT uint64_t total_samples = 0; while (!stop){ size_t num_rx_samps = rx_stream->recv(buf, len, md, 0.1); if (cbuf->enqueue(buf, num_rx_samps) == 2) // Aborting break; total_samples += num_rx_samps; switch (md.error_code) { //handle the error codes case uhd::rx_metadata_t::ERROR_CODE_NONE: break; case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: // The data may not start flowing for a while after we come up // However, after we get the first samples, there should never // be a timeout. Even at the lowest sample rate of 200 kHz, // we expect to get plenty of samples during the 0.1 timeout if (!waiting_for_first_samples) LOG_WARN("Timeout on ch {} at {:10.2}s, last_report at {:10.2}s", ch, tw[ch].current_time, tw[ch].prev_report_time); break; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: overflows[ch] ++; LOG_WARN("Overflow on ch {} at {:10.2}s, last_report at {:10.2}s. Total {}", ch, tw[ch].current_time, tw[ch].prev_report_time, overflows[ch]); LOG_WARN("total {}, rx {}", total_samples, num_rx_samps); break; default: LOG_ERROR("Got error code on ch {} {:#x}:{}, exiting loop...", ch, md.error_code, md.strerror()); stop = true; break; } if (num_rx_samps != 0) // got some samples waiting_for_first_samples = false; } --------------------- _______________________________________________ USRP-users mailing list -- usrp-users@lists.ettus.com<mailto:usrp-users@lists.ettus.com> To unsubscribe send an email to usrp-users-leave@lists.ettus.com<mailto:usrp-users-leave@lists.ettus.com>