From 7d7e3326f94a2ef8f5d880e3d94355bb2763e52e Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Thu, 16 Jun 2022 19:25:45 +0000 Subject: [PATCH] - moved AGC training to 1 sps loop git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@1007 b431acfa-c32f-4a4a-93f1-934dc6c82436 --- Source/Receiver.cpp | 47 +++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Source/Receiver.cpp b/Source/Receiver.cpp index ccbfd13..f4b64d7 100644 --- a/Source/Receiver.cpp +++ b/Source/Receiver.cpp @@ -453,27 +453,14 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len) } #endif - // Blind AGC + // Blind AGC gain adjustment // @2 x symbolrate - // AGC Blind Training Processor::Buffer &next_buf_in = m_farrow.getInputBuffer(); - if (m_params.agc_mode != agc_mode_disabled) + for (n = 0; n < len; n++) { - for (n = 0; n < len; n++) - { - // AGC Blind process samples - ComplexScalar iq_agc = toComplexScalar(CpxScaleRealS(toCpx(iq[n]), AGC_GetWeight(&agcBlind))); - AGC_Process(&agcBlind, CpxMagS(toCpx(iq_agc)), m_params.agcMu[m_params.agcMu_index], m_pSymMapper->R2_cma); - next_buf_in.write(&iq_agc, 1); - } - } - else - { - for (n = 0; n < len; n++) - { - ComplexScalar iq_agc = toComplexScalar(CpxScaleRealS(toCpx(iq[n]), AGC_GetWeight(&agcBlind))); - next_buf_in.write(&iq_agc, 1); - } + // AGC Blind gain adjustments + ComplexScalar iq_agc = toComplexScalar(CpxScaleRealS(toCpx(iq[n]), AGC_GetWeight(&agcBlind))); + next_buf_in.write(&iq_agc, 1); } // Matched filtering and symbol timing recovery @@ -503,21 +490,36 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len) { ComplexScalar iq_mf = buf_ip->readAt(0); + // ----------------------------------------------------- // Carrier Derotator + // @2 x symbolrate + // ----------------------------------------------------- IQ_cpr = toCpx(m_nco_cpr.mixComplexS(iq_mf, ComplexScalar(1,1))); m_nco_cpr.process(m_dOmega_vco, m_params.CPR_phase); IQ_eq_in = IQ_cpr; - // Operate at symbol clock + // ----------------------------------------------------- + // Big and ugly processing loop // @1 x symbolrate + // ----------------------------------------------------- if (ClockIsTick(&m_symClock, 1)) { #ifndef DISABLE_UNUSED_STATISTICS minMaxProcess(&m_statistics.ddcMinMax, IQ_eq_in); #endif + // ----------------------------------------------------- + // AGC Blind process samples + // @1 x symbolrate + // ----------------------------------------------------- + if (m_params.agc_mode != agc_mode_disabled) + { + AGC_Process(&agcBlind, CpxMagS(IQ_eq_in), m_params.agcMu[m_params.agcMu_index], m_pSymMapper->R2_cma); + } + // ----------------------------------------------------- // Equalizer Process samples + // @1 x symbolrate // ----------------------------------------------------- ComplexScalar __IQ_cma; ComplexScalar __IQ_dfeOn; @@ -539,7 +541,10 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len) IQ_soft = IQ_eq; + // ----------------------------------------------------- // Map sympol + // @1 x symbolrate + // ----------------------------------------------------- sym = SymMapDemap(m_pSymMapper, IQ_soft); sym_err = SymMapGetError(m_pSymMapper, IQ_soft, sym); IQ_hard = sym_err.hard_sym; @@ -556,6 +561,7 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len) // ----------------------------------------------------- // Equalizer Training + // @1 x symbolrate // ----------------------------------------------------- sym_cma = SymMapGetSymbolInfo(m_pSymMapper, SymMapDemap(m_pSymMapper, IQ_cma)); if (m_params.cmaMode == cma_mode_training_enabled) @@ -607,7 +613,10 @@ void Receiver::processBaseband(CVec const &iq, uint32_t len) // Update IQ_H IQ_hard_last = IQ_hard; + // ----------------------------------------------------- // Lock-detector development + // @1 x symbolrate + // ----------------------------------------------------- cpx_t winner_diff = Cpx(0,0); radio_float_t winner_d = 1000; int winner_i = 0;