mirror of
https://github.com/juribeparada/MMDVM_HS.git
synced 2025-12-06 07:12:08 +01:00
Merge branch 'master' into duplex
This commit is contained in:
commit
cea661f533
|
|
@ -363,7 +363,11 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset)
|
|||
|
||||
ADF7021_REG2 = (uint32_t) 0b10 << 28; // invert data (and RC alpha = 0.5)
|
||||
ADF7021_REG2 |= (uint32_t) (ADF7021_DEV_P25 / div2) << 19; // deviation
|
||||
#if defined(ENABLE_P25_WIDE)
|
||||
ADF7021_REG2 |= (uint32_t) 0b011 << 4; // modulation (4FSK)
|
||||
#else
|
||||
ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK)
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
10
ADF7021.h
10
ADF7021.h
|
|
@ -62,7 +62,11 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
|||
#define ADF7021_DEV_DMR 23U
|
||||
#define ADF7021_DEV_YSF_L 18U
|
||||
#define ADF7021_DEV_YSF_H 36U
|
||||
#if defined(ENABLE_P25_WIDE)
|
||||
#define ADF7021_DEV_P25 32U
|
||||
#else
|
||||
#define ADF7021_DEV_P25 22U
|
||||
#endif
|
||||
|
||||
// TX/RX CLOCK register (REG 03)
|
||||
#define ADF7021_REG3_DSTAR 0x2A4C4193
|
||||
|
|
@ -142,7 +146,11 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
|||
#define ADF7021_DEV_DMR 14U
|
||||
#define ADF7021_DEV_YSF_L 11U
|
||||
#define ADF7021_DEV_YSF_H 21U
|
||||
#if defined(ENABLE_P25_WIDE)
|
||||
#define ADF7021_DEV_P25 21U
|
||||
#else
|
||||
#define ADF7021_DEV_P25 14U
|
||||
#endif
|
||||
|
||||
// TX/RX CLOCK register (REG 03)
|
||||
#define ADF7021_REG3_DSTAR 0x29EC4153
|
||||
|
|
@ -220,7 +228,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
|||
#define ADF7021_SLICER_TH_DMR 57U
|
||||
#define ADF7021_SLICER_TH_YSF_L 38U
|
||||
#define ADF7021_SLICER_TH_YSF_H 75U
|
||||
#define ADF7021_SLICER_TH_P25 52U
|
||||
#define ADF7021_SLICER_TH_P25 47U
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -282,6 +282,10 @@ scanning over all enabled modes, and you could have some detection delay. Enable
|
|||
#define SERIAL_REPEATER: enable a second serial port (USART2, pins PA2 and PA3) for Nextion
|
||||
LCD display.
|
||||
|
||||
#define ENABLE_P25_WIDE: enable support for Motorola Wide P25 mod/demod in XTS3000 radios. Using
|
||||
this mode improves RX BER. You need to enable this mode in your radio for each conventional
|
||||
personalities.
|
||||
|
||||
Pinout definitions for ZUMSpot Libre Kit (Carrier board, RF7021SE + STM32F103 board):
|
||||
=====================================================================================
|
||||
- Main RF7021SE board:
|
||||
|
|
|
|||
12
Config.h
12
Config.h
|
|
@ -20,11 +20,11 @@
|
|||
#define CONFIG_H
|
||||
|
||||
// Select one board:
|
||||
// 1) Initial release of Pi HAT:
|
||||
// 1) Initial release of ZUM-Spot Pi:
|
||||
// #define PI_HAT_7021_REV_02
|
||||
// 2) ZUM-Spot USB v0.1 and Pi HAT v0.3:
|
||||
// 2) ZUM-Spot USB and ZUM-Spot Pi HAT:
|
||||
// #define PI_HAT_7021_REV_03
|
||||
// 3) Board with modified RF7021SE and Blue Pill STM32F103 (initial tests)
|
||||
// 3) ZUM-Spot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103
|
||||
#define ADF7021_CARRIER_BOARD
|
||||
|
||||
// Enable ADF7021 support:
|
||||
|
|
@ -45,9 +45,8 @@
|
|||
// For 12.2880 MHz:
|
||||
// #define ADF7021_12_2880
|
||||
|
||||
// AFC is enabled by default in D-Star
|
||||
|
||||
// Enable AFC support for DMR, YSF and P25 (experimental)
|
||||
// AFC is already enabled by default in D-Star
|
||||
// #define ADF7021_ENABLE_4FSK_AFC
|
||||
// Configure AFC with positive initial frequency offset
|
||||
// #define ADF7021_AFC_POS
|
||||
|
|
@ -65,4 +64,7 @@
|
|||
// Enable Nextion LCD serial port repeater:
|
||||
// #define SERIAL_REPEATER
|
||||
|
||||
// Enable P25 Wide modulation
|
||||
// #define ENABLE_P25_WIDE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "DMRDMORX.h"
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
//#define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "DStarRX.h"
|
||||
|
|
@ -291,7 +289,6 @@ void CDStarRX::processNone(bool bit)
|
|||
|
||||
// Fuzzy matching of the preamble sync sequence
|
||||
if (countBits32((m_patternBuffer & PREAMBLE_MASK) ^ PREAMBLE_DATA) <= PREAMBLE_ERRS) {
|
||||
DEBUG1("DStarRX: preamble detected, fuzzy");
|
||||
|
||||
// Extend scan period in D-Star, once preamble is detected
|
||||
m_modeTimerCnt = 0;
|
||||
|
|
@ -385,12 +382,11 @@ void CDStarRX::processData(bool bit)
|
|||
bool syncSeen = false;
|
||||
if (m_dataBits >= SYNC_SCAN_START && m_dataBits <= (SYNC_POS + 1U)) {
|
||||
if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) {
|
||||
#if defined(WANT_DEBUG)
|
||||
if (m_dataBits < SYNC_POS)
|
||||
DEBUG2("DStarRX: found data sync in Data, early", SYNC_POS - m_dataBits);
|
||||
else
|
||||
DEBUG1("DStarRX: found data sync in Data");
|
||||
#endif
|
||||
|
||||
m_rxBufferBits = DSTAR_DATA_LENGTH_BITS;
|
||||
m_dataBits = 0U;
|
||||
syncSeen = true;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "DStarTX.h"
|
||||
|
|
|
|||
16
Debug.h
16
Debug.h
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017 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,8 +19,6 @@
|
|||
#if !defined(DEBUG_H)
|
||||
#define DEBUG_H
|
||||
|
||||
#if defined(WANT_DEBUG)
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#define DEBUG1(a) serial.writeDebug((a))
|
||||
|
|
@ -28,18 +26,6 @@
|
|||
#define DEBUG3(a,b,c) serial.writeDebug((a),(b),(c))
|
||||
#define DEBUG4(a,b,c,d) serial.writeDebug((a),(b),(c),(d))
|
||||
#define DEBUG5(a,b,c,d,e) serial.writeDebug((a),(b),(c),(d),(e))
|
||||
#define ASSERT(a) serial.writeAssert((a),#a,__FILE__,__LINE__)
|
||||
|
||||
#else
|
||||
|
||||
#define DEBUG1(a)
|
||||
#define DEBUG2(a,b)
|
||||
#define DEBUG3(a,b,c)
|
||||
#define DEBUG4(a,b,c,d)
|
||||
#define DEBUG5(a,b,c,d,e)
|
||||
#define ASSERT(a)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
17
Makefile
17
Makefile
|
|
@ -107,8 +107,8 @@ BINBIN=outp.bin
|
|||
MCFLAGS=-mcpu=cortex-m3 -march=armv7-m -mthumb -Wall -Wextra
|
||||
|
||||
# COMPILE FLAGS
|
||||
DEFS_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x0
|
||||
DEFS_HS_BL=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x2000
|
||||
DEFS_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x0 -DMADEBYMAKEFILE
|
||||
DEFS_HS_BL=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x2000 -DMADEBYMAKEFILE
|
||||
|
||||
CFLAGS=-c $(MCFLAGS) $(INCLUDES) -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
||||
CXXFLAGS=-c $(MCFLAGS) $(INCLUDES) -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
||||
|
|
@ -138,6 +138,7 @@ debug: CXXFLAGS+=-g $(DEFS_HS)
|
|||
debug: LDFLAGS+=-g
|
||||
debug: release
|
||||
|
||||
release: GitVersion.h
|
||||
release: $(BINDIR)
|
||||
release: $(BINDIR)/$(BINHEX)
|
||||
release: $(BINDIR)/$(BINBIN)
|
||||
|
|
@ -172,6 +173,7 @@ $(BINDIR)/$(BINELF): $(OBJECTS)
|
|||
|
||||
clean:
|
||||
$(CLEANCMD)
|
||||
$(RM) GitVersion.h
|
||||
|
||||
stlink:
|
||||
$(ST_FLASH) write bin/$(BINBIN) 0x8000000
|
||||
|
|
@ -230,3 +232,14 @@ ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
|||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
||||
endif
|
||||
|
||||
# Export the current git version if the index file exists, else 000...
|
||||
GitVersion.h: .FORCE
|
||||
ifneq ("$(wildcard .git/index)","")
|
||||
echo "#define GITVERSION \"$(shell git rev-parse --short HEAD)\"" > $@
|
||||
else
|
||||
echo "#define GITVERSION \"0000000\"" > $@
|
||||
endif
|
||||
|
||||
.FORCE:
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "P25RX.h"
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "P25TX.h"
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
|
||||
#if defined(MADEBYMAKEFILE)
|
||||
#include "GitVersion.h"
|
||||
#endif
|
||||
|
||||
#include "SerialPort.h"
|
||||
|
||||
const uint8_t MMDVM_FRAME_START = 0xE0U;
|
||||
|
|
@ -74,15 +76,21 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
|||
#define DESCRIPTION "MMDVM_HS-ADF7021 20170521 (D-Star/DMR/YSF/P25)"
|
||||
#endif
|
||||
|
||||
#if defined(GITVERSION)
|
||||
#define concat(a, b) a " GitID #" b ""
|
||||
const char HARDWARE[] = concat(DESCRIPTION, GITVERSION);
|
||||
#else
|
||||
#define concat(a, b, c) a " (Build: " b " " c ")"
|
||||
const char HARDWARE[] = concat(DESCRIPTION, __TIME__, __DATE__);
|
||||
#endif
|
||||
|
||||
const uint8_t PROTOCOL_VERSION = 1U;
|
||||
|
||||
CSerialPort::CSerialPort() :
|
||||
m_buffer(),
|
||||
m_ptr(0U),
|
||||
m_len(0U)
|
||||
m_len(0U),
|
||||
m_debug(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -205,6 +213,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||
bool ysfLoDev = (data[0U] & 0x08U) == 0x08U;
|
||||
bool simplex = (data[0U] & 0x80U) == 0x80U;
|
||||
|
||||
m_debug = (data[0U] & 0x10U) == 0x10U;
|
||||
|
||||
bool dstarEnable = (data[1U] & 0x01U) == 0x01U;
|
||||
bool dmrEnable = (data[1U] & 0x02U) == 0x02U;
|
||||
bool ysfEnable = (data[1U] & 0x04U) == 0x04U;
|
||||
|
|
@ -866,6 +876,9 @@ void CSerialPort::writeP25Lost()
|
|||
|
||||
void CSerialPort::writeDebug(const char* text)
|
||||
{
|
||||
if (!m_debug)
|
||||
return;
|
||||
|
||||
uint8_t reply[130U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
|
|
@ -883,6 +896,9 @@ void CSerialPort::writeDebug(const char* text)
|
|||
|
||||
void CSerialPort::writeDebug(const char* text, int16_t n1)
|
||||
{
|
||||
if (!m_debug)
|
||||
return;
|
||||
|
||||
uint8_t reply[130U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
|
|
@ -903,6 +919,9 @@ void CSerialPort::writeDebug(const char* text, int16_t n1)
|
|||
|
||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
||||
{
|
||||
if (!m_debug)
|
||||
return;
|
||||
|
||||
uint8_t reply[130U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
|
|
@ -926,6 +945,9 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
|||
|
||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3)
|
||||
{
|
||||
if (!m_debug)
|
||||
return;
|
||||
|
||||
uint8_t reply[130U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
|
|
@ -952,6 +974,9 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n
|
|||
|
||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4)
|
||||
{
|
||||
if (!m_debug)
|
||||
return;
|
||||
|
||||
uint8_t reply[130U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
|
|
@ -979,31 +1004,3 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n
|
|||
writeInt(1U, reply, count, true);
|
||||
}
|
||||
|
||||
void CSerialPort::writeAssert(bool cond, const char* text, const char* file, long line)
|
||||
{
|
||||
if (cond)
|
||||
return;
|
||||
|
||||
uint8_t reply[200U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
reply[1U] = 0U;
|
||||
reply[2U] = MMDVM_DEBUG2;
|
||||
|
||||
uint8_t count = 3U;
|
||||
for (uint8_t i = 0U; text[i] != '\0'; i++, count++)
|
||||
reply[count] = text[i];
|
||||
|
||||
reply[count++] = ' ';
|
||||
|
||||
for (uint8_t i = 0U; file[i] != '\0'; i++, count++)
|
||||
reply[count] = file[i];
|
||||
|
||||
reply[count++] = (line >> 8) & 0xFF;
|
||||
reply[count++] = (line >> 0) & 0xFF;
|
||||
|
||||
reply[1U] = count;
|
||||
|
||||
writeInt(1U, reply, count, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,12 +50,11 @@ public:
|
|||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3);
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
||||
|
||||
void writeAssert(bool cond, const char* text, const char* file, long line);
|
||||
|
||||
private:
|
||||
uint8_t m_buffer[256U];
|
||||
uint8_t m_ptr;
|
||||
uint8_t m_len;
|
||||
bool m_debug;
|
||||
|
||||
void sendACK();
|
||||
void sendNAK(uint8_t err);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
// #define WANT_DEBUG
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "YSFRX.h"
|
||||
|
|
|
|||
Loading…
Reference in a new issue