From 4ac0001549ea283e6479a36cf0817c8a198c4571 Mon Sep 17 00:00:00 2001 From: Rob Riggs Date: Tue, 28 Dec 2021 19:04:22 -0600 Subject: [PATCH] Use an 8-symbol length FIR filter for symbol interpolation. --- TNC/M17Modulator.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/TNC/M17Modulator.h b/TNC/M17Modulator.h index d105ca9..6a21e80 100644 --- a/TNC/M17Modulator.h +++ b/TNC/M17Modulator.h @@ -26,7 +26,9 @@ struct M17Modulator : Modulator // Six buffers per M17 frame, or 12 half-buffer interrupts. static constexpr uint8_t UPSAMPLE = 10; static constexpr uint32_t BLOCKSIZE = 4; - static constexpr uint32_t STATE_SIZE = (m17::FILTER_TAP_NUM_15 / UPSAMPLE) + BLOCKSIZE - 1; + static constexpr uint32_t STATE_SIZE = (m17::FILTER_TAP_NUM / UPSAMPLE) + BLOCKSIZE - 1; + // Number of bytes (4 symbol groups) to flush the FIR filter. + static constexpr uint8_t FLUSH_LEN = ((m17::FILTER_TAP_NUM / UPSAMPLE) + 3) / 4; static constexpr int16_t DAC_BUFFER_LEN = 80; // 8 symbols, 16 bits, 2 bytes. static constexpr int16_t TRANSFER_LEN = DAC_BUFFER_LEN / 2; // 4 symbols, 8 bits, 1 byte. static constexpr uint16_t VREF = 4095; @@ -49,8 +51,8 @@ struct M17Modulator : Modulator : dacOutputQueueHandle_(queue), ptt_(ptt) { arm_fir_interpolate_init_f32( - &fir_interpolator, UPSAMPLE, m17::FILTER_TAP_NUM_15, - (float32_t*) m17::rrc_taps_f15.data(), fir_state.data(), BLOCKSIZE); + &fir_interpolator, UPSAMPLE, m17::FILTER_TAP_NUM, + (float32_t*) m17::rrc_taps_f.data(), fir_state.data(), BLOCKSIZE); } ~M17Modulator() override {} @@ -118,7 +120,7 @@ struct M17Modulator : Modulator start_conversion(); ptt_->on(); while (delay_count < txdelay) osThreadYield(); - stop_count = 4; // 16 symbols to flush the RRC filter. + stop_count = FLUSH_LEN; osMessagePut(dacOutputQueueHandle_, bits, osWaitForever); state = State::RUNNING; break;