Use an 8-symbol length FIR filter for symbol interpolation.

master
Rob Riggs 2021-12-28 19:04:22 -06:00
rodzic 59783338c8
commit 4ac0001549
1 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -26,7 +26,9 @@ struct M17Modulator : Modulator
// Six buffers per M17 frame, or 12 half-buffer interrupts. // Six buffers per M17 frame, or 12 half-buffer interrupts.
static constexpr uint8_t UPSAMPLE = 10; static constexpr uint8_t UPSAMPLE = 10;
static constexpr uint32_t BLOCKSIZE = 4; 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 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 int16_t TRANSFER_LEN = DAC_BUFFER_LEN / 2; // 4 symbols, 8 bits, 1 byte.
static constexpr uint16_t VREF = 4095; static constexpr uint16_t VREF = 4095;
@ -49,8 +51,8 @@ struct M17Modulator : Modulator
: dacOutputQueueHandle_(queue), ptt_(ptt) : dacOutputQueueHandle_(queue), ptt_(ptt)
{ {
arm_fir_interpolate_init_f32( arm_fir_interpolate_init_f32(
&fir_interpolator, UPSAMPLE, m17::FILTER_TAP_NUM_15, &fir_interpolator, UPSAMPLE, m17::FILTER_TAP_NUM,
(float32_t*) m17::rrc_taps_f15.data(), fir_state.data(), BLOCKSIZE); (float32_t*) m17::rrc_taps_f.data(), fir_state.data(), BLOCKSIZE);
} }
~M17Modulator() override {} ~M17Modulator() override {}
@ -118,7 +120,7 @@ struct M17Modulator : Modulator
start_conversion(); start_conversion();
ptt_->on(); ptt_->on();
while (delay_count < txdelay) osThreadYield(); while (delay_count < txdelay) osThreadYield();
stop_count = 4; // 16 symbols to flush the RRC filter. stop_count = FLUSH_LEN;
osMessagePut(dacOutputQueueHandle_, bits, osWaitForever); osMessagePut(dacOutputQueueHandle_, bits, osWaitForever);
state = State::RUNNING; state = State::RUNNING;
break; break;