mirror of https://github.com/g4klx/MMDVM.git
Converted to 48 kHz sample rate.
This commit is contained in:
parent
f7395a5a22
commit
a773f3adac
|
@ -19,7 +19,7 @@
|
|||
#if !defined(DMRDEFINES_H)
|
||||
#define DMRDEFINES_H
|
||||
|
||||
const unsigned int DMR_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate
|
||||
const unsigned int DMR_RADIO_SYMBOL_LENGTH = 10U; // At 48 kHz sample rate
|
||||
|
||||
const unsigned int DMR_FRAME_LENGTH_BYTES = 33U;
|
||||
const unsigned int DMR_FRAME_LENGTH_BITS = DMR_FRAME_LENGTH_BYTES * 8U;
|
||||
|
|
13
DMRTX.cpp
13
DMRTX.cpp
|
@ -20,11 +20,12 @@
|
|||
#include "Globals.h"
|
||||
#include "DMRSlotType.h"
|
||||
|
||||
// Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB
|
||||
static q15_t DMR_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};
|
||||
const uint16_t DMR_C4FSK_FILTER_LEN = 42U;
|
||||
// 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;
|
||||
|
||||
q15_t DMR_A[] = { 1280, 1280, 1280, 1280, 1280};
|
||||
q15_t DMR_B[] = { 427, 427, 427, 427, 427};
|
||||
|
@ -66,7 +67,7 @@ m_poLen(0U),
|
|||
m_poPtr(0U),
|
||||
m_count(0U)
|
||||
{
|
||||
::memset(m_modState, 0x00U, 70U * sizeof(q15_t));
|
||||
::memset(m_modState, 0x00U, 130U * sizeof(q15_t));
|
||||
|
||||
m_modFilter.numTaps = DMR_C4FSK_FILTER_LEN;
|
||||
m_modFilter.pState = m_modState;
|
||||
|
|
2
DMRTX.h
2
DMRTX.h
|
@ -52,7 +52,7 @@ public:
|
|||
private:
|
||||
CSerialRB m_fifo[2U];
|
||||
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
|
||||
DMRTXSTATE m_state;
|
||||
uint8_t m_idle[DMR_FRAME_LENGTH_BYTES];
|
||||
uint8_t m_cachPtr;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,7 +19,7 @@
|
|||
#if !defined(DSTARDEFINES_H)
|
||||
#define DSTARDEFINES_H
|
||||
|
||||
const unsigned int DSTAR_RADIO_BIT_LENGTH = 5U; // At 24 kHz sample rate
|
||||
const unsigned int DSTAR_RADIO_BIT_LENGTH = 10U; // At 48 kHz sample rate
|
||||
|
||||
const unsigned int DSTAR_HEADER_LENGTH_BYTES = 41U;
|
||||
const unsigned int DSTAR_HEADER_LENGTH_BITS = DSTAR_HEADER_LENGTH_BYTES * 8U;
|
||||
|
|
|
@ -26,9 +26,9 @@ const uint8_t BIT_SYNC = 0xAAU;
|
|||
|
||||
const uint8_t FRAME_SYNC[] = {0xEAU, 0xA6U, 0x00U};
|
||||
|
||||
// Generated using gaussfir(0.5, 4, 5) in MATLAB
|
||||
static q15_t DSTAR_GMSK_FILTER[] = {8, 104, 760, 3158, 7421, 9866, 7421, 3158, 760, 104, 8, 0};
|
||||
const uint16_t DSTAR_GMSK_FILTER_LEN = 12U;
|
||||
// Generated using gaussfir(0.5, 4, 10) in MATLAB
|
||||
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};
|
||||
|
@ -196,7 +196,7 @@ m_poPtr(0U),
|
|||
m_txDelay(60U), // 100ms
|
||||
m_count(0U)
|
||||
{
|
||||
::memset(m_modState, 0x00U, 60U * sizeof(q15_t));
|
||||
::memset(m_modState, 0x00U, 110U * sizeof(q15_t));
|
||||
|
||||
m_modFilter.numTaps = DSTAR_GMSK_FILTER_LEN;
|
||||
m_modFilter.pState = m_modState;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
private:
|
||||
CSerialRB m_buffer;
|
||||
arm_fir_instance_q15 m_modFilter;
|
||||
q15_t m_modState[60U]; // NoTaps + BlockSize - 1, 12 + 40 - 1 plus some spare
|
||||
q15_t m_modState[110U]; // NoTaps + BlockSize - 1, 24 + 80 - 1 plus some spare
|
||||
uint8_t m_poBuffer[400U];
|
||||
uint16_t m_poLen;
|
||||
uint16_t m_poPtr;
|
||||
|
|
35
IO.cpp
35
IO.cpp
|
@ -24,15 +24,16 @@
|
|||
#include "Globals.h"
|
||||
#include "IO.h"
|
||||
|
||||
// Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB
|
||||
static q15_t 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};
|
||||
const uint16_t C4FSK_FILTER_LEN = 42U;
|
||||
// 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;
|
||||
|
||||
// Generated using gaussfir(0.5, 4, 5) in MATLAB
|
||||
static q15_t GMSK_FILTER[] = {8, 104, 760, 3158, 7421, 9866, 7421, 3158, 760, 104, 8, 0};
|
||||
const uint16_t GMSK_FILTER_LEN = 12U;
|
||||
// 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};
|
||||
const uint16_t GMSK_FILTER_LEN = 24U;
|
||||
|
||||
const uint16_t DC_OFFSET = 2048U;
|
||||
|
||||
|
@ -123,8 +124,8 @@ m_count(0U),
|
|||
m_watchdog(0U),
|
||||
m_lockout(false)
|
||||
{
|
||||
::memset(m_C4FSKState, 0x00U, 70U * sizeof(q15_t));
|
||||
::memset(m_GMSKState, 0x00U, 40U * sizeof(q15_t));
|
||||
::memset(m_C4FSKState, 0x00U, 110U * sizeof(q15_t));
|
||||
::memset(m_GMSKState, 0x00U, 50U * sizeof(q15_t));
|
||||
|
||||
m_C4FSKFilter.numTaps = C4FSK_FILTER_LEN;
|
||||
m_C4FSKFilter.pState = m_C4FSKState;
|
||||
|
@ -186,11 +187,11 @@ void CIO::start()
|
|||
TC_CMR_ACPA_CLEAR | TC_CMR_ACPC_CLEAR |
|
||||
TC_CMR_BCPB_CLEAR | TC_CMR_BCPC_CLEAR;
|
||||
#if defined(EXTERNAL_OSC)
|
||||
t->TC_RC = EXTERNAL_OSC / 24000; // Counter resets on RC, so sets period in terms of the external clock
|
||||
t->TC_RA = EXTERNAL_OSC / 48000; // Roughly square wave
|
||||
t->TC_RC = EXTERNAL_OSC / 48000; // Counter resets on RC, so sets period in terms of the external clock
|
||||
t->TC_RA = EXTERNAL_OSC / 96000; // Roughly square wave
|
||||
#else
|
||||
t->TC_RC = 1750; // Counter resets on RC, so sets period in terms of 42MHz internal clock
|
||||
t->TC_RA = 880; // Roughly square wave
|
||||
t->TC_RC = 875; // Counter resets on RC, so sets period in terms of 42MHz internal clock
|
||||
t->TC_RA = 438; // Roughly square wave
|
||||
#endif
|
||||
t->TC_CMR = (t->TC_CMR & 0xFFF0FFFF) | TC_CMR_ACPA_CLEAR | TC_CMR_ACPC_SET; // Set clear and set from RA and RC compares
|
||||
t->TC_CCR = TC_CCR_CLKEN | TC_CCR_SWTRG ; // re-enable local clocking and switch to hardware trigger source.
|
||||
|
@ -209,7 +210,7 @@ void CIO::start()
|
|||
digitalWrite(PIN_COSLED, LOW);
|
||||
digitalWrite(PIN_LED, HIGH);
|
||||
#elif defined(__MBED__)
|
||||
m_ticker.attach(&ADC_Handler, 1.0 / 24000.0);
|
||||
m_ticker.attach(&ADC_Handler, 1.0 / 48000.0);
|
||||
|
||||
m_pinPTT.write(m_pttInvert ? 1 : 0);
|
||||
m_pinCOSLED.write(0);
|
||||
|
@ -235,7 +236,7 @@ void CIO::process()
|
|||
m_watchdog = 0U;
|
||||
}
|
||||
|
||||
if (m_ledCount >= 24000U) {
|
||||
if (m_ledCount >= 48000U) {
|
||||
m_ledCount = 0U;
|
||||
m_ledValue = !m_ledValue;
|
||||
#if defined(__MBED__)
|
||||
|
@ -245,7 +246,7 @@ void CIO::process()
|
|||
#endif
|
||||
}
|
||||
} else {
|
||||
if (m_ledCount >= 240000U) {
|
||||
if (m_ledCount >= 480000U) {
|
||||
m_ledCount = 0U;
|
||||
m_ledValue = !m_ledValue;
|
||||
#if defined(__MBED__)
|
||||
|
|
4
IO.h
4
IO.h
|
@ -70,8 +70,8 @@ private:
|
|||
|
||||
arm_fir_instance_q15 m_C4FSKFilter;
|
||||
arm_fir_instance_q15 m_GMSKFilter;
|
||||
q15_t m_C4FSKState[70U]; // NoTaps + BlockSize - 1, 42 + 20 - 1 plus some spare
|
||||
q15_t m_GMSKState[40U]; // NoTaps + BlockSize - 1, 12 + 20 - 1 plus some spare
|
||||
q15_t m_C4FSKState[110U]; // NoTaps + BlockSize - 1, 82 + 20 - 1 plus some spare
|
||||
q15_t m_GMSKState[50U]; // NoTaps + BlockSize - 1, 24 + 20 - 1 plus some spare
|
||||
|
||||
bool m_pttInvert;
|
||||
q15_t m_rxLevel;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,7 +19,7 @@
|
|||
#if !defined(YSFDEFINES_H)
|
||||
#define YSFDEFINES_H
|
||||
|
||||
const unsigned int YSF_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate
|
||||
const unsigned int YSF_RADIO_SYMBOL_LENGTH = 10U; // At 48 kHz sample rate
|
||||
|
||||
const unsigned int YSF_FRAME_LENGTH_BYTES = 120U;
|
||||
const unsigned int YSF_FRAME_LENGTH_BITS = YSF_FRAME_LENGTH_BYTES * 8U;
|
||||
|
|
Loading…
Reference in New Issue