From 7fabddd7f15162e28704682aeaee7c6f93e328b8 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 21 May 2020 11:11:19 +0100 Subject: [PATCH 01/22] Update the README file. --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8e994ab..59b17d2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,17 @@ -This is the source code of the MMDVM firmware that supports D-Star, DMR, System Fusion, P25, NXDN, and POCSAG modes. +This is the source code of the MMDVM firmware that supports D-Star, DMR, +System Fusion, P25, NXDN, POCSAG, and FM modes. -It runs on the Arduino Due, the ST-Micro STM32F1xxx, STM32F4xxx and STM32F7xxx processors, as well as the Teensy 3.1/3.2/3.5/3.6. What these platforms have in common is the use of an ARM Cortex-M3 or M4 processor with a clock speed greater than 70 MHz, and access to at least one analogue to digital converter and one digital to analogue converter. +It runs on the Arduino Due, the ST-Micro STM32F1xxx, STM32F4xxx and STM32F7xxx +processors, as well as the Teensy 3.1/3.2/3.5/3.6. What these platforms have in +common is the use of an ARM Cortex-M3, M4, or M7 processors with a clock speed +greater than 70 MHz, and access to at least one analogue to digital converter +and one digital to analogue converter. -In order to build this software for the Arduino Due, you will need to edit a file within the Arduino GUI and that is detailed in the BUILD.txt file. The STM32 support is being supplied via the Coocox IDE with ARM GCC. The Teensy support uses Teensyduino. +In order to build this software for the Arduino Due, you will need to edit a +file within the Arduino GUI and that is detailed in the BUILD.txt file. The +STM32 support is being supplied via the ARM GCC compiler. The Teensy support +uses Teensyduino. -This software is licenced under the GPL v2 and is intended for amateur and educational use only. Use of this software for commercial purposes is strictly forbidden. +This software is licenced under the GPL v2 and is intended for amateur and +educational use only. Use of this software for commercial purposes is strictly +forbidden. From 53d8cfa360dc3f8c3763e2a9a4bde8c79345d4cf Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 1 Jun 2020 16:51:59 +0100 Subject: [PATCH 02/22] Revert IOSTM_CMSIS.cpp to 5c9abf2 --- IOSTM_CMSIS.cpp | 68 ++++++++++--------------------------------------- 1 file changed, 14 insertions(+), 54 deletions(-) diff --git a/IOSTM_CMSIS.cpp b/IOSTM_CMSIS.cpp index 6cd92a2..ce498d4 100644 --- a/IOSTM_CMSIS.cpp +++ b/IOSTM_CMSIS.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016, 2017 by Andy Uribe CA6JAU - * Copyright (C) 2017,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2017 by Wojciech Krutnik N0CALL * * This program is free software; you can redistribute it and/or modify @@ -41,7 +41,6 @@ YSF PB8 output P25 PB9 output NXDN PB10 output POCSAG PB11 output -FM PB12 output RX PB0 analog input (ADC1_8) RSSI PB1 analog input (ADC2_9) @@ -85,9 +84,6 @@ USART1_RXD PA10 input (AF) #define PIN_POCSAG 11 #define PORT_POCSAG GPIOB #define BB_POCSAG *((bitband_t)BITBAND_PERIPH(&PORT_POCSAG->ODR, PIN_POCSAG)) -#define PIN_FM 14 -#define PORT_FM GPIOB -#define BB_FM *((bitband_t)BITBAND_PERIPH(&PORT_FM->ODR, PIN_FM)) #define PIN_RX 0 #define PIN_RX_ADC_CH 8 @@ -158,35 +154,16 @@ void GPIOConfigPin(GPIO_TypeDef *port_ptr, uint32_t pin, uint32_t mode_cnf_value #if defined(STM32F1_POG) void FancyLEDEffect() { - int ledCount = 10; - - bitband_t foo[] = {&BB_LED, &BB_COSLED, &BB_PTT, &BB_DMR, &BB_DSTAR, &BB_YSF, &BB_P25, -#if defined(USE_ALTERNATE_NXDN_LEDS) - NULL, -#else - &BB_NXDN, -#endif -#if defined(USE_ALTERNATE_POCSAG_LEDS) - NULL, -#else - &BB_POCSAG, -#endif -#if defined(USE_ALTERNATE_FM_LEDS) - NULL}; -#else - &BB_FM}; -#endif - - for(int i=0; iODR, PIN_USART1_TXD)) = 0x00; delay(SystemCoreClock/1000*100); - for(int i=0; iODR, PIN_USART1_TXD)) = 0x01; delay(SystemCoreClock/1000*20); @@ -195,22 +172,18 @@ void FancyLEDEffect() *((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01; *foo[0] = 0x01; - for(int i=1; i=0; i--) { + for(int i=5; i>=0; i--){ delay(SystemCoreClock/1000*10); - if (foo[i+1] != NULL) - *foo[i+1] = 0x00; - if (foo[i] != NULL) - *foo[i] = 0x01; + *foo[i+1] = 0x00; + *foo[i] = 0x01; } delay(SystemCoreClock/1000*10); - *foo[0] = 0x00; + *foo[5+1-6] = 0x00; *((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x00; delay(SystemCoreClock/1000*10); *((bitband_t)BITBAND_PERIPH(&PORT_USART1_TXD->ODR, PIN_USART1_TXD)) = 0x01; @@ -255,9 +228,6 @@ static inline void GPIOInit() #if !defined(USE_ALTERNATE_POCSAG_LEDS) GPIOConfigPin(PORT_POCSAG, PIN_POCSAG, GPIO_CRL_MODE0_1); #endif -#if !defined(USE_ALTERNATE_FM_LEDS) - GPIOConfigPin(PORT_FM, PIN_FM, GPIO_CRL_MODE0_1); -#endif GPIOConfigPin(PORT_RX, PIN_RX, 0); #if defined(SEND_RSSI_DATA) @@ -490,16 +460,6 @@ void CIO::setPOCSAGInt(bool on) #endif } -void CIO::setFMInt(bool on) -{ -#if defined(USE_ALTERNATE_FM_LEDS) - BB_DSTAR = !!on; - BB_YSF = !!on; -#else - BB_FM = !!on; -#endif -} - void CIO::delayInt(unsigned int dly) { delay(dly); From 598d32287d3e75313433d148140d306dd1662538 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 1 Jun 2020 16:55:13 +0100 Subject: [PATCH 03/22] Add alternate FM LEDs for the POG board. --- IOSTM_CMSIS.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/IOSTM_CMSIS.cpp b/IOSTM_CMSIS.cpp index ce498d4..00f9767 100644 --- a/IOSTM_CMSIS.cpp +++ b/IOSTM_CMSIS.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016, 2017 by Andy Uribe CA6JAU - * Copyright (C) 2017,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2017,2018,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017 by Wojciech Krutnik N0CALL * * This program is free software; you can redistribute it and/or modify @@ -460,6 +460,14 @@ void CIO::setPOCSAGInt(bool on) #endif } +void CIO::setFMInt(bool on) +{ +#if defined(USE_ALTERNATE_FM_LEDS) + BB_DSTAR = !!on; + BB_YSF = !!on; +#endif +} + void CIO::delayInt(unsigned int dly) { delay(dly); From f8d8f858419e85ccb36bae51c94b772339c1a837 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 12 Jul 2020 10:47:43 +0100 Subject: [PATCH 04/22] Small simplification of the timeout tones. --- FMTimeout.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/FMTimeout.cpp b/FMTimeout.cpp index 893e53b..4c1fb55 100644 --- a/FMTimeout.cpp +++ b/FMTimeout.cpp @@ -41,7 +41,7 @@ void CFMTimeout::setParams(uint8_t level) q15_t CFMTimeout::getAudio() { - q15_t sample = 0U; + q15_t sample = 0; if (!m_running) return sample; @@ -52,8 +52,6 @@ q15_t CFMTimeout::getAudio() m_n++; if (m_n >= BUSY_AUDIO_LEN) m_n = 0U; - } else { - sample = 0U; } m_pos++; From ccdbe126e01c887076397c2253b7b170ef6b9f81 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 12 Jul 2020 15:22:35 +0100 Subject: [PATCH 05/22] Fix the timeout tones. --- FM.cpp | 4 ++-- FMTimeout.cpp | 8 ++++---- SerialPort.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/FM.cpp b/FM.cpp index ae44e07..458fc28 100644 --- a/FM.cpp +++ b/FM.cpp @@ -117,11 +117,11 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length) currentSample += m_callsign.getLowAudio(); } + currentSample = m_filterStage3.filter(m_filterStage2.filter(m_filterStage1.filter(currentSample))); + if (!m_callsign.isRunning() && !m_rfAck.isRunning()) currentSample += m_timeoutTone.getAudio(); - currentSample = m_filterStage3.filter(m_filterStage2.filter(m_filterStage1.filter(currentSample))); - currentSample += m_ctcssTX.getAudio(); if (m_modemState == STATE_FM) diff --git a/FMTimeout.cpp b/FMTimeout.cpp index 4c1fb55..771e840 100644 --- a/FMTimeout.cpp +++ b/FMTimeout.cpp @@ -36,7 +36,7 @@ m_n(0U) void CFMTimeout::setParams(uint8_t level) { - m_level = q15_t(level * 128); + m_level = q15_t(level * 5); } q15_t CFMTimeout::getAudio() @@ -45,9 +45,9 @@ q15_t CFMTimeout::getAudio() if (!m_running) return sample; - if (m_pos > 12000U) { - q31_t sample = BUSY_AUDIO[m_n] * m_level; - sample = q15_t(__SSAT((sample >> 15), 16)); + if (m_pos >= 12000U) { + q31_t sample31 = BUSY_AUDIO[m_n] * m_level; + sample = q15_t(__SSAT((sample31 >> 15), 16)); m_n++; if (m_n >= BUSY_AUDIO_LEN) diff --git a/SerialPort.cpp b/SerialPort.cpp index 338f5f9..4e22028 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -103,7 +103,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200520 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20200712 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" From 20013e3adcb95cdbbfc3713f7355bf388bdd72d8 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 13 Jul 2020 17:13:01 +0100 Subject: [PATCH 06/22] Make Use COS As Lockout a run-time parameter and allow for different access modes. --- Config.h | 3 -- FM.cpp | 87 ++++++++++++++++++++++++++++++-------------------- FM.h | 4 +-- IO.cpp | 10 +++--- IO.h | 4 ++- SerialPort.cpp | 21 ++++++------ 6 files changed, 75 insertions(+), 54 deletions(-) diff --git a/Config.h b/Config.h index 73e716b..da79210 100644 --- a/Config.h +++ b/Config.h @@ -35,9 +35,6 @@ // For 19.2 MHz // #define EXTERNAL_OSC 19200000 -// Allow the use of the COS line to lockout the modem -// #define USE_COS_AS_LOCKOUT - // Use pins to output the current mode via LEDs // #define MODE_LEDS diff --git a/FM.cpp b/FM.cpp index 458fc28..e1d5f76 100644 --- a/FM.cpp +++ b/FM.cpp @@ -20,6 +20,14 @@ #include "Globals.h" #include "FM.h" +/* + * Access Mode values are: + * 0 - Carrier access with COS + * 1 - CTCSS only access without COS + * 2 - CTCSS only access with COS + * 3 - CTCSS only access with COS to start, then carrier access with COS + */ + CFM::CFM() : m_callsign(), m_rfAck(), @@ -41,7 +49,7 @@ m_filterStage1( 724, 1448, 724, 32768, -37895, 21352),//3rd order Cheby Fil m_filterStage2(32768, 0,-32768, 32768, -50339, 19052), m_filterStage3(32768, -65536, 32768, 32768, -64075, 31460), m_blanking(), -m_useCOS(true), +m_accessMode(1U), m_cosInvert(false), m_rfAudioBoost(1U), m_downsampler(128U),//Size might need adjustement @@ -54,12 +62,8 @@ m_outputRB(2400U) // 100ms of audio void CFM::samples(bool cos, const q15_t* samples, uint8_t length) { - if (m_useCOS) { - if (m_cosInvert) - cos = !cos; - } else { - cos = true; - } + if (m_cosInvert) + cos = !cos; clock(length); @@ -70,33 +74,48 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length) uint8_t ctcssState = m_ctcssRX.process(currentSample); - if (!m_useCOS) { - // Delay the audio by 100ms to better match the CTCSS detector output - m_inputRB.put(currentSample); - m_inputRB.get(currentSample); + switch (m_accessMode) { + case 0U: + stateMachine(cos); + break; + + case 1U: + // Delay the audio by 100ms to better match the CTCSS detector output + m_inputRB.put(currentSample); + m_inputRB.get(currentSample); + + if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { + // Not enough samples to determine if you have CTCSS, just carry on + } else { + bool validCTCSS = CTCSS_VALID(ctcssState); + stateMachine(validCTCSS); + } + break; + + case 2U: + if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { + // Not enough samples to determine if you have CTCSS, just carry on + } else { + bool validCTCSS = CTCSS_VALID(ctcssState); + stateMachine(validCTCSS && cos); + } + break; + + default: + if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { + // Not enough samples to determine if you have CTCSS, just carry on + } else if (CTCSS_READY(ctcssState) && m_modemState != STATE_FM) { + // We had enough samples for CTCSS and we are in some other mode than FM + bool validCTCSS = CTCSS_VALID(ctcssState); + stateMachine(validCTCSS && cos); + } else { + stateMachine(cos); + } + break; } - if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { - //Not enough samples to determine if you have CTCSS, just carry on + if (m_modemState != STATE_FM) continue; - } else if (CTCSS_READY(ctcssState) && m_modemState != STATE_FM) { - //we had enough samples for CTCSS and we are in some other mode than FM - bool validCTCSS = CTCSS_VALID(ctcssState); - stateMachine(validCTCSS && cos); - if (m_modemState != STATE_FM) - continue; - } else if (CTCSS_READY(ctcssState) && m_modemState == STATE_FM) { - //We had enough samples for CTCSS and we are in FM mode, trigger the state machine - bool validCTCSS = CTCSS_VALID(ctcssState); - stateMachine(validCTCSS && cos); - if (m_modemState != STATE_FM) - break; - } else if (CTCSS_NOT_READY(ctcssState) && m_modemState == STATE_FM && i == length - 1) { - //Not enough samples for CTCSS but we already are in FM, trigger the state machine - //but do not trigger the state machine on every single sample, save CPU! - bool validCTCSS = CTCSS_VALID(ctcssState); - stateMachine(validCTCSS && cos); - } // Only let audio through when relaying audio if (m_state == FS_RELAYING || m_state == FS_KERCHUNK) { @@ -183,10 +202,10 @@ uint8_t CFM::setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_ return m_rfAck.setParams(rfAck, speed, frequency, level, level); } -uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, bool useCOS, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel) +uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, uint8_t accessMode, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel) { - m_useCOS = useCOS; - m_cosInvert = cosInvert; + m_accessMode = accessMode; + m_cosInvert = cosInvert; m_rfAudioBoost = q15_t(rfAudioBoost); diff --git a/FM.h b/FM.h index 6411585..3168dc3 100644 --- a/FM.h +++ b/FM.h @@ -56,7 +56,7 @@ public: uint8_t setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd, bool callsignAtLatch); uint8_t setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level); - uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, bool useCOS, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel); + uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, uint8_t accessMode, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel); private: CFMKeyer m_callsign; @@ -79,7 +79,7 @@ private: CFMDirectFormI m_filterStage2; CFMDirectFormI m_filterStage3; CFMBlanking m_blanking; - bool m_useCOS; + uint8_t m_accessMode; bool m_cosInvert; q15_t m_rfAudioBoost; CFMDownsampler m_downsampler; diff --git a/IO.cpp b/IO.cpp index a737693..c36b6a9 100644 --- a/IO.cpp +++ b/IO.cpp @@ -83,6 +83,7 @@ m_pocsagTXLevel(128 * 128), m_fmTXLevel(128 * 128), m_rxDCOffset(DC_OFFSET), m_txDCOffset(DC_OFFSET), +m_useCOSAsLockout(false), m_ledCount(0U), m_ledValue(true), m_detect(false), @@ -256,9 +257,8 @@ void CIO::process() return; } -#if defined(USE_COS_AS_LOCKOUT) - m_lockout = getCOSInt(); -#endif + if (m_useCOSAsLockout) + m_lockout = getCOSInt(); // Switch off the transmitter if needed if (m_txBuffer.getData() == 0U && m_tx) { @@ -529,7 +529,7 @@ void CIO::setMode() #endif } -void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, uint8_t fmTXLevel, int16_t txDCOffset, int16_t rxDCOffset) +void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, uint8_t fmTXLevel, int16_t txDCOffset, int16_t rxDCOffset, bool useCOSAsLockout) { m_pttInvert = pttInvert; @@ -545,6 +545,8 @@ void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rx m_rxDCOffset = DC_OFFSET + rxDCOffset; m_txDCOffset = DC_OFFSET + txDCOffset; + + m_useCOSAsLockout = useCOSAsLockout; if (rxInvert) m_rxLevel = -m_rxLevel; diff --git a/IO.h b/IO.h index 07ed700..4a8231f 100644 --- a/IO.h +++ b/IO.h @@ -42,7 +42,7 @@ public: void interrupt(); - void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, uint8_t fmTXLevel, int16_t txDCOffset, int16_t rxDCOffset); + void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, uint8_t fmTXLevel, int16_t txDCOffset, int16_t rxDCOffset, bool useCOSAsLockout); void getOverflow(bool& adcOverflow, bool& dacOverflow); @@ -91,6 +91,8 @@ private: uint16_t m_rxDCOffset; uint16_t m_txDCOffset; + bool m_useCOSAsLockout; + uint32_t m_ledCount; bool m_ledValue; diff --git a/SerialPort.cpp b/SerialPort.cpp index 4e22028..171f460 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -103,7 +103,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200712 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20200713 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" @@ -267,11 +267,12 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) if (length < 21U) return 4U; - bool rxInvert = (data[0U] & 0x01U) == 0x01U; - bool txInvert = (data[0U] & 0x02U) == 0x02U; - bool pttInvert = (data[0U] & 0x04U) == 0x04U; - bool ysfLoDev = (data[0U] & 0x08U) == 0x08U; - bool simplex = (data[0U] & 0x80U) == 0x80U; + bool rxInvert = (data[0U] & 0x01U) == 0x01U; + bool txInvert = (data[0U] & 0x02U) == 0x02U; + bool pttInvert = (data[0U] & 0x04U) == 0x04U; + bool ysfLoDev = (data[0U] & 0x08U) == 0x08U; + bool useCOSAsLockout = (data[0U] & 0x20U) == 0x20U; + bool simplex = (data[0U] & 0x80U) == 0x80U; m_debug = (data[0U] & 0x10U) == 0x10U; @@ -363,7 +364,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) p25TX.setParams(p25TXHang); nxdnTX.setParams(nxdnTXHang); - io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel, fmTXLevel, txDCOffset, rxDCOffset); + io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, cwIdTXLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel, fmTXLevel, txDCOffset, rxDCOffset, useCOSAsLockout); io.start(); @@ -431,14 +432,14 @@ uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint8_t length) uint8_t kerchunkTime = data[6U]; uint8_t hangTime = data[7U]; - bool useCOS = (data[8U] & 0x01U) == 0x01U; - bool cosInvert = (data[8U] & 0x02U) == 0x02U; + uint8_t accessMode = data[8U] & 0x7FU; + bool cosInvert = (data[8U] & 0x80U) == 0x80U; uint8_t rfAudioBoost = data[9U]; uint8_t maxDev = data[10U]; uint8_t rxLevel = data[11U]; - return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, cosInvert, rfAudioBoost, maxDev, rxLevel); + return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, accessMode, cosInvert, rfAudioBoost, maxDev, rxLevel); } uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) From dc41fd83d2352f7de790982cbad698c7f59088d3 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 14 Jul 2020 12:20:42 +0100 Subject: [PATCH 07/22] Test the use of a reverse burst at the end of a transmission. --- FM.cpp | 17 +++++++++++++---- FM.h | 1 + FMCTCSSTX.cpp | 9 ++++++--- FMCTCSSTX.h | 2 +- SerialPort.cpp | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/FM.cpp b/FM.cpp index e1d5f76..1c98d90 100644 --- a/FM.cpp +++ b/FM.cpp @@ -45,6 +45,7 @@ m_kerchunkTimer(), m_ackMinTimer(), m_ackDelayTimer(), m_hangTimer(), +m_reverseTimer(), m_filterStage1( 724, 1448, 724, 32768, -37895, 21352),//3rd order Cheby Filter 300 to 2700Hz, 0.2dB passband ripple, sampling rate 24kHz m_filterStage2(32768, 0,-32768, 32768, -50339, 19052), m_filterStage3(32768, -65536, 32768, 32768, -64075, 31460), @@ -57,6 +58,8 @@ m_rxLevel(1), m_inputRB(4800U), // 200ms of audio m_outputRB(2400U) // 100ms of audio { + m_reverseTimer.setTimeout(0U, 150U); + insertDelay(100U); } @@ -141,10 +144,9 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length) if (!m_callsign.isRunning() && !m_rfAck.isRunning()) currentSample += m_timeoutTone.getAudio(); - currentSample += m_ctcssTX.getAudio(); + currentSample += m_ctcssTX.getAudio(m_reverseTimer.isRunning()); - if (m_modemState == STATE_FM) - m_outputRB.put(currentSample); + m_outputRB.put(currentSample); } } @@ -165,6 +167,7 @@ void CFM::reset() m_ackMinTimer.stop(); m_ackDelayTimer.stop(); m_hangTimer.stop(); + m_reverseTimer.stop(); m_ctcssRX.reset(); m_rfAck.stop(); @@ -254,7 +257,10 @@ void CFM::stateMachine(bool validSignal) } if (m_state == FS_LISTENING && m_modemState == STATE_FM) { - if (!m_callsign.isWanted() && !m_rfAck.isWanted()) { + if (!m_callsign.isWanted() && !m_rfAck.isWanted() && !m_reverseTimer.isRunning()) + m_reverseTimer.start(); + + if (!m_callsign.isWanted() && !m_rfAck.isWanted() && m_reverseTimer.isRunning() && m_reverseTimer.hasExpired()) { DEBUG1("Change to STATE_IDLE"); m_modemState = STATE_IDLE; m_callsignTimer.stop(); @@ -263,6 +269,7 @@ void CFM::stateMachine(bool validSignal) m_ackMinTimer.stop(); m_ackDelayTimer.stop(); m_hangTimer.stop(); + m_reverseTimer.stop(); } } } @@ -276,6 +283,7 @@ void CFM::clock(uint8_t length) m_ackMinTimer.clock(length); m_ackDelayTimer.clock(length); m_hangTimer.clock(length); + m_reverseTimer.clock(length); } void CFM::listeningState(bool validSignal) @@ -299,6 +307,7 @@ void CFM::listeningState(bool validSignal) beginRelaying(); m_callsignTimer.start(); + m_reverseTimer.stop(); io.setDecode(true); io.setADCDetection(true); diff --git a/FM.h b/FM.h index 3168dc3..6843f86 100644 --- a/FM.h +++ b/FM.h @@ -75,6 +75,7 @@ private: CFMTimer m_ackMinTimer; CFMTimer m_ackDelayTimer; CFMTimer m_hangTimer; + CFMTimer m_reverseTimer; CFMDirectFormI m_filterStage1; CFMDirectFormI m_filterStage2; CFMDirectFormI m_filterStage3; diff --git a/FMCTCSSTX.cpp b/FMCTCSSTX.cpp index fcffbb5..a2253a6 100644 --- a/FMCTCSSTX.cpp +++ b/FMCTCSSTX.cpp @@ -115,11 +115,14 @@ uint8_t CFMCTCSSTX::setParams(uint8_t frequency, uint8_t level) return 0U; } -q15_t CFMCTCSSTX::getAudio() +q15_t CFMCTCSSTX::getAudio(bool reverse) { q15_t sample = m_values[m_n++]; - if(m_n >= m_length) + if (m_n >= m_length) m_n = 0U; - return sample; + if (reverse) + return -sample; + else + return sample; } diff --git a/FMCTCSSTX.h b/FMCTCSSTX.h index 0c3e6e5..b6f9b12 100644 --- a/FMCTCSSTX.h +++ b/FMCTCSSTX.h @@ -27,7 +27,7 @@ public: uint8_t setParams(uint8_t frequency, uint8_t level); - q15_t getAudio(); + q15_t getAudio(bool reverse); private: q15_t* m_values; diff --git a/SerialPort.cpp b/SerialPort.cpp index 171f460..00380d8 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -103,7 +103,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200713 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20200714 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" From 1ac0628c1c745e6d006783a32873a5d75cd5c7c7 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 14 Jul 2020 14:54:47 +0100 Subject: [PATCH 08/22] Improve the code efficiency slightly. --- FM.cpp | 57 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/FM.cpp b/FM.cpp index 1c98d90..40934bf 100644 --- a/FM.cpp +++ b/FM.cpp @@ -75,44 +75,49 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length) // ARMv7-M has hardware integer division q15_t currentSample = q15_t((q31_t(samples[i]) << 8) / m_rxLevel); - uint8_t ctcssState = m_ctcssRX.process(currentSample); - switch (m_accessMode) { case 0U: stateMachine(cos); break; - case 1U: - // Delay the audio by 100ms to better match the CTCSS detector output - m_inputRB.put(currentSample); - m_inputRB.get(currentSample); + case 1U: { + uint8_t ctcssState = m_ctcssRX.process(currentSample); - if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { - // Not enough samples to determine if you have CTCSS, just carry on - } else { - bool validCTCSS = CTCSS_VALID(ctcssState); - stateMachine(validCTCSS); + // Delay the audio by 100ms to better match the CTCSS detector output + m_inputRB.put(currentSample); + m_inputRB.get(currentSample); + + if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { + // Not enough samples to determine if you have CTCSS, just carry on + } else { + bool validCTCSS = CTCSS_VALID(ctcssState); + stateMachine(validCTCSS); + } } break; - case 2U: - if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { - // Not enough samples to determine if you have CTCSS, just carry on - } else { - bool validCTCSS = CTCSS_VALID(ctcssState); - stateMachine(validCTCSS && cos); + case 2U: { + uint8_t ctcssState = m_ctcssRX.process(currentSample); + if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { + // Not enough samples to determine if you have CTCSS, just carry on + } else { + bool validCTCSS = CTCSS_VALID(ctcssState); + stateMachine(validCTCSS && cos); + } } break; - default: - if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { - // Not enough samples to determine if you have CTCSS, just carry on - } else if (CTCSS_READY(ctcssState) && m_modemState != STATE_FM) { - // We had enough samples for CTCSS and we are in some other mode than FM - bool validCTCSS = CTCSS_VALID(ctcssState); - stateMachine(validCTCSS && cos); - } else { - stateMachine(cos); + default: { + uint8_t ctcssState = m_ctcssRX.process(currentSample); + if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { + // Not enough samples to determine if you have CTCSS, just carry on + } else if (CTCSS_READY(ctcssState) && m_modemState != STATE_FM) { + // We had enough samples for CTCSS and we are in some other mode than FM + bool validCTCSS = CTCSS_VALID(ctcssState); + stateMachine(validCTCSS && cos); + } else { + stateMachine(cos); + } } break; } From 6dfe1a9271c46a62577e712177243806f3ebff96 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Mon, 20 Jul 2020 17:11:29 -0500 Subject: [PATCH 09/22] Add support for WA0EDA MTR2000 & MASTR3 boards --- IOPins.h | 5 +- Makefile | 18 +++++++ SerialSTM.cpp | 12 ++--- pins/pins_f4_stm32eda.h | 103 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 7 deletions(-) create mode 100644 pins/pins_f4_stm32eda.h diff --git a/IOPins.h b/IOPins.h index f3ea4ad..77e3bdc 100644 --- a/IOPins.h +++ b/IOPins.h @@ -62,9 +62,12 @@ #elif defined(DRCC_DVM_NQF) #include "pins/pins_f4_drcc_nqf.h" +#elif defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) + #include "pins/pins_f4_stm32eda.h" + #else #error "A valid board type macro need to be defined." #endif -#endif //#ifndef _IO_PINS_H \ No newline at end of file +#endif //#ifndef _IO_PINS_H diff --git a/Makefile b/Makefile index cd29ef8..2887a25 100644 --- a/Makefile +++ b/Makefile @@ -139,6 +139,10 @@ DEFS_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_DVM -DHSE_VA DEFS_RPT_HAT_TGO=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F40_41xxx -DSTM32F4_RPT_HAT_TGO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE # DRCC_DVM BG7NQF board: DEFS_DRCC_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DDRCC_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE +# WA0EDA F405 MTR2K, MASTR3 board: +DEFS_EDA_405=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F40_41xxx -DSTM32F4_EDA_405 -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE +# WA0EDA F446 MTR2K, MASTR3 board: +DEFS_EDA_446=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_EDA_446 -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE # Build compiler flags @@ -229,6 +233,18 @@ drcc_nqf: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_NQF drcc_nqf: LDFLAGS+=$(LDFLAGS_F4) drcc_nqf: release_f4 +eda405: GitVersion.h +eda405: CFLAGS+=$(CFLAGS_F4) $(DEFS_EDA_405) +eda405: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_EDA_405) +eda405: LDFLAGS+=$(LDFLAGS_F4) +eda405: release_f4 + +eda446: GitVersion.h +eda446: CFLAGS+=$(CFLAGS_F4) $(DEFS_EDA_446) +eda446: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_EDA_446) +eda446: LDFLAGS+=$(LDFLAGS_F4) +eda446: release_f4 + release_f4: $(BINDIR) release_f4: $(OBJDIR_F4) release_f4: $(BINDIR)/$(BINHEX_F4) @@ -350,6 +366,8 @@ endif deploy-f4m: deploy-pi deploy-dvm: deploy-pi +deploy-eda405: deploy-pi +deploy-eda446: deploy-pi deploy-pi-f7: ifneq ($(wildcard /usr/local/bin/stm32flash),) diff --git a/SerialSTM.cpp b/SerialSTM.cpp index 16c930d..b1bd27d 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -50,7 +50,7 @@ extern "C" { } /* ************* USART1 ***************** */ -#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)) || defined(DRCC_DVM) +#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)) || defined(DRCC_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) volatile uint8_t TXSerialfifo1[TX_SERIAL_FIFO_SIZE]; volatile uint8_t RXSerialfifo1[RX_SERIAL_FIFO_SIZE]; @@ -841,7 +841,7 @@ void CSerialPort::beginInt(uint8_t n, int speed) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) InitUSART3(speed); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) InitUSART1(speed); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) InitUSART2(speed); @@ -869,7 +869,7 @@ int CSerialPort::availableInt(uint8_t n) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) return AvailUSART3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) return AvailUSART1(); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) return AvailUSART2(); @@ -895,7 +895,7 @@ int CSerialPort::availableForWriteInt(uint8_t n) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) return AvailForWriteUSART3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) return AvailForWriteUSART1(); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) return AvailForWriteUSART2(); @@ -921,7 +921,7 @@ uint8_t CSerialPort::readInt(uint8_t n) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) return ReadUSART3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) return ReadUSART1(); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) return ReadUSART2(); @@ -949,7 +949,7 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool WriteUSART3(data, length); if (flush) TXSerialFlush3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) WriteUSART1(data, length); if (flush) TXSerialFlush1(); diff --git a/pins/pins_f4_stm32eda.h b/pins/pins_f4_stm32eda.h new file mode 100644 index 0000000..039de73 --- /dev/null +++ b/pins/pins_f4_stm32eda.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2019,2020 by BG5HHP + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _PINS_F4_STM32EDA +#define _PINS_F4_STM32EDA + +/* +Pin definitions for STM32F4 STM32-DVM-MTR2K & STM32-DVM-MASTR3: + +COS PB13 input +PTT PB12 output +COSLED PB4 output +LED PB3 output + +P25 PB8 output +NXDN PB9 output +DSTAR PB6 output +DMR PB5 output +YSF PB7 output +POCSAG PC10 output + +RX PB0 analog input +RSSI PB1 analog input +TX PA4 analog output + +EXT_CLK PA15 input +*/ + +#define PIN_COS GPIO_Pin_13 +#define PORT_COS GPIOB +#define RCC_Per_COS RCC_AHB1Periph_GPIOB + + +#define PIN_PTT GPIO_Pin_12 +#define PORT_PTT GPIOB +#define RCC_Per_PTT RCC_AHB1Periph_GPIOB + +#define PIN_COSLED GPIO_Pin_4 +#define PORT_COSLED GPIOB +#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB + +#define PIN_LED GPIO_Pin_3 +#define PORT_LED GPIOB +#define RCC_Per_LED RCC_AHB1Periph_GPIOB + +#define PIN_P25 GPIO_Pin_8 +#define PORT_P25 GPIOB +#define RCC_Per_P25 RCC_AHB1Periph_GPIOB + +#define PIN_NXDN GPIO_Pin_9 +#define PORT_NXDN GPIOB +#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB + +#define PIN_DSTAR GPIO_Pin_6 +#define PORT_DSTAR GPIOB +#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB + +#define PIN_DMR GPIO_Pin_5 +#define PORT_DMR GPIOB +#define RCC_Per_DMR RCC_AHB1Periph_GPIOB + +#define PIN_YSF GPIO_Pin_7 +#define PORT_YSF GPIOB +#define RCC_Per_YSF RCC_AHB1Periph_GPIOB + +#define PIN_POCSAG GPIO_Pin_10 +#define PORT_POCSAG GPIOC +#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOC + +#define PIN_EXT_CLK GPIO_Pin_15 +#define SRC_EXT_CLK GPIO_PinSource15 +#define PORT_EXT_CLK GPIOA + +#define PIN_RX GPIO_Pin_0 +#define PIN_RX_CH ADC_Channel_8 +#define PORT_RX GPIOB +#define RCC_Per_RX RCC_AHB1Periph_GPIOB + +#define PIN_RSSI GPIO_Pin_1 +#define PIN_RSSI_CH ADC_Channel_9 +#define PORT_RSSI GPIOB +#define RCC_Per_RSSI RCC_AHB1Periph_GPIOB + +#define PIN_TX GPIO_Pin_4 +#define PIN_TX_CH DAC_Channel_1 + +#endif + From e304f5cce26c6d7a80eba8eb74ea6021548cbd8f Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Tue, 21 Jul 2020 08:19:18 -0500 Subject: [PATCH 10/22] Added pin assignment for FM mode LED (WA0EDA) --- IO.cpp | 6 +++--- pins/pins_f4_stm32eda.h | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/IO.cpp b/IO.cpp index c36b6a9..f14dfcd 100644 --- a/IO.cpp +++ b/IO.cpp @@ -152,8 +152,8 @@ void CIO::selfTest() } #if defined(MODE_LEDS) - setDStarInt(true); - setDMRInt(false); + setDStarInt(false); + setDMRInt(true); setYSFInt(false); setP25Int(false); setNXDNInt(false); @@ -161,7 +161,7 @@ void CIO::selfTest() setFMInt(false); delayInt(250); - setDMRInt(true); + setDStarInt(true); delayInt(250); setYSFInt(true); diff --git a/pins/pins_f4_stm32eda.h b/pins/pins_f4_stm32eda.h index 039de73..ea3ae75 100644 --- a/pins/pins_f4_stm32eda.h +++ b/pins/pins_f4_stm32eda.h @@ -33,6 +33,7 @@ DSTAR PB6 output DMR PB5 output YSF PB7 output POCSAG PC10 output +FM PC11 output RX PB0 analog input RSSI PB1 analog input @@ -82,6 +83,10 @@ EXT_CLK PA15 input #define PORT_POCSAG GPIOC #define RCC_Per_POCSAG RCC_AHB1Periph_GPIOC +#define PIN_FM GPIO_Pin_11 +#define PORT_FM GPIOC +#define RCC_Per_FM RCC_AHB1Periph_GPIOC + #define PIN_EXT_CLK GPIO_Pin_15 #define SRC_EXT_CLK GPIO_PinSource15 #define PORT_EXT_CLK GPIOA From a2978d9e9184f7ae48fa1053826c4799b8b4ed81 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Tue, 21 Jul 2020 08:27:02 -0500 Subject: [PATCH 11/22] Removed a local change to not contaminate the repo --- IO.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IO.cpp b/IO.cpp index f14dfcd..c36b6a9 100644 --- a/IO.cpp +++ b/IO.cpp @@ -152,8 +152,8 @@ void CIO::selfTest() } #if defined(MODE_LEDS) - setDStarInt(false); - setDMRInt(true); + setDStarInt(true); + setDMRInt(false); setYSFInt(false); setP25Int(false); setNXDNInt(false); @@ -161,7 +161,7 @@ void CIO::selfTest() setFMInt(false); delayInt(250); - setDStarInt(true); + setDMRInt(true); delayInt(250); setYSFInt(true); From 823b91c97d08ea55f9123575f6ed4789344934b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20S=C3=A1nchez=20Raya?= Date: Mon, 3 Aug 2020 09:17:07 +0200 Subject: [PATCH 12/22] Update YSFRX.cpp Lower MAX_SYNC_FRAMES to 2, so decoder can recover and Yaesu pictures can pass through the modem without problem. --- YSFRX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YSFRX.cpp b/YSFRX.cpp index 88c6f83..3d4a3b5 100644 --- a/YSFRX.cpp +++ b/YSFRX.cpp @@ -36,7 +36,7 @@ const uint8_t NOAVEPTR = 99U; const uint16_t NOENDPTR = 9999U; -const unsigned int MAX_SYNC_FRAMES = 4U + 1U; +const unsigned int MAX_SYNC_FRAMES = 1U + 1U; CYSFRX::CYSFRX() : m_state(YSFRXS_NONE), From 632ddda68bb3182a1320be8f0ab47fe3a3abbbe6 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 31 Aug 2020 16:06:59 +0100 Subject: [PATCH 13/22] Change the handling of the mode LEDs. --- IO.cpp | 38 +++++++++++++++++++++++++++----------- IO.h | 2 +- SerialPort.cpp | 6 ++---- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/IO.cpp b/IO.cpp index c36b6a9..89a3050 100644 --- a/IO.cpp +++ b/IO.cpp @@ -220,7 +220,7 @@ void CIO::start() m_started = true; - setMode(); + setMode(STATE_IDLE); } void CIO::process() @@ -232,8 +232,7 @@ void CIO::process() if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25 || m_modemState == STATE_NXDN || m_modemState == STATE_POCSAG) { if (m_modemState == STATE_DMR && m_tx) dmrTX.setStart(false); - m_modemState = STATE_IDLE; - setMode(); + setMode(STATE_IDLE); } m_watchdog = 0U; @@ -516,17 +515,34 @@ void CIO::setADCDetection(bool detect) m_detect = detect; } -void CIO::setMode() +void CIO::setMode(MMDVM_STATE state) { + if (state == m_modemState) + return; + #if defined(MODE_LEDS) - setDStarInt(m_modemState == STATE_DSTAR); - setDMRInt(m_modemState == STATE_DMR); - setYSFInt(m_modemState == STATE_YSF); - setP25Int(m_modemState == STATE_P25); - setNXDNInt(m_modemState == STATE_NXDN); - setPOCSAGInt(m_modemState == STATE_POCSAG); - setFMInt(m_modemState == STATE_FM); + switch (m_modemState) { + case STATE_DSTAR: setDStarInt(false); break; + case STATE_DMR: setDMRInt(false); break; + case STATE_YSF: setYSFInt(false); break; + case STATE_P25: setP25Int(false); break; + case STATE_NXDN: setNXDNInt(false); break; + case STATE_POCSAG: setPOCSAGInt(false); break; + case STATE_FM: setFMInt(false); break; + } + + switch (state) { + case STATE_DSTAR: setDStarInt(true); break; + case STATE_DMR: setDMRInt(true); break; + case STATE_YSF: setYSFInt(true); break; + case STATE_P25: setP25Int(true); break; + case STATE_NXDN: setNXDNInt(true); break; + case STATE_POCSAG: setPOCSAGInt(true); break; + case STATE_FM: setFMInt(true); break; + } #endif + + m_modemState = state; } void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t cwIdTXLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, uint8_t fmTXLevel, int16_t txDCOffset, int16_t rxDCOffset, bool useCOSAsLockout) diff --git a/IO.h b/IO.h index 4a8231f..cd4d3d1 100644 --- a/IO.h +++ b/IO.h @@ -38,7 +38,7 @@ public: void setDecode(bool dcd); void setADCDetection(bool detect); - void setMode(); + void setMode(MMDVM_STATE state); void interrupt(); diff --git a/SerialPort.cpp b/SerialPort.cpp index 00380d8..35c28d7 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -103,7 +103,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200714 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20200831 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" @@ -568,9 +568,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState) cwIdTX.reset(); - m_modemState = modemState; - - io.setMode(); + io.setMode(modemState); } void CSerialPort::start() From fda1e3dcf42d9abc656caaeb80f26e68784a2c7f Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 1 Sep 2020 09:57:49 +0100 Subject: [PATCH 14/22] More LED fixes. --- IO.cpp | 8 +++++++- SerialPort.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/IO.cpp b/IO.cpp index 89a3050..ab003f2 100644 --- a/IO.cpp +++ b/IO.cpp @@ -133,7 +133,7 @@ void CIO::selfTest() { bool ledValue = false; - for (uint8_t i = 0; i < 6; i++) { + for (uint8_t i = 0U; i < 6U; i++) { ledValue = !ledValue; // We exclude PTT to avoid trigger the transmitter @@ -144,9 +144,15 @@ void CIO::selfTest() setDMRInt(ledValue); setYSFInt(ledValue); setP25Int(ledValue); +#if !defined(USE_ALTERNATE_NXDN_LEDS) setNXDNInt(ledValue); +#endif +#if !defined(USE_ALTERNATE_POCSAG_LEDS) setPOCSAGInt(ledValue); +#endif +#if !defined(USE_ALTERNATE_FM_LEDS) setFMInt(ledValue); +#endif #endif delayInt(250); } diff --git a/SerialPort.cpp b/SerialPort.cpp index 35c28d7..17cb476 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -103,7 +103,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200831 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20200901 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" From 2509ab5ba1efd082c9d76ba473cad3f2e8fb6a7a Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 1 Sep 2020 13:27:29 +0100 Subject: [PATCH 15/22] Fix the self-test LEDs. --- IO.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/IO.cpp b/IO.cpp index ab003f2..5e10feb 100644 --- a/IO.cpp +++ b/IO.cpp @@ -158,13 +158,20 @@ void CIO::selfTest() } #if defined(MODE_LEDS) - setDStarInt(true); + setDStarInt(false); setDMRInt(false); setYSFInt(false); setP25Int(false); +#if !defined(USE_ALTERNATE_NXDN_LEDS) setNXDNInt(false); +#endif +#if !defined(USE_ALTERNATE_POCSAG_LEDS) setPOCSAGInt(false); +#endif +#if !defined(USE_ALTERNATE_FM_LEDS) setFMInt(false); +#endif + setDStarInt(true); delayInt(250); setDMRInt(true); From 061e10e3958d224fe4703e2c86de4ac422d568d8 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 11 Nov 2020 15:23:14 -0300 Subject: [PATCH 16/22] Fixing deploy-pi and deploy-pi-f7 (M0VSE advice) --- Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 2887a25..a0f1a29 100644 --- a/Makefile +++ b/Makefile @@ -354,14 +354,12 @@ endif deploy-pi: ifneq ($(wildcard /usr/local/bin/stm32flash),) -/usr/local/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0 - -/usr/local/bin/stm32ld /dev/ttyAMA0 57600 bin/$(BINBIN_F4) - /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F4) -g 0x0 -R -c /dev/ttyAMA0 + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F4) -g 0x0 -R /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) -/usr/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0 - -/usr/bin/stm32ld /dev/ttyAMA0 57600 bin/$(BINBIN_F4) - /usr/bin/stm32flash -v -w bin/$(BINBIN_F4) -g 0x0 -R -c /dev/ttyAMA0 + /usr/bin/stm32flash -v -w bin/$(BINBIN_F4) -g 0x0 -R /dev/ttyAMA0 endif deploy-f4m: deploy-pi @@ -372,11 +370,11 @@ deploy-eda446: deploy-pi deploy-pi-f7: ifneq ($(wildcard /usr/local/bin/stm32flash),) -/usr/local/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0 - /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0 + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R /dev/ttyAMA0 else ifneq ($(wildcard /usr/bin/stm32flash),) -/usr/bin/stm32flash -i 20,-21,21:-20,21 /dev/ttyAMA0 - /usr/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R -c /dev/ttyAMA0 + /usr/bin/stm32flash -v -w bin/$(BINBIN_F7) -g 0x0 -R /dev/ttyAMA0 endif deploy-f7m: deploy-pi-f7 From 657e71238db319e8341a7e1ef3d450e1447103ed Mon Sep 17 00:00:00 2001 From: Tim Stewart Date: Sat, 28 Nov 2020 22:29:34 -0500 Subject: [PATCH 17/22] Detect full 48 bits of last data frame in a transmission While testing new support for DV Fast Data, I ran across a particular image that reliably generated a bit sequence that the MDMVM firmware interpreted as an end-of-transmission. I dug a bit and discovered that MMDVM only matches on 32 bits of the last data frame instead of the full 48 bits. See http://www.arrl.org/files/file/D-STAR.pdf section 2.1.2, item (6) for details. --- DStarRX.cpp | 20 +++++++++++++++++--- DStarRX.h | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/DStarRX.cpp b/DStarRX.cpp index f14f3fd..72b143e 100644 --- a/DStarRX.cpp +++ b/DStarRX.cpp @@ -41,8 +41,8 @@ const uint32_t DATA_SYNC_MASK = 0x00FFFFFFU; const uint8_t DATA_SYNC_ERRS = 2U; // D-Star bit order version of 0x55 0x55 0xC8 0x7A -const uint32_t END_SYNC_DATA = 0xAAAA135EU; -const uint32_t END_SYNC_MASK = 0xFFFFFFFFU; +const uint64_t END_SYNC_DATA = 0x0000AAAAAAAA135EU; +const uint64_t END_SYNC_MASK = 0x0000FFFFFFFFFFFFU; const uint8_t END_SYNC_ERRS = 1U; const uint8_t BIT_MASK_TABLE0[] = {0x7FU, 0xBFU, 0xDFU, 0xEFU, 0xF7U, 0xFBU, 0xFDU, 0xFEU}; @@ -242,6 +242,7 @@ m_pll(0U), m_prev(false), m_rxState(DSRXS_NONE), m_patternBuffer(0x00U), +m_patternBuffer64(0x00U), m_rxBuffer(), m_rxBufferBits(0U), m_dataBits(0U), @@ -263,6 +264,7 @@ void CDStarRX::reset() m_prev = false; m_rxState = DSRXS_NONE; m_patternBuffer = 0x00U; + m_patternBuffer64 = 0x00U; m_rxBufferBits = 0U; m_dataBits = 0U; m_rssiAccum = 0U; @@ -314,6 +316,10 @@ void CDStarRX::processNone(bool bit) if (bit) m_patternBuffer |= 0x01U; + m_patternBuffer64 <<= 1; + if (bit) + m_patternBuffer64 |= 0x01U; + // Fuzzy matching of the frame sync sequence if (countBits32((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) <= FRAME_SYNC_ERRS) { DEBUG1("DStarRX: found frame sync in None"); @@ -357,6 +363,10 @@ void CDStarRX::processHeader(bool bit) if (bit) m_patternBuffer |= 0x01U; + m_patternBuffer64 <<= 1; + if (bit) + m_patternBuffer64 |= 0x01U; + WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit); m_rxBufferBits++; @@ -389,11 +399,15 @@ void CDStarRX::processData(bool bit) if (bit) m_patternBuffer |= 0x01U; + m_patternBuffer64 <<= 1; + if (bit) + m_patternBuffer64 |= 0x01U; + WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit); m_rxBufferBits++; // Fuzzy matching of the end frame sequences - if (countBits32((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) { + if (countBits64((m_patternBuffer64 & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) { DEBUG1("DStarRX: Found end sync in Data"); io.setDecode(false); diff --git a/DStarRX.h b/DStarRX.h index d636cde..cc327ce 100644 --- a/DStarRX.h +++ b/DStarRX.h @@ -41,6 +41,7 @@ private: bool m_prev; DSRX_STATE m_rxState; uint32_t m_patternBuffer; + uint64_t m_patternBuffer64; uint8_t m_rxBuffer[100U]; unsigned int m_rxBufferBits; unsigned int m_dataBits; From 9440b4311468bc34d6c33195dccafdf325e5a347 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 14 Dec 2020 09:45:53 +0000 Subject: [PATCH 18/22] Simplify the D-Star fast data support. --- DStarRX.cpp | 38 ++++++++++++-------------------------- DStarRX.h | 5 ++--- SerialPort.cpp | 2 +- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/DStarRX.cpp b/DStarRX.cpp index 72b143e..86f7f31 100644 --- a/DStarRX.cpp +++ b/DStarRX.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2017 by Jonathan Naylor G4KLX + * Copyright (C) 2009-2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -31,13 +31,13 @@ const uint32_t INC = PLLINC / 32U; const unsigned int MAX_SYNC_BITS = 100U * DSTAR_DATA_LENGTH_BITS; // D-Star bit order version of 0x55 0x55 0x6E 0x0A -const uint32_t FRAME_SYNC_DATA = 0x00557650U; -const uint32_t FRAME_SYNC_MASK = 0x00FFFFFFU; +const uint64_t FRAME_SYNC_DATA = 0x0000000000557650U; +const uint64_t FRAME_SYNC_MASK = 0x0000000000FFFFFFU; const uint8_t FRAME_SYNC_ERRS = 2U; // D-Star bit order version of 0x55 0x2D 0x16 -const uint32_t DATA_SYNC_DATA = 0x00AAB468U; -const uint32_t DATA_SYNC_MASK = 0x00FFFFFFU; +const uint64_t DATA_SYNC_DATA = 0x0000000000AAB468U; +const uint64_t DATA_SYNC_MASK = 0x0000000000FFFFFFU; const uint8_t DATA_SYNC_ERRS = 2U; // D-Star bit order version of 0x55 0x55 0xC8 0x7A @@ -242,7 +242,6 @@ m_pll(0U), m_prev(false), m_rxState(DSRXS_NONE), m_patternBuffer(0x00U), -m_patternBuffer64(0x00U), m_rxBuffer(), m_rxBufferBits(0U), m_dataBits(0U), @@ -264,7 +263,6 @@ void CDStarRX::reset() m_prev = false; m_rxState = DSRXS_NONE; m_patternBuffer = 0x00U; - m_patternBuffer64 = 0x00U; m_rxBufferBits = 0U; m_dataBits = 0U; m_rssiAccum = 0U; @@ -316,12 +314,8 @@ void CDStarRX::processNone(bool bit) if (bit) m_patternBuffer |= 0x01U; - m_patternBuffer64 <<= 1; - if (bit) - m_patternBuffer64 |= 0x01U; - // Fuzzy matching of the frame sync sequence - if (countBits32((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) <= FRAME_SYNC_ERRS) { + if (countBits64((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) <= FRAME_SYNC_ERRS) { DEBUG1("DStarRX: found frame sync in None"); ::memset(m_rxBuffer, 0x00U, DSTAR_FEC_SECTION_LENGTH_BYTES); @@ -335,7 +329,7 @@ void CDStarRX::processNone(bool bit) } // Exact matching of the data sync bit sequence - if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) == 0U) { + if (countBits64((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) == 0U) { DEBUG1("DStarRX: found data sync in None"); io.setDecode(true); @@ -363,10 +357,6 @@ void CDStarRX::processHeader(bool bit) if (bit) m_patternBuffer |= 0x01U; - m_patternBuffer64 <<= 1; - if (bit) - m_patternBuffer64 |= 0x01U; - WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit); m_rxBufferBits++; @@ -399,15 +389,11 @@ void CDStarRX::processData(bool bit) if (bit) m_patternBuffer |= 0x01U; - m_patternBuffer64 <<= 1; - if (bit) - m_patternBuffer64 |= 0x01U; - WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit); m_rxBufferBits++; // Fuzzy matching of the end frame sequences - if (countBits64((m_patternBuffer64 & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) { + if (countBits64((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) { DEBUG1("DStarRX: Found end sync in Data"); io.setDecode(false); @@ -422,7 +408,7 @@ void CDStarRX::processData(bool bit) // Fuzzy matching of the data sync bit sequence bool syncSeen = false; if (m_rxBufferBits >= (DSTAR_DATA_LENGTH_BITS - 3U)) { - if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) { + if (countBits64((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) { m_rxBufferBits = DSTAR_DATA_LENGTH_BITS; m_dataBits = MAX_SYNC_BITS; syncSeen = true; @@ -432,9 +418,9 @@ void CDStarRX::processData(bool bit) // Check to see if the sync is arriving late if (m_rxBufferBits == DSTAR_DATA_LENGTH_BITS && !syncSeen) { for (uint8_t i = 1U; i <= 3U; i++) { - uint32_t syncMask = DATA_SYNC_MASK >> i; - uint32_t syncData = DATA_SYNC_DATA >> i; - if (countBits32((m_patternBuffer & syncMask) ^ syncData) <= DATA_SYNC_ERRS) { + uint64_t syncMask = DATA_SYNC_MASK >> i; + uint64_t syncData = DATA_SYNC_DATA >> i; + if (countBits64((m_patternBuffer & syncMask) ^ syncData) <= DATA_SYNC_ERRS) { m_rxBufferBits -= i; break; } diff --git a/DStarRX.h b/DStarRX.h index cc327ce..1e1c4e5 100644 --- a/DStarRX.h +++ b/DStarRX.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2017,2020 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 @@ -40,8 +40,7 @@ private: uint32_t m_pll; bool m_prev; DSRX_STATE m_rxState; - uint32_t m_patternBuffer; - uint64_t m_patternBuffer64; + uint64_t m_patternBuffer; uint8_t m_rxBuffer[100U]; unsigned int m_rxBufferBits; unsigned int m_dataBits; diff --git a/SerialPort.cpp b/SerialPort.cpp index 17cb476..f47e01c 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -103,7 +103,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200901 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20201214 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" From 7148cf9f7d62b0aa1edbad5b5078d96e2da35e5c Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 14 Dec 2020 09:46:53 +0000 Subject: [PATCH 19/22] Add I2C support. --- STM32F4XX_Lib | 2 +- STM32F7XX_Lib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/STM32F4XX_Lib b/STM32F4XX_Lib index bcd346f..18aeb6e 160000 --- a/STM32F4XX_Lib +++ b/STM32F4XX_Lib @@ -1 +1 @@ -Subproject commit bcd346f53036ed0eab6643d662a410861655afe2 +Subproject commit 18aeb6ea3a236088fc9f376077c651098e3a495e diff --git a/STM32F7XX_Lib b/STM32F7XX_Lib index 2d5f423..6241f7c 160000 --- a/STM32F7XX_Lib +++ b/STM32F7XX_Lib @@ -1 +1 @@ -Subproject commit 2d5f4236fa5e9828beadbc72473293f25b3ad65e +Subproject commit 6241f7c05eeb6cf1ecd16ca0274bf310efee853f From 842dcdb5c5327b77b7d5c5c8ad5b296454e5f6e9 Mon Sep 17 00:00:00 2001 From: Shawn Chain Date: Fri, 1 Jan 2021 19:48:07 +0800 Subject: [PATCH 20/22] Add DRCC_DVM_HHP446 board support --- IOPins.h | 3 + Makefile | 6 ++ SerialPort.cpp | 6 +- pins/pins_f4_drcc_hhp446.h | 143 +++++++++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 pins/pins_f4_drcc_hhp446.h diff --git a/IOPins.h b/IOPins.h index 77e3bdc..fe0fea4 100644 --- a/IOPins.h +++ b/IOPins.h @@ -62,6 +62,9 @@ #elif defined(DRCC_DVM_NQF) #include "pins/pins_f4_drcc_nqf.h" +#elif defined(DRCC_DVM_HHP446) + #include "pins/pins_f4_drcc_hhp446.h" + #elif defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) #include "pins/pins_f4_stm32eda.h" diff --git a/Makefile b/Makefile index a0f1a29..131b990 100644 --- a/Makefile +++ b/Makefile @@ -233,6 +233,12 @@ drcc_nqf: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_NQF drcc_nqf: LDFLAGS+=$(LDFLAGS_F4) drcc_nqf: release_f4 +hhp446: GitVersion.h +hhp446: CFLAGS+=$(CFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_HHP446 +hhp446: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_HHP446 +hhp446: LDFLAGS+=$(LDFLAGS_F4) +hhp446: release_f4 + eda405: GitVersion.h eda405: CFLAGS+=$(CFLAGS_F4) $(DEFS_EDA_405) eda405: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_EDA_405) diff --git a/SerialPort.cpp b/SerialPort.cpp index f47e01c..9746a46 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -97,13 +97,13 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #if defined(DRCC_DVM_NQF) #define HW_TYPE "MMDVM DRCC_DVM_NQF" -#elif defined(STM32F4_RPT_HAT_TGO) -#define HW_TYPE "MMDVM RPT_HAT_TGO" +#elif defined(DRCC_DVM_HHP446) +#define HW_TYPE "MMDVM DRCC_DVM_HHP(446)" #else #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20201214 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20210101 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" diff --git a/pins/pins_f4_drcc_hhp446.h b/pins/pins_f4_drcc_hhp446.h new file mode 100644 index 0000000..feb99e6 --- /dev/null +++ b/pins/pins_f4_drcc_hhp446.h @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2019,2020 by BG5HHP + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _PINS_F4_DRCC_HHP446_H +#define _PINS_F4_DRCC_HHP446_H + +/* +Pin definitions for DRCC_DVM BG5HHP F446 board rev1 + +TX/PTT_LED PB12 output +RX/COS_LED PB5 output +STATUS_LED PB10 output + +COS_IN PB13 input + +DSTAR N/A +DMR N/A +YSF N/A +P25 N/A +NXDN N/A +POCSAG N/A + +MDMR/BIT0 PB8 output +MYSF/BIT1 PB9 output +MDSTAR/BIT2 PB14 output +MP25/BIT3 PB15 output Generic Mode Pins +MNXDN N/A +MPOCSAG N/A + +RX PA0 analog input +RSSI PA1 analog input +TX PA4 analog output + +EXT_CLK N/A + +UART1_TX PA9 output +UART1_RX PA10 output Host Data Communication + +UART2_TX PA2 output +UART2_RX PA3 output Nextion Data Communication + +I2C1_SCL PB6 output +I2C1_SDA PB7 output OLED Data Communication as master + +*/ + +#define PIN_COS GPIO_Pin_13 +#define PORT_COS GPIOB +#define RCC_Per_COS RCC_AHB1Periph_GPIOB + +#define PIN_PTT GPIO_Pin_12 +#define PORT_PTT GPIOB +#define RCC_Per_PTT RCC_AHB1Periph_GPIOB + +#define PIN_COSLED GPIO_Pin_5 +#define PORT_COSLED GPIOB +#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB + +#define PIN_LED GPIO_Pin_10 +#define PORT_LED GPIOB +#define RCC_Per_LED RCC_AHB1Periph_GPIOB + +#define PIN_TXLED GPIO_Pin_4 +#define PORT_TXLED GPIOB +#define RCC_Per_TXLED RCC_AHB1Periph_GPIOB + +// #define PIN_P25 GPIO_Pin_3 +// #define PORT_P25 GPIOB +// #define RCC_Per_P25 RCC_AHB1Periph_GPIOB + +// #define PIN_NXDN GPIO_Pin_10 +// #define PORT_NXDN GPIOA +// #define RCC_Per_NXDN RCC_AHB1Periph_GPIOA + +// #define PIN_POCSAG GPIO_Pin_12 +// #define PORT_POCSAG GPIOB +// #define RCC_Per_POCSAG RCC_AHB1Periph_GPIOB + +// #define PIN_DSTAR GPIO_Pin_10 +// #define PORT_DSTAR GPIOB +// #define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB + +// #define PIN_DMR GPIO_Pin_4 +// #define PORT_DMR GPIOB +// #define RCC_Per_DMR RCC_AHB1Periph_GPIOB + +// #define PIN_YSF GPIO_Pin_5 +// #define PORT_YSF GPIOB +// #define RCC_Per_YSF RCC_AHB1Periph_GPIOB + +#if defined(MODE_PINS) +#define PIN_MP25 GPIO_Pin_15 +#define PORT_MP25 GPIOB +#define RCC_Per_MP25 RCC_AHB1Periph_GPIOB + +#define PIN_MDSTAR GPIO_Pin_9 +#define PORT_MDSTAR GPIOB +#define RCC_Per_MDSTAR RCC_AHB1Periph_GPIOB + +#define PIN_MDMR GPIO_Pin_8 +#define PORT_MDMR GPIOB +#define RCC_Per_MDMR RCC_AHB1Periph_GPIOB + +#define PIN_MYSF GPIO_Pin_14 +#define PORT_MYSF GPIOB +#define RCC_Per_MYSF RCC_AHB1Periph_GPIOB +#endif + +#define PIN_EXT_CLK GPIO_Pin_15 +#define SRC_EXT_CLK GPIO_PinSource15 +#define PORT_EXT_CLK GPIOA + +#define PIN_RX GPIO_Pin_0 +#define PIN_RX_CH ADC_Channel_0 +#define PORT_RX GPIOA +#define RCC_Per_RX RCC_AHB1Periph_GPIOA + +#define PIN_RSSI GPIO_Pin_1 +#define PIN_RSSI_CH ADC_Channel_1 +#define PORT_RSSI GPIOA +#define RCC_Per_RSSI RCC_AHB1Periph_GPIOA + +#define PIN_TX GPIO_Pin_4 +#define PIN_TX_CH DAC_Channel_1 +#define PORT_TX GPIOA +#define RCC_Per_TX RCC_AHB1Periph_GPIOA + +#endif \ No newline at end of file From 0736a5cbe80149b46451fa5884c413b88dc1b0d6 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Sun, 18 Apr 2021 09:50:46 -0400 Subject: [PATCH 21/22] RB STM32_DVM_F7 support --- IOPins.h | 3 ++ Makefile | 14 +++-- SerialPort.cpp | 4 ++ pins/pins_f4_stm32dvm_v3.h | 10 +++- pins/pins_f7_stm32dvm_v5.h | 108 +++++++++++++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 pins/pins_f7_stm32dvm_v5.h diff --git a/IOPins.h b/IOPins.h index fe0fea4..0adaea6 100644 --- a/IOPins.h +++ b/IOPins.h @@ -59,6 +59,9 @@ #elif defined(STM32F4_DVM) #include "pins/pins_f4_stm32dvm_v3.h" +#elif defined(STM32F7_DVM) + #include "pins/pins_f7_stm32dvm_v5.h" + #elif defined(DRCC_DVM_NQF) #include "pins/pins_f4_drcc_nqf.h" diff --git a/Makefile b/Makefile index 131b990..230af0c 100644 --- a/Makefile +++ b/Makefile @@ -133,8 +133,10 @@ DEFS_PI_F722=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_PI -DHSE_VAL DEFS_F7M=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_F7M -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE # MMDVM_RPT_Hat F0DEI, DB9MAT, DF2ET board: DEFS_RPT_HAT=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F722_RPT_HAT -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE -# STM32F4 DVM board: +# RB STM32F4_DVM board: DEFS_DVM=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE +# RB STM32F7 DVM board: +DEFS_DVM722=-DUSE_HAL_DRIVER -DSTM32F722xx -DSTM32F7XX -DSTM32F7_DVM -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE # MMDVM_RPT_Hat BG4TGO, BG5HHP board: DEFS_RPT_HAT_TGO=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F40_41xxx -DSTM32F4_RPT_HAT_TGO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE # DRCC_DVM BG7NQF board: @@ -222,11 +224,17 @@ f767: LDFLAGS+=$(LDFLAGS_F767) f767: release_f7 dvm: GitVersion.h -dvm: CFLAGS+=$(CFLAGS_F4) $(DEFS_DVM) -dvm: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DVM) +dvm: CFLAGS+=$(CFLAGS_F4) $(DEFS_DVM) -DDRCC_DVM_446 +dvm: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DVM) -DDRCC_DVM_446 dvm: LDFLAGS+=$(LDFLAGS_F4) dvm: release_f4 +dvm722: GitVersion.h +dvm722: CFLAGS+=$(CFLAGS_F7) $(DEFS_DVM722) -DDRCC_DVM_722 +dvm722: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_DVM722) -DDRCC_DVM_722 +dvm722: LDFLAGS+=$(LDFLAGS_F722) +dvm722: release_f7 + drcc_nqf: GitVersion.h drcc_nqf: CFLAGS+=$(CFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_NQF drcc_nqf: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_DRCC_DVM) -DDRCC_DVM_NQF diff --git a/SerialPort.cpp b/SerialPort.cpp index 9746a46..6d81140 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -99,6 +99,10 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM DRCC_DVM_NQF" #elif defined(DRCC_DVM_HHP446) #define HW_TYPE "MMDVM DRCC_DVM_HHP(446)" +#elif defined(DRCC_DVM_722) +#define HW_TYPE "MMDVM RB_STM32_DVM(722)" +#elif defined(DRCC_DVM_446) +#define HW_TYPE "MMDVM RB_STM32_DVM(446)" #else #define HW_TYPE "MMDVM" #endif diff --git a/pins/pins_f4_stm32dvm_v3.h b/pins/pins_f4_stm32dvm_v3.h index ff7895c..35e06e1 100644 --- a/pins/pins_f4_stm32dvm_v3.h +++ b/pins/pins_f4_stm32dvm_v3.h @@ -32,7 +32,7 @@ NXDN PB9 output DSTAR PB6 output DMR PB5 output YSF PB7 output -POCSAG PC10 output +POCSAG PC10 output (Not Valid) RX PB0 analog input RSSI PB1 analog input @@ -78,9 +78,15 @@ EXT_CLK PA15 input #define PORT_YSF GPIOB #define RCC_Per_YSF RCC_AHB1Periph_GPIOB +/* #define PIN_POCSAG GPIO_Pin_10 #define PORT_POCSAG GPIOC #define RCC_Per_POCSAG RCC_AHB1Periph_GPIOC +*/ + +#define PIN_FM GPIO_Pin_14 +#define PORT_FM GPIOB +#define RCC_Per_FM RCC_AHB1Periph_GPIOB #define PIN_EXT_CLK GPIO_Pin_15 #define SRC_EXT_CLK GPIO_PinSource15 @@ -99,4 +105,4 @@ EXT_CLK PA15 input #define PIN_TX GPIO_Pin_4 #define PIN_TX_CH DAC_Channel_1 -#endif \ No newline at end of file +#endif diff --git a/pins/pins_f7_stm32dvm_v5.h b/pins/pins_f7_stm32dvm_v5.h new file mode 100644 index 0000000..0e3ed4f --- /dev/null +++ b/pins/pins_f7_stm32dvm_v5.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2019,2020 by BG5HHP + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _PINS_F7_STM32DVM_V5_H +#define _PINS_F7_STM32DVM_V5_H + +/* +Pin definitions for STM32F4 STM32-DVM rev 5 Board: + +COS PB13 input +PTT PB12 output +COSLED PB4 output +LED PB3 output + +P25 PB8 output +NXDN PB9 output +DSTAR PB6 output +DMR PB5 output +YSF PB7 output +POCSAG PC10 output (Not Valid) + +RX PB0 analog input +RSSI PB1 analog input +TX PA4 analog output + +EXT_CLK PA15 input +*/ + +#define PIN_COS GPIO_Pin_13 +#define PORT_COS GPIOB +#define RCC_Per_COS RCC_AHB1Periph_GPIOB + + +#define PIN_PTT GPIO_Pin_12 +#define PORT_PTT GPIOB +#define RCC_Per_PTT RCC_AHB1Periph_GPIOB + +#define PIN_COSLED GPIO_Pin_4 +#define PORT_COSLED GPIOB +#define RCC_Per_COSLED RCC_AHB1Periph_GPIOB + +#define PIN_LED GPIO_Pin_3 +#define PORT_LED GPIOB +#define RCC_Per_LED RCC_AHB1Periph_GPIOB + +#define PIN_P25 GPIO_Pin_8 +#define PORT_P25 GPIOB +#define RCC_Per_P25 RCC_AHB1Periph_GPIOB + +#define PIN_NXDN GPIO_Pin_9 +#define PORT_NXDN GPIOB +#define RCC_Per_NXDN RCC_AHB1Periph_GPIOB + +#define PIN_DSTAR GPIO_Pin_6 +#define PORT_DSTAR GPIOB +#define RCC_Per_DSTAR RCC_AHB1Periph_GPIOB + +#define PIN_DMR GPIO_Pin_5 +#define PORT_DMR GPIOB +#define RCC_Per_DMR RCC_AHB1Periph_GPIOB + +#define PIN_YSF GPIO_Pin_7 +#define PORT_YSF GPIOB +#define RCC_Per_YSF RCC_AHB1Periph_GPIOB + +/* +#define PIN_POCSAG GPIO_Pin_10 +#define PORT_POCSAG GPIOC +#define RCC_Per_POCSAG RCC_AHB1Periph_GPIOC +*/ + +#define PIN_FM GPIO_Pin_14 +#define PORT_FM GPIOB +#define RCC_Per_FM RCC_AHB1Periph_GPIOB + +#define PIN_EXT_CLK GPIO_Pin_15 +#define SRC_EXT_CLK GPIO_PinSource15 +#define PORT_EXT_CLK GPIOA + +#define PIN_RX GPIO_Pin_0 +#define PIN_RX_CH ADC_Channel_8 +#define PORT_RX GPIOB +#define RCC_Per_RX RCC_AHB1Periph_GPIOB + +#define PIN_RSSI GPIO_Pin_1 +#define PIN_RSSI_CH ADC_Channel_9 +#define PORT_RSSI GPIOB +#define RCC_Per_RSSI RCC_AHB1Periph_GPIOB + +#define PIN_TX GPIO_Pin_4 +#define PIN_TX_CH DAC_Channel_1 + +#endif From 752e13821f6a0483d508210eeef9194dee6ccdc8 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Sun, 2 May 2021 07:19:24 -0400 Subject: [PATCH 22/22] Add STM32F7-DVM board --- SerialSTM.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SerialSTM.cpp b/SerialSTM.cpp index b1bd27d..52badd6 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -27,14 +27,14 @@ Pin definitions: - Host communication: -USART1 - TXD PA9 - RXD PA10 (MMDVM-Pi board, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board) +USART1 - TXD PA9 - RXD PA10 (MMDVM-Pi board, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board, STM32F7-DVM board) USART2 - TXD PA2 - RXD PA3 (Nucleo64 F446RE board, Morpho or Arduino header, MMDVM_RPT_Hat BG4TGO/BG5HHP board) USART3 - TXD PC10 - RXD PC11 (Discovery board) USART3 - TXD PD8 - RXD PD9 (Nucleo144 F767ZI board) - Serial repeater: USART1 - TXD PA9 - RXD PA10 (Nucleo with Arduino header) -UART5 - TXD PC12 - RXD PD2 (Discovery, MMDVM-Pi, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board, Nucleo64 with Morpho header and Nucleo144 F767ZI, MMDVM_RPT_Hat BG4TGO/BG5HHP board) +UART5 - TXD PC12 - RXD PD2 (Discovery, MMDVM-Pi, MMDVM-Pi F722 board, MMDVM-F4M board, STM32F722-F7M board, STM32F4-DVM board, STM32F7-DVM board, Nucleo64 with Morpho header and Nucleo144 F767ZI, MMDVM_RPT_Hat BG4TGO/BG5HHP board) */ #if defined(STM32F4XX) || defined(STM32F7XX) @@ -50,7 +50,7 @@ extern "C" { } /* ************* USART1 ***************** */ -#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)) || defined(DRCC_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) +#if defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_F7M) || defined(STM32F722_PI) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F7_DVM) || (defined(STM32F4_NUCLEO) && defined(STM32F4_NUCLEO_ARDUINO_HEADER)) || defined(DRCC_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) volatile uint8_t TXSerialfifo1[TX_SERIAL_FIFO_SIZE]; volatile uint8_t RXSerialfifo1[RX_SERIAL_FIFO_SIZE]; @@ -841,7 +841,7 @@ void CSerialPort::beginInt(uint8_t n, int speed) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) InitUSART3(speed); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F7_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) InitUSART1(speed); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) InitUSART2(speed); @@ -869,7 +869,7 @@ int CSerialPort::availableInt(uint8_t n) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) return AvailUSART3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F7_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) return AvailUSART1(); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) return AvailUSART2(); @@ -895,7 +895,7 @@ int CSerialPort::availableForWriteInt(uint8_t n) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) return AvailForWriteUSART3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F7_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) return AvailForWriteUSART1(); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) return AvailForWriteUSART2(); @@ -921,7 +921,7 @@ uint8_t CSerialPort::readInt(uint8_t n) case 1U: #if defined(STM32F4_DISCOVERY) || defined(STM32F7_NUCLEO) return ReadUSART3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F7_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) return ReadUSART1(); #elif defined(STM32F4_NUCLEO) || defined(STM32F4_RPT_HAT_TGO) return ReadUSART2(); @@ -949,7 +949,7 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool WriteUSART3(data, length); if (flush) TXSerialFlush3(); - #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) + #elif defined(STM32F4_PI) || defined(STM32F4_F4M) || defined(STM32F722_PI) || defined(STM32F722_F7M) || defined(STM32F722_RPT_HAT) || defined(STM32F4_DVM) || defined(STM32F7_DVM) || defined(STM32F4_EDA_405) || defined(STM32F4_EDA_446) WriteUSART1(data, length); if (flush) TXSerialFlush1();