mstrx: do not wait forever if clock locking fails
Change-Id: Ib85f2452b66fb4d9881fe9676e69e4f6a8ba8f74
This commit is contained in:
parent
0c433350da
commit
10b4e31655
|
@ -482,6 +482,10 @@ int main(int argc, char *argv[])
|
||||||
trx->do_auto_gain = true;
|
trx->do_auto_gain = true;
|
||||||
|
|
||||||
status = trx->init_dev_and_streams();
|
status = trx->init_dev_and_streams();
|
||||||
|
if (status < 0) {
|
||||||
|
std::cerr << "Error initializing hardware, quitting.." << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
trx->set_name_aff_sched("main", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5);
|
trx->set_name_aff_sched("main", 3, SCHED_FIFO, sched_get_priority_max(SCHED_FIFO) - 5);
|
||||||
|
|
||||||
if (!trxcon::trxc_l1ctl_init(tall_trxcon_ctx)) {
|
if (!trxcon::trxc_l1ctl_init(tall_trxcon_ctx)) {
|
||||||
|
|
|
@ -133,6 +133,7 @@ template <typename T> struct uhd_hw {
|
||||||
int init_device(bh_fn_t rxh, bh_fn_t txh)
|
int init_device(bh_fn_t rxh, bh_fn_t txh)
|
||||||
{
|
{
|
||||||
auto const lock_delay_ms = 500;
|
auto const lock_delay_ms = 500;
|
||||||
|
auto clock_lock_attempts = 15; // x lock_delay_ms
|
||||||
auto const mcr = 26e6;
|
auto const mcr = 26e6;
|
||||||
auto const rate = (1625e3 / 6) * 4;
|
auto const rate = (1625e3 / 6) * 4;
|
||||||
auto const ref = "external";
|
auto const ref = "external";
|
||||||
|
@ -157,8 +158,18 @@ template <typename T> struct uhd_hw {
|
||||||
dev->set_tx_bandwidth(bw, channel);
|
dev->set_tx_bandwidth(bw, channel);
|
||||||
|
|
||||||
while (!(dev->get_rx_sensor("lo_locked", channel).to_bool() &&
|
while (!(dev->get_rx_sensor("lo_locked", channel).to_bool() &&
|
||||||
dev->get_mboard_sensor("ref_locked").to_bool()))
|
dev->get_mboard_sensor("ref_locked").to_bool()) &&
|
||||||
|
clock_lock_attempts > 0) {
|
||||||
|
std::cerr << "clock source lock attempts remaining: " << clock_lock_attempts << ".."
|
||||||
|
<< std::endl;
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(lock_delay_ms));
|
std::this_thread::sleep_for(std::chrono::milliseconds(lock_delay_ms));
|
||||||
|
clock_lock_attempts--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clock_lock_attempts <= 0) {
|
||||||
|
std::cerr << "Error locking clock, gpsdo missing? quitting.." << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
uhd::stream_args_t stream_args("sc16", "sc16");
|
uhd::stream_args_t stream_args("sc16", "sc16");
|
||||||
rx_stream = dev->get_rx_stream(stream_args);
|
rx_stream = dev->get_rx_stream(stream_args);
|
||||||
|
|
Loading…
Reference in New Issue