Fix the transmit side and add the compile time option of a shorted raised

root cosine filter.
This commit is contained in:
Jonathan Naylor 2016-03-30 15:53:02 +01:00
parent bededa24f1
commit bf3bee851e
6 changed files with 40 additions and 16 deletions

View File

@ -19,6 +19,8 @@
#if !defined(CONFIG_H)
#define CONFIG_H
#define USE_SHORTER_DMR_FILTER
// Allow for the use of high quality external clock oscillators
// The number is the frequency of the oscillator in Hertz.
// For 12 MHz

View File

@ -20,17 +20,24 @@
#include "Globals.h"
#include "DMRSlotType.h"
#if defined(USE_SHORTER_DMR_FILTER)
// Generated using rcosdesign(0.2, 4, 10, 'sqrt') in MATLAB
static q15_t DMR_C4FSK_FILTER[] = {486, 39, -480, -1022, -1526, -1928, -2164, -2178, -1927, -1384, -548, 561, 1898, 3399, 4980, 6546, 7999, 9246, 10202, 10803, 11008, 10803, 10202, 9246,
7999, 6546, 4980, 3399, 1898, 561, -548, -1384, -1927, -2178, -2164, -1928, -1526, -1022, -480, 39, 486, 0};
const uint16_t DMR_C4FSK_FILTER_LEN = 42U;
#else
// Generated using rcosdesign(0.2, 8, 10, 'sqrt') in MATLAB
static q15_t DMR_C4FSK_FILTER[] = {283, 198, 73, -78, -240, -393, -517, -590, -599, -533, -391, -181, 79, 364, 643, 880, 1041, 1097, 1026, 819, 483, 39, -477, -1016, -1516, -1915, -2150,
-2163, -1914, -1375, -545, 557, 1886, 3376, 4946, 6502, 7946, 9184, 10134, 10731, 10935, 10731, 10134, 9184, 7946, 6502, 4946, 3376, 1886, 557, -545,
-1375, -1914, -2163, -2150, -1915, -1516, -1016, -477, 39, 483, 819, 1026, 1097, 1041, 880, 643, 364, 79, -181, -391, -533, -599, -590, -517, -393, -240,
-78, 73, 198, 283, 0};
const uint16_t DMR_C4FSK_FILTER_LEN = 82U;
#endif
q15_t DMR_A[] = { 1280, 1280, 1280, 1280, 1280};
q15_t DMR_B[] = { 427, 427, 427, 427, 427};
q15_t DMR_C[] = { -427, -427, -427, -427, -427};
q15_t DMR_D[] = {-1280, -1280, -1280, -1280, -1280};
q15_t DMR_A[] = { 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280};
q15_t DMR_B[] = { 427, 427, 427, 427, 427, 427, 427, 427, 427, 427};
q15_t DMR_C[] = { -427, -427, -427, -427, -427, -427, -427, -427, -427, -427};
q15_t DMR_D[] = {-1280, -1280, -1280, -1280, -1280, -1280, -1280, -1280, -1280, -1280};
// The PR FILL and Data Sync pattern.
const uint8_t IDLE_DATA[] =

View File

@ -30,8 +30,8 @@ const uint8_t FRAME_SYNC[] = {0xEAU, 0xA6U, 0x00U};
static q15_t DSTAR_GMSK_FILTER[] = {1, 4, 15, 52, 151, 380, 832, 1579, 2599, 3710, 4594, 4933, 4594, 3710, 2599, 1579, 832, 380, 151, 52, 15, 4, 1, 0};
const uint16_t DSTAR_GMSK_FILTER_LEN = 24U;
q15_t DSTAR_1[] = { 1600, 1600, 1600, 1600, 1600};
q15_t DSTAR_0[] = {-1600, -1600, -1600, -1600, -1600};
q15_t DSTAR_1[] = { 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600};
q15_t DSTAR_0[] = {-1600, -1600, -1600, -1600, -1600, -1600, -1600, -1600, -1600, -1600};
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};

7
IO.cpp
View File

