From f31cceac18bc88dfeac145d35538388c12a73b4d Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 15 Apr 2017 13:44:00 -0300 Subject: [PATCH] Fixing TX inverse SINC filter for P25, and change TX filters for gain=1 --- DMRDMOTX.cpp | 16 ++++++++-------- DMRTX.cpp | 16 ++++++++-------- DStarTX.cpp | 6 +++--- P25TX.cpp | 23 +++++++++++------------ YSFTX.cpp | 24 ++++++++++++------------ 5 files changed, 42 insertions(+), 43 deletions(-) diff --git a/DMRDMOTX.cpp b/DMRDMOTX.cpp index fe64db6..3adb172 100644 --- a/DMRDMOTX.cpp +++ b/DMRDMOTX.cpp @@ -23,15 +23,15 @@ #include "DMRSlotType.h" // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB -static q15_t RRC_0_2_FILTER[] = {0, 0, 0, 0, 401, 104, -340, -731, -847, -553, 112, 909, 1472, 1450, 683, -675, -2144, -3040, -2706, -770, 2667, 6995, - 11237, 14331, 15464, 14331, 11237, 6995, 2667, -770, -2706, -3040, -2144, -675, 683, 1450, 1472, 909, 112, - -553, -847, -731, -340, 104, 401}; // numTaps = 45, L = 5 -const uint16_t RRC_0_2_FILTER_PHASE_LEN = 9U; // phaseLength = numTaps/L +static q15_t RRC_0_2_FILTER[] = {0, 0, 0, 0, 850, 219, -720, -1548, -1795, -1172, 237, 1927, 3120, 3073, 1447, -1431, -4544, -6442, + -5735, -1633, 5651, 14822, 23810, 30367, 32767, 30367, 23810, 14822, 5651, -1633, -5735, -6442, + -4544, -1431, 1447, 3073, 3120, 1927, 237, -1172, -1795, -1548, -720, 219, 850}; // numTaps = 45, L = 5 +const uint16_t RRC_0_2_FILTER_PHASE_LEN = 9U; // phaseLength = numTaps/L -const q15_t DMR_LEVELA = 2889; -const q15_t DMR_LEVELB = 963; -const q15_t DMR_LEVELC = -963; -const q15_t DMR_LEVELD = -2889; +const q15_t DMR_LEVELA = 1362; +const q15_t DMR_LEVELB = 454; +const q15_t DMR_LEVELC = -454; +const q15_t DMR_LEVELD = -1362; // The PR FILL and BS Data Sync pattern. const uint8_t IDLE_DATA[] = diff --git a/DMRTX.cpp b/DMRTX.cpp index e202a3f..0c5d055 100644 --- a/DMRTX.cpp +++ b/DMRTX.cpp @@ -23,15 +23,15 @@ #include "DMRSlotType.h" // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB -static q15_t RRC_0_2_FILTER[] = {0, 0, 0, 0, 401, 104, -340, -731, -847, -553, 112, 909, 1472, 1450, 683, -675, -2144, -3040, -2706, -770, 2667, 6995, - 11237, 14331, 15464, 14331, 11237, 6995, 2667, -770, -2706, -3040, -2144, -675, 683, 1450, 1472, 909, 112, - -553, -847, -731, -340, 104, 401}; // numTaps = 45, L = 5 -const uint16_t RRC_0_2_FILTER_PHASE_LEN = 9U; // phaseLength = numTaps/L +static q15_t RRC_0_2_FILTER[] = {0, 0, 0, 0, 850, 219, -720, -1548, -1795, -1172, 237, 1927, 3120, 3073, 1447, -1431, -4544, -6442, + -5735, -1633, 5651, 14822, 23810, 30367, 32767, 30367, 23810, 14822, 5651, -1633, -5735, -6442, + -4544, -1431, 1447, 3073, 3120, 1927, 237, -1172, -1795, -1548, -720, 219, 850}; // numTaps = 45, L = 5 +const uint16_t RRC_0_2_FILTER_PHASE_LEN = 9U; // phaseLength = numTaps/L -const q15_t DMR_LEVELA = 2889; -const q15_t DMR_LEVELB = 963; -const q15_t DMR_LEVELC = -963; -const q15_t DMR_LEVELD = -2889; +const q15_t DMR_LEVELA = 1362; +const q15_t DMR_LEVELB = 454; +const q15_t DMR_LEVELC = -454; +const q15_t DMR_LEVELD = -1362; // The PR FILL and BS Data Sync pattern. const uint8_t IDLE_DATA[] = diff --git a/DStarTX.cpp b/DStarTX.cpp index 4ed0bf6..031d75d 100644 --- a/DStarTX.cpp +++ b/DStarTX.cpp @@ -28,11 +28,11 @@ const uint8_t BIT_SYNC = 0xAAU; const uint8_t FRAME_SYNC[] = {0xEAU, 0xA6U, 0x00U}; // Generated using gaussfir(0.35, 1, 5) in MATLAB -static q15_t GAUSSIAN_0_35_FILTER[] = {0, 0, 0, 0, 212, 743, 1974, 3965, 6026, 6929, 6026, 3965, 1974, 743, 212}; // numTaps = 15, L = 5 +static q15_t GAUSSIAN_0_35_FILTER[] = {0, 0, 0, 0, 1001, 3514, 9333, 18751, 28499, 32767, 28499, 18751, 9333, 3514, 1001}; // numTaps = 15, L = 5 const uint16_t GAUSSIAN_0_35_FILTER_PHASE_LEN = 3U; // phaseLength = numTaps/L -const q15_t DSTAR_LEVEL0 = -4000; -const q15_t DSTAR_LEVEL1 = 4000; +const q15_t DSTAR_LEVEL0 = -841; +const q15_t DSTAR_LEVEL1 = 841; const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; diff --git a/P25TX.cpp b/P25TX.cpp index a6147ba..59ea804 100644 --- a/P25TX.cpp +++ b/P25TX.cpp @@ -25,23 +25,22 @@ // Generated using rcosdesign(0.2, 8, 5, 'normal') in MATLAB // numTaps = 40, L = 5 -static q15_t RC_0_2_FILTER[] = {-413, -751, -845, -587, 0, 740, 1348, 1520, 1063, 0, -1383, -2583, -3021, -2222, 0, 3435, 7488, 11318, 14053, 15044, 14053, - 11318, 7488, 3435, 0, -2222, -3021, -2583, -1383, 0, 1063, 1520, 1348, 740, 0, -587, -845, -751, -413, 0}; -const uint16_t RC_0_2_FILTER_PHASE_LEN = 8U; // phaseLength = numTaps/L +static q15_t RC_0_2_FILTER[] = {-897, -1636, -1840, -1278, 0, 1613, 2936, 3310, 2315, 0, -3011, -5627, -6580, -4839, + 0, 7482, 16311, 24651, 30607, 32767, 30607, 24651, 16311, 7482, 0, -4839, -6580, -5627, + -3011, 0, 2315, 3310, 2936, 1613, 0, -1278, -1840, -1636, -897, 0}; // numTaps = 40, L = 5 +const uint16_t RC_0_2_FILTER_PHASE_LEN = 8U; // phaseLength = numTaps/L // Generated in MATLAB using the following commands, and then normalised for unity gain // shape2 = 'Inverse-sinc Lowpass'; -// d2 = fdesign.interpolator(2, shape2); +// d2 = fdesign.interpolator(1, shape2); // h2 = design(d2, 'SystemObject', true); -static q15_t LOWPASS_FILTER[] = {170, 401, 340, -203, -715, -478, 281, 419, -440, -1002, -103, 1114, 528, -1389, -1520, 1108, 2674, -388, -4662, - -2132, 9168, 20241, 20241, 9168, -2132, -4662, -388, 2674, 1108, -1520, -1389, 528, 1114, -103, -1002, -440, 419, - 281, -478, -715, -203, 340, 401, 170}; -const uint16_t LOWPASS_FILTER_LEN = 44U; +static q15_t LOWPASS_FILTER[] = {1376, -2393, 4584, -8933, 22325, 22325, -8933, 4584, -2393, 1376}; +const uint16_t LOWPASS_FILTER_LEN = 10U; -const q15_t P25_LEVELA = 1698; -const q15_t P25_LEVELB = 566; -const q15_t P25_LEVELC = -566; -const q15_t P25_LEVELD = -1698; +const q15_t P25_LEVELA = 1260; +const q15_t P25_LEVELB = 420; +const q15_t P25_LEVELC = -420; +const q15_t P25_LEVELD = -1260; const uint8_t P25_START_SYNC = 0x77U; diff --git a/YSFTX.cpp b/YSFTX.cpp index e6010b9..c0361c6 100644 --- a/YSFTX.cpp +++ b/YSFTX.cpp @@ -24,20 +24,20 @@ #include "YSFDefines.h" // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB -static q15_t RRC_0_2_FILTER[] = {0, 0, 0, 0, 401, 104, -340, -731, -847, -553, 112, 909, 1472, 1450, 683, -675, -2144, -3040, -2706, -770, 2667, 6995, - 11237, 14331, 15464, 14331, 11237, 6995, 2667, -770, -2706, -3040, -2144, -675, 683, 1450, 1472, 909, 112, - -553, -847, -731, -340, 104, 401}; // numTaps = 45, L = 5 -const uint16_t RRC_0_2_FILTER_PHASE_LEN = 9U; // phaseLength = numTaps/L +static q15_t RRC_0_2_FILTER[] = {0, 0, 0, 0, 850, 219, -720, -1548, -1795, -1172, 237, 1927, 3120, 3073, 1447, -1431, -4544, -6442, + -5735, -1633, 5651, 14822, 23810, 30367, 32767, 30367, 23810, 14822, 5651, -1633, -5735, -6442, + -4544, -1431, 1447, 3073, 3120, 1927, 237, -1172, -1795, -1548, -720, 219, 850}; // numTaps = 45, L = 5 +const uint16_t RRC_0_2_FILTER_PHASE_LEN = 9U; // phaseLength = numTaps/L -const q15_t YSF_LEVELA_HI = 3900; -const q15_t YSF_LEVELB_HI = 1300; -const q15_t YSF_LEVELC_HI = -1300; -const q15_t YSF_LEVELD_HI = -3900; +const q15_t YSF_LEVELA_HI = 1893; +const q15_t YSF_LEVELB_HI = 631; +const q15_t YSF_LEVELC_HI = -631; +const q15_t YSF_LEVELD_HI = -1893; -const q15_t YSF_LEVELA_LO = 1950; -const q15_t YSF_LEVELB_LO = 650; -const q15_t YSF_LEVELC_LO = -650; -const q15_t YSF_LEVELD_LO = -1950; +const q15_t YSF_LEVELA_LO = 948; +const q15_t YSF_LEVELB_LO = 316; +const q15_t YSF_LEVELC_LO = -316; +const q15_t YSF_LEVELD_LO = -948; const uint8_t YSF_START_SYNC = 0x77U; const uint8_t YSF_END_SYNC = 0xFFU;