Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: accum_timeout < _timeout in wait_for_ack #799

Open
YIN-hechen opened this issue Oct 23, 2024 · 0 comments
Open

AssertionError: accum_timeout < _timeout in wait_for_ack #799

YIN-hechen opened this issue Oct 23, 2024 · 0 comments

Comments

@YIN-hechen
Copy link

YIN-hechen commented Oct 23, 2024

hello

I am having USRP b200mini device with following tool versions:

arch: arm64
os: ubuntu20.04(kernel 5.10.198)
uhd: v4.7.0.0
usb: 3.0

Execute the following code, run for some time will report an error

#include <uhd/usrp/multi_usrp.hpp>
#include <csignal>


static bool stop_signal_called = false;

#define SAMPS_SIZE  2e6

void sig_int_handler(int)
{
    stop_signal_called = true;
}


int main(int argc, char* argv[])
{
    uhd::usrp::multi_usrp::sptr usrp;
    uhd::rx_streamer::sptr rx_stream;
    size_t max_num_samps;
    std::vector<std::complex<float>> buff_ptrs(SAMPS_SIZE);
    std::vector<double> freqs = {3e8, 5e8, 7e8, 9e8, 1e9, 2e9, 3e9, 4e9, 5e9};
    int index = 0;
    uhd::rx_metadata_t md;
    
    usrp = uhd::usrp::multi_usrp::make("");
    usrp->set_time_now(uhd::time_spec_t(0.0));

    uhd::stream_args_t stream_args("fc32","sc16");
    rx_stream = usrp->get_rx_stream(stream_args);

    max_num_samps = rx_stream->get_max_num_samps();

    std::signal(SIGINT, &sig_int_handler);

    usrp->set_rx_bandwidth(56e6);
    usrp->set_rx_rate(56e6);
    usrp->set_rx_gain(40);


    while(not stop_signal_called)
    {
        if(index > freqs.size() - 1)
            index = 0;
        usrp->set_rx_freq(freqs[index]);
        printf("set_rx_freq=%f\n", freqs[index]);
        usrp->set_rx_antenna(index % 2 == 1 ? "TX/RX" : "RX2");
        index++;

        //usleep(200000);

        uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
        stream_cmd.stream_now = true;
        rx_stream->issue_stream_cmd(stream_cmd);

        size_t num_acc_samps = 0;
        size_t num_rx_samps;
        float *buff = (float *)&buff_ptrs[0];
        while(num_acc_samps < SAMPS_SIZE)
        {
            if((SAMPS_SIZE-num_acc_samps) > max_num_samps)
            {
                num_rx_samps = rx_stream->recv(buff+(num_acc_samps*2), max_num_samps, md, 3.0);
            }else
            {
                num_rx_samps = rx_stream->recv(buff+(num_acc_samps*2), SAMPS_SIZE-num_acc_samps, md, 3.0);    
            }

            if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) {
                printf("error_code=%s\n",  md.strerror().data());
                break;
            }
            
            if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_NONE) {
                num_acc_samps += num_rx_samps;
            }
        }

        rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);

        usleep(200000); 
    }

    return 0;
}

error message:
0000000000000000000000000set_rx_freg=900000000.000000
000000error_code=ERROR_CODE_TIMEOUT
terminate called after throwing an instance of 'uhd::assertion_error'
what(): AssertionError: accum_timeout < _timeout in wait_for_ack
at /home/xxx/uhd/uhd-4.7.0.0/host/lib/usrp/b200/b200 _radio_ctrl_core.cpp:227

Anybody a hint what to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant