diff --git a/lib/include/srslte/phy/rf/rf.h b/lib/include/srslte/phy/rf/rf.h index 44bde9943..da1600b66 100644 --- a/lib/include/srslte/phy/rf/rf.h +++ b/lib/include/srslte/phy/rf/rf.h @@ -60,6 +60,7 @@ typedef struct { SRSLTE_RF_ERROR_LATE, SRSLTE_RF_ERROR_UNDERFLOW, SRSLTE_RF_ERROR_OVERFLOW, + SRSLTE_RF_ERROR_RX, SRSLTE_RF_ERROR_OTHER } type; int opt; diff --git a/lib/src/phy/rf/rf_uhd_imp.c b/lib/src/phy/rf/rf_uhd_imp.c index a1bec2657..0370fa700 100644 --- a/lib/src/phy/rf/rf_uhd_imp.c +++ b/lib/src/phy/rf/rf_uhd_imp.c @@ -96,6 +96,19 @@ static void log_underflow(rf_uhd_handler_t *h) { } } +static void log_rx_error(rf_uhd_handler_t *h) { + if (h->uhd_error_handler) { + char error_string[512]; + uhd_usrp_last_error(h->usrp, error_string, 512); + fprintf(stderr, "USRP reported the following error: %s\n", error_string); + + srslte_rf_error_t error; + bzero(&error, sizeof(srslte_rf_error_t)); + error.type = SRSLTE_RF_ERROR_RX; + h->uhd_error_handler(error); + } +} + static void* async_thread(void *h) { rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h; uhd_async_metadata_handle md; @@ -740,6 +753,7 @@ int rf_uhd_recv_with_time_multi(void *h, num_rx_samples, md, 1.0, false, &rxd_samples); if (error) { fprintf(stderr, "Error receiving from UHD: %d\n", error); + log_rx_error(handler); return -1; } @@ -762,8 +776,12 @@ int rf_uhd_recv_with_time_multi(void *h, } } } else { - return uhd_rx_streamer_recv(handler->rx_stream, data, - nsamples, md, 0.0, false, &rxd_samples); + uhd_error error = uhd_rx_streamer_recv(handler->rx_stream, data, nsamples, md, 0.0, false, &rxd_samples); + if (error) { + fprintf(stderr, "Error receiving from UHD: %d\n", error); + log_rx_error(handler); + return -1; + } } if (secs && frac_secs) { uhd_rx_metadata_time_spec(handler->rx_md_first, secs, frac_secs); diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 1de1ddbd0..23175fa46 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -304,8 +304,13 @@ void ue::rf_msg(srslte_rf_error_t error) { ue_base *ue = ue_base::get_instance(LTE); ue->handle_rf_msg(error); - if(error.type == srslte_rf_error_t::SRSLTE_RF_ERROR_OVERFLOW) { + if (error.type == srslte_rf_error_t::SRSLTE_RF_ERROR_OVERFLOW) { ue->radio_overflow(); + } else + if (error.type == srslte_rf_error_t::SRSLTE_RF_ERROR_RX) { + ue->stop(); + ue->cleanup(); + exit(-1); } }