@ -24,12 +24,19 @@
#include "Globals.h"
#include "IO.h"
#if defined(USE_SHORTER_DMR_FILTER)
// Generated using rcosdesign(0.2, 4, 10, 'sqrt') in MATLAB
static q15_t C4FSK_FILTER[] = {486, 39, -480, -1022, -1526, -1928, -2164, -2178, -1927, -1384, -548, 561, 1898, 3399, 4980, 6546, 7999, 9246, 10202, 10803, 11008, 10803, 10202, 9246,
7999, 6546, 4980, 3399, 1898, 561, -548, -1384, -1927, -2178, -2164, -1928, -1526, -1022, -480, 39, 486, 0};
const uint16_t C4FSK_FILTER_LEN = 42U;
#else
// Generated using rcosdesign(0.2, 8, 10, 'sqrt') in MATLAB
static q15_t C4FSK_FILTER[] = {283, 198, 73, -78, -240, -393, -517, -590, -599, -533, -391, -181, 79, 364, 643, 880, 1041, 1097, 1026, 819, 483, 39, -477, -1016, -1516, -1915, -2150,
-2163, -1914, -1375, -545, 557, 1886, 3376, 4946, 6502, 7946, 9184, 10134, 10731, 10935, 10731, 10134, 9184, 7946, 6502, 4946, 3376, 1886, 557, -545,
-1375, -1914, -2163, -2150, -1915, -1516, -1016, -477, 39, 483, 819, 1026, 1097, 1041, 880, 643, 364, 79, -181, -391, -533, -599, -590, -517, -393, -240,
-78, 73, 198, 283, 0};
const uint16_t C4FSK_FILTER_LEN = 82U;
#endif
// Generated using gaussfir(0.5, 4, 10) in MATLAB
static q15_t GMSK_FILTER[] = {1, 4, 15, 52, 151, 380, 832, 1579, 2599, 3710, 4594, 4933, 4594, 3710, 2599, 1579, 832, 380, 151, 52, 15, 4, 1, 0};

View File

@ -22,19 +22,27 @@
#include "YSFDefines.h"
// Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB
static q15_t YSF_C4FSK_FILTER[] = {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, 0};
#if defined(USE_SHORTER_DMR_FILTER)
// Generated using rcosdesign(0.2, 4, 10, 'sqrt') in MATLAB
static q15_t YSF_C4FSK_FILTER[] = {486, 39, -480, -1022, -1526, -1928, -2164, -2178, -1927, -1384, -548, 561, 1898, 3399, 4980, 6546, 7999, 9246, 10202, 10803, 11008, 10803, 10202, 9246,
7999, 6546, 4980, 3399, 1898, 561, -548, -1384, -1927, -2178, -2164, -1928, -1526, -1022, -480, 39, 486, 0};
const uint16_t YSF_C4FSK_FILTER_LEN = 42U;
#else
// Generated using rcosdesign(0.2, 8, 10, 'sqrt') in MATLAB
static q15_t YSF_C4FSK_FILTER[] = {283, 198, 73, -78, -240, -393, -517, -590, -599, -533, -391, -181, 79, 364, 643, 880, 1041, 1097, 1026, 819, 483, 39, -477, -1016, -1516, -1915, -2150,
-2163, -1914, -1375, -545, 557, 1886, 3376, 4946, 6502, 7946, 9184, 10134, 10731, 10935, 10731, 10134, 9184, 7946, 6502, 4946, 3376, 1886, 557, -545,
-1375, -1914, -2163, -2150, -1915, -1516, -1016, -477, 39, 483, 819, 1026, 1097, 1041, 880, 643, 364, 79, -181, -391, -533, -599, -590, -517, -393, -240,
-78, 73, 198, 283, 0};
const uint16_t YSF_C4FSK_FILTER_LEN = 82U;
#endif
const uint8_t YSF_START_SYNC = 0x77U;
const uint8_t YSF_END_SYNC = 0xFFU;
q15_t YSF_A[] = { 1408, 1408, 1408, 1408, 1408};
q15_t YSF_B[] = { 470, 470, 470, 470, 470};
q15_t YSF_C[] = { -470, -470, -470, -470, -470};
q15_t YSF_D[] = {-1408, -1408, -1408, -1408, -1408};
q15_t YSF_A[] = { 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408, 1408};
q15_t YSF_B[] = { 470, 470, 470, 470, 470, 470, 470, 470, 470, 470};
q15_t YSF_C[] = { -470, -470, -470, -470, -470, -470, -470, -470, -470, -470};
q15_t YSF_D[] = {-1408, -1408, -1408, -1408, -1408, -1408, -1408, -1408, -1408, -1408};
CYSFTX::CYSFTX() :
@ -47,7 +55,7 @@ m_poPtr(0U),
m_txDelay(120U), // 100ms
m_count(0U)
{
::memset(m_modState, 0x00U, 70U * sizeof(q15_t));
::memset(m_modState, 0x00U, 130U * sizeof(q15_t));
m_modFilter.numTaps = YSF_C4FSK_FILTER_LEN;
m_modFilter.pState = m_modState;

View File

@ -38,7 +38,7 @@ public:
private:
CSerialRB m_buffer;
arm_fir_instance_q15 m_modFilter;
q15_t m_modState[70U]; // NoTaps + BlockSize - 1, 42 + 20 - 1 plus some spare
q15_t m_modState[130U]; // NoTaps + BlockSize - 1, 82 + 40 - 1 plus some spare
uint8_t m_poBuffer[720U];
uint16_t m_poLen;
uint16_t m_poPtr;