Skip to content

Commit

Permalink
comments, extra retune step.
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed Feb 6, 2024
1 parent 21b0827 commit 910eb1e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ Command a source block with PMT tuning messages to sweep over a set of frequency

### [retune_fft](grc/iqtlabs_retune_fft.block.yml)

Command a source block with PMT tuning messages to sweep over a set of frequency ranges, retuning after a configurable nunber of FFT points are received over a configurable threshold
(while validating power values are in a valid range).
Command a source block with PMT tuning messages to sweep over a set of frequency ranges, retuning after a configurable nunber of FFT points are received over a configurable threshold (while validating power values are in a valid range).

### [tuneable_test_source](grc/iqtlabs_tuneable_test_source.block.yml)

Expand Down
11 changes: 8 additions & 3 deletions lib/retune_fft_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,14 @@ void retune_fft_impl::process_items_(size_t c, const input_type *&in,
slew_samples_ += nfft_;
continue;
}
// Discard windows where max power, is less than requested minimum.
// Ettus radios periodically output low power after retuning. This
// avoids having to use a static skip_fft_count setting.
// Implement the low power hold down workaround (typically for Ettus).
// When retuning the radio, typically the radio responds relatively quickly
// with new rx_time and rx_freq tags acknowledging the request. However,
// we continue to observe samples for the previous frequency for some time.
// Then, we receive all complex 0's for a time, and then we receive samples
// for actual frequency requested. We detect the all-zeros condition (by
// observing implausibly low power) condition and move the rx_time and
// rx_freq tags to this position.
volk_32f_index_max_16u(in_max_pos_.get(), in, nfft_);
float in_max = in[*in_max_pos_];
if (in_max < fft_min_) {
Expand Down
7 changes: 7 additions & 0 deletions lib/retune_pre_fft_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ void retune_pre_fft_impl::process_items_(size_t c, const block_type *&in,
continue;
}
bool all_zeros = all_zeros_(in);
// Implement the low power hold down workaround (typically for Ettus).
// When retuning the radio, typically the radio responds relatively
// quickly with new rx_time and rx_freq tags acknowledging the request.
// However, we continue to observe samples for the previous frequency for
// some time. Then, we receive all complex 0's for a time, and then we
// receive samples for actual frequency requested. We detect the all-zeros
// condition and move the rx_time and rx_freq tags to this position.
if (in_hold_down_) {
if (all_zeros) {
in_hold_down_ = false;
Expand Down
6 changes: 6 additions & 0 deletions lib/retuner_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ void retuner_impl::next_retune_(TIME_T host_now) {
slew_samples_ = 0;
}

// Attempt to account for elapsed time since tuning tag was received,
// but before samples are passed on to subsequent blocks. The accuracy
// of the timestamp itself is not known, since it is the host's gnuradio
// driver that adds the tag and some number of samples may have been in
// flight from the radio
// (https://github.com/gnuradio/gnuradio/blob/fe048a9874d2604d48d396d2b39925a0cf2c3c70/gr-uhd/lib/usrp_source_impl.cc#L636).
TIME_T retuner_impl::apply_rx_time_slew_(TIME_T rx_time) {
if (slew_rx_time_) {
TIME_T slew_time = slew_samples_ / TIME_T(samp_rate_);
Expand Down

0 comments on commit 910eb1e

Please sign in to comment.