我在Ettus x310上有一个简单的c ++测试程序,它现在用来工作了。我试图简单地设置一个USRP的两个通道的两个中心频率。当我尝试在第二个通道上设置任何内容时,会出现上述超出范围错误。
我遇到频道超出范围错误的崩溃:
$ ./t2j.out
linux; GNU C++ version 4.8.4; Boost_105400; UHD_003.009.001-0-gf7a15853
-- X300 initialization sequence...
-- Determining maximum frame size... 1472 bytes.
-- Setup basic communication...
-- Loading values from EEPROM...
-- Setup RF frontend clocking...
-- Radio 1x clock:200
-- Initialize Radio0 control...
-- Performing register loopback test... pass
-- Initialize Radio1 control...
-- Performing register loopback test... pass
terminate called after throwing an instance of 'uhd::index_error'
what(): LookupError: IndexError: multi_usrp: RX channel 140445275195320 out of range for configured RX frontends
Aborted (core dumped)
这是我的测试程序:
int main( void )
{
// sources
gr::uhd::usrp_source::sptr usrp1;
const std::string usrp_addr = std::string( "addr=192.168.10.30" );
uhd::stream_args_t usrp_args = uhd::stream_args_t( "fc32" );
usrp_args.channels = std::vector<size_t> ( 0, 1 );
usrp1 = gr::uhd::usrp_source::make( usrp_addr, usrp_args );
usrp1->set_subdev_spec( std::string( "A:AB B:AB" ), 0 );
usrp1->set_clock_source( "external" );
usrp1->set_samp_rate( 5.0e6 );
usrp1->set_center_freq( 70e6, 0 ); // this is OK
usrp1->set_center_freq( 70e6, 1 ); // crashes here With RX Chan out of Range Error!
printf( "test Done!\n" );
return 0;
}
我迄今为止在搜索中发现的唯一事情就是确保PYTHONPATH设置正确(并确保它确定它指向了site_packages)但是这似乎与GRC有关,而不是C ++。
我正在使用Ubuntu 14.04.4和UHD 3.9.1与gnuradio 3.7.8.1(我也尝试过3.7.9.2),结果相同。
硬件是带有两个BasicRx子板的Ettus x310。
答案 0 :(得分:0)
来自gnuradio / uhd邮件列表的人帮助了我。看起来矢量初始化是错误的:
替换:
stream_args.channels = std :: vector(0,1);
有了这两行:
stream_args.channels.push_back(0);
stream_args.channels.push_back(1);
还有其他更简洁的方法,但现在就可以了。
-Bob