From 9147f68d28ef91839a70ced3d11709920b2e4aab Mon Sep 17 00:00:00 2001 From: phl0 Date: Sat, 24 Feb 2018 12:56:19 +0100 Subject: [PATCH 001/239] Add config option for Dual Hat --- Config.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Config.h b/Config.h index cade0eb..c42ddaf 100644 --- a/Config.h +++ b/Config.h @@ -26,7 +26,9 @@ #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 -// 4) Nano hotSPOT (BI7JTA) +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT // Enable ADF7021 support: From 33681d749bfb44b273293397329e9242cfe3235b Mon Sep 17 00:00:00 2001 From: phl0 Date: Sat, 24 Feb 2018 12:57:49 +0100 Subject: [PATCH 002/239] Add build instructions --- BUILD.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BUILD.md b/BUILD.md index 834fe63..a1af057 100644 --- a/BUILD.md +++ b/BUILD.md @@ -544,6 +544,8 @@ modified RF7021SE and Blue Pill STM32F103). - #define MMDVM_HS_HAT_REV12: enable this option if you have a MMDVM_HS_Hat board for RPi. +- #define MMDVM_HS_DUAL_HAT_REV10: enable this option if you have a MMDVM_HS_Dual_Hat board for RPi/USB. + - #define NANO_HOTSPOT: enable this option if you have a Nano hotSPOT (BI7JTA). - #define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default). From f832ac0a556bc8c58d0230129e1234cf21402a43 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sat, 24 Feb 2018 13:02:21 +0100 Subject: [PATCH 003/239] Add code for MMDVM_HS_Dual_Hat --- IOArduino.cpp | 6 +++--- IOSTM.cpp | 12 ++++++------ version.h | 2 ++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/IOArduino.cpp b/IOArduino.cpp index d31a3c1..f63a34b 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -51,7 +51,7 @@ #define PIN_PTT_LED PB14 #define PIN_COS_LED PB15 -#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(NANO_HOTSPOT) +#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) #define PIN_SCLK PB5 #define PIN_SREAD PB7 @@ -75,7 +75,7 @@ #define PIN_COS_LED PB15 #else -#error "Either ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12 or NANO_HOTSPOT need to be defined" +#error "Either ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10 or NANO_HOTSPOT need to be defined" #endif #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) @@ -148,7 +148,7 @@ void CIO::Init() { #if defined (__STM32F1__) -#if defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(NANO_HOTSPOT) +#if defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY); #endif diff --git a/IOSTM.cpp b/IOSTM.cpp index d2bd437..17e4c73 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -152,7 +152,7 @@ #define PIN_COS_LED GPIO_Pin_15 #define PORT_COS_LED GPIOB -#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(NANO_HOTSPOT) +#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -225,7 +225,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12 or NANO_HOTSPOT need to be defined" +#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10 or NANO_HOTSPOT need to be defined" #endif extern "C" { @@ -247,7 +247,7 @@ extern "C" { } #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -284,7 +284,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif @@ -454,7 +454,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -502,7 +502,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt diff --git a/version.h b/version.h index ccc5845..179a83f 100644 --- a/version.h +++ b/version.h @@ -31,6 +31,8 @@ #define BOARD_INFO "ZUMspot" #elif defined(MMDVM_HS_HAT_REV12) #define BOARD_INFO "MMDVM_HS_Hat" +#elif defined(MMDVM_HS_DUAL_HAT_REV10) +#define BOARD_INFO "MMDVM_HS_Dual_Hat" #elif defined(NANO_HOTSPOT) #define BOARD_INFO "Nano_hotSPOT" #else From 74ccfbb9259fc5612e6461de0317f8eb048b0756 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sat, 24 Feb 2018 13:07:20 +0100 Subject: [PATCH 004/239] Add make option --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index ff3c608..0fca467 100644 --- a/Makefile +++ b/Makefile @@ -411,6 +411,8 @@ endif mmdvm_hs_hat: zumspot-pi +mmdvm_hs_dual_hat: zumspot-pi + dfu: ifdef devser $(DFU_RST) $(devser) 750 From d1047a402080dbd3e2c9f1d7e43f28b90a16578c Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 24 Feb 2018 17:21:00 -0300 Subject: [PATCH 005/239] Fix for NAK error using MMDVMCal with simplex firmware --- SerialPort.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index 1b580f4..b2042aa 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -207,13 +207,6 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) bool ysfLoDev = (data[0U] & 0x08U) == 0x08U; bool simplex = (data[0U] & 0x80U) == 0x80U; -#if !defined(DUPLEX) - if (!simplex) { - DEBUG1("Full duplex not supported with this firmware"); - return 6U; - } -#endif - m_debug = (data[0U] & 0x10U) == 0x10U; bool dstarEnable = (data[1U] & 0x01U) == 0x01U; @@ -266,7 +259,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) m_dmrEnable = dmrEnable; m_ysfEnable = ysfEnable; m_p25Enable = p25Enable; - m_nxdnEnable = nxdnEnable; + m_nxdnEnable = nxdnEnable; if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) { m_dmrEnable = true; @@ -278,12 +271,19 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.ifConf(STATE_DMR, true); } else { - m_modemState = modemState; + m_modemState = modemState; m_calState = STATE_IDLE; } m_duplex = !simplex; +#if !defined(DUPLEX) + if (m_duplex && m_calState == STATE_IDLE && modemState != STATE_DSTARCAL) { + DEBUG1("Full duplex not supported with this firmware"); + return 6U; + } +#endif + dstarTX.setTXDelay(txDelay); ysfTX.setTXDelay(txDelay); p25TX.setTXDelay(txDelay); From 62323e7030cbf2b1c83fda49938caca5d7f235c2 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 24 Feb 2018 17:26:11 -0300 Subject: [PATCH 006/239] Preparing new release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- version.h | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index d173e78..106801b 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index a23f59f..54c21f4 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index e9974a8..f129f61 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 3ad9743..56b6e51 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 16ca47c..2800712 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 7a01d69..c67b2ab 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/version.h b/version.h index ccc5845..c65cc28 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "3" -#define VER_REV "2" -#define VERSION_DATE "20180222" +#define VER_REV "3" +#define VERSION_DATE "20180224" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 3ad4299e038e286ef3fc3cd26c7727401187a1cf Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 25 Feb 2018 17:23:12 +0100 Subject: [PATCH 007/239] Add config template for MMDVM_HS_Dual_Hat --- Config.h | 12 +++---- configs/MMDVM_HS_Dual_Hat.h | 71 +++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 configs/MMDVM_HS_Dual_Hat.h diff --git a/Config.h b/Config.h index c42ddaf..d7304e7 100644 --- a/Config.h +++ b/Config.h @@ -23,11 +23,11 @@ // 1) ZUMspot RPi or ZUMspot USB: // #define ZUMSPOT_ADF7021 // 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: -#define LIBRE_KIT_ADF7021 +// #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 // 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) -// #define MMDVM_HS_DUAL_HAT_REV10 +#define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT @@ -35,7 +35,7 @@ #define ENABLE_ADF7021 // Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): -// #define DUPLEX +#define DUPLEX // TCXO of the ADF7021 // For 14.7456 MHz: @@ -44,14 +44,14 @@ // #define ADF7021_12_2880 // Host communication selection: -// #define STM32_USART1_HOST -#define STM32_USB_HOST +#define STM32_USART1_HOST +// #define STM32_USB_HOST // Enable mode detection: #define ENABLE_SCAN_MODE // Send RSSI value: -// #define SEND_RSSI_DATA +#define SEND_RSSI_DATA // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h new file mode 100644 index 0000000..d7304e7 --- /dev/null +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +#define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +#define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif From 7af016e1b733be64ff84d25ac2f4666210e6c50a Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 25 Feb 2018 17:29:58 +0100 Subject: [PATCH 008/239] Add scripts for FW build/installation of Dual_Hat --- scripts/build_fw.sh | 6 +++ scripts/install_fw_hsdualhat.sh | 77 +++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 scripts/install_fw_hsdualhat.sh diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index e6bf9b0..6a7206c 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -50,6 +50,12 @@ make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw.bin make clean +# Building MMDVM_HS_Dual_Hat +cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw.bin +make clean + # Building Nano hotSPOT cp ~/MMDVM_HS/configs/Nano_hotSPOT.h ~/MMDVM_HS/Config.h make diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh new file mode 100644 index 0000000..a5a88b7 --- /dev/null +++ b/scripts/install_fw_hsdualhat.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + +# 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. + +# Configure latest version +FW_VERSION="v1.3.2" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for MMDVM_HS_Hat +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w mmdvm_hs_dual_hat_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + From bbfee914c174a05dfe31f283c681f89f94fb2ea4 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 25 Feb 2018 17:55:58 +0100 Subject: [PATCH 009/239] Revert "Add config template for MMDVM_HS_Dual_Hat" This reverts commit 3ad4299e038e286ef3fc3cd26c7727401187a1cf. --- Config.h | 12 +++---- configs/MMDVM_HS_Dual_Hat.h | 71 ------------------------------------- 2 files changed, 6 insertions(+), 77 deletions(-) delete mode 100644 configs/MMDVM_HS_Dual_Hat.h diff --git a/Config.h b/Config.h index d7304e7..c42ddaf 100644 --- a/Config.h +++ b/Config.h @@ -23,11 +23,11 @@ // 1) ZUMspot RPi or ZUMspot USB: // #define ZUMSPOT_ADF7021 // 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: -// #define LIBRE_KIT_ADF7021 +#define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 // 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) -#define MMDVM_HS_DUAL_HAT_REV10 +// #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT @@ -35,7 +35,7 @@ #define ENABLE_ADF7021 // Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): -#define DUPLEX +// #define DUPLEX // TCXO of the ADF7021 // For 14.7456 MHz: @@ -44,14 +44,14 @@ // #define ADF7021_12_2880 // Host communication selection: -#define STM32_USART1_HOST -// #define STM32_USB_HOST +// #define STM32_USART1_HOST +#define STM32_USB_HOST // Enable mode detection: #define ENABLE_SCAN_MODE // Send RSSI value: -#define SEND_RSSI_DATA +// #define SEND_RSSI_DATA // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h deleted file mode 100644 index d7304e7..0000000 --- a/configs/MMDVM_HS_Dual_Hat.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU - * - * 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. - */ - -#if !defined(CONFIG_H) -#define CONFIG_H - -// Select one board (STM32F103 based boards) -// 1) ZUMspot RPi or ZUMspot USB: -// #define ZUMSPOT_ADF7021 -// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: -// #define LIBRE_KIT_ADF7021 -// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) -// #define MMDVM_HS_HAT_REV12 -// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) -#define MMDVM_HS_DUAL_HAT_REV10 -// 5) Nano hotSPOT (BI7JTA) -// #define NANO_HOTSPOT - -// Enable ADF7021 support: -#define ENABLE_ADF7021 - -// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): -#define DUPLEX - -// TCXO of the ADF7021 -// For 14.7456 MHz: -#define ADF7021_14_7456 -// For 12.2880 MHz: -// #define ADF7021_12_2880 - -// Host communication selection: -#define STM32_USART1_HOST -// #define STM32_USB_HOST - -// Enable mode detection: -#define ENABLE_SCAN_MODE - -// Send RSSI value: -#define SEND_RSSI_DATA - -// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): -#define SERIAL_REPEATER - -// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): -// #define SERIAL_REPEATER_USART1 - -// Enable P25 Wide modulation: -// #define ENABLE_P25_WIDE - -// Disable mode LEDs blink during scan mode: -// #define QUIET_MODE_LEDS - -// Enable modem debug messages -// #define ENABLE_DEBUG - -#endif From c7b9bea1cbc15b403ada912077f32bd923aa8480 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 25 Feb 2018 17:57:42 +0100 Subject: [PATCH 010/239] Re-add config template for MMDVM_HS_Dual_Hat --- configs/MMDVM_HS_Dual_Hat.h | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 configs/MMDVM_HS_Dual_Hat.h diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h new file mode 100644 index 0000000..2895e04 --- /dev/null +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +#define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +#define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif From e841ae2d896b53a00ea26b24b1c81e95b777862d Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 25 Feb 2018 17:59:07 +0100 Subject: [PATCH 011/239] Update to latest FW version --- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index a5a88b7..51b66b9 100644 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index a23f59f..54c21f4 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.2" +FW_VERSION="v1.3.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From 0303c06a5425a109c458e443864eafac616d9525 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 25 Feb 2018 14:49:42 -0300 Subject: [PATCH 012/239] More minor changes --- README.md | 13 +++++++------ configs/MMDVM_HS_Hat.h | 4 +++- configs/Nano_hotSPOT.h | 4 +++- configs/ZUMspot_Libre.h | 4 +++- configs/ZUMspot_RPi.h | 4 +++- configs/ZUMspot_USB.h | 4 +++- configs/ZUMspot_duplex.h | 4 +++- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7e10516..7bd438b 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,13 @@ This utility includes firmwares binaries and USB drivers for Windows 7/8/10. If Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: -- install_fw_rpi.sh: only for ZUMspot RPi board -- install_fw_hshat.sh: only for MMDVM_HS_Hat board -- install_fw_nanohs.sh: only for Nano hotSPOT board -- install_fw_librekit.sh: only for ZUMspot Libre Kit board or generic MMDVM_HS board -- install_fw_usb.sh: only for ZUMspot USB dongle -- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 +- install_fw_rpi.sh: only for ZUMspot RPi board (KI6ZUM & VE2GZI) +- install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET) +- install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) +- install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) +- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board +- install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) +- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board For example, download the ZUMspot RPi upgrade script: diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 669749e..10edb6c 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -26,7 +26,9 @@ // #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) #define MMDVM_HS_HAT_REV12 -// 4) Nano hotSPOT (BI7JTA) +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT // Enable ADF7021 support: diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 11d64de..b7af467 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -26,7 +26,9 @@ // #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 -// 4) Nano hotSPOT (BI7JTA) +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) #define NANO_HOTSPOT // Enable ADF7021 support: diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index cade0eb..c42ddaf 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -26,7 +26,9 @@ #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 -// 4) Nano hotSPOT (BI7JTA) +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT // Enable ADF7021 support: diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index fb49b9f..544b980 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -26,7 +26,9 @@ // #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 -// 4) Nano hotSPOT (BI7JTA) +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT // Enable ADF7021 support: diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index cb6c095..a769074 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -26,7 +26,9 @@ // #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 -// 4) Nano hotSPOT (BI7JTA) +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT // Enable ADF7021 support: diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 08b44de..a97ae71 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -26,7 +26,9 @@ #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 -// 4) Nano hotSPOT (BI7JTA) +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT // Enable ADF7021 support: From 8a39d11eb9d5226ad49636e2850f2216f955ff83 Mon Sep 17 00:00:00 2001 From: phl0 Date: Fri, 2 Mar 2018 10:49:17 +0100 Subject: [PATCH 013/239] Make install script for MMDVM_HS_Dual_Hat executable --- scripts/install_fw_hsdualhat.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/install_fw_hsdualhat.sh diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh old mode 100644 new mode 100755 From 426e00eab9eaa9f74240e24fc5dbcf646fa7c4f7 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 3 Mar 2018 12:16:19 -0300 Subject: [PATCH 014/239] Update README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 7bd438b..692848d 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,16 @@ Please see [BUILD.md](BUILD.md) for more details, and also [MMDVM](https://group Please check the latest firmware [here](https://github.com/juribeparada/MMDVM_HS/releases). +## Pi-Star binary firmware installation + +You could use the command "sudo pistar-zumspotflash ..." under SSH console: + +- sudo pistar-zumspotflash rpi: ZUMspot RPi board +- sudo pistar-zumspotflash usb: ZUMspot USB dongle +- sudo pistar-zumspotflash libre: ZUMspot Libre Kit or generic MMDVM_HS board with USB +- sudo pistar-zumspotflash hs_hat: MMDVM_HS_Hat board +- sudo pistar-zumspotflash nano_hs: Nano hotSPOT board + ### Windows Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the [releases section](https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.2/ZUMSpotFW_setup.exe). From d90263f52e300edcfd62ef84cba0425a9a35574f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 10 Mar 2018 18:27:02 -0300 Subject: [PATCH 015/239] Enable RSSI support for Nano hotSPOT --- README.md | 2 +- configs/Nano_hotSPOT.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 692848d..2fa6b53 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Please see [BUILD.md](BUILD.md) for more details, and also [MMDVM](https://group Please check the latest firmware [here](https://github.com/juribeparada/MMDVM_HS/releases). -## Pi-Star binary firmware installation +### Pi-Star binary firmware installation You could use the command "sudo pistar-zumspotflash ..." under SSH console: diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index b7af467..189ca82 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -51,7 +51,7 @@ #define ENABLE_SCAN_MODE // Send RSSI value: -// #define SEND_RSSI_DATA +#define SEND_RSSI_DATA // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER From b9d2277e3b04388c68979c0d97c3983e697f069e Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 4 Apr 2018 14:55:54 -0300 Subject: [PATCH 016/239] Add support for Nano DV board (BG4TGO & BG5HHP) --- BUILD.md | 2 + Config.h | 2 + IOArduino.cpp | 6 +-- IOSTM.cpp | 12 +++--- Makefile | 9 +++++ README.md | 1 + configs/MMDVM_HS_Dual_Hat.h | 2 + configs/MMDVM_HS_Hat.h | 2 + configs/NanoDV.h | 73 ++++++++++++++++++++++++++++++++++ configs/Nano_hotSPOT.h | 2 + configs/ZUMspot_Libre.h | 2 + configs/ZUMspot_RPi.h | 2 + configs/ZUMspot_USB.h | 2 + configs/ZUMspot_duplex.h | 2 + scripts/build_fw.sh | 6 +++ scripts/install_fw_nanodv.sh | 77 ++++++++++++++++++++++++++++++++++++ version.h | 6 ++- 17 files changed, 197 insertions(+), 11 deletions(-) create mode 100644 configs/NanoDV.h create mode 100755 scripts/install_fw_nanodv.sh diff --git a/BUILD.md b/BUILD.md index a1af057..9e3087d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -548,6 +548,8 @@ modified RF7021SE and Blue Pill STM32F103). - #define NANO_HOTSPOT: enable this option if you have a Nano hotSPOT (BI7JTA). +- #define NANO_DV_REV10: enable this option if you have a Nano DV (BG4TGO & BG5HHP). + - #define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default). - #define DUPLEX: enable duplex mode with dual ADF7021. It is still under development. diff --git a/Config.h b/Config.h index c42ddaf..d055d9e 100644 --- a/Config.h +++ b/Config.h @@ -30,6 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/IOArduino.cpp b/IOArduino.cpp index f63a34b..0d0d80a 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -51,7 +51,7 @@ #define PIN_PTT_LED PB14 #define PIN_COS_LED PB15 -#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) +#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) #define PIN_SCLK PB5 #define PIN_SREAD PB7 @@ -75,7 +75,7 @@ #define PIN_COS_LED PB15 #else -#error "Either ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10 or NANO_HOTSPOT need to be defined" +#error "Either ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT or NANO_DV_REV10 need to be defined" #endif #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) @@ -148,7 +148,7 @@ void CIO::Init() { #if defined (__STM32F1__) -#if defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) +#if defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY); #endif diff --git a/IOSTM.cpp b/IOSTM.cpp index 17e4c73..79821a6 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -152,7 +152,7 @@ #define PIN_COS_LED GPIO_Pin_15 #define PORT_COS_LED GPIOB -#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) +#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -225,7 +225,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10 or NANO_HOTSPOT need to be defined" +#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT or NANO_DV_REV10 need to be defined" #endif extern "C" { @@ -247,7 +247,7 @@ extern "C" { } #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -284,7 +284,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif @@ -454,7 +454,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -502,7 +502,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt diff --git a/Makefile b/Makefile index 0fca467..0e7200f 100644 --- a/Makefile +++ b/Makefile @@ -400,6 +400,15 @@ ifneq ($(wildcard /usr/bin/stm32flash),) /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 endif +nano-dv: +ifneq ($(wildcard /usr/local/bin/stm32flash),) + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 10,-14,14:-10,14 /dev/ttyAMA0 +endif + +ifneq ($(wildcard /usr/bin/stm32flash),) + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 10,-14,14:-10,14 /dev/ttyAMA0 +endif + zumspot-pi: ifneq ($(wildcard /usr/local/bin/stm32flash),) /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/README.md b/README.md index 2fa6b53..7a9821e 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - install_fw_rpi.sh: only for ZUMspot RPi board (KI6ZUM & VE2GZI) - install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET) - install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) +- install_fw_nanodv.sh: only for Nano DV board (BG4TGO & BG5HHP) - install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) - install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board - install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 2895e04..a17c8bb 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -30,6 +30,8 @@ #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 10edb6c..968c6a2 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -30,6 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/NanoDV.h b/configs/NanoDV.h new file mode 100644 index 0000000..effc6a8 --- /dev/null +++ b/configs/NanoDV.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +#define NANO_DV_REV10 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 189ca82..2dd46e9 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -30,6 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index c42ddaf..d055d9e 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -30,6 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 544b980..b27b144 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -30,6 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index a769074..5b5b837 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -30,6 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index a97ae71..9f36eac 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -30,6 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 6a7206c..30a9050 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -62,4 +62,10 @@ make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_hotspot_fw.bin make clean +# Building Nano DV +cp ~/MMDVM_HS/configs/NanoDV.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_dv_fw.bin +make clean + cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh new file mode 100755 index 0000000..3503c7a --- /dev/null +++ b/scripts/install_fw_nanodv.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (C) 2018 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.3.3" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for Nano DV +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nano_dv_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w nano_hotspot_fw.bin -g 0x0 -R -i 10,-14,14:-10,14 /dev/ttyAMA0 + diff --git a/version.h b/version.h index 9d9aa6c..d52b141 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "3" -#define VER_REV "3" -#define VERSION_DATE "20180224" +#define VER_REV "4" +#define VERSION_DATE "20180404" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" @@ -35,6 +35,8 @@ #define BOARD_INFO "MMDVM_HS_Dual_Hat" #elif defined(NANO_HOTSPOT) #define BOARD_INFO "Nano_hotSPOT" +#elif defined(NANO_DV_REV10) +#define BOARD_INFO "Nano_DV" #else #define BOARD_INFO "MMDVM_HS" #endif From 17d81e35c76cd8a266ce9efdf56a07f394fe8319 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Apr 2018 22:05:38 +0800 Subject: [PATCH 017/239] Update NanoDV.h --- configs/NanoDV.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/NanoDV.h b/configs/NanoDV.h index effc6a8..91f4911 100644 --- a/configs/NanoDV.h +++ b/configs/NanoDV.h @@ -41,9 +41,9 @@ // TCXO of the ADF7021 // For 14.7456 MHz: -#define ADF7021_14_7456 +// #define ADF7021_14_7456 // For 12.2880 MHz: -// #define ADF7021_12_2880 +#define ADF7021_12_2880 // Host communication selection: #define STM32_USART1_HOST @@ -62,10 +62,10 @@ // #define SERIAL_REPEATER_USART1 // Enable P25 Wide modulation: -// #define ENABLE_P25_WIDE +#define ENABLE_P25_WIDE // Disable mode LEDs blink during scan mode: -// #define QUIET_MODE_LEDS +#define QUIET_MODE_LEDS // Enable modem debug messages // #define ENABLE_DEBUG From 4c9c67286ca1488aefa8cd404fd43d27e9342319 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Apr 2018 22:14:42 +0800 Subject: [PATCH 018/239] Update install_fw_nanodv.sh --- scripts/install_fw_nanodv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh index 3503c7a..49d74ad 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv.sh @@ -73,5 +73,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w nano_hotspot_fw.bin -g 0x0 -R -i 10,-14,14:-10,14 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w nano_dv_fw.bin -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 From 21ab8e94a2e638f387f2449b97664edadd8aa9eb Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 7 Apr 2018 00:00:41 +0800 Subject: [PATCH 019/239] Update Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0e7200f..01c0538 100644 --- a/Makefile +++ b/Makefile @@ -402,11 +402,11 @@ endif nano-dv: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 10,-14,14:-10,14 /dev/ttyAMA0 + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 10,-14,14:-10,14 /dev/ttyAMA0 + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 endif zumspot-pi: From 5e737eaf1020b995f4a19bb358e48f5d8cf6a004 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 8 Apr 2018 16:01:32 -0300 Subject: [PATCH 020/239] Add additional check for Config.h options --- SerialSTM.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SerialSTM.cpp b/SerialSTM.cpp index 0ce828e..4363039 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -44,6 +44,10 @@ USART2 - TXD PA2 - RXD PA3 #define TX_SERIAL_FIFO_SIZE 256U #define RX_SERIAL_FIFO_SIZE 256U +#if defined(STM32_USART1_HOST) && defined(STM32_USB_HOST) +#error "You have to select STM32_USART1_HOST or STM32_USB_HOST, but not both" +#endif + #if defined(STM32_USART1_HOST) || defined(SERIAL_REPEATER_USART1) extern "C" { From 8f9e1b822b37ec74843bc7e10a918bd9089a3126 Mon Sep 17 00:00:00 2001 From: juribeparada Date: Fri, 13 Apr 2018 10:01:58 -0300 Subject: [PATCH 021/239] Update README --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7a9821e..1721f6b 100644 --- a/README.md +++ b/README.md @@ -45,13 +45,15 @@ Please check the latest firmware [here](https://github.com/juribeparada/MMDVM_HS ### Pi-Star binary firmware installation -You could use the command "sudo pistar-zumspotflash ..." under SSH console: +You could use some pi-star commands under SSH console: - sudo pistar-zumspotflash rpi: ZUMspot RPi board +- sudo pistar-zumspotflash rpi_duplex: ZUMSpot duplex board conected to GPIO - sudo pistar-zumspotflash usb: ZUMspot USB dongle - sudo pistar-zumspotflash libre: ZUMspot Libre Kit or generic MMDVM_HS board with USB -- sudo pistar-zumspotflash hs_hat: MMDVM_HS_Hat board -- sudo pistar-zumspotflash nano_hs: Nano hotSPOT board +- sudo pistar-mmdvmhshatflash hs_hat: MMDVM_HS_Hat board conected to GPIO +- sudo pistar-mmdvmhshatflash hs_dual_hat: HS_DUAL_HAT board conected to GPIO +- sudo pistar-nanohsflash nano_hs: Nano hotSPOT board ### Windows From 9e11854e43d7e98733ad4ba5b7cd8d1774c3a4c5 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 21 Apr 2018 00:17:55 -0300 Subject: [PATCH 022/239] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1721f6b..26379e8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This software is licenced under the GPL v2 and is intended for amateur and educa - Supported modes: D-Star, DMR, Yaesu Fusion, P25 Phase 1 and NXDN - Automatic mode detection (scanning) -- G4KLX software suite: [MMDVMHost](https://github.com/g4klx/MMDVMHost), [ircDDBGateway](https://github.com/dl5di/OpenDV), [YSFGateway](https://github.com/g4klx/YSFClients), [P25Gateway](https://github.com/g4klx/P25Clients), [DMRGateway](https://github.com/g4klx/DMRGateway) and [MMDVMCal](https://github.com/g4klx/MMDVMCal) +- G4KLX software suite: [MMDVMHost](https://github.com/g4klx/MMDVMHost), [ircDDBGateway](https://github.com/dl5di/OpenDV), [YSFGateway](https://github.com/g4klx/YSFClients), [P25Gateway](https://github.com/g4klx/P25Clients), [DMRGateway](https://github.com/g4klx/DMRGateway), [NXDNGateway](https://github.com/g4klx/NXDNClients) and [MMDVMCal](https://github.com/g4klx/MMDVMCal) - Bands: 144, 220, 430 and 900 MHz (VHF requires external inductor) - Status LEDs (PTT, COR and digital modes) - Serial repeater port for Nextion displays @@ -35,6 +35,8 @@ Dual ADF7021 for full duplex operation (#define DUPLEX in Config.h) will work on If you can't decode any 4FSK modulation (DMR, YSF, P25 or NXDN) with your ZUMspot, the common solution is to adjust RX frequency offset (RXOffset) in your MMDVM.ini file. Please try with steps of +-100 Hz until you get low BER. If you don't have test equipment, the procedure is trial and error. In some cases TXOffset adjustment is also required for proper radio decoding. If you have test equipment, please use [MMDVMCal](https://github.com/g4klx/MMDVMCal). +If you have problems updating firmware using USB bootloader (DFU mode) on Orange Pi or any other system different from RPi, you could compile the dfu tool directly. You could get the source code of a dfu tool [here](https://sourceforge.net/projects/dfu-programmer/files/dfu-programmer/0.7.0/). + # Quick start Please see [BUILD.md](BUILD.md) for more details, and also [MMDVM](https://groups.yahoo.com/neo/groups/mmdvm/info) Yahoo Groups. You also can check at MMDVM_HS/scripts folder for some automatic tasks. From 5540c60ee10bef7336f9d399e768c1697f591ade Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 5 May 2018 11:48:40 -0300 Subject: [PATCH 023/239] Add STM32F10X_Lib as submodule --- .gitignore | 1 - .gitmodules | 3 +++ STM32F10X_Lib | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 160000 STM32F10X_Lib diff --git a/.gitignore b/.gitignore index ac00791..c092581 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,3 @@ bin/ GitVersion\.h -STM32F10X_Lib/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f867702 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "STM32F10X_Lib"] + path = STM32F10X_Lib + url = https://github.com/juribeparada/STM32F10X_Lib diff --git a/STM32F10X_Lib b/STM32F10X_Lib new file mode 160000 index 0000000..f57ebc3 --- /dev/null +++ b/STM32F10X_Lib @@ -0,0 +1 @@ +Subproject commit f57ebc35af760675bd6d15e6667e6e66508f852b From fb8806ec0199150426b1d1bbb35bdc1b1142cf40 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 5 May 2018 13:03:14 -0300 Subject: [PATCH 024/239] Update docs --- BUILD.md | 9 ++++++--- README.md | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/BUILD.md b/BUILD.md index 9e3087d..939fb63 100644 --- a/BUILD.md +++ b/BUILD.md @@ -98,7 +98,8 @@ Download the firmware sources: cd ~ git clone https://github.com/juribeparada/MMDVM_HS cd MMDVM_HS/ - git clone https://github.com/juribeparada/STM32F10X_Lib + git submodule init + git submodule update (Please do not download any different code inside MMDVM_HS folder) @@ -293,7 +294,8 @@ Download the sources: cd ~ git clone https://github.com/juribeparada/MMDVM_HS cd MMDVM_HS/ - git clone https://github.com/juribeparada/STM32F10X_Lib + git submodule init + git submodule update (Please do not download any different code inside MMDVM_HS folder) @@ -429,7 +431,8 @@ Download the sources: cd ~ git clone https://github.com/juribeparada/MMDVM_HS cd MMDVM_HS/ - git clone https://github.com/juribeparada/STM32F10X_Lib + git submodule init + git submodule update (Please do not download any different code inside MMDVM_HS folder) diff --git a/README.md b/README.md index 26379e8..32deaaf 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,8 @@ Download the sources: cd ~ git clone https://github.com/juribeparada/MMDVM_HS cd MMDVM_HS/ - git clone https://github.com/juribeparada/STM32F10X_Lib + git submodule init + git submodule update Build the firmware with USB bootloader support (the default Config.h is OK for Libre Kit): @@ -192,7 +193,8 @@ Download the firmware sources: cd ~ git clone https://github.com/juribeparada/MMDVM_HS cd MMDVM_HS/ - git clone https://github.com/juribeparada/STM32F10X_Lib + git submodule init + git submodule update Edit Config.h From 05d5b38ab94381a23bf232b7df3f644b7197129a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 11:00:47 -0400 Subject: [PATCH 025/239] Increasing ring buffers --- NXDNTX.cpp | 2 +- P25TX.cpp | 2 +- SerialRB.h | 2 +- YSFTX.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NXDNTX.cpp b/NXDNTX.cpp index 0f3938c..9792af2 100644 --- a/NXDNTX.cpp +++ b/NXDNTX.cpp @@ -27,7 +27,7 @@ const uint8_t NXDN_PREAMBLE[] = {0x57U, 0x75U, 0xFDU}; const uint8_t NXDN_SYNC = 0x5FU; CNXDNTX::CNXDNTX() : -m_buffer(1500U), +m_buffer(2500U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), diff --git a/P25TX.cpp b/P25TX.cpp index 48f688e..96cc355 100644 --- a/P25TX.cpp +++ b/P25TX.cpp @@ -26,7 +26,7 @@ const uint8_t P25_START_SYNC = 0x77U; CP25TX::CP25TX() : -m_buffer(1500U), +m_buffer(2500U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), diff --git a/SerialRB.h b/SerialRB.h index 40c862f..79b3c5c 100644 --- a/SerialRB.h +++ b/SerialRB.h @@ -31,7 +31,7 @@ Boston, MA 02110-1301, USA. #include #endif -const uint16_t SERIAL_RINGBUFFER_SIZE = 370U; +const uint16_t SERIAL_RINGBUFFER_SIZE = 2000U; class CSerialRB { public: diff --git a/YSFTX.cpp b/YSFTX.cpp index 9e01f55..1b88e75 100644 --- a/YSFTX.cpp +++ b/YSFTX.cpp @@ -27,7 +27,7 @@ const uint8_t YSF_START_SYNC = 0x77U; const uint8_t YSF_END_SYNC = 0xFFU; CYSFTX::CYSFTX() : -m_buffer(1500U), +m_buffer(2500U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), From ecc597b6fe3d0c1ded23f0ba22033110099f2cac Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 11:02:17 -0400 Subject: [PATCH 026/239] Replacing 1.2 kHz tone fill by a pseudo random fill (DMR DMO) --- DMRDMOTX.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/DMRDMOTX.cpp b/DMRDMOTX.cpp index deb4ff8..f491f13 100644 --- a/DMRDMOTX.cpp +++ b/DMRDMOTX.cpp @@ -21,6 +21,13 @@ #include "Config.h" #include "Globals.h" +// PR FILL pattern +const uint8_t PR_FILL[] = + {0x63U, 0xEAU, 0x00U, 0x76U, 0x6CU, 0x76U, 0xC4U, 0x52U, 0xC8U, 0x78U, + 0x09U, 0x2DU, 0xB8U, 0x79U, 0x27U, 0x57U, 0x9BU, 0x31U, 0xBCU, 0x3EU, + 0xEAU, 0x45U, 0xC3U, 0x30U, 0x49U, 0x17U, 0x93U, 0xAEU, 0x8BU, 0x6DU, + 0xA4U, 0xA5U, 0xADU, 0xA2U, 0xF1U, 0x35U, 0xB5U, 0x3CU, 0x1EU}; + const uint8_t DMR_SYNC = 0x5FU; CDMRDMOTX::CDMRDMOTX() : @@ -51,13 +58,15 @@ void CDMRDMOTX::process() } else { m_delay = false; - for (unsigned int i = 0U; i < 72U; i++) - m_poBuffer[m_poLen++] = DMR_SYNC; - for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) m_poBuffer[i] = m_fifo.get(); + + for (unsigned int i = 0U; i < 39U; i++) + m_poBuffer[i + DMR_FRAME_LENGTH_BYTES] = PR_FILL[i]; + } m_poPtr = 0U; + m_poLen = 72U; } } From 1428fdb7ffe9fe715bacff3a02bf341738a277a7 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 11:02:33 -0400 Subject: [PATCH 027/239] Updating version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index d52b141..ca6ce8f 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "3" -#define VER_REV "4" -#define VERSION_DATE "20180404" +#define VER_REV "5" +#define VERSION_DATE "20180521" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 979554b0e4282a8b46ceecee8d02b88289e575a4 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 11:11:43 -0400 Subject: [PATCH 028/239] Fix typo --- DMRDMOTX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DMRDMOTX.cpp b/DMRDMOTX.cpp index f491f13..75bda46 100644 --- a/DMRDMOTX.cpp +++ b/DMRDMOTX.cpp @@ -64,9 +64,9 @@ void CDMRDMOTX::process() for (unsigned int i = 0U; i < 39U; i++) m_poBuffer[i + DMR_FRAME_LENGTH_BYTES] = PR_FILL[i]; + m_poLen = 72U; } m_poPtr = 0U; - m_poLen = 72U; } } From a2bad49418a75d8f5b2f989b97f7b10091cc0c27 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 11:24:33 -0400 Subject: [PATCH 029/239] Preparing for next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 106801b..643c125 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 51b66b9..5a5ab30 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 54c21f4..770495a 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index f129f61..410e7dd 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh index 49d74ad..618f848 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 56b6e51..b7a1eb5 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 2800712..b28f654 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index c67b2ab..1f7b0a0 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.3" +FW_VERSION="v1.3.5" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From 851a7141a224a2df9799d64e3279b0e061cff2eb Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 15:23:48 -0400 Subject: [PATCH 030/239] Reducing ring buffers for duplex mode fix --- NXDNTX.cpp | 2 +- P25TX.cpp | 2 +- SerialRB.h | 2 +- YSFTX.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NXDNTX.cpp b/NXDNTX.cpp index 9792af2..326a8cc 100644 --- a/NXDNTX.cpp +++ b/NXDNTX.cpp @@ -27,7 +27,7 @@ const uint8_t NXDN_PREAMBLE[] = {0x57U, 0x75U, 0xFDU}; const uint8_t NXDN_SYNC = 0x5FU; CNXDNTX::CNXDNTX() : -m_buffer(2500U), +m_buffer(2000U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), diff --git a/P25TX.cpp b/P25TX.cpp index 96cc355..81f98f1 100644 --- a/P25TX.cpp +++ b/P25TX.cpp @@ -26,7 +26,7 @@ const uint8_t P25_START_SYNC = 0x77U; CP25TX::CP25TX() : -m_buffer(2500U), +m_buffer(2000U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), diff --git a/SerialRB.h b/SerialRB.h index 79b3c5c..e0022ab 100644 --- a/SerialRB.h +++ b/SerialRB.h @@ -31,7 +31,7 @@ Boston, MA 02110-1301, USA. #include #endif -const uint16_t SERIAL_RINGBUFFER_SIZE = 2000U; +const uint16_t SERIAL_RINGBUFFER_SIZE = 1000U; class CSerialRB { public: diff --git a/YSFTX.cpp b/YSFTX.cpp index 1b88e75..b50d014 100644 --- a/YSFTX.cpp +++ b/YSFTX.cpp @@ -27,7 +27,7 @@ const uint8_t YSF_START_SYNC = 0x77U; const uint8_t YSF_END_SYNC = 0xFFU; CYSFTX::CYSFTX() : -m_buffer(2500U), +m_buffer(2000U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), From 337f967b148c3ba13f8afcf591eb3da0b93bb771 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 15:24:10 -0400 Subject: [PATCH 031/239] Preparing next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 643c125..1293ec6 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 5a5ab30..ba155a8 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 770495a..4511d14 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 410e7dd..fb246aa 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh index 618f848..25d1ddc 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index b7a1eb5..2aad91e 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index b28f654..ee211b5 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 1f7b0a0..0de0b98 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.5" +FW_VERSION="v1.3.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From bd6217a4a6d15af0771f9f256299bcb3dec59d3b Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 15:25:43 -0400 Subject: [PATCH 032/239] Update version --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index ca6ce8f..48c2adb 100644 --- a/version.h +++ b/version.h @@ -24,7 +24,7 @@ #define VER_MAJOR "1" #define VER_MINOR "3" -#define VER_REV "5" +#define VER_REV "6" #define VERSION_DATE "20180521" #if defined(ZUMSPOT_ADF7021) From d1ac21188f986a42f23bf77ca74ff0c2cd95a0f4 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 21 May 2018 21:46:33 -0400 Subject: [PATCH 033/239] Include service LED in QUIET_MODE_LEDS option --- IO.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IO.cpp b/IO.cpp index f9d1a0c..387b5e4 100644 --- a/IO.cpp +++ b/IO.cpp @@ -114,11 +114,15 @@ void CIO::process() m_watchdog = 0U; } +#if defined(QUIET_MODE_LEDS) + LED_pin(HIGH); +#else if (m_ledCount >= 24000U) { m_ledCount = 0U; m_ledValue = !m_ledValue; LED_pin(m_ledValue); } +#endif } else { if (m_ledCount >= 240000U) { m_ledCount = 0U; From 0d4bc47674817a960ecf2223f73f14ede6b0dbb0 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 22 May 2018 20:46:06 -0400 Subject: [PATCH 034/239] Restoring YSF, P25 and NXDN ring buffer sizes --- NXDNTX.cpp | 2 +- P25TX.cpp | 2 +- YSFTX.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NXDNTX.cpp b/NXDNTX.cpp index 326a8cc..0f3938c 100644 --- a/NXDNTX.cpp +++ b/NXDNTX.cpp @@ -27,7 +27,7 @@ const uint8_t NXDN_PREAMBLE[] = {0x57U, 0x75U, 0xFDU}; const uint8_t NXDN_SYNC = 0x5FU; CNXDNTX::CNXDNTX() : -m_buffer(2000U), +m_buffer(1500U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), diff --git a/P25TX.cpp b/P25TX.cpp index 81f98f1..48f688e 100644 --- a/P25TX.cpp +++ b/P25TX.cpp @@ -26,7 +26,7 @@ const uint8_t P25_START_SYNC = 0x77U; CP25TX::CP25TX() : -m_buffer(2000U), +m_buffer(1500U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), diff --git a/YSFTX.cpp b/YSFTX.cpp index b50d014..9e01f55 100644 --- a/YSFTX.cpp +++ b/YSFTX.cpp @@ -27,7 +27,7 @@ const uint8_t YSF_START_SYNC = 0x77U; const uint8_t YSF_END_SYNC = 0xFFU; CYSFTX::CYSFTX() : -m_buffer(2000U), +m_buffer(1500U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), From 8b3828c3944205eba541b7a5042b40e537ab755f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 22 May 2018 20:47:07 -0400 Subject: [PATCH 035/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 48c2adb..dfc3e67 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "3" -#define VER_REV "6" -#define VERSION_DATE "20180521" +#define VER_REV "7" +#define VERSION_DATE "20180522" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From b268e40025a36caa222c0ec6fa3cbd1c9bfa3255 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 23 May 2018 14:28:12 -0400 Subject: [PATCH 036/239] Separated SRV LED control option --- Config.h | 3 +++ IO.cpp | 2 +- configs/MMDVM_HS_Dual_Hat.h | 3 +++ configs/MMDVM_HS_Hat.h | 3 +++ configs/NanoDV.h | 3 +++ configs/Nano_hotSPOT.h | 3 +++ configs/ZUMspot_Libre.h | 3 +++ configs/ZUMspot_RPi.h | 3 +++ configs/ZUMspot_USB.h | 3 +++ configs/ZUMspot_duplex.h | 3 +++ 10 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Config.h b/Config.h index d055d9e..13ace8b 100644 --- a/Config.h +++ b/Config.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/IO.cpp b/IO.cpp index 387b5e4..b0e5369 100644 --- a/IO.cpp +++ b/IO.cpp @@ -114,7 +114,7 @@ void CIO::process() m_watchdog = 0U; } -#if defined(QUIET_MODE_LEDS) +#if defined(CONSTANT_SRV_LED) LED_pin(HIGH); #else if (m_ledCount >= 24000U) { diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index a17c8bb..815a909 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 968c6a2..47d73d1 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/NanoDV.h b/configs/NanoDV.h index 91f4911..0fef16a 100644 --- a/configs/NanoDV.h +++ b/configs/NanoDV.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 2dd46e9..5dd9008 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index d055d9e..13ace8b 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index b27b144..ce27a97 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 5b5b837..037dfb9 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 9f36eac..e70601b 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -67,6 +67,9 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + // Enable modem debug messages // #define ENABLE_DEBUG From a0d6e8ab1c35f2497b7f44f3489da08c97bd353d Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 23 May 2018 14:28:38 -0400 Subject: [PATCH 037/239] Print MCU memory usage during compilation --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 01c0538..0e8a980 100644 --- a/Makefile +++ b/Makefile @@ -197,7 +197,7 @@ LDFLAGS_F7 =-T stm32f7xx_link.ld $(MCFLAGS_F7) $(INCLUDES_LIBS_F7) # Common flags CFLAGS=-Os -ffunction-sections -fdata-sections -nostdlib -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter -nostdlib CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter -LDFLAGS=-Os --specs=nano.specs --specs=nosys.specs +LDFLAGS=-Os --specs=nano.specs --specs=nosys.specs -Wl,--print-memory-usage # Build Rules .PHONY: all release_f1 release_f4 release_f7 hs bl pi-f4 f446 f767 clean From 623b28067c745c267765b25cf842324f3b965e64 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 23 May 2018 20:45:24 -0400 Subject: [PATCH 038/239] Removing "--print-memory-usage", not support for some compilers --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0e8a980..01c0538 100644 --- a/Makefile +++ b/Makefile @@ -197,7 +197,7 @@ LDFLAGS_F7 =-T stm32f7xx_link.ld $(MCFLAGS_F7) $(INCLUDES_LIBS_F7) # Common flags CFLAGS=-Os -ffunction-sections -fdata-sections -nostdlib -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter -nostdlib CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter -LDFLAGS=-Os --specs=nano.specs --specs=nosys.specs -Wl,--print-memory-usage +LDFLAGS=-Os --specs=nano.specs --specs=nosys.specs # Build Rules .PHONY: all release_f1 release_f4 release_f7 hs bl pi-f4 f446 f767 clean From 9034c1add8a304db93940bcc31b8c4b058f37b2e Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 26 May 2018 11:07:41 -0400 Subject: [PATCH 039/239] Preparing next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 1293ec6..87a6cd6 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index ba155a8..11212df 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 4511d14..86aea35 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index fb246aa..0f8a6d7 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh index 25d1ddc..f4765c7 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 2aad91e..3193c35 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index ee211b5..6ee9a34 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 0de0b98..6b370fa 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.6" +FW_VERSION="v1.3.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From ef79d6bb5da81d8bbe81d6616c98da30f293b4fe Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 27 May 2018 20:07:15 -0400 Subject: [PATCH 040/239] Add binary firmware support for generic MMDVM_HS boards with GPIO interface --- README.md | 6 ++- configs/generic_duplex_gpio.h | 76 ++++++++++++++++++++++++++++++ configs/generic_gpio.h | 76 ++++++++++++++++++++++++++++++ scripts/build_fw.sh | 12 +++++ scripts/install_fw_duplex_gpio.sh | 77 +++++++++++++++++++++++++++++++ scripts/install_fw_gen_gpio.sh | 77 +++++++++++++++++++++++++++++++ 6 files changed, 322 insertions(+), 2 deletions(-) create mode 100644 configs/generic_duplex_gpio.h create mode 100644 configs/generic_gpio.h create mode 100755 scripts/install_fw_duplex_gpio.sh create mode 100755 scripts/install_fw_gen_gpio.sh diff --git a/README.md b/README.md index 32deaaf..f3bcfe0 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,11 @@ Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) - install_fw_nanodv.sh: only for Nano DV board (BG4TGO & BG5HHP) - install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) -- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board +- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface - install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) -- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board +- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with USB interface +- install_fw_gen_gpio.sh: only for generic MMDVM_HS board (EA7GIB) with GPIO serial interface +- install_fw_duplex_gpio.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with GPIO serial interface For example, download the ZUMspot RPi upgrade script: diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h new file mode 100644 index 0000000..05eeef1 --- /dev/null +++ b/configs/generic_duplex_gpio.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +#define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +#define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +// #define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h new file mode 100644 index 0000000..da560be --- /dev/null +++ b/configs/generic_gpio.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +#define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +// #define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 30a9050..e5a61d2 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -68,4 +68,16 @@ make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_dv_fw.bin make clean +# Building Generic Simplex GPIO +cp ~/MMDVM_HS/configs/generic_gpio.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_gpio_fw.bin +make clean + +# Building Generic Duplex GPIO +cp ~/MMDVM_HS/configs/generic_duplex_gpio.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_duplex_gpio_fw.bin +make clean + cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh new file mode 100755 index 0000000..90ba7cc --- /dev/null +++ b/scripts/install_fw_duplex_gpio.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (C) 2017,2018 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.3.7" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for Generic Duplex GPIO +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_duplex_gpio_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w generic_duplex_gpio_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh new file mode 100755 index 0000000..d3677e8 --- /dev/null +++ b/scripts/install_fw_gen_gpio.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (C) 2017,2018 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.3.7" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for Generic Simplex GPIO +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_gpio_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w generic_gpio_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + From 62f34d8f6818e1d19a29d275e37aa7bc8dd1e82f Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 5 Jun 2018 16:55:18 +0200 Subject: [PATCH 041/239] Add firmware build support for 12.288MHz HS_Hats --- configs/MMDVM_HS_Hat-12mhz.h | 76 ++++++++++++++++++++++++++++++ scripts/build_fw.sh | 6 +++ scripts/install_fw_hshat-12mhz.sh | 77 +++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 configs/MMDVM_HS_Hat-12mhz.h create mode 100644 scripts/install_fw_hshat-12mhz.sh diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h new file mode 100644 index 0000000..5553909 --- /dev/null +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +#define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +// #define ADF7021_14_7456 +// For 12.2880 MHz: +#define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index e5a61d2..1d96235 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -50,6 +50,12 @@ make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw.bin make clean +# Building MMDVM_HS_Hat (12.288 MHz TCXO) +cp ~/MMDVM_HS/configs/MMDVM_HS_Hat-12mhz.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw-12mhz.bin +make clean + # Building MMDVM_HS_Dual_Hat cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h ~/MMDVM_HS/Config.h make diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh new file mode 100644 index 0000000..ee5a2ce --- /dev/null +++ b/scripts/install_fw_hshat-12mhz.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + +# 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. + +# Configure latest version +FW_VERSION="v1.3.7" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for MMDVM_HS_Hat with 12.288 MHz TCXO +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw-12mhz.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w mmdvm_hs_hat_fw-12mhz.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + From c1a31f227a8bb8129873df10fe246a47035ffb1e Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 5 Jun 2018 14:03:54 -0400 Subject: [PATCH 042/239] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f3bcfe0..d08f99b 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - install_fw_rpi.sh: only for ZUMspot RPi board (KI6ZUM & VE2GZI) - install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET) +- install_fw_hshat-12mhz.sh: only for MMDVM_HS_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET) - install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) - install_fw_nanodv.sh: only for Nano DV board (BG4TGO & BG5HHP) - install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) From a6603a602475be57b3fdf5b2e3155ddfaec85ce9 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 6 Jun 2018 10:02:21 +0200 Subject: [PATCH 043/239] Add info about TCXO freq to hardware description --- version.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/version.h b/version.h index dfc3e67..d852d55 100644 --- a/version.h +++ b/version.h @@ -41,6 +41,13 @@ #define BOARD_INFO "MMDVM_HS" #endif +#if defined(ADF7021_14_7456) +#define TCXO_FREQ "14.7456" +#endif +#if defined(ADF7021_12_2880) +#define TCXO_FREQ "12.2880" +#endif + #if defined(ENABLE_ADF7021) && defined(ADF7021_N_VER) #define RF_CHIP "ADF7021N" #elif defined(ENABLE_ADF7021) @@ -55,7 +62,7 @@ #define FW_VERSION "v" VER_MAJOR "." VER_MINOR "." VER_REV " " VERSION_DATE -#define DESCRIPTION BOARD_INFO "-" FW_VERSION " " RF_DUAL RF_CHIP " FW by CA6JAU" +#define DESCRIPTION BOARD_INFO "-" FW_VERSION " " TCXO_FREQ "MHz " RF_DUAL RF_CHIP " FW by CA6JAU" #if defined(MADEBYMAKEFILE) #include "GitVersion.h" From ebdbd8bd728f7a791de7c0fb65d2480259415146 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 7 Jun 2018 14:10:44 +0200 Subject: [PATCH 044/239] Make script executable --- scripts/install_fw_hshat-12mhz.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/install_fw_hshat-12mhz.sh diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh old mode 100644 new mode 100755 From 121e909367554f1b894d290522cfb70230c4063e Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 17 Jun 2018 20:10:00 -0400 Subject: [PATCH 045/239] Add POCSAG support (TX) --- ADF7021.cpp | 37 +++++++++++++-- ADF7021.h | 12 +++++ DMRDMOTX.cpp | 1 - DMRDMOTX.h | 1 - DStarTX.cpp | 6 +-- DStarTX.h | 1 - Globals.h | 7 +++ IO.cpp | 14 ++++-- IO.h | 4 +- IOArduino.cpp | 5 ++ IOSTM.cpp | 5 ++ MMDVM_HS.cpp | 18 ++++++-- MMDVM_HS.ino | 18 ++++++-- NXDNTX.cpp | 2 - NXDNTX.h | 1 - P25TX.cpp | 3 +- P25TX.h | 1 - POCSAGDefines.h | 27 +++++++++++ POCSAGTX.cpp | 118 ++++++++++++++++++++++++++++++++++++++++++++++++ POCSAGTX.h | 46 +++++++++++++++++++ SerialPort.cpp | 92 ++++++++++++++++++++++++++++--------- YSFTX.cpp | 3 +- YSFTX.h | 1 - 23 files changed, 367 insertions(+), 56 deletions(-) create mode 100644 POCSAGDefines.h create mode 100644 POCSAGTX.cpp create mode 100644 POCSAGTX.h diff --git a/ADF7021.cpp b/ADF7021.cpp index d100da0..2fa56fe 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -48,6 +48,7 @@ uint16_t m_dmrDev; uint16_t m_ysfDev; uint16_t m_p25Dev; uint16_t m_nxdnDev; +uint16_t m_pocsagDev; static void Send_AD7021_control_shift() { @@ -186,7 +187,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) uint32_t ADF7021_REG13 = 0U; int32_t AFC_OFFSET = 0; - if(modemState != STATE_CWID) + if(modemState != STATE_CWID && modemState != STATE_POCSAG) m_modemState_prev = modemState; // Toggle CE pin for ADF7021 reset @@ -226,6 +227,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) switch (modemState) { case STATE_DSTAR: + case STATE_POCSAG: AFC_OFFSET = 0; break; case STATE_DMR: @@ -314,6 +316,28 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) break; + case STATE_POCSAG: + // Dev: 4500 Hz, symb rate = 1200 + + ADF7021_REG3 = ADF7021_REG3_POCSAG; + ADF7021_REG10 = ADF7021_REG10_POCSAG; + + ADF7021_REG4 = (uint32_t) 0b0100 << 0; // register 4 + ADF7021_REG4 |= (uint32_t) 0b001 << 4; // demod mode, 2FSK + ADF7021_REG4 |= (uint32_t) 0b1 << 7; + ADF7021_REG4 |= (uint32_t) 0b10 << 8; + ADF7021_REG4 |= (uint32_t) ADF7021_DISC_BW_POCSAG << 10; // Disc BW + ADF7021_REG4 |= (uint32_t) ADF7021_POST_BW_POCSAG << 20; // Post dem BW + ADF7021_REG4 |= (uint32_t) 0b10 << 30; // IF filter (25 kHz) + + // Register 13 not used with 2FSK + ADF7021_REG13 = (uint32_t) 0b1101 << 0; // register 13 + + ADF7021_REG2 = (uint32_t) 0b00 << 28; // clock normal + ADF7021_REG2 |= (uint32_t) (ADF7021_DEV_POCSAG / div2)<< 19; // deviation + ADF7021_REG2 |= (uint32_t) 0b000 << 4; // modulation (2FSK) + break; + case STATE_DSTAR: // Dev: 1200 Hz, symb rate = 4800 @@ -523,7 +547,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) Send_AD7021_control(); #if defined(DUPLEX) -if(m_duplex && (modemState != STATE_CWID)) +if(m_duplex && (modemState != STATE_CWID && modemState != STATE_POCSAG)) ifConf2(modemState); #endif } @@ -888,7 +912,7 @@ void CIO::setPower(uint8_t power) m_power = power >> 2; } -void CIO::setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, bool ysfLoDev) +void CIO::setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, bool ysfLoDev) { m_dstarDev = uint16_t((ADF7021_DEV_DSTAR * uint16_t(dstarTXLevel)) / 128U); m_dmrDev = uint16_t((ADF7021_DEV_DMR * uint16_t(dmrTXLevel)) / 128U); @@ -900,6 +924,7 @@ void CIO::setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXL m_p25Dev = uint16_t((ADF7021_DEV_P25 * uint16_t(p25TXLevel)) / 128U); m_nxdnDev = uint16_t((ADF7021_DEV_NXDN * uint16_t(nxdnTXLevel)) / 128U); + m_pocsagDev = uint16_t((ADF7021_DEV_POCSAG * uint16_t(pocsagTXLevel)) / 128U); } void CIO::updateCal() @@ -1011,6 +1036,11 @@ uint16_t CIO::devNXDN() return (uint16_t)((ADF7021_PFD * m_nxdnDev) / (f_div * 65536)); } +uint16_t CIO::devPOCSAG() +{ + return (uint16_t)((ADF7021_PFD * m_pocsagDev) / (f_div * 65536)); +} + void CIO::printConf() { DEBUG1("MMDVM_HS FW configuration:"); @@ -1022,6 +1052,7 @@ void CIO::printConf() DEBUG2("YSF +1 sym dev (Hz):", devYSF()); DEBUG2("P25 +1 sym dev (Hz):", devP25()); DEBUG2("NXDN +1 sym dev (Hz):", devNXDN()); + DEBUG2("POCSAG dev (Hz):", devPOCSAG()); } #endif diff --git a/ADF7021.h b/ADF7021.h index 3fcecb9..e56bf6f 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -67,6 +67,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // DEMOD_CLK = 4.9152 MHz (DMR, YSF_L, P25) // DEMOD_CLK = 7.3728 MHz (YSF_H) // DEMOD CLK = 3.6864 MHz (NXDN) +// DEMOD_CLK = 7.3728 MHz (POCSAG) #define ADF7021_PFD 3686400.0 // PLL (REG 01) @@ -86,6 +87,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 22U #endif #define ADF7021_DEV_NXDN 13U +#define ADF7021_DEV_POCSAG 160U // TX/RX CLOCK register (REG 03) #define ADF7021_REG3_DSTAR 0x2A4C4193 @@ -102,6 +104,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_P25 0x2A4C80D3 #define ADF7021_REG3_NXDN 0x2A4CC113 #endif +#define ADF7021_REG3_POCSAG 0x2A4F0093 // Discriminator bandwith, demodulator (REG 04) // Bug in ADI evaluation software, use datasheet formula (4FSK) @@ -111,6 +114,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 516U // K=28 #define ADF7021_DISC_BW_P25 394U // K=32 #define ADF7021_DISC_BW_NXDN 295U // K=32 +#define ADF7021_DISC_BW_POCSAG 406U // K=22 // Post demodulator bandwith (REG 04) #define ADF7021_POST_BW_DSTAR 10U @@ -118,6 +122,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 7U +#define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) #define ADF7021_REG5 0x000024F5 @@ -127,6 +132,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // AFC configuration (REG 10) #define ADF7021_REG10_DSTAR 0x0C96473A +#define ADF7021_REG10_POCSAG 0x1496473A #if defined(ADF7021_ENABLE_4FSK_AFC) #define ADF7021_REG10_DMR 0x01FE473A @@ -162,6 +168,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // DEMOD_CLK = 2.4576 MHz (DSTAR) // DEMOD_CLK = 6.1440 MHz (DMR, YSF_H, YSF_L, P25) // DEMOD_CLK = 3.0720 MHz (NXDN) +// DEMOD_CLK = 6.1440 MHz (POCSAG) #define ADF7021_PFD 6144000.0 // PLL (REG 01) @@ -181,6 +188,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 13U #endif #define ADF7021_DEV_NXDN 8U +#define ADF7021_DEV_POCSAG 96U // TX/RX CLOCK register (REG 03) #define ADF7021_REG3_DSTAR 0x29EC4153 @@ -197,6 +205,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_P25 0x29ECA093 #define ADF7021_REG3_NXDN 0x29ECA113 #endif +#define ADF7021_REG3_POCSAG 0x29EE8093 // Discriminator bandwith, demodulator (REG 04) // Bug in ADI evaluation software, use datasheet formula (4FSK) @@ -206,6 +215,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 430U // K=28 #define ADF7021_DISC_BW_P25 493U // K=32 #define ADF7021_DISC_BW_NXDN 246U // K=32 +#define ADF7021_DISC_BW_POCSAG 338U // K=22 // Post demodulator bandwith (REG 04) #define ADF7021_POST_BW_DSTAR 10U @@ -213,6 +223,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 8U +#define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) #define ADF7021_REG5 0x00001ED5 @@ -222,6 +233,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // AFC (REG 10) #define ADF7021_REG10_DSTAR 0x0C96557A +#define ADF7021_REG10_POCSAG 0x1496557A #if defined(ADF7021_ENABLE_4FSK_AFC) #define ADF7021_REG10_DMR 0x01FE557A diff --git a/DMRDMOTX.cpp b/DMRDMOTX.cpp index 75bda46..bfc02c0 100644 --- a/DMRDMOTX.cpp +++ b/DMRDMOTX.cpp @@ -36,7 +36,6 @@ m_poBuffer(), m_poLen(0U), m_poPtr(0U), m_txDelay(240U), // 200ms -m_count(0U), m_delay(false), m_cal(false) { diff --git a/DMRDMOTX.h b/DMRDMOTX.h index 010ba99..1e3e4f3 100644 --- a/DMRDMOTX.h +++ b/DMRDMOTX.h @@ -45,7 +45,6 @@ private: uint16_t m_poLen; uint16_t m_poPtr; uint16_t m_txDelay; - uint32_t m_count; bool m_delay; bool m_cal; diff --git a/DStarTX.cpp b/DStarTX.cpp index 25e0416..ba873c3 100644 --- a/DStarTX.cpp +++ b/DStarTX.cpp @@ -186,9 +186,8 @@ m_poBuffer(), m_poLen(0U), m_poPtr(0U), m_txDelay(60U), // 100ms -m_count(0U) +m_delay(false) { - } void CDStarTX::process() @@ -201,7 +200,6 @@ void CDStarTX::process() if (type == DSTAR_HEADER && m_poLen == 0U) { if (!m_tx) { m_delay = true; - m_count = 0U; m_poLen = m_txDelay; } else { m_delay = false; @@ -228,8 +226,6 @@ void CDStarTX::process() if (type == DSTAR_DATA && m_poLen == 0U) { m_delay = false; - if (!m_tx) - m_count = 0U; // Pop the type byte off m_buffer.get(); diff --git a/DStarTX.h b/DStarTX.h index c3f0308..5b3fdae 100644 --- a/DStarTX.h +++ b/DStarTX.h @@ -42,7 +42,6 @@ private: uint16_t m_poLen; uint16_t m_poPtr; uint16_t m_txDelay; // In bytes - uint32_t m_count; bool m_delay; void txHeader(const uint8_t* in, uint8_t* out) const; diff --git a/Globals.h b/Globals.h index 76569a4..a6bcd37 100644 --- a/Globals.h +++ b/Globals.h @@ -40,6 +40,7 @@ enum MMDVM_STATE { STATE_YSF = 3, STATE_P25 = 4, STATE_NXDN = 5, + STATE_POCSAG = 6, // Dummy states start at 90 STATE_DMRDMO1K = 92, @@ -75,6 +76,7 @@ const uint8_t MARK_NONE = 0x00U; #include "P25TX.h" #include "NXDNRX.h" #include "NXDNTX.h" +#include "POCSAGTX.h" #include "CWIdTX.h" #include "CalRSSI.h" #include "CalDMR.h" @@ -89,6 +91,8 @@ extern MMDVM_STATE m_calState; extern MMDVM_STATE m_modemState_prev; extern bool m_cwid_state; +extern bool m_pocsag_state; + extern uint8_t m_cwIdTXLevel; extern uint32_t m_modeTimerCnt; @@ -98,6 +102,7 @@ extern bool m_dmrEnable; extern bool m_ysfEnable; extern bool m_p25Enable; extern bool m_nxdnEnable; +extern bool m_pocsagEnable; extern bool m_duplex; @@ -130,6 +135,8 @@ extern CP25TX p25TX; extern CNXDNRX nxdnRX; extern CNXDNTX nxdnTX; +extern CPOCSAGTX pocsagTX; + extern CCalDMR calDMR; #if defined(SEND_RSSI_DATA) diff --git a/IO.cpp b/IO.cpp index b0e5369..8c33119 100644 --- a/IO.cpp +++ b/IO.cpp @@ -48,6 +48,7 @@ m_watchdog(0U) YSF_pin(LOW); P25_pin(LOW); NXDN_pin(LOW); + POCSAG_pin(LOW); COS_pin(LOW); DEB_pin(LOW); @@ -85,6 +86,7 @@ void CIO::selfTest() YSF_pin(ledValue); P25_pin(ledValue); NXDN_pin(ledValue); + POCSAG_pin(ledValue); COS_pin(ledValue); blinks++; @@ -106,7 +108,7 @@ void CIO::process() if (m_started) { // Two seconds timeout if (m_watchdog >= 19200U) { - if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25 || m_modemState == STATE_NXDN) { + if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25 || m_modemState == STATE_NXDN) { m_modemState = STATE_IDLE; setMode(m_modemState); } @@ -139,6 +141,11 @@ void CIO::process() // Restoring previous mode io.ifConf(m_modemState_prev, true); } + if(m_pocsag_state) { // check for POCSAG end of transmission + m_pocsag_state = false; + // Restoring previous mode + io.ifConf(m_modemState_prev, true); + } setRX(false); } @@ -157,7 +164,7 @@ void CIO::process() if(m_modeTimerCnt >= scantime) { m_modeTimerCnt = 0U; - if( (m_modemState == STATE_IDLE) && (m_scanPauseCnt == 0U) && m_scanEnable && !m_cwid_state) { + if( (m_modemState == STATE_IDLE) && (m_scanPauseCnt == 0U) && m_scanEnable && !m_cwid_state && !m_pocsag_state) { m_scanPos = (m_scanPos + 1U) % m_TotalModes; #if !defined(QUIET_MODE_LEDS) setMode(m_Modes[m_scanPos]); @@ -306,7 +313,8 @@ void CIO::setMode(MMDVM_STATE modemState) DMR_pin(modemState == STATE_DMR); YSF_pin(modemState == STATE_YSF); P25_pin(modemState == STATE_P25); - NXDN_pin(modemState == STATE_NXDN); + NXDN_pin(modemState == STATE_NXDN); + POCSAG_pin(modemState == STATE_POCSAG); } void CIO::setDecode(bool dcd) diff --git a/IO.h b/IO.h index b6c13e0..8e2c705 100644 --- a/IO.h +++ b/IO.h @@ -76,6 +76,7 @@ public: void YSF_pin(bool on); void P25_pin(bool on); void NXDN_pin(bool on); + void POCSAG_pin(bool on); void COS_pin(bool on); void interrupt(void); #if defined(DUPLEX) @@ -110,7 +111,7 @@ public: #endif void start(void); void startInt(void); - void setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, bool ysfLoDev); + void setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, bool ysfLoDev); void updateCal(void); #if defined(SEND_RSSI_DATA) @@ -131,6 +132,7 @@ public: uint16_t devYSF(void); uint16_t devP25(void); uint16_t devNXDN(void); + uint16_t devPOCSAG(void); void printConf(); #endif diff --git a/IOArduino.cpp b/IOArduino.cpp index 0d0d80a..e88aa37 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -316,6 +316,11 @@ void CIO::NXDN_pin(bool on) digitalWrite(PIN_NXDN_LED, on ? HIGH : LOW); } +void CIO::POCSAG_pin(bool on) +{ + // TODO: add a LED pin for POCSAG mode +} + void CIO::PTT_pin(bool on) { digitalWrite(PIN_PTT_LED, on ? HIGH : LOW); diff --git a/IOSTM.cpp b/IOSTM.cpp index 79821a6..7d894d6 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -647,6 +647,11 @@ void CIO::NXDN_pin(bool on) GPIO_WriteBit(PORT_NXDN_LED, PIN_NXDN_LED, on ? Bit_SET : Bit_RESET); } +void CIO::POCSAG_pin(bool on) +{ + // TODO: add a LED pin for POCSAG mode +} + void CIO::PTT_pin(bool on) { GPIO_WriteBit(PORT_PTT_LED, PIN_PTT_LED, on ? Bit_SET : Bit_RESET); diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index ea32e2e..2b556ec 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -31,15 +31,18 @@ MMDVM_STATE m_calState = STATE_IDLE; MMDVM_STATE m_modemState_prev = STATE_IDLE; bool m_cwid_state = false; +bool m_pocsag_state = false; + uint8_t m_cwIdTXLevel = 30; uint32_t m_modeTimerCnt; -bool m_dstarEnable = true; -bool m_dmrEnable = true; -bool m_ysfEnable = true; -bool m_p25Enable = true; -bool m_nxdnEnable = true; +bool m_dstarEnable = true; +bool m_dmrEnable = true; +bool m_ysfEnable = true; +bool m_p25Enable = true; +bool m_nxdnEnable = true; +bool m_pocsagEnable = true; bool m_duplex = false; @@ -69,6 +72,8 @@ CP25TX p25TX; CNXDNRX nxdnRX; CNXDNTX nxdnTX; +CPOCSAGTX pocsagTX; + CCalDMR calDMR; #if defined(SEND_RSSI_DATA) @@ -115,6 +120,9 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); + if (m_pocsagEnable && m_modemState == STATE_POCSAG) + pocsagTX.process(); + if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) calDMR.process(); diff --git a/MMDVM_HS.ino b/MMDVM_HS.ino index 1cacba2..7b1cd39 100644 --- a/MMDVM_HS.ino +++ b/MMDVM_HS.ino @@ -27,15 +27,18 @@ MMDVM_STATE m_calState = STATE_IDLE; MMDVM_STATE m_modemState_prev = STATE_IDLE; bool m_cwid_state = false; +bool m_pocsag_state = false; + uint8_t m_cwIdTXLevel = 30; uint32_t m_modeTimerCnt; -bool m_dstarEnable = true; -bool m_dmrEnable = true; -bool m_ysfEnable = true; -bool m_p25Enable = true; -bool m_nxdnEnable = true; +bool m_dstarEnable = true; +bool m_dmrEnable = true; +bool m_ysfEnable = true; +bool m_p25Enable = true; +bool m_nxdnEnable = true; +bool m_pocsagEnable = true; bool m_duplex = false; @@ -65,6 +68,8 @@ CP25TX p25TX; CNXDNRX nxdnRX; CNXDNTX nxdnTX; +CPOCSAGTX pocsagTX; + CCalDMR calDMR; #if defined(SEND_RSSI_DATA) @@ -110,6 +115,9 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); + if (m_pocsagEnable && m_modemState == STATE_POCSAG) + pocsagTX.process(); + if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) calDMR.process(); diff --git a/NXDNTX.cpp b/NXDNTX.cpp index 0f3938c..1e84cfc 100644 --- a/NXDNTX.cpp +++ b/NXDNTX.cpp @@ -32,7 +32,6 @@ m_poBuffer(), m_poLen(0U), m_poPtr(0U), m_txDelay(240U), // 200ms -m_count(0U), m_delay(false), m_preamble(false) { @@ -47,7 +46,6 @@ void CNXDNTX::process() if (!m_tx) { m_delay = true; m_preamble = false; - m_count = 0U; m_poLen = m_txDelay; } else { m_delay = false; diff --git a/NXDNTX.h b/NXDNTX.h index c17ab37..e12467e 100644 --- a/NXDNTX.h +++ b/NXDNTX.h @@ -40,7 +40,6 @@ private: uint16_t m_poLen; uint16_t m_poPtr; uint16_t m_txDelay; - uint32_t m_count; bool m_delay; bool m_preamble; diff --git a/P25TX.cpp b/P25TX.cpp index 48f688e..6831527 100644 --- a/P25TX.cpp +++ b/P25TX.cpp @@ -31,7 +31,7 @@ m_poBuffer(), m_poLen(0U), m_poPtr(0U), m_txDelay(240U), // 200ms -m_count(0U) +m_delay(false) { } @@ -43,7 +43,6 @@ void CP25TX::process() if (m_poLen == 0U) { if (!m_tx) { m_delay = true; - m_count = 0U; m_poLen = m_txDelay; } else { uint8_t length = m_buffer.get(); diff --git a/P25TX.h b/P25TX.h index 93b3290..beb9da5 100644 --- a/P25TX.h +++ b/P25TX.h @@ -40,7 +40,6 @@ private: uint16_t m_poLen; uint16_t m_poPtr; uint16_t m_txDelay; - uint32_t m_count; bool m_delay; void writeByte(uint8_t c); diff --git a/POCSAGDefines.h b/POCSAGDefines.h new file mode 100644 index 0000000..3b28fa3 --- /dev/null +++ b/POCSAGDefines.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2009-2018 by Jonathan Naylor G4KLX + * Copyright (C) 2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(POCSAGDEFINES_H) +#define POCSAGDEFINES_H + +const uint16_t POCSAG_PREAMBLE_LENGTH_BYTES = 576U / 8U; +const uint16_t POCSAG_FRAME_LENGTH_BYTES = 17U * sizeof(uint32_t); +const uint8_t POCSAG_SYNC = 0xAAU; + +#endif diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp new file mode 100644 index 0000000..8717026 --- /dev/null +++ b/POCSAGTX.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#include "Config.h" +#include "Globals.h" +#include "POCSAGTX.h" +#include "POCSAGDefines.h" + +CPOCSAGTX::CPOCSAGTX() : +m_buffer(1000U), +m_poBuffer(), +m_poLen(0U), +m_poPtr(0U), +m_txDelay(POCSAG_PREAMBLE_LENGTH_BYTES), +m_delay(false) +{ +} + +void CPOCSAGTX::process() +{ + if (m_buffer.getData() == 0U && m_poLen == 0U) + return; + + if (m_poLen == 0U) { + if (!m_tx) { + m_delay = true; + m_poLen = m_txDelay; + } else { + m_delay = false; + for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) + m_poBuffer[m_poLen++] = m_buffer.get(); + } + + m_poPtr = 0U; + } + + if (m_poLen > 0U) { + uint16_t space = io.getSpace(); + + while (space > 8U) { + if (m_delay) { + m_poPtr++; + writeByte(POCSAG_SYNC); + } + else + writeByte(m_poBuffer[m_poPtr++]); + + space -= 8U; + + if (m_poPtr >= m_poLen) { + m_poPtr = 0U; + m_poLen = 0U; + m_delay = false; + return; + } + } + } +} + +uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) +{ + if (length != POCSAG_FRAME_LENGTH_BYTES) + return 4U; + + uint16_t space = m_buffer.getSpace(); + if (space < POCSAG_FRAME_LENGTH_BYTES) + return 5U; + + for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) + m_buffer.put(data[i]); + + return 0U; +} + +void CPOCSAGTX::writeByte(uint8_t c) +{ + uint8_t bit; + uint8_t mask = 0x01U; + + for (uint8_t i = 0U; i < 8U; i++) { + if ((c & mask) == mask) + bit = 1U; + else + bit = 0U; + + io.write(&bit, 1); + mask <<= 1; + } + +} + +void CPOCSAGTX::setTXDelay(uint8_t delay) +{ + m_txDelay = POCSAG_PREAMBLE_LENGTH_BYTES + uint16_t(delay); + + if (m_txDelay > 1200U) + m_txDelay = 1200U; +} + +uint8_t CPOCSAGTX::getSpace() const +{ + return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES; +} diff --git a/POCSAGTX.h b/POCSAGTX.h new file mode 100644 index 0000000..a102ce9 --- /dev/null +++ b/POCSAGTX.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(POCSAGTX_H) +#define POCSAGTX_H + +class CPOCSAGTX { +public: + CPOCSAGTX(); + + uint8_t writeData(const uint8_t* data, uint8_t length); + + void setTXDelay(uint8_t delay); + + uint8_t getSpace() const; + + void process(); + +private: + CSerialRB m_buffer; + uint8_t m_poBuffer[200U]; + uint16_t m_poLen; + uint16_t m_poPtr; + uint16_t m_txDelay; + bool m_delay; + + void writeByte(uint8_t c); +}; + +#endif diff --git a/SerialPort.cpp b/SerialPort.cpp index b2042aa..2fcef12 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -59,6 +59,8 @@ const uint8_t MMDVM_P25_LOST = 0x32U; const uint8_t MMDVM_NXDN_DATA = 0x40U; const uint8_t MMDVM_NXDN_LOST = 0x41U; +const uint8_t MMDVM_POCSAG_DATA = 0x50U; + const uint8_t MMDVM_ACK = 0x70U; const uint8_t MMDVM_NAK = 0x7FU; @@ -128,7 +130,9 @@ void CSerialPort::getStatus() reply[3U] |= 0x08U; if (m_nxdnEnable) reply[3U] |= 0x10U; - + if (m_pocsagEnable) + reply[3U] |= 0x20U; + reply[4U] = uint8_t(m_modemState); reply[5U] = m_tx ? 0x01U : 0x00U; @@ -177,7 +181,12 @@ void CSerialPort::getStatus() else reply[11U] = 0U; - writeInt(1U, reply, 11); + if (m_pocsagEnable) + reply[12U] = pocsagTX.getSpace(); + else + reply[12U] = 0U; + + writeInt(1U, reply, 13); } void CSerialPort::getVersion() @@ -209,11 +218,12 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) m_debug = (data[0U] & 0x10U) == 0x10U; - bool dstarEnable = (data[1U] & 0x01U) == 0x01U; - bool dmrEnable = (data[1U] & 0x02U) == 0x02U; - bool ysfEnable = (data[1U] & 0x04U) == 0x04U; - bool p25Enable = (data[1U] & 0x08U) == 0x08U; - bool nxdnEnable = (data[1U] & 0x10U) == 0x10U; + bool dstarEnable = (data[1U] & 0x01U) == 0x01U; + bool dmrEnable = (data[1U] & 0x02U) == 0x02U; + bool ysfEnable = (data[1U] & 0x04U) == 0x04U; + bool p25Enable = (data[1U] & 0x08U) == 0x08U; + bool nxdnEnable = (data[1U] & 0x10U) == 0x10U; + bool pocsagEnable = (data[1U] & 0x20U) == 0x20U; uint8_t txDelay = data[2U]; if (txDelay > 50U) @@ -221,7 +231,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) MMDVM_STATE modemState = MMDVM_STATE(data[3U]); - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL) return 4U; if (modemState == STATE_DSTAR && !dstarEnable) return 4U; @@ -233,6 +243,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) return 4U; if (modemState == STATE_NXDN && !nxdnEnable) return 4U; + if (modemState == STATE_POCSAG && !pocsagEnable) + return 4U; uint8_t colorCode = data[6U]; if (colorCode > 15U) @@ -244,22 +256,27 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) m_cwIdTXLevel = data[5U]>>2; - uint8_t dstarTXLevel = data[9U]; - uint8_t dmrTXLevel = data[10U]; - uint8_t ysfTXLevel = data[11U]; - uint8_t p25TXLevel = data[12U]; - uint8_t nxdnTXLevel = 128U; + uint8_t dstarTXLevel = data[9U]; + uint8_t dmrTXLevel = data[10U]; + uint8_t ysfTXLevel = data[11U]; + uint8_t p25TXLevel = data[12U]; + uint8_t nxdnTXLevel = 128U; + uint8_t pocsagTXLevel = 128U; if (length >= 16U) nxdnTXLevel = data[15U]; - io.setDeviations(dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, ysfLoDev); + if (length >= 18U) + pocsagTXLevel = data[17U]; - m_dstarEnable = dstarEnable; - m_dmrEnable = dmrEnable; - m_ysfEnable = ysfEnable; - m_p25Enable = p25Enable; - m_nxdnEnable = nxdnEnable; + io.setDeviations(dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel, ysfLoDev); + + m_dstarEnable = dstarEnable; + m_dmrEnable = dmrEnable; + m_ysfEnable = ysfEnable; + m_p25Enable = p25Enable; + m_nxdnEnable = nxdnEnable; + m_pocsagEnable = pocsagEnable; if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) { m_dmrEnable = true; @@ -288,6 +305,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) ysfTX.setTXDelay(txDelay); p25TX.setTXDelay(txDelay); nxdnTX.setTXDelay(txDelay); + pocsagTX.setTXDelay(txDelay); dmrDMOTX.setTXDelay(txDelay); #if defined(DUPLEX) @@ -336,7 +354,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) if (modemState == m_modemState) return 0U; - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL) return 4U; if (modemState == STATE_DSTAR && !m_dstarEnable) return 4U; @@ -348,6 +366,8 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) return 4U; if (modemState == STATE_NXDN && !m_nxdnEnable) return 4U; + if (modemState == STATE_POCSAG && !m_pocsagEnable) + return 4U; if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) { m_dmrEnable = true; @@ -454,6 +474,19 @@ void CSerialPort::setMode(MMDVM_STATE modemState) p25RX.reset(); cwIdTX.reset(); break; + case STATE_POCSAG: + DEBUG1("Mode set to POCSAG"); +#if defined(DUPLEX) + dmrIdleRX.reset(); + dmrRX.reset(); +#endif + dmrDMORX.reset(); + dstarRX.reset(); + ysfRX.reset(); + p25RX.reset(); + nxdnRX.reset(); + cwIdTX.reset(); + break; default: DEBUG1("Mode set to Idle"); // STATE_IDLE @@ -461,12 +494,12 @@ void CSerialPort::setMode(MMDVM_STATE modemState) } m_modemState = modemState; - + if ((modemState != STATE_IDLE) && (m_modemState_prev != modemState)) { DEBUG1("setMode: configuring Hardware"); io.ifConf(modemState, true); } - + io.setMode(m_modemState); } @@ -751,6 +784,21 @@ void CSerialPort::process() } break; + case MMDVM_POCSAG_DATA: + if (m_pocsagEnable) { + if (m_modemState == STATE_IDLE || m_modemState == STATE_POCSAG) + m_pocsag_state = true; + err = pocsagTX.writeData(m_buffer + 3U, m_len - 3U); + } + if (err == 0U) { + if (m_modemState == STATE_IDLE) + setMode(STATE_POCSAG); + } else { + DEBUG2("Received invalid POCSAG data", err); + sendNAK(err); + } + break; + #if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) case MMDVM_SERIAL: writeInt(3U, m_buffer + 3U, m_len - 3U); diff --git a/YSFTX.cpp b/YSFTX.cpp index 9e01f55..fa5e402 100644 --- a/YSFTX.cpp +++ b/YSFTX.cpp @@ -32,7 +32,7 @@ m_poBuffer(), m_poLen(0U), m_poPtr(0U), m_txDelay(240U), // 200ms -m_count(0U) +m_delay(false) { } @@ -44,7 +44,6 @@ void CYSFTX::process() if (m_poLen == 0U) { if (!m_tx) { m_delay = true; - m_count = 0U; m_poLen = m_txDelay; } else { m_delay = false; diff --git a/YSFTX.h b/YSFTX.h index fc80f63..21dcb1d 100644 --- a/YSFTX.h +++ b/YSFTX.h @@ -40,7 +40,6 @@ private: uint16_t m_poLen; uint16_t m_poPtr; uint16_t m_txDelay; - uint32_t m_count; bool m_delay; void writeByte(uint8_t c); From 113b6444d844c664696d914b9de7c7bb892e88d3 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 18 Jun 2018 00:07:32 -0400 Subject: [PATCH 046/239] Fix bit order for POCSAG --- POCSAGTX.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index 8717026..e969b9c 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -1,4 +1,5 @@ /* + * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -90,18 +91,16 @@ uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) void CPOCSAGTX::writeByte(uint8_t c) { uint8_t bit; - uint8_t mask = 0x01U; + uint8_t mask = 0x80U; - for (uint8_t i = 0U; i < 8U; i++) { + for (uint8_t i = 0U; i < 8U; i++, c <<= 1) { if ((c & mask) == mask) bit = 1U; else bit = 0U; io.write(&bit, 1); - mask <<= 1; } - } void CPOCSAGTX::setTXDelay(uint8_t delay) From a2d079548276206f3800be565c5dae255b295d94 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 18 Jun 2018 13:51:00 -0400 Subject: [PATCH 047/239] Invert POCSAG TX data --- ADF7021.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 2fa56fe..5466da1 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -333,7 +333,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) // Register 13 not used with 2FSK ADF7021_REG13 = (uint32_t) 0b1101 << 0; // register 13 - ADF7021_REG2 = (uint32_t) 0b00 << 28; // clock normal + ADF7021_REG2 = (uint32_t) 0b10 << 28; // inverted data, clock normal ADF7021_REG2 |= (uint32_t) (ADF7021_DEV_POCSAG / div2)<< 19; // deviation ADF7021_REG2 |= (uint32_t) 0b000 << 4; // modulation (2FSK) break; From d9a868eb10b1cc37df7ff2316a3a3c61bf7b4d67 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 18 Jun 2018 14:44:26 -0400 Subject: [PATCH 048/239] Fix getStatus() reply length --- SerialPort.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index b2042aa..358bf50 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -114,7 +114,7 @@ void CSerialPort::getStatus() // Send all sorts of interesting internal values reply[0U] = MMDVM_FRAME_START; - reply[1U] = 11U; + reply[1U] = 12U; reply[2U] = MMDVM_GET_STATUS; reply[3U] = 0x00U; @@ -177,7 +177,7 @@ void CSerialPort::getStatus() else reply[11U] = 0U; - writeInt(1U, reply, 11); + writeInt(1U, reply, 12); } void CSerialPort::getVersion() From d4dec3d76d868ed4e4c4fc302493ca345084fc35 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 18 Jun 2018 14:47:13 -0400 Subject: [PATCH 049/239] Fix getStatus() reply length --- SerialPort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index 2fcef12..d6d2d37 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -116,7 +116,7 @@ void CSerialPort::getStatus() // Send all sorts of interesting internal values reply[0U] = MMDVM_FRAME_START; - reply[1U] = 11U; + reply[1U] = 13U; reply[2U] = MMDVM_GET_STATUS; reply[3U] = 0x00U; From 707157a777aa07bbbf831d7bd3ec690670635215 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 19 Jun 2018 14:56:37 -0400 Subject: [PATCH 050/239] Add support for separated POCSAG frequency --- ADF7021.cpp | 20 +++++++++++++++++-- IO.cpp | 10 +++++++++- IO.h | 3 ++- SerialPort.cpp | 52 ++++++++++++++++++++++++++++++-------------------- 4 files changed, 60 insertions(+), 25 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 5466da1..e09114b 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -187,9 +187,19 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) uint32_t ADF7021_REG13 = 0U; int32_t AFC_OFFSET = 0; - if(modemState != STATE_CWID && modemState != STATE_POCSAG) + uint32_t frequency_tx_tmp, frequency_rx_tmp; + + if (modemState != STATE_CWID && modemState != STATE_POCSAG) m_modemState_prev = modemState; + // Change frequency for POCSAG mode, store a backup of DV frequencies + if (modemState == STATE_POCSAG) { + frequency_tx_tmp = m_frequency_tx; + frequency_rx_tmp = m_frequency_rx; + m_frequency_tx = m_pocsag_freq_tx; + m_frequency_rx = m_pocsag_freq_tx; + } + // Toggle CE pin for ADF7021 reset if(reset) { CE_pin(LOW); @@ -545,7 +555,13 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) AD7021_control_word = 0x000E000F; #endif Send_AD7021_control(); - + + // Restore normal DV frequencies + if (modemState == STATE_POCSAG) { + m_frequency_tx = frequency_tx_tmp; + m_frequency_rx = frequency_rx_tmp; + } + #if defined(DUPLEX) if(m_duplex && (modemState != STATE_CWID && modemState != STATE_POCSAG)) ifConf2(modemState); diff --git a/IO.cpp b/IO.cpp index 8c33119..d2d041f 100644 --- a/IO.cpp +++ b/IO.cpp @@ -24,6 +24,7 @@ uint32_t m_frequency_rx; uint32_t m_frequency_tx; +uint32_t m_pocsag_freq_tx; uint8_t m_power; CIO::CIO(): @@ -288,7 +289,7 @@ bool CIO::hasRXOverflow() return m_rxBuffer.hasOverflowed(); } -uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power) +uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx) { // Configure power level setPower(rf_power); @@ -300,9 +301,16 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po ((frequency_rx >= UHF2_MIN)&&(frequency_rx < UHF2_MAX)) || ((frequency_tx >= UHF2_MIN)&&(frequency_tx < UHF2_MAX)) ) ) return 4U; + if( !( ((pocsag_freq_tx >= VHF1_MIN)&&(pocsag_freq_tx < VHF1_MAX)) || \ + ((pocsag_freq_tx >= UHF1_MIN)&&(pocsag_freq_tx < UHF1_MAX)) || \ + ((pocsag_freq_tx >= VHF2_MIN)&&(pocsag_freq_tx < VHF2_MAX)) || \ + ((pocsag_freq_tx >= UHF2_MIN)&&(pocsag_freq_tx < UHF2_MAX)) ) ) + return 4U; + // Configure frequency m_frequency_rx = frequency_rx; m_frequency_tx = frequency_tx; + m_pocsag_freq_tx = pocsag_freq_tx; return 0U; } diff --git a/IO.h b/IO.h index 8e2c705..5fe4081 100644 --- a/IO.h +++ b/IO.h @@ -42,6 +42,7 @@ extern uint32_t m_frequency_rx; extern uint32_t m_frequency_tx; +extern uint32_t m_pocsag_freq_tx; extern uint8_t m_power; class CIO { @@ -93,7 +94,7 @@ public: void process(void); bool hasTXOverflow(void); bool hasRXOverflow(void); - uint8_t setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power); + uint8_t setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx); void setPower(uint8_t power); void setMode(MMDVM_STATE modemState); void setDecode(bool dcd); diff --git a/SerialPort.cpp b/SerialPort.cpp index d6d2d37..8ee44b5 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -388,31 +388,41 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) uint8_t CSerialPort::setFreq(const uint8_t* data, uint8_t length) { - uint32_t freq_rx, freq_tx; - uint8_t rf_power; + uint32_t freq_rx, freq_tx, pocsag_freq_tx; + uint8_t rf_power; - if (length < 9U) - return 4U; + if (length < 9U) + return 4U; - // Old MMDVMHost, set full power - if (length == 9U) - rf_power = 255U; + // Very old MMDVMHost, set full power + if (length == 9U) + rf_power = 255U; - // New MMDVMHost, set power from MMDVM.ini - if (length == 10U) - rf_power = data[9U]; + // Current MMDVMHost, set power from MMDVM.ini + if (length >= 10U) + rf_power = data[9U]; - freq_rx = data[1U] * 1U; - freq_rx += data[2U] * 256U; - freq_rx += data[3U] * 65536U; - freq_rx += data[4U] * 16777216U; - - freq_tx = data[5U] * 1U; - freq_tx += data[6U] * 256U; - freq_tx += data[7U] * 65536U; - freq_tx += data[8U] * 16777216U; - - return io.setFreq(freq_rx, freq_tx, rf_power); + freq_rx = data[1U] << 0; + freq_rx |= data[2U] << 8; + freq_rx |= data[3U] << 16; + freq_rx |= data[4U] << 24; + + freq_tx = data[5U] << 0; + freq_tx |= data[6U] << 8; + freq_tx |= data[7U] << 16; + freq_tx |= data[8U] << 24; + + // New MMDVMHost, set POCSAG TX frequency + if (length >= 14U) { + pocsag_freq_tx = data[10U] << 0; + pocsag_freq_tx |= data[11U] << 8; + pocsag_freq_tx |= data[12U] << 16; + pocsag_freq_tx |= data[13U] << 24; + } + else + pocsag_freq_tx = freq_tx; + + return io.setFreq(freq_rx, freq_tx, rf_power, pocsag_freq_tx); } void CSerialPort::setMode(MMDVM_STATE modemState) From c35aa8d874467846f698df739a345012cf8dbcd9 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 20 Jun 2018 20:14:40 -0400 Subject: [PATCH 051/239] Enable external POCSAG deviation adjustment (50 % = +-4.5 kHz for symbol deviation) --- ADF7021.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index e09114b..f5f71dc 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -344,7 +344,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG13 = (uint32_t) 0b1101 << 0; // register 13 ADF7021_REG2 = (uint32_t) 0b10 << 28; // inverted data, clock normal - ADF7021_REG2 |= (uint32_t) (ADF7021_DEV_POCSAG / div2)<< 19; // deviation + ADF7021_REG2 |= (uint32_t) (m_pocsagDev / div2) << 19; // deviation ADF7021_REG2 |= (uint32_t) 0b000 << 4; // modulation (2FSK) break; From 72e7a4362f95e07fda93c1629e3e9edd26a9fe29 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 21 Jun 2018 15:11:05 -0400 Subject: [PATCH 052/239] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d08f99b..bba2621 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # Introduction -This is the source code of ZUMspot/MMDVM_HS, personal hotspot (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital modes. +This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital modes. This software is intended to be run on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib). +This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 imitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. + 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. # Features From 60894b736425d4073d4e73e400a6276009bdfd24 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 21 Jun 2018 15:12:00 -0400 Subject: [PATCH 053/239] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d08f99b..bba2621 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # Introduction -This is the source code of ZUMspot/MMDVM_HS, personal hotspot (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital modes. +This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital modes. This software is intended to be run on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib). +This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 imitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. + 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. # Features From 1387760e72f4ad465e16969225b3b6706c867fb6 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 21 Jun 2018 15:13:28 -0400 Subject: [PATCH 054/239] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bba2621..086cde2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7 This software is intended to be run on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib). -This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 imitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. +This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 limitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. 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 f04cd58e1975dea53e28be83ba5cc26e43c74aa8 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 21 Jun 2018 19:44:57 -0400 Subject: [PATCH 055/239] Update README --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bba2621..f656f24 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,20 @@ # Introduction -This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital modes. +This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital voice modes and POCSAG 1200 pager protocol. This software is intended to be run on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib). -This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 imitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. +This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 limitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. 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. # Features - Supported modes: D-Star, DMR, Yaesu Fusion, P25 Phase 1 and NXDN +- Other modes: POCSAG 1200 - Automatic mode detection (scanning) -- G4KLX software suite: [MMDVMHost](https://github.com/g4klx/MMDVMHost), [ircDDBGateway](https://github.com/dl5di/OpenDV), [YSFGateway](https://github.com/g4klx/YSFClients), [P25Gateway](https://github.com/g4klx/P25Clients), [DMRGateway](https://github.com/g4klx/DMRGateway), [NXDNGateway](https://github.com/g4klx/NXDNClients) and [MMDVMCal](https://github.com/g4klx/MMDVMCal) +- G4KLX software suite: [MMDVMHost](https://github.com/g4klx/MMDVMHost), [ircDDBGateway](https://github.com/g4klx/ircDDBGateway), [YSFGateway](https://github.com/g4klx/YSFClients), [P25Gateway](https://github.com/g4klx/P25Clients), [DMRGateway](https://github.com/g4klx/DMRGateway), [NXDNGateway](https://github.com/g4klx/NXDNClients), +[DAPNETGateway](https://github.com/g4klx/DAPNETGateway) and [MMDVMCal](https://github.com/g4klx/MMDVMCal) - Bands: 144, 220, 430 and 900 MHz (VHF requires external inductor) - Status LEDs (PTT, COR and digital modes) - Serial repeater port for Nextion displays From 81d61b3fbf7e654bcda96b5a006daf24d9b7fb5d Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 21 Jun 2018 19:46:08 -0400 Subject: [PATCH 056/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index d852d55..897da54 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "3" -#define VER_REV "7" -#define VERSION_DATE "20180522" +#define VER_REV "8" +#define VERSION_DATE "20180621" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 654403afc004bf4619b1e86919a2178900154f2b Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 21 Jun 2018 20:48:19 -0400 Subject: [PATCH 057/239] Change to linear demodulator for POCSAG (not used for now...) --- ADF7021.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index f5f71dc..8be1f8d 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -333,7 +333,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG10 = ADF7021_REG10_POCSAG; ADF7021_REG4 = (uint32_t) 0b0100 << 0; // register 4 - ADF7021_REG4 |= (uint32_t) 0b001 << 4; // demod mode, 2FSK + ADF7021_REG4 |= (uint32_t) 0b000 << 4; // 2FSK linear demodulator ADF7021_REG4 |= (uint32_t) 0b1 << 7; ADF7021_REG4 |= (uint32_t) 0b10 << 8; ADF7021_REG4 |= (uint32_t) ADF7021_DISC_BW_POCSAG << 10; // Disc BW From 773c69afb01df188a3d940034c10d53bdb460e43 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 21 Jun 2018 20:48:42 -0400 Subject: [PATCH 058/239] Additional checks for POCSAG mode --- IO.cpp | 6 ++++-- SerialPort.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/IO.cpp b/IO.cpp index d2d041f..d5e38b1 100644 --- a/IO.cpp +++ b/IO.cpp @@ -140,12 +140,14 @@ void CIO::process() if(m_cwid_state) { // check for CW ID end of transmission m_cwid_state = false; // Restoring previous mode - io.ifConf(m_modemState_prev, true); + if (m_TotalModes) + io.ifConf(m_modemState_prev, true); } if(m_pocsag_state) { // check for POCSAG end of transmission m_pocsag_state = false; // Restoring previous mode - io.ifConf(m_modemState_prev, true); + if (m_TotalModes) + io.ifConf(m_modemState_prev, true); } setRX(false); } diff --git a/SerialPort.cpp b/SerialPort.cpp index 8ee44b5..5ee99e7 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -330,6 +330,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.ifConf(STATE_P25, true); else if(m_nxdnEnable) io.ifConf(STATE_NXDN, true); + else if(m_pocsagEnable) + io.ifConf(STATE_POCSAG, true); } io.start(); From dc9b8c28f648eeb362b917e02605ae4ff0bbec38 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 3 Jul 2018 14:17:42 -0400 Subject: [PATCH 059/239] Update TX delay according to G4KLX MMDVM firmware --- POCSAGDefines.h | 2 +- POCSAGTX.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/POCSAGDefines.h b/POCSAGDefines.h index 3b28fa3..513ffbc 100644 --- a/POCSAGDefines.h +++ b/POCSAGDefines.h @@ -20,7 +20,7 @@ #if !defined(POCSAGDEFINES_H) #define POCSAGDEFINES_H -const uint16_t POCSAG_PREAMBLE_LENGTH_BYTES = 576U / 8U; +const uint16_t POCSAG_PREAMBLE_LENGTH_BYTES = 18U * sizeof(uint32_t); const uint16_t POCSAG_FRAME_LENGTH_BYTES = 17U * sizeof(uint32_t); const uint8_t POCSAG_SYNC = 0xAAU; diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index e969b9c..9d8f389 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -105,10 +105,10 @@ void CPOCSAGTX::writeByte(uint8_t c) void CPOCSAGTX::setTXDelay(uint8_t delay) { - m_txDelay = POCSAG_PREAMBLE_LENGTH_BYTES + uint16_t(delay); + m_txDelay = POCSAG_PREAMBLE_LENGTH_BYTES + (delay * 3U) / 2U; - if (m_txDelay > 1200U) - m_txDelay = 1200U; + if (m_txDelay > 150U) + m_txDelay = 150U; } uint8_t CPOCSAGTX::getSpace() const From 602d773377094648805e48835b71ebe126afd86a Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 4 Jul 2018 10:12:21 +0200 Subject: [PATCH 060/239] Use DStar and DMR LEDs for POCSAG mode until a separate POCSAG LED is available on newer boards --- IOArduino.cpp | 5 ++++- IOSTM.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/IOArduino.cpp b/IOArduino.cpp index e88aa37..1887951 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -318,7 +318,10 @@ void CIO::NXDN_pin(bool on) void CIO::POCSAG_pin(bool on) { - // TODO: add a LED pin for POCSAG mode + // Use D-Star and DMR LED to indicate POCSAG mode + // TODO: add a separate LED pin for POCSAG mode + digitalWrite(PIN_DSTAR_LED, on ? HIGH : LOW); + digitalWrite(PIN_DMR_LED, on ? HIGH : LOW); } void CIO::PTT_pin(bool on) diff --git a/IOSTM.cpp b/IOSTM.cpp index 7d894d6..962fe29 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -649,7 +649,10 @@ void CIO::NXDN_pin(bool on) void CIO::POCSAG_pin(bool on) { - // TODO: add a LED pin for POCSAG mode + // Use D-Star and DMR LED to indicate POCSAG mode + // TODO: add a separate LED pin for POCSAG mode + GPIO_WriteBit(PORT_DSTAR_LED, PIN_DSTAR_LED, on ? Bit_SET : Bit_RESET); + GPIO_WriteBit(PORT_DMR_LED, PIN_DMR_LED, on ? Bit_SET : Bit_RESET); } void CIO::PTT_pin(bool on) From 57878e1cea9cf03de8c9e4670113eeccb1e11dee Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 4 Jul 2018 22:19:25 +0200 Subject: [PATCH 061/239] Adapt LED handling to MMDVM options --- Config.h | 6 ++++++ IOArduino.cpp | 10 ++++++++-- IOSTM.cpp | 10 ++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Config.h b/Config.h index 13ace8b..df112ef 100644 --- a/Config.h +++ b/Config.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/IOArduino.cpp b/IOArduino.cpp index 1887951..41042f1 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -313,15 +313,21 @@ void CIO::P25_pin(bool on) void CIO::NXDN_pin(bool on) { +#if defined(USE_ALTERNATE_NXDN_LEDS) + digitalWrite(PIN_YSF_LED, on ? HIGH : LOW); + digitalWrite(PIN_P25_LED, on ? HIGH : LOW); +#else digitalWrite(PIN_NXDN_LED, on ? HIGH : LOW); +#endif } void CIO::POCSAG_pin(bool on) { - // Use D-Star and DMR LED to indicate POCSAG mode - // TODO: add a separate LED pin for POCSAG mode +#if defined(USE_ALTERNATE_POCSAG_LEDS) digitalWrite(PIN_DSTAR_LED, on ? HIGH : LOW); digitalWrite(PIN_DMR_LED, on ? HIGH : LOW); +#endif + // TODO: add a separate LED pin for POCSAG mode } void CIO::PTT_pin(bool on) diff --git a/IOSTM.cpp b/IOSTM.cpp index 962fe29..ac2e26b 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -644,15 +644,21 @@ void CIO::P25_pin(bool on) void CIO::NXDN_pin(bool on) { +#if defined(USE_ALTERNATE_NXDN_LEDS) + GPIO_WriteBit(PORT_YSF_LED, PIN_YSF_LED, on ? Bit_SET : Bit_RESET); + GPIO_WriteBit(PORT_P25_LED, PIN_P25_LED, on ? Bit_SET : Bit_RESET); +#else GPIO_WriteBit(PORT_NXDN_LED, PIN_NXDN_LED, on ? Bit_SET : Bit_RESET); +#endif } void CIO::POCSAG_pin(bool on) { - // Use D-Star and DMR LED to indicate POCSAG mode - // TODO: add a separate LED pin for POCSAG mode +#if defined(USE_ALTERNATE_POCSAG_LEDS) GPIO_WriteBit(PORT_DSTAR_LED, PIN_DSTAR_LED, on ? Bit_SET : Bit_RESET); GPIO_WriteBit(PORT_DMR_LED, PIN_DMR_LED, on ? Bit_SET : Bit_RESET); +#endif + // TODO: add a separate LED pin for POCSAG mode } void CIO::PTT_pin(bool on) From 1791efe6a5b6036ff7fe10de208355fbef207236 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 4 Jul 2018 23:24:47 -0400 Subject: [PATCH 062/239] Update version --- version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.h b/version.h index 897da54..9f0ada2 100644 --- a/version.h +++ b/version.h @@ -23,9 +23,9 @@ #include "ADF7021.h" #define VER_MAJOR "1" -#define VER_MINOR "3" -#define VER_REV "8" -#define VERSION_DATE "20180621" +#define VER_MINOR "4" +#define VER_REV "0" +#define VERSION_DATE "20180705" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 2e2d2b30046f8146a25d93d3ce1e34f12a000f41 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 4 Jul 2018 23:42:07 -0400 Subject: [PATCH 063/239] Optimizing bit memory ring buffer --- BitRB.cpp | 17 +++++++++++------ version.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/BitRB.cpp b/BitRB.cpp index 0aa8ae5..0b56a65 100644 --- a/BitRB.cpp +++ b/BitRB.cpp @@ -21,6 +21,11 @@ Boston, MA 02110-1301, USA. #include "BitRB.h" +const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; + +#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) +#define READ_BIT1(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) + CBitRB::CBitRB(uint16_t length) : m_length(length), m_bits(NULL), @@ -30,8 +35,8 @@ m_tail(0U), m_full(false), m_overflow(false) { - m_bits = new uint8_t[length]; - m_control = new uint8_t[length]; + m_bits = new uint8_t[length / 8U]; + m_control = new uint8_t[length / 8U]; } uint16_t CBitRB::getSpace() const @@ -68,8 +73,8 @@ bool CBitRB::put(uint8_t bit, uint8_t control) return false; } - m_bits[m_head] = bit; - m_control[m_head] = control; + WRITE_BIT1(m_bits, m_head, bit); + WRITE_BIT1(m_control, m_head, control); m_head++; if (m_head >= m_length) @@ -86,8 +91,8 @@ bool CBitRB::get(uint8_t& bit, uint8_t& control) if (m_head == m_tail && !m_full) return false; - bit = m_bits[m_tail]; - control = m_control[m_tail]; + bit = READ_BIT1(m_bits, m_tail); + control = READ_BIT1(m_control, m_tail); m_full = false; diff --git a/version.h b/version.h index 9f0ada2..128b230 100644 --- a/version.h +++ b/version.h @@ -24,7 +24,7 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "0" +#define VER_REV "1" #define VERSION_DATE "20180705" #if defined(ZUMSPOT_ADF7021) From dedb41954fb2fc0edee739bcd89e063d6015b9f4 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 5 Jul 2018 00:11:33 -0400 Subject: [PATCH 064/239] Revert "Optimizing bit memory ring buffer" This reverts commit 2e2d2b30046f8146a25d93d3ce1e34f12a000f41. --- BitRB.cpp | 17 ++++++----------- version.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/BitRB.cpp b/BitRB.cpp index 0b56a65..0aa8ae5 100644 --- a/BitRB.cpp +++ b/BitRB.cpp @@ -21,11 +21,6 @@ Boston, MA 02110-1301, USA. #include "BitRB.h" -const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; - -#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) -#define READ_BIT1(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) - CBitRB::CBitRB(uint16_t length) : m_length(length), m_bits(NULL), @@ -35,8 +30,8 @@ m_tail(0U), m_full(false), m_overflow(false) { - m_bits = new uint8_t[length / 8U]; - m_control = new uint8_t[length / 8U]; + m_bits = new uint8_t[length]; + m_control = new uint8_t[length]; } uint16_t CBitRB::getSpace() const @@ -73,8 +68,8 @@ bool CBitRB::put(uint8_t bit, uint8_t control) return false; } - WRITE_BIT1(m_bits, m_head, bit); - WRITE_BIT1(m_control, m_head, control); + m_bits[m_head] = bit; + m_control[m_head] = control; m_head++; if (m_head >= m_length) @@ -91,8 +86,8 @@ bool CBitRB::get(uint8_t& bit, uint8_t& control) if (m_head == m_tail && !m_full) return false; - bit = READ_BIT1(m_bits, m_tail); - control = READ_BIT1(m_control, m_tail); + bit = m_bits[m_tail]; + control = m_control[m_tail]; m_full = false; diff --git a/version.h b/version.h index 128b230..9f0ada2 100644 --- a/version.h +++ b/version.h @@ -24,7 +24,7 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "1" +#define VER_REV "0" #define VERSION_DATE "20180705" #if defined(ZUMSPOT_ADF7021) From 0400ab4019cc30225792832409416db4c4bdc93b Mon Sep 17 00:00:00 2001 From: Andy Date: Sat, 7 Jul 2018 16:20:56 -0400 Subject: [PATCH 065/239] Prepare next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 87a6cd6..9c5c132 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 90ba7cc..5a8851a 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index d3677e8..24000f2 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 11212df..66b59c9 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index ee5a2ce..ccfa1de 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 86aea35..15ac220 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 0f8a6d7..77a8bfb 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh index f4765c7..b29342b 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 3193c35..98e73d3 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 6ee9a34..7b41431 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 6b370fa..0d6124b 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.3.7" +FW_VERSION="v1.4.0" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From 97939376a3d5c33f7c2b05a8f475cfa96b357f00 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 8 Jul 2018 11:37:07 +0200 Subject: [PATCH 066/239] Fix two compiler warnings about indentiation --- DStarTX.cpp | 2 +- SerialPort.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DStarTX.cpp b/DStarTX.cpp index ba873c3..5b3f91e 100644 --- a/DStarTX.cpp +++ b/DStarTX.cpp @@ -383,7 +383,7 @@ void CDStarTX::txHeader(const uint8_t* in, uint8_t* out) const if (i < 660U) { if (d & 0x08U) out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]); - i++; + i++; if (d & 0x04U) out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]); diff --git a/SerialPort.cpp b/SerialPort.cpp index 5ee99e7..335c72c 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -798,9 +798,10 @@ void CSerialPort::process() case MMDVM_POCSAG_DATA: if (m_pocsagEnable) { - if (m_modemState == STATE_IDLE || m_modemState == STATE_POCSAG) + if (m_modemState == STATE_IDLE || m_modemState == STATE_POCSAG) { m_pocsag_state = true; err = pocsagTX.writeData(m_buffer + 3U, m_len - 3U); + } } if (err == 0U) { if (m_modemState == STATE_IDLE) From e1dabaa6db669e8801dad7fc11d933d79d3d1911 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 9 Jul 2018 16:37:27 +0200 Subject: [PATCH 067/239] Fix ALTERNATE_LEDs function --- IO.cpp | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/IO.cpp b/IO.cpp index d5e38b1..9f55a70 100644 --- a/IO.cpp +++ b/IO.cpp @@ -319,12 +319,36 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po void CIO::setMode(MMDVM_STATE modemState) { - DSTAR_pin(modemState == STATE_DSTAR); - DMR_pin(modemState == STATE_DMR); - YSF_pin(modemState == STATE_YSF); - P25_pin(modemState == STATE_P25); - NXDN_pin(modemState == STATE_NXDN); - POCSAG_pin(modemState == STATE_POCSAG); +#if defined(USE_ALTERNATE_POCSAG_LEDS) + if (modemState != STATE_POCSAG) { +#endif + DSTAR_pin(modemState == STATE_DSTAR); + DMR_pin(modemState == STATE_DMR); +#if defined(USE_ALTERNATE_POCSAG_LEDS) + } +#endif +#if defined(USE_ALTERNATE_NXDN_LEDS) + if (modemState != STATE_NXDN) { +#endif + YSF_pin(modemState == STATE_YSF); + P25_pin(modemState == STATE_P25); +#if defined(USE_ALTERNATE_NXDN_LEDS) + } +#endif +#if defined(USE_ALTERNATE_NXDN_LEDS) + if (modemState != STATE_YSF && modemState != STATE_P25) { +#endif + NXDN_pin(modemState == STATE_NXDN); +#if defined(USE_ALTERNATE_NXDN_LEDS) + } +#endif +#if defined(USE_ALTERNATE_POCSAG_LEDS) + if (modemState != STATE_DSTAR && modemState != STATE_DMR) { +#endif + POCSAG_pin(modemState == STATE_POCSAG); +#if defined(USE_ALTERNATE_POCSAG_LEDS) + } +#endif } void CIO::setDecode(bool dcd) From e30b9f0bcb8d3917686d01387329c891e0fb9d10 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 9 Jul 2018 19:35:26 +0200 Subject: [PATCH 068/239] Fix merge mistake --- Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config.h b/Config.h index d4bece9..df112ef 100644 --- a/Config.h +++ b/Config.h @@ -37,7 +37,7 @@ #define ENABLE_ADF7021 // Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): -#define DUPLEX +// #define DUPLEX // TCXO of the ADF7021 // For 14.7456 MHz: From 5585d56088520d5ec811948f7cfe9dbfe09448a0 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 9 Jul 2018 14:47:12 -0400 Subject: [PATCH 069/239] Update version --- configs/MMDVM_HS_Dual_Hat.h | 6 ++++++ configs/MMDVM_HS_Hat-12mhz.h | 6 ++++++ configs/MMDVM_HS_Hat.h | 6 ++++++ configs/NanoDV.h | 6 ++++++ configs/Nano_hotSPOT.h | 6 ++++++ configs/ZUMspot_Libre.h | 6 ++++++ configs/ZUMspot_RPi.h | 6 ++++++ configs/ZUMspot_USB.h | 6 ++++++ configs/ZUMspot_duplex.h | 6 ++++++ configs/generic_duplex_gpio.h | 6 ++++++ configs/generic_gpio.h | 6 ++++++ scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- version.h | 4 ++-- 23 files changed, 79 insertions(+), 13 deletions(-) diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 815a909..b5d2105 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 5553909..ad1307f 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 47d73d1..4638dfd 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/NanoDV.h b/configs/NanoDV.h index 0fef16a..9d90a4b 100644 --- a/configs/NanoDV.h +++ b/configs/NanoDV.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 5dd9008..2ef0670 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 13ace8b..df112ef 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index ce27a97..76c371a 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 037dfb9..fa4d85d 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index e70601b..d4bece9 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 05eeef1..acea3b0 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index da560be..2b307f4 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 9c5c132..8a668a8 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 5a8851a..bcf9fe6 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 24000f2..28678ca 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 66b59c9..6e5bc10 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index ccfa1de..366b518 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 15ac220..4b7c23e 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 77a8bfb..9fee583 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh index b29342b..b3aa27c 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 98e73d3..4f1e7d4 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 7b41431..9fca17a 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 0d6124b..b30c840 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/version.h b/version.h index 9f0ada2..854259d 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "0" -#define VERSION_DATE "20180705" +#define VER_REV "1" +#define VERSION_DATE "20180709" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From a0cbf3bb90283f686333eb0abe1bed81d0fc10aa Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 11 Jul 2018 14:01:18 +0200 Subject: [PATCH 070/239] Add support for 12.288MHz MMDVM_HS_Dual_Hats --- configs/MMDVM_HS_Dual_Hat-12mhz.h | 76 ++++++++++++++++++++++++++ scripts/build_fw.sh | 6 +++ scripts/install_fw_hsdualhat-12mhz.sh | 77 +++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 configs/MMDVM_HS_Dual_Hat-12mhz.h create mode 100755 scripts/install_fw_hsdualhat-12mhz.sh diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h new file mode 100644 index 0000000..7b0fef7 --- /dev/null +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +#define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +#define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +// #define ADF7021_14_7456 +// For 12.2880 MHz: +#define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Constant Service LED once repeater is running +// #define CONSTANT_SRV_LED + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 1d96235..c13ebfb 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -62,6 +62,12 @@ make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw.bin make clean +# Building MMDVM_HS_Dual_Hat (12.288 MHz TCXO) +cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat-12mhz.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw-12mhz.bin +make clean + # Building Nano hotSPOT cp ~/MMDVM_HS/configs/Nano_hotSPOT.h ~/MMDVM_HS/Config.h make diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh new file mode 100755 index 0000000..39f2ab9 --- /dev/null +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + +# 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. + +# Configure latest version +FW_VERSION="v1.4.0" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for MMDVM_HS_Hat +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw-12mhz.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w mmdvm_hs_dual_hat_fw-12mhz.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + From 491dd309a101b3f6ff35b2a2ed713a36e15db0d9 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 11 Jul 2018 14:04:20 +0200 Subject: [PATCH 071/239] update version --- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 39f2ab9..f2dedcf 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.0" +FW_VERSION="v1.4.1" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From f8565fc084a81e0b58602991d75abe23039699d6 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 11 Jul 2018 16:22:13 +0200 Subject: [PATCH 072/239] Add ALTERNATEs to Dual 12MHz config template --- configs/MMDVM_HS_Dual_Hat-12mhz.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 7b0fef7..d0cab28 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -70,6 +70,12 @@ // Constant Service LED once repeater is running // #define CONSTANT_SRV_LED +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + // Enable modem debug messages // #define ENABLE_DEBUG From 1364fa1658e09b903fafb6f322a89030fe88c1a6 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 11 Jul 2018 16:23:37 +0200 Subject: [PATCH 073/239] Acitvate ALTERNATE_POCSAG LEDs for MMDVM_HS_Hats --- configs/MMDVM_HS_Dual_Hat-12mhz.h | 2 +- configs/MMDVM_HS_Dual_Hat.h | 2 +- configs/MMDVM_HS_Hat-12mhz.h | 2 +- configs/MMDVM_HS_Hat.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index d0cab28..1802fa2 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -74,7 +74,7 @@ // #define USE_ALTERNATE_NXDN_LEDS // Use the D-Star and DMR LEDs for POCSAG -// #define USE_ALTERNATE_POCSAG_LEDS +#define USE_ALTERNATE_POCSAG_LEDS // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index b5d2105..b182724 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -74,7 +74,7 @@ // #define USE_ALTERNATE_NXDN_LEDS // Use the D-Star and DMR LEDs for POCSAG -// #define USE_ALTERNATE_POCSAG_LEDS +#define USE_ALTERNATE_POCSAG_LEDS // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index ad1307f..8a11a90 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -74,7 +74,7 @@ // #define USE_ALTERNATE_NXDN_LEDS // Use the D-Star and DMR LEDs for POCSAG -// #define USE_ALTERNATE_POCSAG_LEDS +#define USE_ALTERNATE_POCSAG_LEDS // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 4638dfd..b4be985 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -74,7 +74,7 @@ // #define USE_ALTERNATE_NXDN_LEDS // Use the D-Star and DMR LEDs for POCSAG -// #define USE_ALTERNATE_POCSAG_LEDS +#define USE_ALTERNATE_POCSAG_LEDS // Enable modem debug messages // #define ENABLE_DEBUG From 5f7b628417aa4bc774d8602fec105836ff02830a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 15 Jul 2018 19:12:09 -0400 Subject: [PATCH 074/239] Add new SRV LED options by Aleksander S56AL --- Config.h | 5 ++++- IO.cpp | 14 ++++++++++++++ configs/MMDVM_HS_Dual_Hat-12mhz.h | 5 ++++- configs/MMDVM_HS_Dual_Hat.h | 5 ++++- configs/MMDVM_HS_Hat-12mhz.h | 5 ++++- configs/MMDVM_HS_Hat.h | 5 ++++- configs/NanoDV.h | 5 ++++- configs/Nano_hotSPOT.h | 5 ++++- configs/ZUMspot_Libre.h | 5 ++++- configs/ZUMspot_RPi.h | 5 ++++- configs/ZUMspot_USB.h | 5 ++++- configs/ZUMspot_duplex.h | 5 ++++- configs/generic_duplex_gpio.h | 5 ++++- configs/generic_gpio.h | 5 ++++- version.h | 4 ++-- 15 files changed, 68 insertions(+), 15 deletions(-) diff --git a/Config.h b/Config.h index df112ef..c0ac7e8 100644 --- a/Config.h +++ b/Config.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/IO.cpp b/IO.cpp index 9f55a70..0b0d26c 100644 --- a/IO.cpp +++ b/IO.cpp @@ -119,6 +119,20 @@ void CIO::process() #if defined(CONSTANT_SRV_LED) LED_pin(HIGH); +#elif defined(CONSTANT_SRV_LED_INVERTED) + LED_pin(LOW); +#elif defined(DISCREET_SRV_LED) + if (m_ledCount == 10000U) LED_pin(LOW); + if (m_ledCount >= 480000U) { + m_ledCount = 0U; + LED_pin(HIGH); + }; +#elif defined(DISCREET_SRV_LED_INVERTED) + if (m_ledCount == 10000U) LED_pin(HIGH); + if (m_ledCount >= 480000U) { + m_ledCount = 0U; + LED_pin(LOW); + }; #else if (m_ledCount >= 24000U) { m_ledCount = 0U; diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 1802fa2..f115691 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index b182724..1305fbf 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 8a11a90..e220f9d 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index b4be985..6e190e3 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/NanoDV.h b/configs/NanoDV.h index 9d90a4b..9dfe6ff 100644 --- a/configs/NanoDV.h +++ b/configs/NanoDV.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 2ef0670..d0d1021 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index df112ef..c0ac7e8 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 76c371a..f38b6cc 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index fa4d85d..78fbadc 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index d4bece9..31b58b2 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index acea3b0..214b15b 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index 2b307f4..d03a361 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -67,8 +67,11 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Constant Service LED once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS diff --git a/version.h b/version.h index 854259d..d0bbbfc 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "1" -#define VERSION_DATE "20180709" +#define VER_REV "2" +#define VERSION_DATE "20180715" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 6499fd159636fb2200b9fa24ffb76e5d5e011f35 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 15 Jul 2018 20:51:42 -0400 Subject: [PATCH 075/239] Optimizing DMR RX buffer memory --- DMRDMORX.cpp | 33 +++++++++++++++++++++++---------- DMRDMORX.h | 2 +- DMRSlotRX.cpp | 33 +++++++++++++++++++++++---------- DMRSlotRX.h | 2 +- 4 files changed, 48 insertions(+), 22 deletions(-) diff --git a/DMRDMORX.cpp b/DMRDMORX.cpp index c3b0813..f3f6bf0 100644 --- a/DMRDMORX.cpp +++ b/DMRDMORX.cpp @@ -33,6 +33,11 @@ const uint8_t CONTROL_NONE = 0x00U; const uint8_t CONTROL_VOICE = 0x20U; const uint8_t CONTROL_DATA = 0x40U; +const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; + +#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) +#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7))) + CDMRDMORX::CDMRDMORX() : m_patternBuffer(0x00U), m_dataPtr(0U), @@ -60,8 +65,8 @@ void CDMRDMORX::reset() void CDMRDMORX::databit(bool bit) { - m_buffer[m_dataPtr] = bit; - + WRITE_BIT1(m_buffer, m_dataPtr, bit); + m_patternBuffer <<= 1; if (bit) m_patternBuffer |= 0x01U; @@ -236,28 +241,36 @@ void CDMRDMORX::bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer) for (uint8_t i = 0U; i < count; i++) { buffer[i] = 0U; - buffer[i] |= ((m_buffer[start++] & 0x01) << 7); + buffer[i] |= READ_BIT1(m_buffer, start) << 7; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 6); + buffer[i] |= READ_BIT1(m_buffer, start) << 6; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 5); + buffer[i] |= READ_BIT1(m_buffer, start) << 5; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 4); + buffer[i] |= READ_BIT1(m_buffer, start) << 4; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 3); + buffer[i] |= READ_BIT1(m_buffer, start) << 3; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 2); + buffer[i] |= READ_BIT1(m_buffer, start) << 2; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 1); + buffer[i] |= READ_BIT1(m_buffer, start) << 1; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 0); + buffer[i] |= READ_BIT1(m_buffer, start) << 0; + start++; if (start >= DMO_BUFFER_LENGTH_BITS) start -= DMO_BUFFER_LENGTH_BITS; } diff --git a/DMRDMORX.h b/DMRDMORX.h index 09a85d9..65123c1 100644 --- a/DMRDMORX.h +++ b/DMRDMORX.h @@ -41,7 +41,7 @@ public: private: uint64_t m_patternBuffer; - uint8_t m_buffer[DMO_BUFFER_LENGTH_BITS]; + uint8_t m_buffer[DMO_BUFFER_LENGTH_BITS / 8U]; // 72 bytes uint8_t frame[DMR_FRAME_LENGTH_BYTES + 3U]; uint16_t m_dataPtr; uint16_t m_syncPtr; diff --git a/DMRSlotRX.cpp b/DMRSlotRX.cpp index 3b32045..d08338e 100644 --- a/DMRSlotRX.cpp +++ b/DMRSlotRX.cpp @@ -36,6 +36,11 @@ const uint8_t CONTROL_NONE = 0x00U; const uint8_t CONTROL_VOICE = 0x20U; const uint8_t CONTROL_DATA = 0x40U; +const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; + +#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) +#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7))) + CDMRSlotRX::CDMRSlotRX() : m_slot(false), m_patternBuffer(0x00U), @@ -104,8 +109,8 @@ bool CDMRSlotRX::databit(bool bit) if (m_delayPtr < m_delay) return (m_state1 != DMRRXS_NONE) || (m_state2 != DMRRXS_NONE); - m_buffer[m_dataPtr] = bit; - + WRITE_BIT1(m_buffer, m_dataPtr, bit); + m_patternBuffer <<= 1; if (bit) m_patternBuffer |= 0x01U; @@ -421,28 +426,36 @@ void CDMRSlotRX::bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer) { for (uint8_t i = 0U; i < count; i++) { buffer[i] = 0U; - buffer[i] |= ((m_buffer[start++] & 0x01) << 7); + buffer[i] |= READ_BIT1(m_buffer, start) << 7; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 6); + buffer[i] |= READ_BIT1(m_buffer, start) << 6; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 5); + buffer[i] |= READ_BIT1(m_buffer, start) << 5; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 4); + buffer[i] |= READ_BIT1(m_buffer, start) << 4; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 3); + buffer[i] |= READ_BIT1(m_buffer, start) << 3; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 2); + buffer[i] |= READ_BIT1(m_buffer, start) << 2; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 1); + buffer[i] |= READ_BIT1(m_buffer, start) << 1; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 0); + buffer[i] |= READ_BIT1(m_buffer, start) << 0; + start++; if (start >= DMR_BUFFER_LENGTH_BITS) start -= DMR_BUFFER_LENGTH_BITS; } diff --git a/DMRSlotRX.h b/DMRSlotRX.h index f726ac8..26064f9 100644 --- a/DMRSlotRX.h +++ b/DMRSlotRX.h @@ -50,7 +50,7 @@ public: private: bool m_slot; uint64_t m_patternBuffer; - uint8_t m_buffer[DMR_BUFFER_LENGTH_BITS]; + uint8_t m_buffer[DMR_BUFFER_LENGTH_BITS / 8U]; // 72 bytes uint16_t m_dataPtr; uint8_t frame1[DMR_FRAME_LENGTH_BYTES + 3U]; From 5da9d93db6211f9d0e8054ac457f3e84e4111fda Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 15 Jul 2018 21:20:08 -0400 Subject: [PATCH 076/239] Optimizing memory for DMR Idle RX --- DMRDMORX.cpp | 1 + DMRIdleRX.cpp | 36 +++++++++++++++++++++++++----------- DMRIdleRX.h | 2 +- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/DMRDMORX.cpp b/DMRDMORX.cpp index f3f6bf0..e7f8a5c 100644 --- a/DMRDMORX.cpp +++ b/DMRDMORX.cpp @@ -40,6 +40,7 @@ const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02 CDMRDMORX::CDMRDMORX() : m_patternBuffer(0x00U), +m_buffer(), m_dataPtr(0U), m_syncPtr(0U), m_startPtr(0U), diff --git a/DMRIdleRX.cpp b/DMRIdleRX.cpp index 60ff9e4..681135a 100644 --- a/DMRIdleRX.cpp +++ b/DMRIdleRX.cpp @@ -34,7 +34,13 @@ const uint16_t NOENDPTR = 9999U; const uint8_t CONTROL_IDLE = 0x80U; const uint8_t CONTROL_DATA = 0x40U; +const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; + +#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) +#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7))) + CDMRIdleRX::CDMRIdleRX() : +m_patternBuffer(0U), m_buffer(), m_dataPtr(0U), m_endPtr(NOENDPTR), @@ -50,8 +56,8 @@ void CDMRIdleRX::reset() void CDMRIdleRX::databit(bool bit) { - m_buffer[m_dataPtr] = bit; - + WRITE_BIT1(m_buffer, m_dataPtr, bit); + m_patternBuffer <<= 1; if (bit) m_patternBuffer |= 0x01U; @@ -68,7 +74,7 @@ void CDMRIdleRX::databit(bool bit) uint16_t ptr = m_endPtr + 1; if (ptr >= DMR_FRAME_LENGTH_BITS) - ptr -= DMR_FRAME_LENGTH_BITS; + ptr -= DMR_FRAME_LENGTH_BITS; uint8_t frame[DMR_FRAME_LENGTH_BYTES + 1U]; bitsToBytes(ptr, DMR_FRAME_LENGTH_BYTES, frame + 1U); @@ -95,28 +101,36 @@ void CDMRIdleRX::bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer) { for (uint8_t i = 0U; i < count; i++) { buffer[i] = 0U; - buffer[i] |= ((m_buffer[start++] & 0x01) << 7); + buffer[i] |= READ_BIT1(m_buffer, start) << 7; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 6); + buffer[i] |= READ_BIT1(m_buffer, start) << 6; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 5); + buffer[i] |= READ_BIT1(m_buffer, start) << 5; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 4); + buffer[i] |= READ_BIT1(m_buffer, start) << 4; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 3); + buffer[i] |= READ_BIT1(m_buffer, start) << 3; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 2); + buffer[i] |= READ_BIT1(m_buffer, start) << 2; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 1); + buffer[i] |= READ_BIT1(m_buffer, start) << 1; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; - buffer[i] |= ((m_buffer[start++] & 0x01) << 0); + buffer[i] |= READ_BIT1(m_buffer, start) << 0; + start++; if (start >= DMR_FRAME_LENGTH_BITS) start -= DMR_FRAME_LENGTH_BITS; } diff --git a/DMRIdleRX.h b/DMRIdleRX.h index 87c5e73..bbd050b 100644 --- a/DMRIdleRX.h +++ b/DMRIdleRX.h @@ -38,7 +38,7 @@ public: private: uint64_t m_patternBuffer; - uint8_t m_buffer[DMR_FRAME_LENGTH_BITS]; + uint8_t m_buffer[DMR_FRAME_LENGTH_BITS / 8U]; uint16_t m_dataPtr; uint16_t m_endPtr; uint8_t m_colorCode; From d5bfe0e5df2107914c651ff39c31ea36d6b7ab99 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 15 Jul 2018 23:48:47 -0400 Subject: [PATCH 077/239] Add adjustable bit buffer for DMRIdleRX --- DMRIdleRX.cpp | 47 +++++++++++++++++++++++------------------------ DMRIdleRX.h | 4 +++- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/DMRIdleRX.cpp b/DMRIdleRX.cpp index 681135a..c7f0f79 100644 --- a/DMRIdleRX.cpp +++ b/DMRIdleRX.cpp @@ -63,18 +63,17 @@ void CDMRIdleRX::databit(bool bit) m_patternBuffer |= 0x01U; if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) { - m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; - if (m_endPtr >= DMR_FRAME_LENGTH_BITS) - m_endPtr -= DMR_FRAME_LENGTH_BITS; + m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; + if (m_endPtr >= DMR_IDLE_LENGTH_BITS) + m_endPtr -= DMR_IDLE_LENGTH_BITS; // DEBUG3("SYNC MS Data found pos/end:", m_dataPtr, m_endPtr); } if (m_dataPtr == m_endPtr) { - uint16_t ptr = m_endPtr + 1; - - if (ptr >= DMR_FRAME_LENGTH_BITS) - ptr -= DMR_FRAME_LENGTH_BITS; + uint16_t ptr = m_endPtr + DMR_IDLE_LENGTH_BITS - DMR_FRAME_LENGTH_BITS + 1; + if (ptr >= DMR_IDLE_LENGTH_BITS) + ptr -= DMR_IDLE_LENGTH_BITS; uint8_t frame[DMR_FRAME_LENGTH_BYTES + 1U]; bitsToBytes(ptr, DMR_FRAME_LENGTH_BYTES, frame + 1U); @@ -93,7 +92,7 @@ void CDMRIdleRX::databit(bool bit) } m_dataPtr++; - if (m_dataPtr >= DMR_FRAME_LENGTH_BITS) + if (m_dataPtr >= DMR_IDLE_LENGTH_BITS) m_dataPtr = 0U; } @@ -103,36 +102,36 @@ void CDMRIdleRX::bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer) buffer[i] = 0U; buffer[i] |= READ_BIT1(m_buffer, start) << 7; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; buffer[i] |= READ_BIT1(m_buffer, start) << 6; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; buffer[i] |= READ_BIT1(m_buffer, start) << 5; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; buffer[i] |= READ_BIT1(m_buffer, start) << 4; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; buffer[i] |= READ_BIT1(m_buffer, start) << 3; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; buffer[i] |= READ_BIT1(m_buffer, start) << 2; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; buffer[i] |= READ_BIT1(m_buffer, start) << 1; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; buffer[i] |= READ_BIT1(m_buffer, start) << 0; start++; - if (start >= DMR_FRAME_LENGTH_BITS) - start -= DMR_FRAME_LENGTH_BITS; + if (start >= DMR_IDLE_LENGTH_BITS) + start -= DMR_IDLE_LENGTH_BITS; } } diff --git a/DMRIdleRX.h b/DMRIdleRX.h index bbd050b..46b3785 100644 --- a/DMRIdleRX.h +++ b/DMRIdleRX.h @@ -26,6 +26,8 @@ #include "DMRDefines.h" +const uint16_t DMR_IDLE_LENGTH_BITS = 576U; + class CDMRIdleRX { public: CDMRIdleRX(); @@ -38,7 +40,7 @@ public: private: uint64_t m_patternBuffer; - uint8_t m_buffer[DMR_FRAME_LENGTH_BITS / 8U]; + uint8_t m_buffer[DMR_IDLE_LENGTH_BITS / 8U]; uint16_t m_dataPtr; uint16_t m_endPtr; uint8_t m_colorCode; From 56d3b16493b2e37a1ea0aee3f0132107a3e7541b Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 16 Jul 2018 00:54:59 -0400 Subject: [PATCH 078/239] Some DMRIdleRX adjustment and version update --- DMRIdleRX.cpp | 3 +-- DMRIdleRX.h | 2 +- version.h | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DMRIdleRX.cpp b/DMRIdleRX.cpp index c7f0f79..69dd93d 100644 --- a/DMRIdleRX.cpp +++ b/DMRIdleRX.cpp @@ -26,8 +26,7 @@ #include "DMRSlotType.h" #include "Utils.h" -const uint8_t MAX_SYNC_SYMBOLS_ERRS = 2U; -const uint8_t MAX_SYNC_BYTES_ERRS = 3U; +const uint8_t MAX_SYNC_BYTES_ERRS = 2U; const uint16_t NOENDPTR = 9999U; diff --git a/DMRIdleRX.h b/DMRIdleRX.h index 46b3785..78b7553 100644 --- a/DMRIdleRX.h +++ b/DMRIdleRX.h @@ -26,7 +26,7 @@ #include "DMRDefines.h" -const uint16_t DMR_IDLE_LENGTH_BITS = 576U; +const uint16_t DMR_IDLE_LENGTH_BITS = 400U; class CDMRIdleRX { public: diff --git a/version.h b/version.h index d0bbbfc..4bc129b 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "2" -#define VERSION_DATE "20180715" +#define VER_REV "3" +#define VERSION_DATE "20180716" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 1f2ae86612d78d8d71761c6a13ef4f4d3c21fde4 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 16 Jul 2018 13:33:22 -0400 Subject: [PATCH 079/239] Reducing DMRIdleRX buffer a little, fix some format and copyrights --- DMRDMORX.cpp | 54 +++++++++++++++---------------- DMRDMORX.h | 2 +- DMRIdleRX.cpp | 7 ++-- DMRIdleRX.h | 4 +-- DMRSlotRX.cpp | 88 ++++++++++++++++++++++++--------------------------- 5 files changed, 72 insertions(+), 83 deletions(-) diff --git a/DMRDMORX.cpp b/DMRDMORX.cpp index e7f8a5c..a8fcb24 100644 --- a/DMRDMORX.cpp +++ b/DMRDMORX.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2009-2016 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * * 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 @@ -65,7 +65,7 @@ void CDMRDMORX::reset() } void CDMRDMORX::databit(bool bit) -{ +{ WRITE_BIT1(m_buffer, m_dataPtr, bit); m_patternBuffer <<= 1; @@ -92,7 +92,7 @@ void CDMRDMORX::databit(bool bit) correlateSync(); } } - + if (m_dataPtr == m_endPtr) { frame[0U] = m_control; @@ -189,7 +189,7 @@ void CDMRDMORX::databit(bool bit) // End of this slot, reset some items for the next slot. m_control = CONTROL_NONE; } - + m_dataPtr++; if (m_dataPtr >= DMO_BUFFER_LENGTH_BITS) @@ -199,41 +199,37 @@ void CDMRDMORX::databit(bool bit) } void CDMRDMORX::correlateSync() -{ +{ if ( (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) || \ (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_S2_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) ) { + m_control = CONTROL_DATA; + m_syncPtr = m_dataPtr; - m_control = CONTROL_DATA; - m_syncPtr = m_dataPtr; + m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; + if (m_startPtr >= DMO_BUFFER_LENGTH_BITS) + m_startPtr -= DMO_BUFFER_LENGTH_BITS; - m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; - if (m_startPtr >= DMO_BUFFER_LENGTH_BITS) - m_startPtr -= DMO_BUFFER_LENGTH_BITS; + m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; + if (m_endPtr >= DMO_BUFFER_LENGTH_BITS) + m_endPtr -= DMO_BUFFER_LENGTH_BITS; - m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; - if (m_endPtr >= DMO_BUFFER_LENGTH_BITS) - m_endPtr -= DMO_BUFFER_LENGTH_BITS; - - m_modeTimerCnt = 0; - - //DEBUG4("SYNC MS Data found pos/start/end:", m_dataPtr, m_startPtr, m_endPtr); + m_modeTimerCnt = 0; + //DEBUG4("SYNC MS Data found pos/start/end:", m_dataPtr, m_startPtr, m_endPtr); } else if ( (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) || \ (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_S2_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) ) { + m_control = CONTROL_VOICE; + m_syncPtr = m_dataPtr; - m_control = CONTROL_VOICE; - m_syncPtr = m_dataPtr; + m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; + if (m_startPtr >= DMO_BUFFER_LENGTH_BITS) + m_startPtr -= DMO_BUFFER_LENGTH_BITS; - m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; - if (m_startPtr >= DMO_BUFFER_LENGTH_BITS) - m_startPtr -= DMO_BUFFER_LENGTH_BITS; + m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; + if (m_endPtr >= DMO_BUFFER_LENGTH_BITS) + m_endPtr -= DMO_BUFFER_LENGTH_BITS; - m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; - if (m_endPtr >= DMO_BUFFER_LENGTH_BITS) - m_endPtr -= DMO_BUFFER_LENGTH_BITS; - - m_modeTimerCnt = 0; - - //DEBUG4("SYNC MS Voice found pos/start/end: ", m_dataPtr, m_startPtr, m_endPtr); + m_modeTimerCnt = 0; + //DEBUG4("SYNC MS Voice found pos/start/end: ", m_dataPtr, m_startPtr, m_endPtr); } } diff --git a/DMRDMORX.h b/DMRDMORX.h index 65123c1..5979003 100644 --- a/DMRDMORX.h +++ b/DMRDMORX.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * * 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 diff --git a/DMRIdleRX.cpp b/DMRIdleRX.cpp index 69dd93d..d20fd96 100644 --- a/DMRIdleRX.cpp +++ b/DMRIdleRX.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2009-2017 by Jonathan Naylor G4KLX - * Copyright (C) 2017 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU * * 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 @@ -60,12 +60,11 @@ void CDMRIdleRX::databit(bool bit) m_patternBuffer <<= 1; if (bit) m_patternBuffer |= 0x01U; - + if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) { m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; if (m_endPtr >= DMR_IDLE_LENGTH_BITS) m_endPtr -= DMR_IDLE_LENGTH_BITS; - // DEBUG3("SYNC MS Data found pos/end:", m_dataPtr, m_endPtr); } @@ -81,7 +80,7 @@ void CDMRIdleRX::databit(bool bit) uint8_t dataType; CDMRSlotType slotType; slotType.decode(frame + 1U, colorCode, dataType); - + if (colorCode == m_colorCode && dataType == DT_CSBK) { frame[0U] = CONTROL_IDLE | CONTROL_DATA | DT_CSBK; serial.writeDMRData(false, frame, DMR_FRAME_LENGTH_BYTES + 1U); diff --git a/DMRIdleRX.h b/DMRIdleRX.h index 78b7553..1e3592d 100644 --- a/DMRIdleRX.h +++ b/DMRIdleRX.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2015 by Jonathan Naylor G4KLX - * Copyright (C) 2017 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018 by Andy Uribe CA6JAU * * 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 @@ -26,7 +26,7 @@ #include "DMRDefines.h" -const uint16_t DMR_IDLE_LENGTH_BITS = 400U; +const uint16_t DMR_IDLE_LENGTH_BITS = 320U; class CDMRIdleRX { public: diff --git a/DMRSlotRX.cpp b/DMRSlotRX.cpp index d08338e..07b98f6 100644 --- a/DMRSlotRX.cpp +++ b/DMRSlotRX.cpp @@ -102,8 +102,7 @@ void CDMRSlotRX::reset() bool CDMRSlotRX::databit(bool bit) { - uint16_t min; - uint16_t max; + uint16_t min, max; m_delayPtr++; if (m_delayPtr < m_delay) @@ -367,58 +366,53 @@ void CDMRSlotRX::correlateSync() uint8_t control; if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) { + control = CONTROL_DATA; + syncPtr = m_dataPtr; - control = CONTROL_DATA; - syncPtr = m_dataPtr; + startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; + if (startPtr >= DMR_BUFFER_LENGTH_BITS) + startPtr -= DMR_BUFFER_LENGTH_BITS; - startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; - if (startPtr >= DMR_BUFFER_LENGTH_BITS) - startPtr -= DMR_BUFFER_LENGTH_BITS; + endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; + if (endPtr >= DMR_BUFFER_LENGTH_BITS) + endPtr -= DMR_BUFFER_LENGTH_BITS; - endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; - if (endPtr >= DMR_BUFFER_LENGTH_BITS) - endPtr -= DMR_BUFFER_LENGTH_BITS; - - if(m_slot) { - m_syncPtr2 = syncPtr; - m_startPtr2 = startPtr; - m_endPtr2 = endPtr; - m_control2 = control; - } else { - m_syncPtr1 = syncPtr; - m_startPtr1 = startPtr; - m_endPtr1 = endPtr; - m_control1 = control; - } - - //DEBUG5("SYNC corr MS Data found slot/pos/start/end:", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); - + if(m_slot) { + m_syncPtr2 = syncPtr; + m_startPtr2 = startPtr; + m_endPtr2 = endPtr; + m_control2 = control; + } else { + m_syncPtr1 = syncPtr; + m_startPtr1 = startPtr; + m_endPtr1 = endPtr; + m_control1 = control; + } + //DEBUG5("SYNC corr MS Data found slot/pos/start/end:", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); } else if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) { + control = CONTROL_VOICE; + syncPtr = m_dataPtr; - control = CONTROL_VOICE; - syncPtr = m_dataPtr; + startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; + if (startPtr >= DMR_BUFFER_LENGTH_BITS) + startPtr -= DMR_BUFFER_LENGTH_BITS; - startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1; - if (startPtr >= DMR_BUFFER_LENGTH_BITS) - startPtr -= DMR_BUFFER_LENGTH_BITS; - - endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; - if (endPtr >= DMR_BUFFER_LENGTH_BITS) - endPtr -= DMR_BUFFER_LENGTH_BITS; + endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U; + if (endPtr >= DMR_BUFFER_LENGTH_BITS) + endPtr -= DMR_BUFFER_LENGTH_BITS; - if(m_slot) { - m_syncPtr2 = syncPtr; - m_startPtr2 = startPtr; - m_endPtr2 = endPtr; - m_control2 = control; - } else { - m_syncPtr1 = syncPtr; - m_startPtr1 = startPtr; - m_endPtr1 = endPtr; - m_control1 = control; - } - - //DEBUG5("SYNC corr MS Voice found slot/pos/start/end: ", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); + if(m_slot) { + m_syncPtr2 = syncPtr; + m_startPtr2 = startPtr; + m_endPtr2 = endPtr; + m_control2 = control; + } else { + m_syncPtr1 = syncPtr; + m_startPtr1 = startPtr; + m_endPtr1 = endPtr; + m_control1 = control; + } + //DEBUG5("SYNC corr MS Voice found slot/pos/start/end: ", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); } } From 1fec6e5f77e9d5ef73fd88dee8f5587b7c76f5ed Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 16 Jul 2018 16:04:49 -0400 Subject: [PATCH 080/239] Optimizing memory for bit ring buffer --- BitRB.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/BitRB.cpp b/BitRB.cpp index 0aa8ae5..0260d10 100644 --- a/BitRB.cpp +++ b/BitRB.cpp @@ -1,7 +1,7 @@ /* TX fifo control - Copyright (C) KI6ZUM 2015 Copyright (C) 2015,2016 by Jonathan Naylor G4KLX -Copyright (C) 2016,2017 by Andy Uribe CA6JAU +Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -21,6 +21,11 @@ Boston, MA 02110-1301, USA. #include "BitRB.h" +const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; + +#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) +#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7))) + CBitRB::CBitRB(uint16_t length) : m_length(length), m_bits(NULL), @@ -30,7 +35,7 @@ m_tail(0U), m_full(false), m_overflow(false) { - m_bits = new uint8_t[length]; + m_bits = new uint8_t[length / 8U]; m_control = new uint8_t[length]; } @@ -68,7 +73,7 @@ bool CBitRB::put(uint8_t bit, uint8_t control) return false; } - m_bits[m_head] = bit; + WRITE_BIT1(m_bits, m_head, bit); m_control[m_head] = control; m_head++; @@ -86,7 +91,7 @@ bool CBitRB::get(uint8_t& bit, uint8_t& control) if (m_head == m_tail && !m_full) return false; - bit = m_bits[m_tail]; + bit = READ_BIT1(m_bits, m_tail); control = m_control[m_tail]; m_full = false; From ab929d2bd2b2fd262be4d4b68601d1cb8c8f09ef Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 16 Jul 2018 17:20:26 -0400 Subject: [PATCH 081/239] Full memory optimization for ring buffer --- BitRB.cpp | 6 +++--- DMRRX.cpp | 18 ++++++++---------- DMRRX.h | 1 + DMRTX.cpp | 18 +++++++++++------- DMRTX.h | 1 + 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/BitRB.cpp b/BitRB.cpp index 0260d10..1f23b17 100644 --- a/BitRB.cpp +++ b/BitRB.cpp @@ -36,7 +36,7 @@ m_full(false), m_overflow(false) { m_bits = new uint8_t[length / 8U]; - m_control = new uint8_t[length]; + m_control = new uint8_t[length / 8U]; } uint16_t CBitRB::getSpace() const @@ -74,7 +74,7 @@ bool CBitRB::put(uint8_t bit, uint8_t control) } WRITE_BIT1(m_bits, m_head, bit); - m_control[m_head] = control; + WRITE_BIT1(m_control, m_head, control); m_head++; if (m_head >= m_length) @@ -92,7 +92,7 @@ bool CBitRB::get(uint8_t& bit, uint8_t& control) return false; bit = READ_BIT1(m_bits, m_tail); - control = m_control[m_tail]; + control = READ_BIT1(m_control, m_tail); m_full = false; diff --git a/DMRRX.cpp b/DMRRX.cpp index 92fb004..c2b2906 100644 --- a/DMRRX.cpp +++ b/DMRRX.cpp @@ -24,23 +24,21 @@ #include "Globals.h" #include "DMRRX.h" -CDMRRX::CDMRRX() +CDMRRX::CDMRRX() : +m_control_old(0U) { } void CDMRRX::databit(bool bit, const uint8_t control) { - switch (control) { - case MARK_SLOT1: - m_slotRX.start(false); - break; - case MARK_SLOT2: + if (control != m_control_old) { + m_control_old = control; + if (control) m_slotRX.start(true); - break; - default: - break; + else + m_slotRX.start(false); } - + io.setDecode(m_slotRX.databit(bit)); } diff --git a/DMRRX.h b/DMRRX.h index b286cd8..50f8028 100644 --- a/DMRRX.h +++ b/DMRRX.h @@ -39,6 +39,7 @@ public: private: CDMRSlotRX m_slotRX; + uint8_t m_control_old; }; #endif diff --git a/DMRTX.cpp b/DMRTX.cpp index 8b85f12..abf9331 100644 --- a/DMRTX.cpp +++ b/DMRTX.cpp @@ -59,7 +59,8 @@ m_poBuffer(), m_poLen(0U), m_poPtr(0U), m_frameCount(0U), -m_abort() +m_abort(), +m_control_old(0U) { ::memcpy(m_newShortLC, EMPTY_SHORT_LC, 12U); ::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U); @@ -218,21 +219,24 @@ void CDMRTX::writeByte(uint8_t c, uint8_t control) { uint8_t bit; uint8_t mask = 0x80U; - uint8_t control_tmp; + uint8_t control_tmp = m_control_old; for (uint8_t i = 0U; i < 8U; i++, c <<= 1) { if ((c & mask) == mask) bit = 1U; else bit = 0U; - - control_tmp = MARK_NONE; - if( i == 7U || i == 6U) - control_tmp = control; + if(i == 7U) { + if (control == MARK_SLOT2) + control_tmp = true; + else if (control == MARK_SLOT1) + control_tmp = false; + + m_control_old = control_tmp; + } io.write(&bit, 1, &control_tmp); - } } diff --git a/DMRTX.h b/DMRTX.h index ae6734f..3a1a2ba 100644 --- a/DMRTX.h +++ b/DMRTX.h @@ -70,6 +70,7 @@ private: uint16_t m_poPtr; uint32_t m_frameCount; bool m_abort[2U]; + uint8_t m_control_old; void createData(uint8_t slotIndex); void createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex); From 6729d23b78f0092b1ed1d81f90476d8c3544ea31 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 16 Jul 2018 17:39:30 -0400 Subject: [PATCH 082/239] Preparing next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 8a668a8..e3d0003 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index bcf9fe6..d57d303 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 28678ca..b739097 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index f2dedcf..bfbb6b2 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 6e5bc10..735dc13 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 366b518..2b06c1e 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 4b7c23e..70e1d10 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 9fee583..7cfd13b 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv.sh index b3aa27c..87ed420 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 4f1e7d4..378f7f3 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 9fca17a..0a256bf 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index b30c840..295aaf3 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.1" +FW_VERSION="v1.4.3" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From 46ba5cc4f74d072aa545fd54fc5b64bb473e65bd Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 17 Jul 2018 00:17:06 -0400 Subject: [PATCH 083/239] Add receiver gain compilation options --- ADF7021.cpp | 10 +++++++++- ADF7021.h | 4 ++-- Config.h | 10 ++++++++++ configs/MMDVM_HS_Dual_Hat-12mhz.h | 10 ++++++++++ configs/MMDVM_HS_Dual_Hat.h | 10 ++++++++++ configs/MMDVM_HS_Hat-12mhz.h | 10 ++++++++++ configs/MMDVM_HS_Hat.h | 10 ++++++++++ configs/NanoDV.h | 10 ++++++++++ configs/Nano_hotSPOT.h | 10 ++++++++++ configs/ZUMspot_Libre.h | 10 ++++++++++ configs/ZUMspot_RPi.h | 10 ++++++++++ configs/ZUMspot_USB.h | 10 ++++++++++ configs/ZUMspot_duplex.h | 10 ++++++++++ configs/generic_duplex_gpio.h | 10 ++++++++++ configs/generic_gpio.h | 10 ++++++++++ 15 files changed, 141 insertions(+), 3 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 8be1f8d..fe9cc80 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -525,7 +525,15 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) Send_AD7021_control(); // AGC (auto, defaults) (9) - AD7021_control_word = 0x000231E9; +#if defined(AD7021_GAIN_AUTO) + AD7021_control_word = 0x000231E9; // AGC ON, normal operation +#elif defined(AD7021_GAIN_AUTO_LIN) + AD7021_control_word = 0x100231E9; // AGC ON, LNA high linearity +#elif defined(AD7021_GAIN_LOW) + AD7021_control_word = 0x120631E9; // AGC OFF, low gain, LNA high linearity +#elif defined(AD7021_GAIN_HIGH) + AD7021_control_word = 0x00A631E9; // AGC OFF, high gain +#endif Send_AD7021_control(); // AFC (10) diff --git a/ADF7021.h b/ADF7021.h index e56bf6f..19a2bb0 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -118,7 +118,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // Post demodulator bandwith (REG 04) #define ADF7021_POST_BW_DSTAR 10U -#define ADF7021_POST_BW_DMR 150U +#define ADF7021_POST_BW_DMR 80U #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 7U @@ -219,7 +219,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // Post demodulator bandwith (REG 04) #define ADF7021_POST_BW_DSTAR 10U -#define ADF7021_POST_BW_DMR 150U +#define ADF7021_POST_BW_DMR 80U #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 8U diff --git a/Config.h b/Config.h index c0ac7e8..6082fc1 100644 --- a/Config.h +++ b/Config.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index f115691..cebc1ba 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 1305fbf..42f0c34 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index e220f9d..7e4e8e9 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 6e190e3..8df414f 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/NanoDV.h b/configs/NanoDV.h index 9dfe6ff..f7caf38 100644 --- a/configs/NanoDV.h +++ b/configs/NanoDV.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index d0d1021..d13c134 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index c0ac7e8..6082fc1 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index f38b6cc..08db3f4 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 78fbadc..230b8aa 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 31b58b2..7779981 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 214b15b..0c1cf2d 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index d03a361..10332c0 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -45,6 +45,16 @@ // For 12.2880 MHz: // #define ADF7021_12_2880 +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST From 4d66c27885bb396c24248349d75b785723815c00 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 17 Jul 2018 00:17:53 -0400 Subject: [PATCH 084/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 4bc129b..329bcb6 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "3" -#define VERSION_DATE "20180716" +#define VER_REV "4" +#define VERSION_DATE "20180717" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 4bfae22ef0327c38aff61d6769694e6de9a2005a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 17 Jul 2018 23:58:42 -0400 Subject: [PATCH 085/239] Add G4KLX (MMDVM firmware) improvement for "transmission lost" in D-Star --- DStarRX.cpp | 59 +++++++++++++++++++++++++++-------------------------- DStarRX.h | 1 + 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/DStarRX.cpp b/DStarRX.cpp index 57f8659..cc8411e 100644 --- a/DStarRX.cpp +++ b/DStarRX.cpp @@ -22,11 +22,7 @@ #include "DStarRX.h" #include "Utils.h" -const unsigned int MAX_SYNC_BITS = 50U * DSTAR_DATA_LENGTH_BITS; - -const unsigned int SYNC_POS = 21U * DSTAR_DATA_LENGTH_BITS; -const unsigned int SYNC_SCAN_START = SYNC_POS - 3U; -const unsigned int SYNC_SCAN_END = SYNC_POS + 3U; +const unsigned int MAX_SYNC_BITS = 100U * DSTAR_DATA_LENGTH_BITS; // D-Star preamble sequence (only 32 bits of 101010...) const uint32_t PREAMBLE_MASK = 0xFFFFFFFFU; @@ -41,7 +37,7 @@ 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 uint8_t DATA_SYNC_ERRS = 2U; +const uint8_t DATA_SYNC_ERRS = 3U; // D-Star bit order version of 0x55 0x55 0xC8 0x7A const uint32_t END_SYNC_DATA = 0xAAAA135EU; @@ -312,7 +308,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) { DEBUG1("DStarRX: found data sync in None, exact"); - + io.setDecode(true); ::memcpy(m_rxBuffer, DSTAR_DATA_SYNC_BYTES, DSTAR_DATA_LENGTH_BYTES); @@ -321,7 +317,7 @@ void CDStarRX::processNone(bool bit) ::memset(m_rxBuffer, 0x00U, DSTAR_DATA_LENGTH_BYTES + 2U); m_rxBufferBits = 0U; - m_dataBits = 0U; + m_dataBits = MAX_SYNC_BITS; m_rxState = DSRXS_DATA; return; } @@ -343,14 +339,14 @@ void CDStarRX::processHeader(bool bit) bool ok = rxHeader(m_rxBuffer, header); if (ok) { io.setDecode(true); - - serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES); + + writeRSSIHeader(header); ::memset(m_rxBuffer, 0x00U, DSTAR_DATA_LENGTH_BYTES + 2U); m_rxBufferBits = 0U; m_rxState = DSRXS_DATA; - m_dataBits = SYNC_POS - DSTAR_DATA_LENGTH_BITS + 1U; + m_dataBits = MAX_SYNC_BITS; } else { // The checksum failed, return to looking for syncs m_rxState = DSRXS_NONE; @@ -371,7 +367,7 @@ void CDStarRX::processData(bool bit) if (countBits32((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) { DEBUG1("DStarRX: Found end sync in Data"); io.setDecode(false); - + serial.writeDStarEOT(); m_rxState = DSRXS_NONE; @@ -380,42 +376,33 @@ void CDStarRX::processData(bool bit) // Fuzzy matching of the data sync bit sequence bool syncSeen = false; - if (m_dataBits >= SYNC_SCAN_START && m_dataBits <= (SYNC_POS + 1U)) { + if (m_rxBufferBits >= (DSTAR_DATA_LENGTH_BITS - 3U)) { if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) { - 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"); - } - m_rxBufferBits = DSTAR_DATA_LENGTH_BITS; - m_dataBits = 0U; - syncSeen = true; + m_dataBits = MAX_SYNC_BITS; + syncSeen = true; } } // Check to see if the sync is arriving late - if (m_dataBits == SYNC_POS) { + 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) { - DEBUG2("DStarRX: found data sync in Data, late", i); m_rxBufferBits -= i; - m_dataBits -= i; break; } } } - m_dataBits++; + m_dataBits--; // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE - if (m_dataBits >= MAX_SYNC_BITS) { + if (m_dataBits == 0U) { DEBUG1("DStarRX: data sync timed out, lost lock"); io.setDecode(false); - + serial.writeDStarLost(); m_rxState = DSRXS_NONE; @@ -431,7 +418,7 @@ void CDStarRX::processData(bool bit) writeRSSIData(m_rxBuffer); } else serial.writeDStarData(m_rxBuffer, DSTAR_DATA_LENGTH_BYTES); - + io.setDecode(true); // Start the next frame @@ -656,6 +643,20 @@ bool CDStarRX::checksum(const uint8_t* header) const return crc8[0U] == header[DSTAR_HEADER_LENGTH_BYTES - 2U] && crc8[1U] == header[DSTAR_HEADER_LENGTH_BYTES - 1U]; } +void CDStarRX::writeRSSIHeader(unsigned char* header) +{ +#if defined(SEND_RSSI_DATA) + uint16_t rssi = io.readRSSI(); + + header[41U] = (rssi >> 8) & 0xFFU; + header[42U] = (rssi >> 0) & 0xFFU; + + serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES + 2U); +#else + serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES + 0U); +#endif +} + void CDStarRX::writeRSSIData(unsigned char* data) { #if defined(SEND_RSSI_DATA) diff --git a/DStarRX.h b/DStarRX.h index b6b17ac..589914d 100644 --- a/DStarRX.h +++ b/DStarRX.h @@ -58,6 +58,7 @@ private: void viterbiDecode(int* data); void traceBack(); bool checksum(const uint8_t* header) const; + void writeRSSIHeader(unsigned char* header); void writeRSSIData(unsigned char* data); }; From 32721d8bb2a474937b2ad843fd446ce03e5d55aa Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 17 Jul 2018 23:59:48 -0400 Subject: [PATCH 086/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 329bcb6..db00eb0 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "4" -#define VERSION_DATE "20180717" +#define VER_REV "5" +#define VERSION_DATE "20180718" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 8f0e0dacada0e0ecd3bb84bc7528890363018acd Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 19 Jul 2018 23:28:17 -0400 Subject: [PATCH 087/239] Some code cleanup --- BitRB.cpp | 2 +- DMRDMOTX.cpp | 4 ++-- Globals.h | 3 --- IO.cpp | 4 ++-- POCSAGTX.cpp | 21 +++++++++------------ 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/BitRB.cpp b/BitRB.cpp index 1f23b17..4ba8efb 100644 --- a/BitRB.cpp +++ b/BitRB.cpp @@ -25,7 +25,7 @@ const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02 #define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) #define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7))) - + CBitRB::CBitRB(uint16_t length) : m_length(length), m_bits(NULL), diff --git a/DMRDMOTX.cpp b/DMRDMOTX.cpp index bfc02c0..30df87d 100644 --- a/DMRDMOTX.cpp +++ b/DMRDMOTX.cpp @@ -77,10 +77,10 @@ void CDMRDMOTX::process() m_poPtr++; writeByte(DMR_SYNC); } else - writeByte(m_poBuffer[m_poPtr++]); + writeByte(m_poBuffer[m_poPtr++]); space -= 8U; - + if (m_poPtr >= m_poLen) { m_poPtr = 0U; m_poLen = 0U; diff --git a/Globals.h b/Globals.h index a6bcd37..419417c 100644 --- a/Globals.h +++ b/Globals.h @@ -83,9 +83,6 @@ const uint8_t MARK_NONE = 0x00U; #include "Debug.h" #include "Utils.h" -const uint16_t TX_RINGBUFFER_SIZE = 1024U; -const uint16_t RX_RINGBUFFER_SIZE = 1024U; - extern MMDVM_STATE m_modemState; extern MMDVM_STATE m_calState; extern MMDVM_STATE m_modemState_prev; diff --git a/IO.cpp b/IO.cpp index 0b0d26c..8a76d4d 100644 --- a/IO.cpp +++ b/IO.cpp @@ -29,8 +29,8 @@ uint8_t m_power; CIO::CIO(): m_started(false), -m_rxBuffer(RX_RINGBUFFER_SIZE), -m_txBuffer(TX_RINGBUFFER_SIZE), +m_rxBuffer(1024U), +m_txBuffer(1024U), m_LoDevYSF(false), m_ledCount(0U), m_scanEnable(false), diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index 9d8f389..f4bdfe3 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -34,35 +34,32 @@ m_delay(false) void CPOCSAGTX::process() { - if (m_buffer.getData() == 0U && m_poLen == 0U) - return; - - if (m_poLen == 0U) { + if (m_poLen == 0U && m_buffer.getData() > 0U) { if (!m_tx) { m_delay = true; m_poLen = m_txDelay; } else { m_delay = false; for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) - m_poBuffer[m_poLen++] = m_buffer.get(); - } + m_poBuffer[i] = m_buffer.get(); + m_poLen = POCSAG_FRAME_LENGTH_BYTES; + } m_poPtr = 0U; } if (m_poLen > 0U) { uint16_t space = io.getSpace(); - + while (space > 8U) { if (m_delay) { m_poPtr++; writeByte(POCSAG_SYNC); - } - else - writeByte(m_poBuffer[m_poPtr++]); + } else + writeByte(m_poBuffer[m_poPtr++]); space -= 8U; - + if (m_poPtr >= m_poLen) { m_poPtr = 0U; m_poLen = 0U; @@ -92,7 +89,7 @@ void CPOCSAGTX::writeByte(uint8_t c) { uint8_t bit; uint8_t mask = 0x80U; - + for (uint8_t i = 0U; i < 8U; i++, c <<= 1) { if ((c & mask) == mask) bit = 1U; From 6fa1c6507e9323d71075594d4d8a03264b1e09a4 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Fri, 20 Jul 2018 00:46:54 -0400 Subject: [PATCH 088/239] Fix for missing POCSAG start tone --- MMDVM_HS.cpp | 2 +- MMDVM_HS.ino | 2 +- POCSAGTX.cpp | 8 ++++++++ POCSAGTX.h | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index 2b556ec..cf15140 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -120,7 +120,7 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); - if (m_pocsagEnable && m_modemState == STATE_POCSAG) + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) diff --git a/MMDVM_HS.ino b/MMDVM_HS.ino index 7b1cd39..ebf4adc 100644 --- a/MMDVM_HS.ino +++ b/MMDVM_HS.ino @@ -115,7 +115,7 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); - if (m_pocsagEnable && m_modemState == STATE_POCSAG) + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index f4bdfe3..b4dc7ab 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -70,6 +70,14 @@ void CPOCSAGTX::process() } } +bool CPOCSAGTX::busy() +{ + if (m_poLen > 0U) + return true; + else + return false; +} + uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) { if (length != POCSAG_FRAME_LENGTH_BYTES) diff --git a/POCSAGTX.h b/POCSAGTX.h index a102ce9..7391cad 100644 --- a/POCSAGTX.h +++ b/POCSAGTX.h @@ -32,6 +32,8 @@ public: void process(); + bool busy(); + private: CSerialRB m_buffer; uint8_t m_poBuffer[200U]; From a8fdf6b09e6c37573efab0b2ac228df9a1a010d6 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:39:48 +0800 Subject: [PATCH 089/239] Update MMDVM_HS_Dual_Hat-12mhz.h Update NanoDV Port --- configs/MMDVM_HS_Dual_Hat-12mhz.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index cebc1ba..10a56a8 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -30,7 +30,7 @@ #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From 0800781244dfbe3d9879986e16fb48d735e2153b Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:40:29 +0800 Subject: [PATCH 090/239] Update MMDVM_HS_Dual_Hat.h Update NanoDV Port --- configs/MMDVM_HS_Dual_Hat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 42f0c34..f2bc5cc 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -30,7 +30,7 @@ #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From a80e9963713a0d1daf93289164b368eb7e0aef3d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:41:09 +0800 Subject: [PATCH 091/239] Update MMDVM_HS_Hat-12mhz.h Update NanoDV Port --- configs/MMDVM_HS_Hat-12mhz.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 7e4e8e9..024e90e 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From c33c599d09b2da004511f697f7a782080cce4b3d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:42:02 +0800 Subject: [PATCH 092/239] Update MMDVM_HS_Hat.h Update NanoDV Port --- configs/MMDVM_HS_Hat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 8df414f..db065ab 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From bffa0b5a2edcc22889c52c280592e7bfaa188ecb Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:42:34 +0800 Subject: [PATCH 093/239] Update NanoDV.h Update NanoDV Por --- configs/NanoDV.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/NanoDV.h b/configs/NanoDV.h index f7caf38..17097eb 100644 --- a/configs/NanoDV.h +++ b/configs/NanoDV.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) #define NANO_DV_REV10 // Enable ADF7021 support: From 5d2b8c8e08e70830f405a1872a088d1cc373ae8e Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:43:15 +0800 Subject: [PATCH 094/239] Update Nano_hotSPOT.h --- configs/Nano_hotSPOT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index d13c134..c2620a1 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From f3fb35132e86290551408d46d722f5a57a1569c8 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:43:36 +0800 Subject: [PATCH 095/239] Update ZUMspot_Libre.h --- configs/ZUMspot_Libre.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 6082fc1..79f26bf 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From 41d13c26539c2cd10a7b748c14b586f1a1465c24 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:44:08 +0800 Subject: [PATCH 096/239] Update ZUMspot_RPi.h --- configs/ZUMspot_RPi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 08db3f4..9d32502 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From d7e5f2be767a87ec3d75551349eedf9be2c5e736 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:44:36 +0800 Subject: [PATCH 097/239] Update ZUMspot_USB.h --- configs/ZUMspot_USB.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 230b8aa..9d5e239 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From 994c7b81a1985d5ee29057ad89af9e74d3c51393 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:44:58 +0800 Subject: [PATCH 098/239] Update ZUMspot_duplex.h --- configs/ZUMspot_duplex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 7779981..e1bace7 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From a6811881a5655befd6356dd723d378edd0e508e1 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:45:27 +0800 Subject: [PATCH 099/239] Update generic_duplex_gpio.h --- configs/generic_duplex_gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 0c1cf2d..b5b1364 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From bd9529eab301a7087dfc8627cd6873a971fccc43 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:45:49 +0800 Subject: [PATCH 100/239] Update generic_gpio.h --- configs/generic_gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index 10332c0..3f6813a 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From 745273a7b0443b830e25e1fd7ec22c156f88ec74 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:47:40 +0800 Subject: [PATCH 101/239] Rename NanoDV.h to NanoDV_NPI.h --- configs/{NanoDV.h => NanoDV_NPI.h} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename configs/{NanoDV.h => NanoDV_NPI.h} (100%) diff --git a/configs/NanoDV.h b/configs/NanoDV_NPI.h similarity index 100% rename from configs/NanoDV.h rename to configs/NanoDV_NPI.h From 4ceaab33bccdffe010a6f0148a17dfb0a2f154e2 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:50:05 +0800 Subject: [PATCH 102/239] Create NanoDV_USB.h --- configs/NanoDV_USB.h | 95 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 configs/NanoDV_USB.h diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h new file mode 100644 index 0000000..716a0dc --- /dev/null +++ b/configs/NanoDV_USB.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) +#define NANO_DV_REV10 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +// #define ADF7021_14_7456 +// For 12.2880 MHz: +#define ADF7021_12_2880 + +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + +// Host communication selection: +// #define STM32_USART1_HOST +#define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +#define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +#define QUIET_MODE_LEDS + +// Engage a constant or descreet Service LED mode once repeater is running +// #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +#define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED + +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +#define USE_ALTERNATE_POCSAG_LEDS + +// Enable modem debug messages +// #define ENABLE_DEBUG + +#endif From 029c6e7da0df8fa3bc9a1d3541e38b0c8ffff32e Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:50:32 +0800 Subject: [PATCH 103/239] Update NanoDV_NPI.h --- configs/NanoDV_NPI.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 17097eb..b0dab9a 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -80,14 +80,14 @@ // Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED // #define CONSTANT_SRV_LED_INVERTED -// #define DISCREET_SRV_LED +#define DISCREET_SRV_LED // #define DISCREET_SRV_LED_INVERTED // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS // Use the D-Star and DMR LEDs for POCSAG -// #define USE_ALTERNATE_POCSAG_LEDS +#define USE_ALTERNATE_POCSAG_LEDS // Enable modem debug messages // #define ENABLE_DEBUG From 169ab45e9c0b9c70c27c050ede30bdaea8b54146 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:52:54 +0800 Subject: [PATCH 104/239] Update build_fw.sh --- scripts/build_fw.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index c13ebfb..1bae995 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -74,10 +74,16 @@ make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_hotspot_fw.bin make clean -# Building Nano DV -cp ~/MMDVM_HS/configs/NanoDV.h ~/MMDVM_HS/Config.h +# Building NanoDV NPi +cp ~/MMDVM_HS/configs/NanoDV_NPi.h ~/MMDVM_HS/Config.h make -mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_dv_fw.bin +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nanodv_npi_fw.bin +make clean + +# Building NanoDV USB +cp ~/MMDVM_HS/configs/NanoDV_USB.h ~/MMDVM_HS/Config.h +make bl +mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/nanodv_usb_fw.bin make clean # Building Generic Simplex GPIO From ba97bd2cdeb450ee6547f93673a5cecd3b6160fc Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:56:20 +0800 Subject: [PATCH 105/239] Update and rename install_fw_nanodv.sh to install_fw_nanodv_npi.sh --- scripts/{install_fw_nanodv.sh => install_fw_nanodv_npi.sh} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename scripts/{install_fw_nanodv.sh => install_fw_nanodv_npi.sh} (98%) diff --git a/scripts/install_fw_nanodv.sh b/scripts/install_fw_nanodv_npi.sh similarity index 98% rename from scripts/install_fw_nanodv.sh rename to scripts/install_fw_nanodv_npi.sh index 87ed420..3436a79 100755 --- a/scripts/install_fw_nanodv.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -23,7 +23,7 @@ FW_VERSION="v1.4.3" MAC_DEV_USB_SER="/dev/cu.usbmodem1441" # Download latest firmware for Nano DV -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nano_dv_fw.bin +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nanodv_npi_fw.bin # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then From ba1a9045f0ec10e5ba8ae93643d9628d2924bb18 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:59:01 +0800 Subject: [PATCH 106/239] Create install_fw_nanodv_usb.sh --- scripts/install_fw_nanodv_usb.sh | 83 ++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 scripts/install_fw_nanodv_usb.sh diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh new file mode 100644 index 0000000..2fe8149 --- /dev/null +++ b/scripts/install_fw_nanodv_usb.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Copyright (C) 2017,2018 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.4.3" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for ZUMspot USB +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nanodv_usb_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Reset ZUMspot to enter bootloader mode +eval sudo $DFU_RST $DEV_USB_SER 750 + +# Upload the firmware +eval sudo $DFU_UTIL -D nanodv_usb_fw.bin -d 1eaf:0003 -a 2 -R -R + +echo +echo "Please RESET your Nano DV !" +echo From b7e0c0ac555b8e855d12481c7127a7569d1a0755 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 20 Jul 2018 16:59:48 +0800 Subject: [PATCH 107/239] Update Config.h --- Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config.h b/Config.h index 6082fc1..79f26bf 100644 --- a/Config.h +++ b/Config.h @@ -30,7 +30,7 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) Nano DV revisions 1.0 (BG4TGO & BG5HHP) +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 // Enable ADF7021 support: From 12e8114a3ee1a3ea89ffb0916e5ead2a01cdf978 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Fri, 20 Jul 2018 20:38:29 -0400 Subject: [PATCH 108/239] Additional check to transmit all POCSAG buffer --- POCSAGTX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index b4dc7ab..228f34a 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -72,7 +72,7 @@ void CPOCSAGTX::process() bool CPOCSAGTX::busy() { - if (m_poLen > 0U) + if (m_poLen > 0U || m_buffer.getData() > 0U) return true; else return false; From 17161460bf2d29691dc3b5785e496f190565c752 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Fri, 20 Jul 2018 20:47:56 -0400 Subject: [PATCH 109/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index db00eb0..618bbec 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "5" -#define VERSION_DATE "20180718" +#define VER_REV "6" +#define VERSION_DATE "20180720" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From cd1e95ff3124d2ca6234edb43c98e9dc025ed553 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 21 Jul 2018 12:10:05 -0400 Subject: [PATCH 110/239] Some cleanup --- DMRSlotRX.cpp | 28 +++++++++++++++++----------- DMRSlotRX.h | 2 ++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/DMRSlotRX.cpp b/DMRSlotRX.cpp index 07b98f6..df75fe5 100644 --- a/DMRSlotRX.cpp +++ b/DMRSlotRX.cpp @@ -80,6 +80,12 @@ void CDMRSlotRX::reset() m_delayPtr = 0U; m_patternBuffer = 0U; + reset1(); + reset2(); +} + +void CDMRSlotRX::reset1() +{ m_syncPtr1 = 0U; m_control1 = CONTROL_NONE; m_syncCount1 = 0U; @@ -88,8 +94,10 @@ void CDMRSlotRX::reset() m_endPtr1 = NOENDPTR; m_type1 = 0U; m_n1 = 0U; +} - +void CDMRSlotRX::reset2() +{ m_syncPtr2 = 0U; m_control2 = CONTROL_NONE; m_syncCount2 = 0U; @@ -228,8 +236,7 @@ void CDMRSlotRX::procSlot1() m_syncCount1++; if (m_syncCount1 >= MAX_SYNC_LOST_FRAMES) { serial.writeDMRLost(0U); - m_state1 = DMRRXS_NONE; - m_endPtr1 = NOENDPTR; + reset1(); } } @@ -249,7 +256,7 @@ void CDMRSlotRX::procSlot1() } } } - + // End of this slot, reset some items for the next slot. m_control1 = CONTROL_NONE; } @@ -331,8 +338,7 @@ void CDMRSlotRX::procSlot2() m_syncCount2++; if (m_syncCount2 >= MAX_SYNC_LOST_FRAMES) { serial.writeDMRLost(1U); - m_state2 = DMRRXS_NONE; - m_endPtr2 = NOENDPTR; + reset2(); } } @@ -352,7 +358,7 @@ void CDMRSlotRX::procSlot2() } } } - + // End of this slot, reset some items for the next slot. m_control2 = CONTROL_NONE; } @@ -469,10 +475,10 @@ void CDMRSlotRX::writeRSSIData1() { #if defined(SEND_RSSI_DATA) uint16_t rssi = io.readRSSI(); - + frame1[34U] = (rssi >> 8) & 0xFFU; frame1[35U] = (rssi >> 0) & 0xFFU; - + serial.writeDMRData(0U, frame1, DMR_FRAME_LENGTH_BYTES + 3U); #else serial.writeDMRData(0U, frame1, DMR_FRAME_LENGTH_BYTES + 1U); @@ -483,10 +489,10 @@ void CDMRSlotRX::writeRSSIData2() { #if defined(SEND_RSSI_DATA) uint16_t rssi = io.readRSSI(); - + frame2[34U] = (rssi >> 8) & 0xFFU; frame2[35U] = (rssi >> 0) & 0xFFU; - + serial.writeDMRData(1U, frame2, DMR_FRAME_LENGTH_BYTES + 3U); #else serial.writeDMRData(1U, frame2, DMR_FRAME_LENGTH_BYTES + 1U); diff --git a/DMRSlotRX.h b/DMRSlotRX.h index 26064f9..bbdb87f 100644 --- a/DMRSlotRX.h +++ b/DMRSlotRX.h @@ -83,6 +83,8 @@ private: void bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer); void writeRSSIData1(); void writeRSSIData2(); + void reset1(); + void reset2(); }; #endif From 10c725c1ddfea3acc718ebfb484b60ce5736c353 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 21 Jul 2018 12:12:51 -0400 Subject: [PATCH 111/239] Preparing next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv_npi.sh | 2 +- scripts/install_fw_nanodv_usb.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index e3d0003..e3e69e8 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index d57d303..8548949 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index b739097..77fb36e 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index bfbb6b2..ac27329 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 735dc13..6bc71f3 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 2b06c1e..6926fb6 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 70e1d10..a812843 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 7cfd13b..23cc2ce 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 3436a79..9ac1f44 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 2fe8149..9eff13a 100644 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 378f7f3..bca8ac2 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 0a256bf..3d60129 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 295aaf3..65dd601 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.3" +FW_VERSION="v1.4.6" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From f3cca5a22914bf2575f0d833d47b7db859c1a11f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 21 Jul 2018 12:49:03 -0400 Subject: [PATCH 112/239] Update README --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f656f24..b7399df 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,13 @@ You could use some pi-star commands under SSH console: - sudo pistar-zumspotflash rpi_duplex: ZUMSpot duplex board conected to GPIO - sudo pistar-zumspotflash usb: ZUMspot USB dongle - sudo pistar-zumspotflash libre: ZUMspot Libre Kit or generic MMDVM_HS board with USB -- sudo pistar-mmdvmhshatflash hs_hat: MMDVM_HS_Hat board conected to GPIO -- sudo pistar-mmdvmhshatflash hs_dual_hat: HS_DUAL_HAT board conected to GPIO +- sudo pistar-mmdvmhshatflash hs_hat: MMDVM_HS_Hat board (14.7456MHz TCXO) +- sudo pistar-mmdvmhshatflash hs_dual_hat: HS_DUAL_HAT board (14.7456MHz TCXO) +- sudo pistar-mmdvmhshatflash hs_hat-12mhz: MMDVM_HS_Hat board (12.288MHz TCXO) +- sudo pistar-mmdvmhshatflash hs_dual_hat-12mhz: HS_DUAL_HAT board (12.288MHz TCXO) - sudo pistar-nanohsflash nano_hs: Nano hotSPOT board +- sudo pistar-nanodvflash pi: NanoDV NPi board +- sudo pistar-nanodvflash usb: NanoDV USB board ### Windows @@ -75,7 +79,8 @@ Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET) - install_fw_hshat-12mhz.sh: only for MMDVM_HS_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET) - install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) -- install_fw_nanodv.sh: only for Nano DV board (BG4TGO & BG5HHP) +- install_fw_nanodv_npi.sh: only for NanoDV NPi board 1.0 (BG4TGO & BG5HHP) +- install_fw_nanodv_usb.sh: only for NanoDV USB board 1.0 (BG4TGO & BG5HHP) - install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) - install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface - install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) @@ -212,8 +217,11 @@ and enable: #define ZUMSPOT_ADF7021 #define ENABLE_ADF7021 #define ADF7021_14_7456 + #define AD7021_GAIN_AUTO #define STM32_USART1_HOST #define ENABLE_SCAN_MODE + #define USE_ALTERNATE_NXDN_LEDS + #define USE_ALTERNATE_POCSAG_LEDS Build the firmware: From 48fdade2f18a7ac17279b6b48c7726d8b5747584 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 25 Jul 2018 09:09:53 +0800 Subject: [PATCH 113/239] Update install_fw_nanodv_npi.sh fix bug --- scripts/install_fw_nanodv_npi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 3436a79..7f14d27 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -73,5 +73,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w nano_dv_fw.bin -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w nanodv_npi_fw.bin -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 From 0f1bc291140db3d48d6e6648f1bdac6d18e632a8 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 19 Aug 2018 14:19:59 -0300 Subject: [PATCH 114/239] Update README --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b7399df..3554997 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,25 @@ and wait to complete the upgrading process. ## Build from the sources -You could check at MMDVM_HS/configs for common Config.h examples, using different ZUMspot boards. +You could use example files from MMDVM_HS/configs folder and overwrite the Config.h file, in order to compile a firmware with default settings. There are a specific config file for each ZUMspot or any MMDVM_HS compatible boards. In general, there are two possible compilation ways: + +- Board with USB interface + +Boards with STM32_USB_HOST option enabled in Config.h (ZUMspot Libre Kit, ZUMspot USB, GIBSpot USB, NanoDV USB, etc). Those boards need to have the USB bootloader installed. For example: + + make clean + make bl + make dfu + +- Board with GPIO interface + +Boards with STM32_USART1_HOST option enabled in Config.h (ZUMspot RPi, MMDVM_HS_Hat, MMDVM_HS_Dual_Hat, Nano hotSPOT, etc). No USB bootloader needed. For example: + + make clean + make + make zumspot-pi + +Some detailed examples as follows: ### MMDVM_HS_Hat From 06d8efa446b6101e756b1166293668a2f87d7d07 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 19 Aug 2018 21:20:43 -0300 Subject: [PATCH 115/239] Fix for clock drift between radio and duplex HS --- DMRTX.cpp | 12 +++++++++--- README.md | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/DMRTX.cpp b/DMRTX.cpp index abf9331..e99d1a0 100644 --- a/DMRTX.cpp +++ b/DMRTX.cpp @@ -255,14 +255,20 @@ void CDMRTX::createData(uint8_t slotIndex) if (m_fifo[slotIndex].getData() > 0U && m_frameCount >= STARTUP_COUNT) { for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) { m_poBuffer[i] = m_fifo[slotIndex].get(); - m_markBuffer[i] = MARK_NONE; + if (i == 8U) + m_markBuffer[i] = slotIndex == 0U ? MARK_SLOT1 : MARK_SLOT2; + else + m_markBuffer[i] = MARK_NONE; } } else { m_abort[slotIndex] = false; // Transmit an idle message for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) { m_poBuffer[i] = m_idle[i]; - m_markBuffer[i] = MARK_NONE; + if (i == 8U) + m_markBuffer[i] = slotIndex == 0U ? MARK_SLOT1 : MARK_SLOT2; + else + m_markBuffer[i] = MARK_NONE; } } @@ -287,7 +293,7 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex) ::memcpy(m_poBuffer, m_shortLC + m_cachPtr, 3U); m_markBuffer[0U] = MARK_NONE; m_markBuffer[1U] = MARK_NONE; - m_markBuffer[2U] = rxSlotIndex == 1U ? MARK_SLOT1 : MARK_SLOT2; + m_markBuffer[2U] = MARK_NONE; bool at = false; if (m_frameCount >= STARTUP_COUNT) diff --git a/README.md b/README.md index 3554997..a8280f9 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ and wait to complete the upgrading process. You could use example files from MMDVM_HS/configs folder and overwrite the Config.h file, in order to compile a firmware with default settings. There are a specific config file for each ZUMspot or any MMDVM_HS compatible boards. In general, there are two possible compilation ways: -- Board with USB interface +- Boards with USB interface: Boards with STM32_USB_HOST option enabled in Config.h (ZUMspot Libre Kit, ZUMspot USB, GIBSpot USB, NanoDV USB, etc). Those boards need to have the USB bootloader installed. For example: @@ -115,7 +115,7 @@ Boards with STM32_USB_HOST option enabled in Config.h (ZUMspot Libre Kit, ZUMspo make bl make dfu -- Board with GPIO interface +- Boards with GPIO interface: Boards with STM32_USART1_HOST option enabled in Config.h (ZUMspot RPi, MMDVM_HS_Hat, MMDVM_HS_Dual_Hat, Nano hotSPOT, etc). No USB bootloader needed. For example: From a86f263fdb9f5f315130d8093a1286ee471ef7cb Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 19 Aug 2018 23:09:28 -0300 Subject: [PATCH 116/239] Enable more debug messages for duplex DMR mode --- DMRSlotRX.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DMRSlotRX.cpp b/DMRSlotRX.cpp index df75fe5..82aa673 100644 --- a/DMRSlotRX.cpp +++ b/DMRSlotRX.cpp @@ -394,7 +394,7 @@ void CDMRSlotRX::correlateSync() m_endPtr1 = endPtr; m_control1 = control; } - //DEBUG5("SYNC corr MS Data found slot/pos/start/end:", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); + DEBUG5("SYNC corr MS Data found slot/pos/start/end:", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); } else if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) { control = CONTROL_VOICE; syncPtr = m_dataPtr; @@ -418,7 +418,7 @@ void CDMRSlotRX::correlateSync() m_endPtr1 = endPtr; m_control1 = control; } - //DEBUG5("SYNC corr MS Voice found slot/pos/start/end: ", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); + DEBUG5("SYNC corr MS Voice found slot/pos/start/end: ", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr); } } From b14548e9db68d522787cc16f5cf4e5d26ecf7b89 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 21 Aug 2018 20:20:41 -0300 Subject: [PATCH 117/239] Preparing next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv_npi.sh | 2 +- scripts/install_fw_nanodv_usb.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- version.h | 4 ++-- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index e3e69e8..97394da 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 8548949..4b4c192 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 77fb36e..affee65 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index ac27329..028dc87 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 6bc71f3..b6237e0 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 6926fb6..f0e9a23 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index a812843..3c65441 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 23cc2ce..0759879 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 28f6e38..8687c0c 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 9eff13a..7611762 100644 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index bca8ac2..8bd6943 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 3d60129..3877136 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 65dd601..4f339b7 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.6" +FW_VERSION="v1.4.7" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/version.h b/version.h index 618bbec..e20c56c 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "6" -#define VERSION_DATE "20180720" +#define VER_REV "7" +#define VERSION_DATE "20180821" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 6c64ef133694c63312baf717c188e0925a799a58 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 26 Aug 2018 12:39:57 -0300 Subject: [PATCH 118/239] Update README --- README.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a8280f9..0478968 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,49 @@ This software is licenced under the GPL v2 and is intended for amateur and educa - CW ID support - Full duplex support with two ADF7021 +# Known issues + +## Common issues for simplex and duplex boards + +- High RX BER or not RX, poor TX audio (4FSK modes): adjust frequency offset, specially RXOffset. +- Poor audio with MD380: increase DMR deviation to 55 % or 60 %. +- Bad RX sensitivity: this is not a firmware issue, ADF7021 has a minimum signal detection around -109 dBm in DMR, but RX performance depends on RF board design, external RX noise, frequency, etc. At the moment only original ZUMspot RPi can reach the best RX sensitivity in 70 cm band. + +## Duplex boards + +- Not DMR activation ("repeater fail" error) with MD380, Ailunce HD1 or some other radios: increase DMR deviation to 55 % or 60 %. +- RX timeout: this is due to TX and RX clock differences, which does not have easy solution. Be sure your firmware version is >= 1.4.7, which minimizes this problem. + +# Notes for previous users of MMDVM boards + +MMDVM_HS boards do not need deviation calibration like MMDVM boards, but could be necessary some frequency offset calibration (ADF7021 does not have AFC for 4FSK modes). + +The following options in MMDVM.ini ([Modem] setion) have not any effect for MMDVM_HS boards: + + TXInvert + RXInvert + PTTInvert + RXLevel + RXDCOffset + TXDCOffset + +The following options in MMDVM.ini ([Modem] setion) are very important for MMDVM_HS boards: + + RXOffset: RX frequency offset (HS RX BER improvement) + TXOffset: TX frequency offset (radio RX improvement) + TXLevel: default deviation setting (recommended value: 50) + RFLevel: RF power output (recommended value: 100) + CWIdTXLevel: CW ID deviation setting (recommended value: 50) + D-StarTXLevel: D-Star deviation setting (recommended value: 50) + DMRTXLevel: DMR deviation setting (recommended value: 50) + YSFTXLevel: YSF deviation setting (recommended value: 50) + P25TXLevel: P25 deviation setting (recommended value: 50) + NXDNTXLevel: NXDN deviation setting (recommended value: 50) + POCSAGTXLevel: POCSAG deviation setting (recommended value: 50) + # Important notes -The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2 ppm of frequency stability. You could use also 12.2880 MHz TCXO, but this frequency configuration has less testing. Any other TCXO frequency is not supported. +The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2 ppm of frequency stability. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TXCO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues. Please set TXLevel=50 in MMDVM.ini to configure default deviation levels for all modes. You could modify this value and other TXLevel paramenters to change deviation levels. Use [MMDVMCal](https://github.com/g4klx/MMDVMCal) to check DMR deviation level and TX frequency offset with calibrated test equipment. From 96e0a368b91f75d18410c8a23b7d8e59fa56027f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 26 Aug 2018 12:49:22 -0300 Subject: [PATCH 119/239] Correct typo in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0478968..b21e37b 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ This software is licenced under the GPL v2 and is intended for amateur and educa MMDVM_HS boards do not need deviation calibration like MMDVM boards, but could be necessary some frequency offset calibration (ADF7021 does not have AFC for 4FSK modes). -The following options in MMDVM.ini ([Modem] setion) have not any effect for MMDVM_HS boards: +The following options in MMDVM.ini ([Modem] section) have not any effect for MMDVM_HS boards: TXInvert RXInvert @@ -49,7 +49,7 @@ The following options in MMDVM.ini ([Modem] setion) have not any effect for MMDV RXDCOffset TXDCOffset -The following options in MMDVM.ini ([Modem] setion) are very important for MMDVM_HS boards: +The following options in MMDVM.ini ([Modem] section) are very important for MMDVM_HS boards: RXOffset: RX frequency offset (HS RX BER improvement) TXOffset: TX frequency offset (radio RX improvement) @@ -65,7 +65,7 @@ The following options in MMDVM.ini ([Modem] setion) are very important for MMDVM # Important notes -The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2 ppm of frequency stability. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TXCO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues. +The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2.5 ppm of frequency stability. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TCXO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues. Please set TXLevel=50 in MMDVM.ini to configure default deviation levels for all modes. You could modify this value and other TXLevel paramenters to change deviation levels. Use [MMDVMCal](https://github.com/g4klx/MMDVMCal) to check DMR deviation level and TX frequency offset with calibrated test equipment. From 2e3f304d2e40e1da4d493f73e3b84b0d691bd01b Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 30 Aug 2018 11:59:19 +0200 Subject: [PATCH 120/239] Make nanodv USB script executable --- scripts/install_fw_nanodv_usb.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/install_fw_nanodv_usb.sh diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh old mode 100644 new mode 100755 From 3fbeee3c3b5b5fa800f047f3643e41dc816ec7a1 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 3 Sep 2018 23:29:44 -0300 Subject: [PATCH 121/239] Update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b21e37b..63ab4ac 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ This software is licenced under the GPL v2 and is intended for amateur and educa ## Duplex boards +- Very difficult DMR activation ("repeater fail" error): disable mode scanning, select just DMR mode. - Not DMR activation ("repeater fail" error) with MD380, Ailunce HD1 or some other radios: increase DMR deviation to 55 % or 60 %. - RX timeout: this is due to TX and RX clock differences, which does not have easy solution. Be sure your firmware version is >= 1.4.7, which minimizes this problem. @@ -65,7 +66,7 @@ The following options in MMDVM.ini ([Modem] section) are very important for MMDV # Important notes -The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2.5 ppm of frequency stability. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TCXO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues. +The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2.5 ppm of frequency stability or better. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TCXO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues. Please set TXLevel=50 in MMDVM.ini to configure default deviation levels for all modes. You could modify this value and other TXLevel paramenters to change deviation levels. Use [MMDVMCal](https://github.com/g4klx/MMDVMCal) to check DMR deviation level and TX frequency offset with calibrated test equipment. From ad2df94a466aef90a02e5538ea0ca3d09d8b422a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 8 Sep 2018 15:54:35 -0300 Subject: [PATCH 122/239] Fix for USB bug in RPi 3 B+ --- IOArduino.cpp | 7 +++---- IOSTM.cpp | 48 ++++++++++++++++++++++++------------------------ version.h | 4 ++-- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/IOArduino.cpp b/IOArduino.cpp index 41042f1..1eae9ce 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -153,7 +153,7 @@ void CIO::Init() #endif #endif - + pinMode(PIN_SCLK, OUTPUT); pinMode(PIN_SDATA, OUTPUT); pinMode(PIN_SREAD, INPUT); @@ -170,19 +170,18 @@ void CIO::Init() pinMode(PIN_NXDN_LED, OUTPUT); pinMode(PIN_PTT_LED, OUTPUT); pinMode(PIN_COS_LED, OUTPUT); - + #if defined(DUPLEX) pinMode(PIN_SLE2, OUTPUT); pinMode(PIN_RXD2, INPUT); pinMode(PIN_TXD2, INPUT); #endif - + #if defined(BIDIR_DATA_PIN) pinMode(PIN_TXD, INPUT); #else pinMode(PIN_TXD, OUTPUT); #endif - } void CIO::startInt() diff --git a/IOSTM.cpp b/IOSTM.cpp index ac2e26b..bb377c4 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -278,8 +278,15 @@ extern "C" { } void CIO::Init() -{ - // USB Conf IO: +{ + GPIO_InitTypeDef GPIO_InitStruct; + GPIO_StructInit(&GPIO_InitStruct); + + EXTI_InitTypeDef EXTI_InitStructure; +#if defined(DUPLEX) + EXTI_InitTypeDef EXTI_InitStructure2; +#endif + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE); #if defined(PI_HAT_7021_REV_02) @@ -288,32 +295,25 @@ void CIO::Init() GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif + // Pin PA11,PA12 = LOW, USB Reset + GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12; + GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_Init(GPIOA, &GPIO_InitStruct); + GPIO_WriteBit(GPIOA, GPIO_Pin_11, Bit_RESET); + GPIO_WriteBit(GPIOA, GPIO_Pin_12, Bit_RESET); + + // 10 ms delay + delay_us(10000U); + + GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12; + GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; + GPIO_Init(GPIOA, &GPIO_InitStruct); + RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5); RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); - EXTI_InitTypeDef EXTI_InitStructure; -#if defined(DUPLEX) - EXTI_InitTypeDef EXTI_InitStructure2; -#endif - - GPIO_InitTypeDef GPIO_InitStruct; - GPIO_StructInit(&GPIO_InitStruct); - - // Pin PA12 = LOW, USB Reset in generic boards - GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12; - GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; - GPIO_Init(GPIOA, &GPIO_InitStruct); - GPIO_WriteBit(GPIOA, GPIO_Pin_12, Bit_RESET); - - volatile unsigned int delay; - for(delay = 0;delay<512;delay++); - - GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12; - GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_Init(GPIOA, &GPIO_InitStruct); - // Pin SCLK GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_SCLK; diff --git a/version.h b/version.h index e20c56c..414d4d7 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "7" -#define VERSION_DATE "20180821" +#define VER_REV "8" +#define VERSION_DATE "20180908" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From b9fd0b12337927f0580cff95dcf9465f6b8a3e04 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 8 Sep 2018 16:01:53 -0300 Subject: [PATCH 123/239] Preparing next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv_npi.sh | 2 +- scripts/install_fw_nanodv_usb.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 97394da..4b2fae8 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 4b4c192..5022a93 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index affee65..617c281 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 028dc87..0af9ec6 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index b6237e0..20542eb 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index f0e9a23..93b92c4 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 3c65441..859f6ba 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 0759879..d820e57 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 8687c0c..f2edf3f 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 7611762..69bc08c 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 8bd6943..c411e32 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 3877136..47d09eb 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 4f339b7..3fdfc66 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.7" +FW_VERSION="v1.4.8" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From 45fc69cee5ffae99fc83195fa97a61810515a09f Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 18 Sep 2018 14:02:11 -0300 Subject: [PATCH 124/239] Add option for long USB reset pulse --- Config.h | 3 +++ IOSTM.cpp | 5 +++++ configs/MMDVM_HS_Dual_Hat-12mhz.h | 3 +++ configs/MMDVM_HS_Dual_Hat.h | 3 +++ configs/MMDVM_HS_Hat-12mhz.h | 3 +++ configs/MMDVM_HS_Hat.h | 3 +++ configs/NanoDV_NPI.h | 3 +++ configs/NanoDV_USB.h | 3 +++ configs/Nano_hotSPOT.h | 3 +++ configs/ZUMspot_Libre.h | 3 +++ configs/ZUMspot_RPi.h | 3 +++ configs/ZUMspot_USB.h | 3 +++ configs/ZUMspot_duplex.h | 3 +++ configs/generic_duplex_gpio.h | 3 +++ configs/generic_gpio.h | 3 +++ version.h | 2 +- 16 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Config.h b/Config.h index 79f26bf..8e42814 100644 --- a/Config.h +++ b/Config.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +#define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/IOSTM.cpp b/IOSTM.cpp index bb377c4..a78e091 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -303,8 +303,13 @@ void CIO::Init() GPIO_WriteBit(GPIOA, GPIO_Pin_11, Bit_RESET); GPIO_WriteBit(GPIOA, GPIO_Pin_12, Bit_RESET); +#if defined(LONG_USB_RESET) // 10 ms delay delay_us(10000U); +#else + volatile unsigned int delay; + for(delay = 0;delay<512;delay++); +#endif GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 10a56a8..de8fe01 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index f2bc5cc..bebd7cf 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 024e90e..53dc693 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index db065ab..bd94ea9 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index b0dab9a..8d735c9 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index 716a0dc..cf5dd13 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +#define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index c2620a1..db63bbf 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 79f26bf..8e42814 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +#define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 9d32502..134789b 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 9d5e239..712697c 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +#define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index e1bace7..dc8c3a4 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +#define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index b5b1364..4fd47e4 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index 3f6813a..d9307ec 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -89,6 +89,9 @@ // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + // Enable modem debug messages // #define ENABLE_DEBUG diff --git a/version.h b/version.h index 414d4d7..6f4b02d 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "4" #define VER_REV "8" -#define VERSION_DATE "20180908" +#define VERSION_DATE "20180918" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From a0b9ae8142bd3202592d46679f0ffa6d6e02b994 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 18 Sep 2018 22:35:08 -0300 Subject: [PATCH 125/239] Bootloader with long USB reset is the default USB bootloader + some cleanup --- BUILD.md | 90 ++++++++++++++++++--------------------------------- Makefile | 55 ++++++++++++++++++++++--------- STM32F10X_Lib | 2 +- 3 files changed, 72 insertions(+), 75 deletions(-) diff --git a/BUILD.md b/BUILD.md index 939fb63..e30a599 100644 --- a/BUILD.md +++ b/BUILD.md @@ -169,23 +169,19 @@ Install the USB bootloader to STM32F103. Follow the instructions: https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/stm32duino-bootloader -Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file -(you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation): +Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file (you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation): My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat -You have to be sure that Windows detect your ZUMspot as an USB serial device COMx (please -see Windows Device Manager). +You have to be sure that Windows detect your ZUMspot as an USB serial device COMx (please see Windows Device Manager). Download the source (zip file) of MMDVM_HS from: https://github.com/juribeparada/MMDVM_HS -Do not download or install the STM32F103 library (STM32F10X_Lib) this is not necessary -under STM32duino. +Do not download or install the STM32F103 library (STM32F10X_Lib) this is not necessary under STM32duino. -Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this -folder can't have spaces. +Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this folder can't have spaces. Start the Arduino IDE. Open the MMDVM_HS.ino file in the MMDVM_HS folder. @@ -207,9 +203,7 @@ Edit Config.h: Click the Upload button in the IDE and wait for the transfer. -Once the transfer is completed, press the RESET button of the board or disconnect and -connect the USB cable. You will see the LED (PC13) of the blue pill blinking. Once you connect -with MMDVMHost, the LED will blink fast. +Once the transfer is completed, press the RESET button of the board or disconnect and connect the USB cable. You will see the LED (PC13) of the blue pill blinking. Once you connect with MMDVMHost, the LED will blink fast. For further help with STM32duino and STM32F103 blue pill boards, please see the STM32duino [forum](http://www.stm32duino.com). @@ -218,30 +212,26 @@ For further help with STM32duino and STM32F103 blue pill boards, please see the Download the source code (zip file) of MMDVM_HS from: https://github.com/juribeparada/MMDVM_HS - -Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this -folder can't have spaces. + +Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this folder can't have spaces. Download the ST libraries STM32F10X_Lib-master.zip from: https://github.com/juribeparada/STM32F10X_Lib/ -Extract the STM32F10X_Lib-master folder into the same folder as the MMDVM_HS. Change the folder -name to "STM32F10X_Lib". +Extract the STM32F10X_Lib-master folder into the same folder as the MMDVM_HS. Change the folder name to "STM32F10X_Lib". Download the GNU make utility: http://gnuwin32.sourceforge.net/packages/make.htm -Download the binaries zip file and extract make.exe and put it in the same directory MMDVM_HS. Download -the dependencies zip file and extract libintl3.dll and libiconv2.dll and put them in the same directory MMDVM_HS. +Download the binaries zip file and extract make.exe and put it in the same directory MMDVM_HS. Download the dependencies zip file and extract libintl3.dll and libiconv2.dll and put them in the same directory MMDVM_HS. Download the GNU ARM embedded toolchain from here: https://launchpad.net/gcc-arm-embedded/+download Currently the direct link to the installer is here: - https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-win32.exe Download STM32duino (Arduino for STM32) from this URL (only for USB drivers): @@ -251,9 +241,8 @@ Download STM32duino (Arduino for STM32) from this URL (only for USB drivers): Unzip and copy Arduino_STM32-ZUMspot folder in (for example): C:\Arduino_STM32-ZUMspot - -Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file -(you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation): + +Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file (you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation): C:\Arduino_STM32-ZUMspot\drivers\win\install_drivers.bat @@ -321,9 +310,7 @@ If you are using Pi-Star, stop services: sudo systemctl stop mmdvmhost.timer sudo systemctl stop mmdvmhost.service -Upload bootloader and firmware to ZUMspot Libre Kit, using serial port first (you -are using an USB-serial converter with device name /dev/ttyUSB0). Move BOOT0 -jumper to 1, next press and release RESET and execute: +Upload bootloader and firmware to ZUMspot Libre Kit, using serial port first (you are using an USB-serial converter with device name /dev/ttyUSB0). Move BOOT0 jumper to 1, next press and release RESET and execute: sudo make serial-bl devser=/dev/ttyUSB0 @@ -496,25 +483,25 @@ Please check here for detailed instructions: - make mmdvm_hs_hat: upload the firmware to MMDVM_HS_Hat board (using internal RPi serial port) -- make dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional, -and it corresponds to the USB serial port device name. This option permits to perform a reset -to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button -of the ZUMspot just before using this command. +- make dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional, and it corresponds to the USB serial port device name. This option permits to perform a reset to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button of the ZUMspot just before using this command. - make serial devser=/dev/ttyXXX: upload standard firmware using serial port bootloader method. -- make serial-bl devser=/dev/ttyXXX: upload firmware with USB bootloader support using serial -port bootloader method. +- make serial-bl devser=/dev/ttyXXX: upload firmware with USB bootloader support using serial port bootloader method. + +- make serial-bl-old devser=/dev/ttyXXX: same as "make serial-bl" but using bootloader with short reset pulse. - make stlink: upload standard firmware using ST-Link interface. - make stlink-bl: upload firmware with USB bootloader support using ST-Link interface. -- make ocd: upload standard firmware using ST-Link interface. This method uses a local -openocd installation. +- make stlink-bl-old: same as "make stlink-bl" but using bootloader with short reset pulse. -- make ocd-bl: upload firmware with USB bootloader support using ST-Link interface. This -method uses a local openocd installation. +- make ocd: upload standard firmware using ST-Link interface. This method uses a local openocd installation. + +- make ocd-bl: upload firmware with USB bootloader support using ST-Link interface. This method uses a local openocd installation. + +- make ocd-bl-old: same as "make ocd-bl" but using bootloader with short reset pulse. ## Common Makefile commands @@ -539,11 +526,9 @@ ZUMspot RPi (no USB support needed): # Config.h options -- #define ZUMSPOT_ADF7021: enable pinouts support for ZUMspot RPi or ZUMspot USB. You have -to enable this option if you have one of these products. +- #define ZUMSPOT_ADF7021: enable pinouts support for ZUMspot RPi or ZUMspot USB. You have to enable this option if you have one of these products. -- #define LIBRE_KIT_ADF7021: enable this option if you have a ZUMspot Libre Kit (Board with -modified RF7021SE and Blue Pill STM32F103). +- #define LIBRE_KIT_ADF7021: enable this option if you have a ZUMspot Libre Kit (Board with modified RF7021SE and Blue Pill STM32F103). - #define MMDVM_HS_HAT_REV12: enable this option if you have a MMDVM_HS_Hat board for RPi. @@ -561,16 +546,11 @@ modified RF7021SE and Blue Pill STM32F103). - #define ADF7021_12_2880: select this option if your board uses a 12.2880 MHz. -- #define STM32_USART1_HOST: enable direct serial host communication with ZUMspot (using USART1 -PA9 and PA10 pins). Disable STM32_USB_HOST if you enable this option. Enable this if you have -a ZUMspot RPi. You don't need to enable this option if you will transfer the bootloader. +- #define STM32_USART1_HOST: enable direct serial host communication with ZUMspot (using USART1 PA9 and PA10 pins). Disable STM32_USB_HOST if you enable this option. Enable this if you have a ZUMspot RPi. You don't need to enable this option if you will transfer the bootloader. -- #define STM32_USB_HOST: enable USB host communication with ZUMspot (using STM32F103 USB -interface). Disable STM32_USART1_HOST if you enable this option. Enable this if you have -a ZUMspot USB or ZUMspot Libre Kit. +- #define STM32_USB_HOST: enable USB host communication with ZUMspot (using STM32F103 USB interface). Disable STM32_USART1_HOST if you enable this option. Enable this if you have a ZUMspot USB or ZUMspot Libre Kit. -- #define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMspot. This is based on -scanning over all enabled modes, and you could have some detection delay. Enabled by default. +- #define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMspot. This is based on scanning over all enabled modes, and you could have some detection delay. Enabled by default. - #define SEND_RSSI_DATA: enable RSSI reports to MMDVMHost. It is already converted to dBm. @@ -636,8 +616,7 @@ Misc pins: PIN_LED PC13 (status led) PIN_DEB PB9 (debugging pin) -You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for -reducing EMI. +You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for reducing EMI. ## Pinout definitions for Arduino Due/Zero + RF7021SE @@ -676,8 +655,7 @@ Misc pins: PIN_LED 13 PIN_DEB 11 -You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for -reducing EMI. +You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for reducing EMI. ## Pinout definitions for Teensy (3.1, 3.2, 3.5 or 3.6) + RF7021SE: @@ -718,8 +696,7 @@ Misc pins: PIN_LED 13 PIN_DEB 23 -You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for -reducing EMI. +You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for reducing EMI. # Hidden functions @@ -733,11 +710,9 @@ Also in ADF7021.h: - #define ADF7021_N_VER: enable support for narrow band version of ADF7021 (ADF7021N). Disabled by default, in general all boards will have just ADF7021. -- #define ADF7021_ENABLE_4FSK_AFC: enable AFC support for DMR, YSF and P25. This is experimental, -depending on your frequency offset this option will improve or not your BER reception. +- #define ADF7021_ENABLE_4FSK_AFC: enable AFC support for DMR, YSF and P25. This is experimental, depending on your frequency offset this option will improve or not your BER reception. -- #define ADF7021_AFC_POS: enable this option if you can not receive any signal after enable the -ADF7021_ENABLE_4FSK_AFC option. +- #define ADF7021_AFC_POS: enable this option if you can not receive any signal after enable the ADF7021_ENABLE_4FSK_AFC option. - #define ADF7021_DISABLE_RC_4FSK: disable TX Raised Cosine filter for 4FSK modulation in ADF7021. Default TX pulse shaping filter for 4FSK is not optimum for DMR, YSF and P25. Activating this option might improve audio in 4FSK digital modes. @@ -748,4 +723,3 @@ In Globals.h: In IOSTM.cpp: - #define PI_HAT_7021_REV_02: enable pinouts for first revision of ZUMspot RPi. In general is not used. - diff --git a/Makefile b/Makefile index 01c0538..c44d58b 100644 --- a/Makefile +++ b/Makefile @@ -105,19 +105,19 @@ ifeq ($(OS),Windows_NT) else CLEANCMD=rm -f $(OBJ_F1BL) $(OBJ_F4) $(OBJ_F7) $(BINDIR)/*.hex $(BINDIR)/mmdvm_f1.bin $(BINDIR)/*.elf MDDIRS=mkdir $@ - - ifeq ($(shell uname -s),Linux) - ifeq ($(shell uname -m),x86_64) + + ifeq ($(shell uname -s),Linux) + ifeq ($(shell uname -m),x86_64) DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util ST_FLASH=./$(F1_LIB_PATH)/utils/linux64/st-flash STM32FLASH=./$(F1_LIB_PATH)/utils/linux64/stm32flash - else ifeq ($(shell uname -m),armv7l) + else ifeq ($(shell uname -m),armv7l) DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset DFU_UTIL=./$(F1_LIB_PATH)/utils/rpi32/dfu-util ST_FLASH=./$(F1_LIB_PATH)/utils/rpi32/st-flash STM32FLASH=./$(F1_LIB_PATH)/utils/rpi32/stm32flash - else ifeq ($(shell uname -m),armv6l) + else ifeq ($(shell uname -m),armv6l) DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset DFU_UTIL=./$(F1_LIB_PATH)/utils/rpi32/dfu-util ST_FLASH=./$(F1_LIB_PATH)/utils/rpi32/st-flash @@ -127,15 +127,15 @@ else DFU_UTIL=./$(F1_LIB_PATH)/utils/linux/dfu-util ST_FLASH=./$(F1_LIB_PATH)/utils/linux/st-flash STM32FLASH=./$(F1_LIB_PATH)/utils/linux/stm32flash - endif - endif + endif + endif - ifeq ($(shell uname -s),Darwin) + ifeq ($(shell uname -s),Darwin) DFU_RST=./$(F1_LIB_PATH)/utils/macosx/upload-reset DFU_UTIL=./$(F1_LIB_PATH)/utils/macosx/dfu-util ST_FLASH=./$(F1_LIB_PATH)/utils/macosx/st-flash STM32FLASH=./$(F1_LIB_PATH)/utils/macosx/stm32flash - endif + endif endif # Default reference oscillator frequencies @@ -294,7 +294,7 @@ $(BINDIR)/$(BINELF_F1): $(OBJ_F1) $(BINDIR)/$(BINHEX_F4): $(BINDIR)/$(BINELF_F4) $(CP) -O ihex $< $@ @echo "Objcopy from ELF to IHEX complete!\n" - + $(BINDIR)/$(BINBIN_F4): $(BINDIR)/$(BINELF_F4) $(CP) -O binary $< $@ @echo "Objcopy from ELF to BINARY complete!\n" @@ -307,7 +307,7 @@ $(BINDIR)/$(BINELF_F4): $(OBJ_F4) $(BINDIR)/$(BINHEX_F7): $(BINDIR)/$(BINELF_F7) $(CP) -O ihex $< $@ @echo "Objcopy from ELF to IHEX complete!\n" - + $(BINDIR)/$(BINBIN_F7): $(BINDIR)/$(BINELF_F7) $(CP) -O binary $< $@ @echo "Objcopy from ELF to BINARY complete!\n" @@ -376,18 +376,26 @@ $(OBJDIR_F1)/%.o: $(USB_F1)/%.c clean: $(CLEANCMD) $(RM) GitVersion.h - + stlink: $(ST_FLASH) write bin/$(BINBIN_F1) 0x8000000 stlink-bl: + $(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000 + $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 + +stlink-bl-old: $(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000 $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 - + serial: $(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser) serial-bl: + $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser) + $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) + +serial-bl-old: $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser) $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) @@ -427,7 +435,7 @@ ifdef devser $(DFU_RST) $(devser) 750 endif $(DFU_UTIL) -D bin/$(BINBIN_F1BL) -d 1eaf:0003 -a 2 -R -R - + ocd: ifneq ($(wildcard /usr/bin/openocd),) /usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1) verify reset exit" @@ -440,8 +448,24 @@ endif 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 bin/$(BINELF_F1) verify reset exit" endif - + ocd-bl: +ifneq ($(wildcard /usr/bin/openocd),) + /usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin verify reset exit 0x08000000" + /usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000" +endif + +ifneq ($(wildcard /usr/local/bin/openocd),) + /usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin verify reset exit 0x08000000" + /usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000" +endif + +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 $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.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_F1BL) verify reset exit 0x08002000" +endif + +ocd-bl-old: ifneq ($(wildcard /usr/bin/openocd),) /usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000" /usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000" @@ -472,4 +496,3 @@ endif endif .FORCE: - diff --git a/STM32F10X_Lib b/STM32F10X_Lib index f57ebc3..74ff937 160000 --- a/STM32F10X_Lib +++ b/STM32F10X_Lib @@ -1 +1 @@ -Subproject commit f57ebc35af760675bd6d15e6667e6e66508f852b +Subproject commit 74ff93791264faef4c2d8e871b2877d24e0bd1c1 From b0ab167f0356c63c08304350f9ed442114d56ec4 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 18 Sep 2018 22:50:21 -0300 Subject: [PATCH 126/239] Update README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 63ab4ac..984908c 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ This software is licenced under the GPL v2 and is intended for amateur and educa - High RX BER or not RX, poor TX audio (4FSK modes): adjust frequency offset, specially RXOffset. - Poor audio with MD380: increase DMR deviation to 55 % or 60 %. - Bad RX sensitivity: this is not a firmware issue, ADF7021 has a minimum signal detection around -109 dBm in DMR, but RX performance depends on RF board design, external RX noise, frequency, etc. At the moment only original ZUMspot RPi can reach the best RX sensitivity in 70 cm band. +- Not working with RPi 3B+ (USB): be sure your firmware version is >= 1.4.8 and update to new USB bootloader with long reset pulse (make stlink-bl, for example). +- Not working with USB (not RPi 3B+): compile with disabled "LONG_USB_RESET" option, and use old bootloader (make stlink-bl-old, for example). ## Duplex boards From 943df053a9138eb192e6bc0e59ac1f4c28d56163 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 18 Sep 2018 23:44:31 -0300 Subject: [PATCH 127/239] Update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 984908c..9ba3127 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,11 @@ This software is licenced under the GPL v2 and is intended for amateur and educa ## Common issues for simplex and duplex boards - High RX BER or not RX, poor TX audio (4FSK modes): adjust frequency offset, specially RXOffset. +- Not instantaneous mode detection (2 modes or more enabled): mode detection could be slow and sometimes you need to hold PTT several seconds, in order to activate the hotspot. There is no solution for that, since ADF7021 works only one mode at once. You can disable mode scanning, enabling just one mode. - Poor audio with MD380: increase DMR deviation to 55 % or 60 %. - Bad RX sensitivity: this is not a firmware issue, ADF7021 has a minimum signal detection around -109 dBm in DMR, but RX performance depends on RF board design, external RX noise, frequency, etc. At the moment only original ZUMspot RPi can reach the best RX sensitivity in 70 cm band. - Not working with RPi 3B+ (USB): be sure your firmware version is >= 1.4.8 and update to new USB bootloader with long reset pulse (make stlink-bl, for example). -- Not working with USB (not RPi 3B+): compile with disabled "LONG_USB_RESET" option, and use old bootloader (make stlink-bl-old, for example). +- Not working with USB (not RPi 3B+): compile with "LONG_USB_RESET" option disabled, and use old bootloader (make stlink-bl-old, for example). ## Duplex boards From bc48446e77290fe31abcbf2a173596f7cb59643e Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 19 Sep 2018 15:02:24 -0300 Subject: [PATCH 128/239] Add Makefile option for firmware without bootloader support (not tested yet) --- BUILD.md | 6 ++++++ Makefile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- README.md | 6 ++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/BUILD.md b/BUILD.md index e30a599..ebcde77 100644 --- a/BUILD.md +++ b/BUILD.md @@ -489,16 +489,22 @@ Please check here for detailed instructions: - make serial-bl devser=/dev/ttyXXX: upload firmware with USB bootloader support using serial port bootloader method. +- make serial-nobl devser=/dev/ttyXXX: upload firmware with USB support using serial port bootloader method, but without USB bootloader installation. + - make serial-bl-old devser=/dev/ttyXXX: same as "make serial-bl" but using bootloader with short reset pulse. - make stlink: upload standard firmware using ST-Link interface. - make stlink-bl: upload firmware with USB bootloader support using ST-Link interface. +- make stlink-nobl: upload firmware with USB support using ST-Link interface, but without USB bootloader. + - make stlink-bl-old: same as "make stlink-bl" but using bootloader with short reset pulse. - make ocd: upload standard firmware using ST-Link interface. This method uses a local openocd installation. +- make ocd-nobl: upload firmware with USB support using ST-Link interface, but without USB bootloader. This method uses a local openocd installation. + - make ocd-bl: upload firmware with USB bootloader support using ST-Link interface. This method uses a local openocd installation. - make ocd-bl-old: same as "make ocd-bl" but using bootloader with short reset pulse. diff --git a/Makefile b/Makefile index c44d58b..aa22174 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,9 @@ BINBIN_F1=mmdvm_f1.bin BINELF_F1BL=mmdvm_f1bl.elf BINHEX_F1BL=mmdvm_f1bl.hex BINBIN_F1BL=mmdvm_f1bl.bin +BINELF_F1NOBL=mmdvm_f1nobl.elf +BINHEX_F1NOBL=mmdvm_f1nobl.hex +BINBIN_F1NOBL=mmdvm_f1nobl.bin BINELF_F4=mmdvm_f4.elf BINHEX_F4=mmdvm_f4.hex BINBIN_F4=mmdvm_f4.bin @@ -103,7 +106,7 @@ ifeq ($(OS),Windows_NT) DFU_UTIL=./$(F1_LIB_PATH)/utils/win/dfu-util.exe STM32FLASH=./$(F1_LIB_PATH)/utils/win/stm32flash.exe else - CLEANCMD=rm -f $(OBJ_F1BL) $(OBJ_F4) $(OBJ_F7) $(BINDIR)/*.hex $(BINDIR)/mmdvm_f1.bin $(BINDIR)/*.elf + CLEANCMD=rm -f $(OBJ_F1BL) $(OBJ_F4) $(OBJ_F7) $(BINDIR)/*.hex $(BINDIR)/mmdvm_f1.bin $(BINDIR)/mmdvm_f1bl.bin $(BINDIR)/mmdvm_f1nobl.bin $(BINDIR)/*.elf MDDIRS=mkdir $@ ifeq ($(shell uname -s),Linux) @@ -200,7 +203,7 @@ CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno- LDFLAGS=-Os --specs=nano.specs --specs=nosys.specs # Build Rules -.PHONY: all release_f1 release_f4 release_f7 hs bl pi-f4 f446 f767 clean +.PHONY: all release_f1 release_f4 release_f7 hs bl nobl pi-f4 f446 f767 clean all: hs @@ -229,6 +232,11 @@ bl: CXXFLAGS+=$(CXXFLAGS_F1) $(DEFS_F1_HS_BL) bl: LDFLAGS+=$(LDFLAGS_F1_BL) bl: release_f1bl +nobl: CFLAGS+=$(CFLAGS_F1) $(DEFS_F1_HS) +nobl: CXXFLAGS+=$(CXXFLAGS_F1) $(DEFS_F1_HS) +nobl: LDFLAGS+=$(LDFLAGS_F1_N) +nobl: release_f1nobl + release_f1: GitVersion.h release_f1: $(BINDIR) release_f1: $(OBJDIR_F1) @@ -241,6 +249,12 @@ release_f1bl: $(OBJDIR_F1) release_f1bl: $(BINDIR)/$(BINHEX_F1BL) release_f1bl: $(BINDIR)/$(BINBIN_F1BL) +release_f1nobl: GitVersion.h +release_f1nobl: $(BINDIR) +release_f1nobl: $(OBJDIR_F1) +release_f1nobl: $(BINDIR)/$(BINHEX_F1NOBL) +release_f1nobl: $(BINDIR)/$(BINBIN_F1NOBL) + release_f4: GitVersion.h release_f4: $(BINDIR) release_f4: $(OBJDIR_F4) @@ -278,6 +292,19 @@ $(BINDIR)/$(BINELF_F1BL): $(OBJ_F1BL) @echo "Linking complete!\n" $(SIZE) $(BINDIR)/$(BINELF_F1BL) +$(BINDIR)/$(BINHEX_F1NOBL): $(BINDIR)/$(BINELF_F1NOBL) + $(CP) -O ihex $< $@ + @echo "Objcopy from ELF to IHEX complete!\n" + +$(BINDIR)/$(BINBIN_F1NOBL): $(BINDIR)/$(BINELF_F1NOBL) + $(CP) -O binary $< $@ + @echo "Objcopy from ELF to BINARY complete!\n" + +$(BINDIR)/$(BINELF_F1NOBL): $(OBJ_F1BL) + $(CXX) $(OBJ_F1BL) $(LDFLAGS) -o $@ + @echo "Linking complete!\n" + $(SIZE) $(BINDIR)/$(BINELF_F1NOBL) + $(BINDIR)/$(BINHEX_F1): $(BINDIR)/$(BINELF_F1) $(CP) -O ihex $< $@ @echo "Objcopy from ELF to IHEX complete!\n" @@ -380,6 +407,9 @@ clean: stlink: $(ST_FLASH) write bin/$(BINBIN_F1) 0x8000000 +stlink-nobl: + $(ST_FLASH) write bin/$(BINBIN_F1NOBL) 0x8000000 + stlink-bl: $(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000 $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 @@ -391,6 +421,9 @@ stlink-bl-old: serial: $(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser) +serial-nobl: + $(STM32FLASH) -v -w bin/$(BINBIN_F1NOBL) -g 0x0 $(devser) + serial-bl: $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser) $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) @@ -449,6 +482,19 @@ 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 bin/$(BINELF_F1) verify reset exit" endif +ocd-nobl: +ifneq ($(wildcard /usr/bin/openocd),) + /usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1NOBL) verify reset exit" +endif + +ifneq ($(wildcard /usr/local/bin/openocd),) + /usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1NOBL) verify reset exit" +endif + +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 bin/$(BINELF_F1NOBL) verify reset exit" +endif + ocd-bl: ifneq ($(wildcard /usr/bin/openocd),) /usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin verify reset exit 0x08000000" diff --git a/README.md b/README.md index 9ba3127..51fb61d 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,12 @@ Boards with STM32_USB_HOST option enabled in Config.h (ZUMspot Libre Kit, ZUMspo make bl make dfu +You can optionally install a firmware without bootloader, with USB support. Be aware you will need always a ST-Link or serial interface in order to install or update the firmware. For this reason, you should use USB bootloader, unless you have trouble with the bootloader. + + make clean + make nobl + make stlink-nobl + - Boards with GPIO interface: Boards with STM32_USART1_HOST option enabled in Config.h (ZUMspot RPi, MMDVM_HS_Hat, MMDVM_HS_Dual_Hat, Nano hotSPOT, etc). No USB bootloader needed. For example: From 7020510f2ee945bcba8021b93912cb09bda2183d Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 7 Oct 2018 12:56:00 -0300 Subject: [PATCH 129/239] Add banned frequency ranges --- IO.cpp | 9 +++++++++ IO.h | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/IO.cpp b/IO.cpp index 8a76d4d..ea7b97b 100644 --- a/IO.cpp +++ b/IO.cpp @@ -323,6 +323,15 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po ((pocsag_freq_tx >= UHF2_MIN)&&(pocsag_freq_tx < UHF2_MAX)) ) ) return 4U; + // Check banned frequency ranges + if( ((frequency_rx >= BAN1_MIN)&&(frequency_rx <= BAN1_MAX)) || ((frequency_tx >= BAN1_MIN)&&(frequency_tx <= BAN1_MAX)) || \ + ((frequency_rx >= BAN2_MIN)&&(frequency_rx <= BAN2_MAX)) || ((frequency_tx >= BAN2_MIN)&&(frequency_tx <= BAN2_MAX)) ) + return 4U; + + if( ((pocsag_freq_tx >= BAN1_MIN)&&(pocsag_freq_tx <= BAN1_MAX)) || \ + ((pocsag_freq_tx >= BAN2_MIN)&&(pocsag_freq_tx <= BAN2_MAX)) ) + return 4U; + // Configure frequency m_frequency_rx = frequency_rx; m_frequency_tx = frequency_tx; diff --git a/IO.h b/IO.h index 5fe4081..0159184 100644 --- a/IO.h +++ b/IO.h @@ -28,6 +28,7 @@ #define LOW 0 #define HIGH 1 +// HS frequency ranges #define VHF1_MIN 144000000 #define VHF1_MAX 148000000 #define VHF2_MIN 219000000 @@ -37,6 +38,12 @@ #define UHF2_MIN 842000000 #define UHF2_MAX 950000000 +// Banned amateur frequency ranges (satellite only, ISS, etc) +#define BAN1_MIN 145800000 +#define BAN1_MAX 146000000 +#define BAN2_MIN 435000000 +#define BAN2_MAX 438000000 + #define SCAN_TIME 1920 #define SCAN_PAUSE 20000 From 03f276db2cfcb43bcecb6c9f40f231260d57b33c Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 7 Oct 2018 12:57:14 -0300 Subject: [PATCH 130/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 6f4b02d..abb3b29 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "8" -#define VERSION_DATE "20180918" +#define VER_REV "9" +#define VERSION_DATE "20181007" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 5834da83d8e9fed42276aec4202821f4c7035647 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 7 Oct 2018 23:55:52 -0300 Subject: [PATCH 131/239] Fix RSSI bug in duplex mode --- ADF7021.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index fe9cc80..0625690 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -113,7 +113,7 @@ uint16_t CIO::readRSSI() // Register 7, readback enable, ADC RSSI mode AD7021_RB = 0x0147; - + // Send control register for(AD7021_counter = 8; AD7021_counter >= 0; AD7021_counter--) { if(bitRead(AD7021_RB, AD7021_counter) == HIGH) @@ -128,9 +128,16 @@ uint16_t CIO::readRSSI() } SDATA_pin(LOW); - SLE_pin(HIGH); + + if (!m_duplex) + SLE_pin(HIGH); +#if defined(DUPLEX) + if (m_duplex) + SLE2_pin(HIGH); +#endif + dlybit(); - + // Read SREAD pin for(AD7021_counter = 17; AD7021_counter >= 0; AD7021_counter--) { SCLK_pin(HIGH); @@ -144,12 +151,17 @@ uint16_t CIO::readRSSI() } - SLE_pin(LOW); - + if (!m_duplex) + SLE_pin(LOW); +#if defined(DUPLEX) + if (m_duplex) + SLE2_pin(LOW); +#endif + // Process RSSI code RB_code = RB_word & 0x7f; gain_code = (RB_word >> 7) & 0x0f; - + switch(gain_code) { case 0b1010: gain_corr = 0U; From 2b53c86277c2d5f530ff39079e7a9369a39e1e5e Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 8 Oct 2018 00:10:42 -0300 Subject: [PATCH 132/239] Fix RSSI bug for duplex mode and MMDVMCal --- ADF7021.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 0625690..1f78a23 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -129,11 +129,13 @@ uint16_t CIO::readRSSI() SDATA_pin(LOW); - if (!m_duplex) - SLE_pin(HIGH); #if defined(DUPLEX) - if (m_duplex) + if (m_duplex || m_calState == STATE_RSSICAL) SLE2_pin(HIGH); + else + SLE_pin(HIGH); +#else + SLE_pin(HIGH); #endif dlybit(); @@ -151,11 +153,13 @@ uint16_t CIO::readRSSI() } - if (!m_duplex) - SLE_pin(LOW); #if defined(DUPLEX) - if (m_duplex) + if (m_duplex || m_calState == STATE_RSSICAL) SLE2_pin(LOW); + else + SLE_pin(LOW); +#else + SLE_pin(LOW); #endif // Process RSSI code From 77c988c21df1fbb9994a379e515505b4331643f5 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 8 Oct 2018 00:13:14 -0300 Subject: [PATCH 133/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index abb3b29..ea871a3 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "9" -#define VERSION_DATE "20181007" +#define VER_REV "10" +#define VERSION_DATE "20181008" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 8d550790589f83f8ada33b6b7fc29470a0e61ddc Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 8 Oct 2018 21:21:17 -0300 Subject: [PATCH 134/239] Add Config.h options for frequency band check and restrictions --- Config.h | 6 ++++++ IO.cpp | 4 ++++ configs/MMDVM_HS_Dual_Hat-12mhz.h | 6 ++++++ configs/MMDVM_HS_Dual_Hat.h | 6 ++++++ configs/MMDVM_HS_Hat-12mhz.h | 6 ++++++ configs/MMDVM_HS_Hat.h | 6 ++++++ configs/NanoDV_NPI.h | 6 ++++++ configs/NanoDV_USB.h | 6 ++++++ configs/Nano_hotSPOT.h | 6 ++++++ configs/ZUMspot_Libre.h | 6 ++++++ configs/ZUMspot_RPi.h | 6 ++++++ configs/ZUMspot_USB.h | 6 ++++++ configs/ZUMspot_duplex.h | 6 ++++++ configs/generic_duplex_gpio.h | 6 ++++++ configs/generic_gpio.h | 6 ++++++ 15 files changed, 88 insertions(+) diff --git a/Config.h b/Config.h index 8e42814..58433b3 100644 --- a/Config.h +++ b/Config.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/IO.cpp b/IO.cpp index ea7b97b..53d689b 100644 --- a/IO.cpp +++ b/IO.cpp @@ -310,6 +310,7 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po // Configure power level setPower(rf_power); +#if !defined(DISABLE_FREQ_CHECK) // Check frequency ranges if( !( ((frequency_rx >= VHF1_MIN)&&(frequency_rx < VHF1_MAX)) || ((frequency_tx >= VHF1_MIN)&&(frequency_tx < VHF1_MAX)) || \ ((frequency_rx >= UHF1_MIN)&&(frequency_rx < UHF1_MAX)) || ((frequency_tx >= UHF1_MIN)&&(frequency_tx < UHF1_MAX)) || \ @@ -322,7 +323,9 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po ((pocsag_freq_tx >= VHF2_MIN)&&(pocsag_freq_tx < VHF2_MAX)) || \ ((pocsag_freq_tx >= UHF2_MIN)&&(pocsag_freq_tx < UHF2_MAX)) ) ) return 4U; +#endif +#if !defined(DISABLE_FREQ_BAN) // Check banned frequency ranges if( ((frequency_rx >= BAN1_MIN)&&(frequency_rx <= BAN1_MAX)) || ((frequency_tx >= BAN1_MIN)&&(frequency_tx <= BAN1_MAX)) || \ ((frequency_rx >= BAN2_MIN)&&(frequency_rx <= BAN2_MAX)) || ((frequency_tx >= BAN2_MIN)&&(frequency_tx <= BAN2_MAX)) ) @@ -331,6 +334,7 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po if( ((pocsag_freq_tx >= BAN1_MIN)&&(pocsag_freq_tx <= BAN1_MAX)) || \ ((pocsag_freq_tx >= BAN2_MIN)&&(pocsag_freq_tx <= BAN2_MAX)) ) return 4U; +#endif // Configure frequency m_frequency_rx = frequency_rx; diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index de8fe01..2a8def7 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index bebd7cf..5cf37ed 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 53dc693..d802831 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index bd94ea9..8d65403 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 8d735c9..864f5fb 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index cf5dd13..3efa23a 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index db63bbf..931fad1 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 8e42814..58433b3 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 134789b..4c15fce 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 712697c..7774c0c 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index dc8c3a4..f131e9a 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 4fd47e4..4bbad13 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index d9307ec..bf68e1f 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -95,4 +95,10 @@ // Enable modem debug messages // #define ENABLE_DEBUG +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + #endif From 3284a72febab7134feb5ae844b606e1b9c1cd04f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 28 Oct 2018 18:16:59 -0300 Subject: [PATCH 135/239] P25 RX logic rewrite (including some updates from MMDVM) --- P25Defines.h | 33 ++++++----- P25RX.cpp | 155 +++++++++++++++++++++++++++++++++++++-------------- P25RX.h | 12 ++-- version.h | 4 +- 4 files changed, 142 insertions(+), 62 deletions(-) diff --git a/P25Defines.h b/P25Defines.h index 408ff5f..2419821 100644 --- a/P25Defines.h +++ b/P25Defines.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 by Jonathan Naylor G4KLX + * Copyright (C) 2018 by Andy Uribe CA6JAU * * 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 @@ -21,26 +22,27 @@ const unsigned int P25_HDR_FRAME_LENGTH_BYTES = 99U; const unsigned int P25_HDR_FRAME_LENGTH_BITS = P25_HDR_FRAME_LENGTH_BYTES * 8U; -const unsigned int P25_HDR_FRAME_LENGTH_SYMBOLS = P25_HDR_FRAME_LENGTH_BYTES * 4U; const unsigned int P25_LDU_FRAME_LENGTH_BYTES = 216U; const unsigned int P25_LDU_FRAME_LENGTH_BITS = P25_LDU_FRAME_LENGTH_BYTES * 8U; -const unsigned int P25_LDU_FRAME_LENGTH_SYMBOLS = P25_LDU_FRAME_LENGTH_BYTES * 4U; const unsigned int P25_TERMLC_FRAME_LENGTH_BYTES = 54U; const unsigned int P25_TERMLC_FRAME_LENGTH_BITS = P25_TERMLC_FRAME_LENGTH_BYTES * 8U; -const unsigned int P25_TERMLC_FRAME_LENGTH_SYMBOLS = P25_TERMLC_FRAME_LENGTH_BYTES * 4U; const unsigned int P25_TERM_FRAME_LENGTH_BYTES = 18U; const unsigned int P25_TERM_FRAME_LENGTH_BITS = P25_TERM_FRAME_LENGTH_BYTES * 8U; -const unsigned int P25_TERM_FRAME_LENGTH_SYMBOLS = P25_TERM_FRAME_LENGTH_BYTES * 4U; -const unsigned int P25_SYNC_LENGTH_BYTES = 6U; -const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U; -const unsigned int P25_SYNC_LENGTH_SYMBOLS = P25_SYNC_LENGTH_BYTES * 4U; +const unsigned int P25_TSDU_FRAME_LENGTH_BYTES = 45U; +const unsigned int P25_TSDU_FRAME_LENGTH_BITS = P25_TSDU_FRAME_LENGTH_BYTES * 8U; -const unsigned int P25_NID_LENGTH_BITS = 64U; -const unsigned int P25_NID_LENGTH_SYMBOLS = 32U; +const unsigned int P25_PDU_HDR_FRAME_LENGTH_BYTES = 45U; +const unsigned int P25_PDU_HDR_FRAME_LENGTH_BITS = P25_PDU_HDR_FRAME_LENGTH_BYTES * 8U; + +const unsigned int P25_SYNC_LENGTH_BYTES = 6U; +const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U; + +const unsigned int P25_NID_LENGTH_BYTES = 8U; +const unsigned int P25_NID_LENGTH_BITS = P25_NID_LENGTH_BYTES * 8U; const uint8_t P25_SYNC_BYTES[] = {0x55U, 0x75U, 0xF5U, 0xFFU, 0x77U, 0xFFU}; const uint8_t P25_SYNC_BYTES_LENGTH = 6U; @@ -48,11 +50,12 @@ const uint8_t P25_SYNC_BYTES_LENGTH = 6U; const uint64_t P25_SYNC_BITS = 0x00005575F5FF77FFU; const uint64_t P25_SYNC_BITS_MASK = 0x0000FFFFFFFFFFFFU; -// 5 5 7 5 F 5 F F 7 7 F F -// 01 01 01 01 01 11 01 01 11 11 01 01 11 11 11 11 01 11 01 11 11 11 11 11 -// +3 +3 +3 +3 +3 -3 +3 +3 -3 -3 +3 +3 -3 -3 -3 -3 +3 -3 +3 -3 -3 -3 -3 -3 - -const uint32_t P25_SYNC_SYMBOLS = 0x00FB30A0U; -const uint32_t P25_SYNC_SYMBOLS_MASK = 0x00FFFFFFU; +const uint8_t P25_DUID_HDU = 0x00U; // Header Data Unit +const uint8_t P25_DUID_TDU = 0x03U; // Simple Terminator Data Unit +const uint8_t P25_DUID_LDU1 = 0x05U; // Logical Link Data Unit 1 +const uint8_t P25_DUID_TSDU = 0x07U; // Trunking System Data Unit +const uint8_t P25_DUID_LDU2 = 0x0AU; // Logical Link Data Unit 2 +const uint8_t P25_DUID_PDU = 0x0CU; // Packet Data Unit +const uint8_t P25_DUID_TDULC = 0x0FU; // Terminator Data Unit with Link Control #endif diff --git a/P25RX.cpp b/P25RX.cpp index 47e7e30..cd9f69c 100644 --- a/P25RX.cpp +++ b/P25RX.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * * 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 @@ -31,33 +31,44 @@ const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02 #define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) +const uint16_t NOENDPTR = 9999U; + CP25RX::CP25RX() : -m_prev(false), m_state(P25RXS_NONE), m_bitBuffer(0x00U), m_outBuffer(), m_buffer(NULL), m_bufferPtr(0U), -m_lostCount(0U) +m_endPtr(NOENDPTR), +m_lostCount(0U), +m_duid(0U) { m_buffer = m_outBuffer + 1U; } void CP25RX::reset() { - m_prev = false; m_state = P25RXS_NONE; m_bitBuffer = 0x00U; m_bufferPtr = 0U; + m_endPtr = NOENDPTR; m_lostCount = 0U; + m_duid = 0U; } void CP25RX::databit(bool bit) { - if (m_state == P25RXS_NONE) - processNone(bit); - else - processData(bit); + switch (m_state) { + case P25RXS_HDR: + processHdr(bit); + break; + case P25RXS_LDU: + processLdu(bit); + break; + default: + processNone(bit); + break; + } } void CP25RX::processNone(bool bit) @@ -71,72 +82,106 @@ void CP25RX::processNone(bool bit) DEBUG1("P25RX: sync found in None"); for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++) m_buffer[i] = P25_SYNC_BYTES[i]; - + m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = P25_SYNC_LENGTH_BITS; - m_state = P25RXS_DATA; - + m_state = P25RXS_HDR; + io.setDecode(true); } } -void CP25RX::processData(bool bit) +void CP25RX::processHdr(bool bit) { m_bitBuffer <<= 1; if (bit) m_bitBuffer |= 0x01U; WRITE_BIT1(m_buffer, m_bufferPtr, bit); - m_bufferPtr++; - // Search for an early sync to indicate an LDU following a header - if (m_bufferPtr >= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS - 1U) && m_bufferPtr <= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS + 1U)) { + m_bufferPtr++; + if (m_bufferPtr > P25_LDU_FRAME_LENGTH_BITS) + reset(); + + if (m_bufferPtr == P25_SYNC_LENGTH_BITS + 16U) { + // FIXME: we should check and correct for errors in NID first! + m_duid = m_buffer[7U] & 0x0F; + + if (m_duid != P25_DUID_HDU && m_duid != P25_DUID_TSDU && + m_duid != P25_DUID_TDU && m_duid != P25_DUID_TDULC) { + m_lostCount = MAX_SYNC_FRAMES; + m_state = P25RXS_LDU; + return; + } + + setEndPtr(); + DEBUG2("P25RX: DUID", m_duid); + } + + // Search for end of header frame + if (m_bufferPtr == m_endPtr) { + m_outBuffer[0U] = 0x01U; + serial.writeP25Hdr(m_outBuffer, (m_endPtr / 8U) + 1U); + + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = 0U; + m_state = P25RXS_LDU; + } +} + +void CP25RX::processLdu(bool bit) +{ + m_bitBuffer <<= 1; + if (bit) + m_bitBuffer |= 0x01U; + + WRITE_BIT1(m_buffer, m_bufferPtr, bit); + + m_bufferPtr++; + if (m_bufferPtr > P25_LDU_FRAME_LENGTH_BITS) + reset(); + + // Only search for a sync in the right place +-2 bits + if (m_bufferPtr >= (P25_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (P25_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the data sync bit sequence if (countBits64((m_bitBuffer & P25_SYNC_BITS_MASK) ^ P25_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) { - DEBUG2("P25RX: found LDU sync in Data, pos", m_bufferPtr - P25_SYNC_LENGTH_BITS); - - m_outBuffer[0U] = 0x01U; - serial.writeP25Hdr(m_outBuffer, P25_HDR_FRAME_LENGTH_BYTES + 1U); - - // Restore the sync that's now in the wrong place - for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++) - m_buffer[i] = P25_SYNC_BYTES[i]; - + DEBUG1("P25RX: found sync in LDU"); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = P25_SYNC_LENGTH_BITS; } } - // Only search for a sync in the right place +-2 symbols - if (m_bufferPtr >= (P25_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (P25_SYNC_LENGTH_BITS + 2U)) { - // Fuzzy matching of the data sync bit sequence - if (countBits64((m_bitBuffer & P25_SYNC_BITS_MASK) ^ P25_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) { - DEBUG2("P25RX: found sync in Data, pos", m_bufferPtr - P25_SYNC_LENGTH_BITS); - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = P25_SYNC_LENGTH_BITS; - } + if (m_bufferPtr == P25_SYNC_LENGTH_BITS + 16U) { + // We use DUID here only to detect TDU for EOT + // FIXME: we should check and correct for errors in NID first! + m_duid = m_buffer[7U] & 0x0F; + setEndPtr(); + DEBUG2("P25RX: DUID", m_duid); } // Send a data frame to the host if the required number of bits have been received if (m_bufferPtr == P25_LDU_FRAME_LENGTH_BITS) { - // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE m_lostCount--; + // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE if (m_lostCount == 0U) { DEBUG1("P25RX: sync timed out, lost lock"); io.setDecode(false); - serial.writeP25Lost(); - - m_state = P25RXS_NONE; + reset(); } else { + // Write data to host m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; - writeRSSILdu(m_outBuffer); - + // Start the next frame ::memset(m_outBuffer, 0x00U, P25_LDU_FRAME_LENGTH_BYTES + 3U); m_bufferPtr = 0U; } + + // Check if we found a TDU to avoid a false "lost lock" + if (m_duid == P25_DUID_TDU || m_duid == P25_DUID_TDULC) { + reset(); + } } } @@ -144,14 +189,42 @@ void CP25RX::writeRSSILdu(uint8_t* ldu) { #if defined(SEND_RSSI_DATA) uint16_t rssi = io.readRSSI(); - + ldu[217U] = (rssi >> 8) & 0xFFU; ldu[218U] = (rssi >> 0) & 0xFFU; - + serial.writeP25Ldu(ldu, P25_LDU_FRAME_LENGTH_BYTES + 3U); #else serial.writeP25Ldu(ldu, P25_LDU_FRAME_LENGTH_BYTES + 1U); #endif } - +void CP25RX::setEndPtr() +{ + switch (m_duid) { + case P25_DUID_HDU: + DEBUG1("P25RX: sync found in HDU"); + m_endPtr = P25_HDR_FRAME_LENGTH_BITS; + break; + case P25_DUID_TDU: + DEBUG1("P25RX: sync found in TDU"); + m_endPtr = P25_TERM_FRAME_LENGTH_BITS; + break; + case P25_DUID_TSDU: + DEBUG1("P25RX: sync found in TSDU"); + m_endPtr = P25_TSDU_FRAME_LENGTH_BITS; + break; + case P25_DUID_PDU: + // FIXME: not sure about PDU lengths since they have arbitrary length... + DEBUG1("P25RX: sync found in PDU"); + m_endPtr = P25_PDU_HDR_FRAME_LENGTH_BITS; + break; + case P25_DUID_TDULC: + DEBUG1("P25RX: sync found in TDULC"); + m_endPtr = P25_TERMLC_FRAME_LENGTH_BITS; + break; + default: + m_endPtr = P25_LDU_FRAME_LENGTH_BITS; + break; + } +} diff --git a/P25RX.h b/P25RX.h index 25eea77..ef0cbfb 100644 --- a/P25RX.h +++ b/P25RX.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * * 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 @@ -24,7 +24,8 @@ enum P25RX_STATE { P25RXS_NONE, - P25RXS_DATA + P25RXS_HDR, + P25RXS_LDU }; class CP25RX { @@ -36,17 +37,20 @@ public: void reset(); private: - bool m_prev; P25RX_STATE m_state; uint64_t m_bitBuffer; uint8_t m_outBuffer[P25_LDU_FRAME_LENGTH_BYTES + 3U]; uint8_t* m_buffer; uint16_t m_bufferPtr; + uint16_t m_endPtr; uint16_t m_lostCount; + uint8_t m_duid; void processNone(bool bit); - void processData(bool bit); + void processHdr(bool bit); + void processLdu(bool bit); void writeRSSILdu(uint8_t* data); + void setEndPtr(); }; #endif diff --git a/version.h b/version.h index ea871a3..47dc04b 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "10" -#define VERSION_DATE "20181008" +#define VER_REV "11" +#define VERSION_DATE "20181028" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From e0332c4efa975fa22bbdfeef0c5232f85cfef9f7 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 28 Oct 2018 19:03:37 -0300 Subject: [PATCH 136/239] Additional checks for overflows and some code cleanup --- DStarRX.cpp | 6 ++++++ DStarRX.h | 4 +++- NXDNDefines.h | 21 +++------------------ NXDNRX.cpp | 16 +++++++--------- NXDNRX.h | 4 +--- YSFDefines.h | 20 ++++++-------------- YSFRX.cpp | 22 ++++++++++------------ YSFRX.h | 4 +--- 8 files changed, 37 insertions(+), 60 deletions(-) diff --git a/DStarRX.cpp b/DStarRX.cpp index cc8411e..dac1841 100644 --- a/DStarRX.cpp +++ b/DStarRX.cpp @@ -330,7 +330,10 @@ void CDStarRX::processHeader(bool bit) m_patternBuffer |= 0x01U; WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit); + m_rxBufferBits++; + if (m_rxBufferBits > DSTAR_BUFFER_LENGTH_BITS) + reset(); // A full FEC header if (m_rxBufferBits == DSTAR_FEC_SECTION_LENGTH_BITS) { @@ -361,7 +364,10 @@ void CDStarRX::processData(bool bit) m_patternBuffer |= 0x01U; WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit); + m_rxBufferBits++; + if (m_rxBufferBits > DSTAR_BUFFER_LENGTH_BITS) + reset(); // Fuzzy matching of the end frame sequences if (countBits32((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) { diff --git a/DStarRX.h b/DStarRX.h index 589914d..e8a4b68 100644 --- a/DStarRX.h +++ b/DStarRX.h @@ -22,6 +22,8 @@ #include "DStarDefines.h" +const uint16_t DSTAR_BUFFER_LENGTH_BITS = 800U; + enum DSRX_STATE { DSRXS_NONE, DSRXS_HEADER, @@ -39,7 +41,7 @@ public: private: DSRX_STATE m_rxState; uint32_t m_patternBuffer; - uint8_t m_rxBuffer[100U]; + uint8_t m_rxBuffer[DSTAR_BUFFER_LENGTH_BITS / 8U]; unsigned int m_rxBufferBits; unsigned int m_dataBits; unsigned int m_mar; diff --git a/NXDNDefines.h b/NXDNDefines.h index a98166f..595cc20 100644 --- a/NXDNDefines.h +++ b/NXDNDefines.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2018 by Andy Uribe CA6JAU * * 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,16 +20,10 @@ #if !defined(NXDNDEFINES_H) #define NXDNDEFINES_H -const unsigned int NXDN_RADIO_SYMBOL_LENGTH = 10U; // At 24 kHz sample rate - -const unsigned int NXDN_FRAME_LENGTH_BITS = 384U; -const unsigned int NXDN_FRAME_LENGTH_BYTES = NXDN_FRAME_LENGTH_BITS / 8U; -const unsigned int NXDN_FRAME_LENGTH_SYMBOLS = NXDN_FRAME_LENGTH_BITS / 2U; -const unsigned int NXDN_FRAME_LENGTH_SAMPLES = NXDN_FRAME_LENGTH_SYMBOLS * NXDN_RADIO_SYMBOL_LENGTH; +const unsigned int NXDN_FRAME_LENGTH_BITS = 384U; +const unsigned int NXDN_FRAME_LENGTH_BYTES = NXDN_FRAME_LENGTH_BITS / 8U; const unsigned int NXDN_FSW_LENGTH_BITS = 20U; -const unsigned int NXDN_FSW_LENGTH_SYMBOLS = NXDN_FSW_LENGTH_BITS / 2U; -const unsigned int NXDN_FSW_LENGTH_SAMPLES = NXDN_FSW_LENGTH_SYMBOLS * NXDN_RADIO_SYMBOL_LENGTH; const uint8_t NXDN_FSW_BYTES[] = {0xCDU, 0xF5U, 0x90U}; const uint8_t NXDN_FSW_BYTES_MASK[] = {0xFFU, 0xFFU, 0xF0U}; @@ -37,14 +32,4 @@ const uint8_t NXDN_FSW_BYTES_LENGTH = 3U; const uint32_t NXDN_FSW_BITS = 0x000CDF59U; const uint32_t NXDN_FSW_BITS_MASK = 0x000FFFFFU; -// C D F 5 9 -// 11 00 11 01 11 11 01 01 10 01 -// -3 +1 -3 +3 -3 -3 +3 +3 -1 +3 - -const int8_t NXDN_FSW_SYMBOLS_VALUES[] = {-3, +1, -3, +3, -3, -3, +3, +3, -1, +3}; - -const uint16_t NXDN_FSW_SYMBOLS = 0x014DU; -const uint16_t NXDN_FSW_SYMBOLS_MASK = 0x03FFU; - #endif - diff --git a/NXDNRX.cpp b/NXDNRX.cpp index ac9e3c7..3b4dd94 100644 --- a/NXDNRX.cpp +++ b/NXDNRX.cpp @@ -32,7 +32,6 @@ const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02 #define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) CNXDNRX::CNXDNRX() : -m_prev(false), m_state(NXDNRXS_NONE), m_bitBuffer(0x00U), m_outBuffer(), @@ -45,7 +44,6 @@ m_lostCount(0U) void CNXDNRX::reset() { - m_prev = false; m_state = NXDNRXS_NONE; m_bitBuffer = 0x00U; m_bufferPtr = 0U; @@ -75,11 +73,10 @@ void CNXDNRX::processNone(bool bit) m_lostCount = MAX_FSW_FRAMES; m_bufferPtr = NXDN_FSW_LENGTH_BITS; m_state = NXDNRXS_DATA; - + io.setDecode(true); - } - + } void CNXDNRX::processData(bool bit) @@ -89,7 +86,10 @@ void CNXDNRX::processData(bool bit) m_bitBuffer |= 0x01U; WRITE_BIT1(m_buffer, m_bufferPtr, bit); + m_bufferPtr++; + if (m_bufferPtr > NXDN_FRAME_LENGTH_BITS) + reset(); // Only search for a sync in the right place +-2 symbols if (m_bufferPtr >= (NXDN_FSW_LENGTH_BITS - 2U) && m_bufferPtr <= (NXDN_FSW_LENGTH_BITS + 2U)) { @@ -108,13 +108,11 @@ void CNXDNRX::processData(bool bit) if (m_lostCount == 0U) { DEBUG1("NXDNRX: sync timed out, lost lock"); io.setDecode(false); - serial.writeNXDNLost(); - - m_state = NXDNRXS_NONE; + reset(); } else { + // Write data to host m_outBuffer[0U] = m_lostCount == (MAX_FSW_FRAMES - 1U) ? 0x01U : 0x00U; - writeRSSIData(m_outBuffer); // Start the next frame diff --git a/NXDNRX.h b/NXDNRX.h index 9b3e1cf..6a33dfb 100644 --- a/NXDNRX.h +++ b/NXDNRX.h @@ -36,7 +36,6 @@ public: void reset(); private: - bool m_prev; NXDNRX_STATE m_state; uint64_t m_bitBuffer; uint8_t m_outBuffer[NXDN_FRAME_LENGTH_BYTES + 3U]; @@ -47,8 +46,7 @@ private: void processNone(bool bit); void processData(bool bit); void writeRSSIData(uint8_t* data); - + }; #endif - diff --git a/YSFDefines.h b/YSFDefines.h index 810ff39..e261fcb 100644 --- a/YSFDefines.h +++ b/YSFDefines.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2009-2015 by Jonathan Naylor G4KLX + * Copyright (C) 2018 by Andy Uribe CA6JAU * * 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,16 +20,13 @@ #if !defined(YSFDEFINES_H) #define YSFDEFINES_H -const unsigned int YSF_FRAME_LENGTH_BYTES = 120U; -const unsigned int YSF_FRAME_LENGTH_BITS = YSF_FRAME_LENGTH_BYTES * 8U; -const unsigned int YSF_FRAME_LENGTH_SYMBOLS = YSF_FRAME_LENGTH_BYTES * 4U; +const unsigned int YSF_FRAME_LENGTH_BYTES = 120U; +const unsigned int YSF_FRAME_LENGTH_BITS = YSF_FRAME_LENGTH_BYTES * 8U; -const unsigned int YSF_SYNC_LENGTH_BYTES = 5U; -const unsigned int YSF_SYNC_LENGTH_BITS = YSF_SYNC_LENGTH_BYTES * 8U; -const unsigned int YSF_SYNC_LENGTH_SYMBOLS = YSF_SYNC_LENGTH_BYTES * 4U; +const unsigned int YSF_SYNC_LENGTH_BYTES = 5U; +const unsigned int YSF_SYNC_LENGTH_BITS = YSF_SYNC_LENGTH_BYTES * 8U; -const unsigned int YSF_FICH_LENGTH_BITS = 200U; -const unsigned int YSF_FICH_LENGTH_SYMBOLS = 100U; +const unsigned int YSF_FICH_LENGTH_BITS = 200U; const uint8_t YSF_SYNC_BYTES[] = {0xD4U, 0x71U, 0xC9U, 0x63U, 0x4DU}; const uint8_t YSF_SYNC_BYTES_LENGTH = 5U; @@ -36,11 +34,5 @@ const uint8_t YSF_SYNC_BYTES_LENGTH = 5U; const uint64_t YSF_SYNC_BITS = 0x000000D471C9634DU; const uint64_t YSF_SYNC_BITS_MASK = 0x000000FFFFFFFFFFU; -// D 4 7 1 C 9 6 3 4 D -// 11 01 01 00 01 11 00 01 11 00 10 01 01 10 00 11 01 00 11 01 -// -3 +3 +3 +1 +3 -3 +1 +3 -3 +1 -1 +3 +3 -1 +3 -3 +3 +1 -3 +3 -const uint32_t YSF_SYNC_SYMBOLS = 0x0007B5ADU; -const uint32_t YSF_SYNC_SYMBOLS_MASK = 0x000FFFFFU; - #endif diff --git a/YSFRX.cpp b/YSFRX.cpp index 0aed910..fa4a659 100644 --- a/YSFRX.cpp +++ b/YSFRX.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2009-2017 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * * 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 @@ -32,7 +32,6 @@ const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02 #define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) CYSFRX::CYSFRX() : -m_prev(false), m_state(YSFRXS_NONE), m_bitBuffer(0x00U), m_outBuffer(), @@ -45,7 +44,6 @@ m_lostCount(0U) void CYSFRX::reset() { - m_prev = false; m_state = YSFRXS_NONE; m_bitBuffer = 0x00U; m_bufferPtr = 0U; @@ -75,9 +73,8 @@ void CYSFRX::processNone(bool bit) m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = YSF_SYNC_LENGTH_BITS; m_state = YSFRXS_DATA; - + io.setDecode(true); - } } @@ -89,9 +86,12 @@ void CYSFRX::processData(bool bit) m_bitBuffer |= 0x01U; WRITE_BIT1(m_buffer, m_bufferPtr, bit); - m_bufferPtr++; - // Only search for a sync in the right place +-2 symbols + m_bufferPtr++; + if (m_bufferPtr > YSF_FRAME_LENGTH_BITS) + reset(); + + // Only search for a sync in the right place +-2 bits if (m_bufferPtr >= (YSF_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (YSF_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the data sync bit sequence if (countBits64((m_bitBuffer & YSF_SYNC_BITS_MASK) ^ YSF_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) { @@ -103,18 +103,16 @@ void CYSFRX::processData(bool bit) // Send a data frame to the host if the required number of bits have been received if (m_bufferPtr == YSF_FRAME_LENGTH_BITS) { - // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE m_lostCount--; + // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE if (m_lostCount == 0U) { DEBUG1("YSFRX: sync timed out, lost lock"); io.setDecode(false); - serial.writeYSFLost(); - - m_state = YSFRXS_NONE; + reset(); } else { + // Write data to host m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; - writeRSSIData(m_outBuffer); // Start the next frame diff --git a/YSFRX.h b/YSFRX.h index 435e314..3e2ee8f 100644 --- a/YSFRX.h +++ b/YSFRX.h @@ -36,7 +36,6 @@ public: void reset(); private: - bool m_prev; YSFRX_STATE m_state; uint64_t m_bitBuffer; uint8_t m_outBuffer[YSF_FRAME_LENGTH_BYTES + 3U]; @@ -47,8 +46,7 @@ private: void processNone(bool bit); void processData(bool bit); void writeRSSIData(uint8_t* data); - + }; #endif - From c45a7cf38fd6f106634d4927cc10cc3ac51135b2 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 3 Nov 2018 20:06:12 -0300 Subject: [PATCH 137/239] Enable debug messages for simplex boards --- Config.h | 2 +- configs/MMDVM_HS_Hat-12mhz.h | 2 +- configs/MMDVM_HS_Hat.h | 2 +- configs/NanoDV_NPI.h | 2 +- configs/NanoDV_USB.h | 2 +- configs/Nano_hotSPOT.h | 2 +- configs/ZUMspot_Libre.h | 2 +- configs/ZUMspot_RPi.h | 2 +- configs/ZUMspot_USB.h | 2 +- configs/generic_gpio.h | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Config.h b/Config.h index 58433b3..b7d146f 100644 --- a/Config.h +++ b/Config.h @@ -93,7 +93,7 @@ #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index d802831..f102194 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -93,7 +93,7 @@ // #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 8d65403..02105a4 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -93,7 +93,7 @@ // #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 864f5fb..96bf446 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -93,7 +93,7 @@ // #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index 3efa23a..819f8e0 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -93,7 +93,7 @@ #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 931fad1..012eb32 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -93,7 +93,7 @@ // #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 58433b3..b7d146f 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -93,7 +93,7 @@ #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 4c15fce..95be8d7 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -93,7 +93,7 @@ // #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 7774c0c..c5502b4 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -93,7 +93,7 @@ #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index bf68e1f..b6d7519 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -93,7 +93,7 @@ // #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK From 1aab7ec3556b6caf4aeb350ab6f38e63b609949d Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 4 Nov 2018 14:34:31 -0300 Subject: [PATCH 138/239] Support for interrupt counter test mode --- ADF7021.cpp | 55 ++++++++++++++++++++++++++------------------------ CalDMR.cpp | 14 ++++++++++++- CalDMR.h | 1 + CalRSSI.cpp | 2 +- Debug.h | 2 +- Globals.h | 3 ++- IO.cpp | 18 +++++++++++++---- IO.h | 13 ++++++++++-- MMDVM_HS.cpp | 2 +- MMDVM_HS.ino | 2 +- SerialPort.cpp | 31 ++++++++++++++-------------- SerialPort.h | 5 ++--- version.h | 4 ++-- 13 files changed, 93 insertions(+), 59 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 1f78a23..4def500 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - + #include "Config.h" #if defined(ENABLE_ADF7021) @@ -283,7 +283,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) m_RX_F_divider = floor(divider + 0.5); ADF7021_RX_REG0 = (uint32_t) 0b0000; - + #if defined(BIDIR_DATA_PIN) ADF7021_RX_REG0 |= (uint32_t) 0b01001 << 27; // mux regulator/receive #else @@ -292,7 +292,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_RX_REG0 |= (uint32_t) m_RX_N_divider << 19; // frequency; ADF7021_RX_REG0 |= (uint32_t) m_RX_F_divider << 4; // frequency; - + if( div2 == 1U ) divider = m_frequency_tx / (ADF7021_PFD / 2U); else @@ -369,7 +369,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG3 = ADF7021_REG3_DSTAR; ADF7021_REG10 = ADF7021_REG10_DSTAR; - + // K=32 ADF7021_REG4 = (uint32_t) 0b0100 << 0; // register 4 ADF7021_REG4 |= (uint32_t) 0b001 << 4; // mode, GMSK @@ -386,10 +386,10 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG2 |= (uint32_t) (m_dstarDev / div2) << 19; // deviation ADF7021_REG2 |= (uint32_t) 0b001 << 4; // modulation (GMSK) break; - + case STATE_DMR: // Dev: +1 symb 648 Hz, symb rate = 4800 - + ADF7021_REG3 = ADF7021_REG3_DMR; ADF7021_REG10 = ADF7021_REG10_DMR; @@ -413,7 +413,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) #endif break; - + case STATE_YSF: // Dev: +1 symb 900 Hz, symb rate = 4800 @@ -440,7 +440,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) #endif break; - + case STATE_P25: // Dev: +1 symb 600 Hz, symb rate = 4800 @@ -467,7 +467,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) #endif break; - + case STATE_NXDN: // Dev: +1 symb 350 Hz, symb rate = 2400 @@ -494,7 +494,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) #endif break; - + default: break; } @@ -531,7 +531,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG2 |= (uint32_t) 0b110001 << 7; // PA AD7021_control_word = ADF7021_REG2; Send_AD7021_control(); - + // TEST DAC (14) #if defined(TEST_DAC) AD7021_control_word = 0x0000001E; @@ -567,7 +567,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) // 3FSK/4FSK DEMOD (13) AD7021_control_word = ADF7021_REG13; Send_AD7021_control(); - + #if defined(TEST_TX) PTT_pin(HIGH); AD7021_control_word = ADF7021_TX_REG0; @@ -607,7 +607,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) ADF7021_REG3 = ADF7021_REG3_DSTAR; ADF7021_REG10 = ADF7021_REG10_DSTAR; - + // K=32 ADF7021_REG4 = (uint32_t) 0b0100 << 0; // register 4 ADF7021_REG4 |= (uint32_t) 0b001 << 4; // mode, GMSK @@ -624,10 +624,10 @@ void CIO::ifConf2(MMDVM_STATE modemState) ADF7021_REG2 |= (uint32_t) (m_dstarDev / div2)<< 19; // deviation ADF7021_REG2 |= (uint32_t) 0b001 << 4; // modulation (GMSK) break; - + case STATE_DMR: // Dev: +1 symb 648 Hz, symb rate = 4800 - + ADF7021_REG3 = ADF7021_REG3_DMR; ADF7021_REG10 = ADF7021_REG10_DMR; @@ -647,7 +647,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) ADF7021_REG2 |= (uint32_t) (m_dmrDev / div2) << 19; // deviation ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) break; - + case STATE_YSF: // Dev: +1 symb 900 Hz, symb rate = 4800 @@ -670,7 +670,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) ADF7021_REG2 |= (uint32_t) (m_ysfDev / div2) << 19; // deviation ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) break; - + case STATE_P25: // Dev: +1 symb 600 Hz, symb rate = 4800 @@ -740,7 +740,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) // IF coarse cal (5) AD7021_control_word = ADF7021_REG5; Send_AD7021_control2(); - + // Delay for coarse IF filter calibration delay_IFcal(); @@ -754,7 +754,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) ADF7021_REG2 |= (uint32_t) 0b110001 << 7; // PA AD7021_control_word = ADF7021_REG2; Send_AD7021_control2(); - + // TEST DAC (14) AD7021_control_word = 0x0000000E; Send_AD7021_control2(); @@ -778,7 +778,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) // 3FSK/4FSK DEMOD (13) AD7021_control_word = ADF7021_REG13; Send_AD7021_control2(); - + // TEST MODE (disabled) (15) AD7021_control_word = 0x000E000F; Send_AD7021_control2(); @@ -788,7 +788,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) void CIO::interrupt() { uint8_t bit = 0U; - + if (!m_started) return; @@ -850,7 +850,7 @@ void CIO::interrupt() even = ADF7021_EVEN_BIT; } } - + // we sample the RX bit at rising TXD clock edge, so TXD must be 1 and we are not in tx mode if (!m_tx && clk == 1U && !m_duplex) { if(RXD_pin()) @@ -860,7 +860,7 @@ void CIO::interrupt() m_rxBuffer.put(bit, m_control); } - + if (torx_request == true && even == ADF7021_EVEN_BIT && m_tx && clk == 0U) { // that is absolutely crucial in 4FSK, see datasheet: // enable sle after 1/4 tBit == 26uS when sending MSB (even == false) and clock is low @@ -881,14 +881,15 @@ void CIO::interrupt() // last tranmittted bit is always the even bit // since the current bit is a transitional "don't care" bit, never transmitted even = !ADF7021_EVEN_BIT; - } + } m_watchdog++; m_modeTimerCnt++; + m_int1counter++; if(m_scanPauseCnt >= SCAN_PAUSE) m_scanPauseCnt = 0U; - + if(m_scanPauseCnt != 0U) m_scanPauseCnt++; } @@ -897,7 +898,7 @@ void CIO::interrupt() void CIO::interrupt2() { uint8_t bit = 0U; - + if(m_duplex) { if(RXD2_pin()) bit = 1U; @@ -906,6 +907,8 @@ void CIO::interrupt2() m_rxBuffer.put(bit, m_control); } + + m_int2counter++; } #endif diff --git a/CalDMR.cpp b/CalDMR.cpp index 8977b22..d952eb1 100644 --- a/CalDMR.cpp +++ b/CalDMR.cpp @@ -53,7 +53,8 @@ CCalDMR::CCalDMR() : m_transmit(false), m_state(DMRCAL1K_IDLE), m_dmr1k(), -m_audioSeq(0) +m_audioSeq(0), +m_count(0) { ::memcpy(m_dmr1k, VOICE_1K, DMR_FRAME_LENGTH_BYTES + 1U); } @@ -72,6 +73,17 @@ void CCalDMR::process() case STATE_DMRDMO1K: dmrdmo1k(); break; + case STATE_INTCAL: + // Simple interrupt counter for board diagnostics (TCXO, connections, etc) + // Not intended for precise interrupt frequency measurements + m_count++; + if (m_count >= CAL_DLY_LOOP) { + m_count = 0U; + uint16_t int1, int2; + io.getIntCounter(int1, int2); + DEBUG3("Counter INT1/INT2:", int1 >> 1U, int2); + } + break; default: break; } diff --git a/CalDMR.h b/CalDMR.h index 33fec17..8748093 100644 --- a/CalDMR.h +++ b/CalDMR.h @@ -47,6 +47,7 @@ private: DMRCAL1K m_state; uint8_t m_dmr1k[DMR_FRAME_LENGTH_BYTES + 1U]; uint8_t m_audioSeq; + uint32_t m_count; }; #endif diff --git a/CalRSSI.cpp b/CalRSSI.cpp index 0859cf4..11af51d 100644 --- a/CalRSSI.cpp +++ b/CalRSSI.cpp @@ -51,7 +51,7 @@ void CCalRSSI::process() if (m_navg >= 6U) { uint16_t ave = m_accum / 6U; - + uint8_t buffer[6U]; buffer[0U] = (m_max >> 8) & 0xFFU; buffer[1U] = (m_max >> 0) & 0xFFU; diff --git a/Debug.h b/Debug.h index c98da19..445e11a 100644 --- a/Debug.h +++ b/Debug.h @@ -36,7 +36,7 @@ #define DEBUG1(a) #define DEBUG2(a,b) #define DEBUG2I(a,b) -#define DEBUG3(a,b,c) +#define DEBUG3(a,b,c) serial.writeDebug((a),(b),(c)) #define DEBUG4(a,b,c,d) #define DEBUG5(a,b,c,d,e) diff --git a/Globals.h b/Globals.h index 419417c..8bfacd2 100644 --- a/Globals.h +++ b/Globals.h @@ -47,7 +47,8 @@ enum MMDVM_STATE { STATE_RSSICAL = 96, STATE_CWID = 97, STATE_DMRCAL = 98, - STATE_DSTARCAL = 99 + STATE_DSTARCAL = 99, + STATE_INTCAL = 100 }; const uint8_t MARK_SLOT1 = 0x08U; diff --git a/IO.cpp b/IO.cpp index 53d689b..00521aa 100644 --- a/IO.cpp +++ b/IO.cpp @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - + #include "Config.h" #include "Globals.h" #include "IO.h" @@ -37,10 +37,12 @@ m_scanEnable(false), m_scanPauseCnt(0U), m_scanPos(0U), m_ledValue(true), -m_watchdog(0U) +m_watchdog(0U), +m_int1counter(0U), +m_int2counter(0U) { Init(); - + CE_pin(HIGH); LED_pin(HIGH); PTT_pin(LOW); @@ -165,7 +167,7 @@ void CIO::process() } setRX(false); } - + if(m_modemState_prev == STATE_DSTAR) scantime = SCAN_TIME; else if(m_modemState_prev == STATE_DMR) @@ -402,3 +404,11 @@ uint32_t CIO::getWatchdog() { return m_watchdog; } + +void CIO::getIntCounter(uint16_t &int1, uint16_t &int2) +{ + int1 = m_int1counter; + int2 = m_int2counter; + m_int1counter = 0U; + m_int2counter = 0U; +} diff --git a/IO.h b/IO.h index 0159184..b8e5a7e 100644 --- a/IO.h +++ b/IO.h @@ -47,6 +47,12 @@ #define SCAN_TIME 1920 #define SCAN_PAUSE 20000 +#if defined(DUPLEX) +#define CAL_DLY_LOOP 96100U +#else +#define CAL_DLY_LOOP 106000U +#endif + extern uint32_t m_frequency_rx; extern uint32_t m_frequency_tx; extern uint32_t m_pocsag_freq_tx; @@ -70,7 +76,7 @@ public: void CE_pin(bool on); bool RXD_pin(void); bool CLK_pin(void); - + #if defined(BIDIR_DATA_PIN) void RXD_pin_write(bool on); #endif @@ -90,7 +96,7 @@ public: #if defined(DUPLEX) void interrupt2(void); #endif - + #if defined(BIDIR_DATA_PIN) void Data_dir_out(bool dir); #endif @@ -108,6 +114,7 @@ public: void setLoDevYSF(bool ysfLoDev); void resetWatchdog(void); uint32_t getWatchdog(void); + void getIntCounter(uint16_t &int1, uint16_t &int2); void selfTest(void); // RF interface API @@ -162,6 +169,8 @@ private: MMDVM_STATE m_Modes[5]; bool m_ledValue; volatile uint32_t m_watchdog; + volatile uint16_t m_int1counter; + volatile uint16_t m_int2counter; }; diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index cf15140..3c08431 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -123,7 +123,7 @@ void loop() if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); - if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) + if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL) calDMR.process(); #if defined(SEND_RSSI_DATA) diff --git a/MMDVM_HS.ino b/MMDVM_HS.ino index ebf4adc..7d55012 100644 --- a/MMDVM_HS.ino +++ b/MMDVM_HS.ino @@ -118,7 +118,7 @@ void loop() if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); - if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) + if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL) calDMR.process(); #if defined(SEND_RSSI_DATA) diff --git a/SerialPort.cpp b/SerialPort.cpp index 335c72c..e6738a0 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -212,7 +212,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) { if (length < 13U) return 4U; - + bool ysfLoDev = (data[0U] & 0x08U) == 0x08U; bool simplex = (data[0U] & 0x80U) == 0x80U; @@ -231,7 +231,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) MMDVM_STATE modemState = MMDVM_STATE(data[3U]); - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_INTCAL && modemState != STATE_RSSICAL) return 4U; if (modemState == STATE_DSTAR && !dstarEnable) return 4U; @@ -278,7 +278,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) m_nxdnEnable = nxdnEnable; m_pocsagEnable = pocsagEnable; - if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) { + if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) { m_dmrEnable = true; m_modemState = STATE_DMR; m_calState = modemState; @@ -319,7 +319,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.setLoDevYSF(ysfLoDev); - if (!m_firstCal || (modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL)) { + if (!m_firstCal || (modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL)) { if(m_dstarEnable) io.ifConf(STATE_DSTAR, true); else if(m_dmrEnable) @@ -339,7 +339,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.printConf(); #endif - if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) + if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) m_firstCal = true; return 0U; @@ -356,7 +356,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) if (modemState == m_modemState) return 0U; - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL) return 4U; if (modemState == STATE_DSTAR && !m_dstarEnable) return 4U; @@ -371,7 +371,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) if (modemState == STATE_POCSAG && !m_pocsagEnable) return 4U; - if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) { + if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) { m_dmrEnable = true; tmpState = STATE_DMR; m_calState = modemState; @@ -589,7 +589,7 @@ void CSerialPort::process() case MMDVM_CAL_DATA: if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) { err = calDMR.write(m_buffer + 3U, m_len - 3U); - } else if (m_calState == STATE_RSSICAL) { + } else if (m_calState == STATE_RSSICAL || m_calState == STATE_INTCAL) { err = 0U; } if (err == 0U) { @@ -1129,12 +1129,11 @@ void CSerialPort::writeRSSIData(const uint8_t* data, uint8_t length) #endif #if defined(ENABLE_DEBUG) - void CSerialPort::writeDebug(const char* text) { if (!m_debug) return; - + uint8_t reply[130U]; reply[0U] = MMDVM_FRAME_START; @@ -1154,7 +1153,7 @@ void CSerialPort::writeDebugI(const char* text, int32_t n1) { if (!m_debug) return; - + uint8_t reply[130U]; reply[0U] = MMDVM_FRAME_START; @@ -1180,7 +1179,7 @@ void CSerialPort::writeDebug(const char* text, int16_t n1) { if (!m_debug) return; - + uint8_t reply[130U]; reply[0U] = MMDVM_FRAME_START; @@ -1198,12 +1197,13 @@ void CSerialPort::writeDebug(const char* text, int16_t n1) writeInt(1U, reply, count, true); } +#endif 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; @@ -1225,11 +1225,12 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2) writeInt(1U, reply, count, true); } +#if defined(ENABLE_DEBUG) 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; @@ -1285,6 +1286,4 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n writeInt(1U, reply, count, true); } - #endif - diff --git a/SerialPort.h b/SerialPort.h index bbfb7a6..b1fa6b7 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -56,10 +56,10 @@ public: void writeDebug(const char* text); void writeDebug(const char* text, int16_t n1); void writeDebugI(const char* text, int32_t n1); - void writeDebug(const char* text, int16_t n1, int16_t n2); 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); #endif + void writeDebug(const char* text, int16_t n1, int16_t n2); private: uint8_t m_buffer[256U]; @@ -76,7 +76,7 @@ private: uint8_t setMode(const uint8_t* data, uint8_t length); void setMode(MMDVM_STATE modemState); uint8_t setFreq(const uint8_t* data, uint8_t length); - + // Hardware versions void beginInt(uint8_t n, int speed); int availableInt(uint8_t n); @@ -85,4 +85,3 @@ private: }; #endif - diff --git a/version.h b/version.h index 47dc04b..cdfedd9 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "11" -#define VERSION_DATE "20181028" +#define VER_REV "12" +#define VERSION_DATE "20181104" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 6add9c540d3b4b59aae0a4c7bfa721eb154cba18 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 4 Nov 2018 16:10:27 -0300 Subject: [PATCH 139/239] Fix delay constants for interrupt counter test mode --- IO.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/IO.h b/IO.h index b8e5a7e..c50f08f 100644 --- a/IO.h +++ b/IO.h @@ -48,9 +48,17 @@ #define SCAN_PAUSE 20000 #if defined(DUPLEX) -#define CAL_DLY_LOOP 96100U +#if defined(STM32_USB_HOST) +#define CAL_DLY_LOOP 98950U #else -#define CAL_DLY_LOOP 106000U +#define CAL_DLY_LOOP 105100U +#endif +#else +#if defined(STM32_USB_HOST) +#define CAL_DLY_LOOP 110850U +#else +#define CAL_DLY_LOOP 114350U +#endif #endif extern uint32_t m_frequency_rx; From 0e8783c53354e1122e816ecfe4547e6651f1bbe5 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 4 Nov 2018 16:40:33 -0300 Subject: [PATCH 140/239] Preparing next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv_npi.sh | 2 +- scripts/install_fw_nanodv_usb.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 4b2fae8..559f29b 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 5022a93..3019e69 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 617c281..35fa0d3 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 0af9ec6..6b71721 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 20542eb..eff3a25 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 93b92c4..3bb3d6a 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 859f6ba..0af6351 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index d820e57..cfbaa5b 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index f2edf3f..f38968f 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 69bc08c..eb2b5f2 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index c411e32..b49eaa4 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 47d09eb..07832a8 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 3fdfc66..50c1fe0 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.8" +FW_VERSION="v1.4.12" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From dec70516c3f1b3bceffe001cda3990dcde7448a7 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 4 Nov 2018 17:25:20 -0300 Subject: [PATCH 141/239] Fix delay constants again --- IO.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IO.h b/IO.h index c50f08f..b455cff 100644 --- a/IO.h +++ b/IO.h @@ -51,13 +51,13 @@ #if defined(STM32_USB_HOST) #define CAL_DLY_LOOP 98950U #else -#define CAL_DLY_LOOP 105100U +#define CAL_DLY_LOOP 96100U #endif #else #if defined(STM32_USB_HOST) #define CAL_DLY_LOOP 110850U #else -#define CAL_DLY_LOOP 114350U +#define CAL_DLY_LOOP 104600U #endif #endif From 7bdef738b2ebde8fd733fbea8f1c4de61c13c89b Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 4 Dec 2018 23:50:27 -0300 Subject: [PATCH 142/239] Update MMDVM modem protocol --- SerialPort.cpp | 8 ++++++++ version.h | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index e6738a0..ad3d0fb 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -66,6 +66,9 @@ const uint8_t MMDVM_NAK = 0x7FU; const uint8_t MMDVM_SERIAL = 0x80U; +const uint8_t MMDVM_TRANSPARENT = 0x90U; +const uint8_t MMDVM_QSO_INFO = 0x91U; + const uint8_t MMDVM_DEBUG1 = 0xF1U; const uint8_t MMDVM_DEBUG2 = 0xF2U; const uint8_t MMDVM_DEBUG3 = 0xF3U; @@ -812,6 +815,11 @@ void CSerialPort::process() } break; + case MMDVM_TRANSPARENT: + case MMDVM_QSO_INFO: + // Do nothing on the MMDVM. + break; + #if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) case MMDVM_SERIAL: writeInt(3U, m_buffer + 3U, m_len - 3U); diff --git a/version.h b/version.h index cdfedd9..86b20d8 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "12" -#define VERSION_DATE "20181104" +#define VER_REV "13" +#define VERSION_DATE "20181204" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 6183d00264d28d9b453fe7fe0c92e93f0ea991fc Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 9 Dec 2018 18:59:10 -0300 Subject: [PATCH 143/239] Update some pinouts --- IOArduino.cpp | 82 +++++++++++++++++++++++++++++---------------------- IOSTM.cpp | 24 +++++++++++++-- 2 files changed, 68 insertions(+), 38 deletions(-) diff --git a/IOArduino.cpp b/IOArduino.cpp index 1eae9ce..967a38c 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -47,7 +47,12 @@ #define PIN_DMR_LED PB13 #define PIN_YSF_LED PB1 #define PIN_P25_LED PB0 -#define PIN_NXDN_LED PA8 +#if defined(STM32_USB_HOST) +#define PIN_NXDN_LED PA1 +#else +#define PIN_NXDN_LED PA7 +#endif +#define PIN_POCSAG_LED PA5 #define PIN_PTT_LED PB14 #define PIN_COS_LED PB15 @@ -71,6 +76,7 @@ #define PIN_YSF_LED PB1 #define PIN_P25_LED PB0 #define PIN_NXDN_LED PA8 +#define PIN_POCSAG_LED PA7 #define PIN_PTT_LED PB14 #define PIN_COS_LED PB15 @@ -81,44 +87,46 @@ #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) // Teensy pin definitions -#define PIN_SCLK 2 -#define PIN_SDATA 3 -#define PIN_SREAD 4 -#define PIN_SLE 5 -#define PIN_CE 6 -#define PIN_RXD 7 -#define PIN_TXD 8 -#define PIN_CLKOUT 22 -#define PIN_LED 13 -#define PIN_DEB 23 -#define PIN_DSTAR_LED 16 -#define PIN_DMR_LED 17 -#define PIN_YSF_LED 18 -#define PIN_P25_LED 19 -#define PIN_NXDN_LED 20 -#define PIN_PTT_LED 14 -#define PIN_COS_LED 15 +#define PIN_SCLK 2 +#define PIN_SDATA 3 +#define PIN_SREAD 4 +#define PIN_SLE 5 +#define PIN_CE 6 +#define PIN_RXD 7 +#define PIN_TXD 8 +#define PIN_CLKOUT 22 +#define PIN_LED 13 +#define PIN_DEB 23 +#define PIN_DSTAR_LED 16 +#define PIN_DMR_LED 17 +#define PIN_YSF_LED 18 +#define PIN_P25_LED 19 +#define PIN_NXDN_LED 20 +#define PIN_POCSAG_LED 21 +#define PIN_PTT_LED 14 +#define PIN_COS_LED 15 #else // Arduino pin definitions (Due and Zero) -#define PIN_SCLK 3 -#define PIN_SDATA 4 // 2 in Arduino Zero Pro -#define PIN_SREAD 5 -#define PIN_SLE 6 -#define PIN_CE 12 -#define PIN_RXD 7 -#define PIN_TXD 8 -#define PIN_CLKOUT 2 // 4 in Arduino Zero Pro -#define PIN_LED 13 -#define PIN_DEB 11 -#define PIN_DSTAR_LED 14 -#define PIN_DMR_LED 15 -#define PIN_YSF_LED 16 -#define PIN_P25_LED 17 -#define PIN_NXDN_LED 18 -#define PIN_PTT_LED 9 -#define PIN_COS_LED 10 +#define PIN_SCLK 3 +#define PIN_SDATA 4 // 2 in Arduino Zero Pro +#define PIN_SREAD 5 +#define PIN_SLE 6 +#define PIN_CE 12 +#define PIN_RXD 7 +#define PIN_TXD 8 +#define PIN_CLKOUT 2 // 4 in Arduino Zero Pro +#define PIN_LED 13 +#define PIN_DEB 11 +#define PIN_DSTAR_LED 14 +#define PIN_DMR_LED 15 +#define PIN_YSF_LED 16 +#define PIN_P25_LED 17 +#define PIN_NXDN_LED 18 +#define PIN_POCSAG_LED 19 +#define PIN_PTT_LED 9 +#define PIN_COS_LED 10 #endif @@ -168,6 +176,7 @@ void CIO::Init() pinMode(PIN_YSF_LED, OUTPUT); pinMode(PIN_P25_LED, OUTPUT); pinMode(PIN_NXDN_LED, OUTPUT); + pinMode(PIN_POCSAG_LED, OUTPUT); pinMode(PIN_PTT_LED, OUTPUT); pinMode(PIN_COS_LED, OUTPUT); @@ -325,8 +334,9 @@ void CIO::POCSAG_pin(bool on) #if defined(USE_ALTERNATE_POCSAG_LEDS) digitalWrite(PIN_DSTAR_LED, on ? HIGH : LOW); digitalWrite(PIN_DMR_LED, on ? HIGH : LOW); +#else + digitalWrite(PIN_POCSAG_LED, on ? HIGH : LOW); #endif - // TODO: add a separate LED pin for POCSAG mode } void CIO::PTT_pin(bool on) diff --git a/IOSTM.cpp b/IOSTM.cpp index a78e091..1dc3465 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -83,6 +83,9 @@ #define PIN_NXDN_LED GPIO_Pin_8 #define PORT_NXDN_LED GPIOA +#define PIN_POCSAG_LED GPIO_Pin_5 +#define PORT_POCSAG_LED GPIOA + #define PIN_PTT_LED GPIO_Pin_12 #define PORT_PTT_LED GPIOB @@ -143,9 +146,16 @@ #define PIN_P25_LED GPIO_Pin_0 #define PORT_P25_LED GPIOB -#define PIN_NXDN_LED GPIO_Pin_8 +#if defined(STM32_USB_HOST) +#define PIN_NXDN_LED GPIO_Pin_1 +#else +#define PIN_NXDN_LED GPIO_Pin_7 +#endif #define PORT_NXDN_LED GPIOA +#define PIN_POCSAG_LED GPIO_Pin_5 +#define PORT_POCSAG_LED GPIOA + #define PIN_PTT_LED GPIO_Pin_14 #define PORT_PTT_LED GPIOB @@ -218,6 +228,9 @@ #define PIN_NXDN_LED GPIO_Pin_8 #define PORT_NXDN_LED GPIOA +#define PIN_POCSAG_LED GPIO_Pin_7 +#define PORT_POCSAG_LED GPIOA + #define PIN_PTT_LED GPIO_Pin_14 #define PORT_PTT_LED GPIOB @@ -433,6 +446,12 @@ void CIO::Init() GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_NXDN_LED, &GPIO_InitStruct); + // POCSAG LED + GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStruct.GPIO_Pin = PIN_POCSAG_LED; + GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_Init(PORT_POCSAG_LED, &GPIO_InitStruct); + // PTT LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_PTT_LED; @@ -662,8 +681,9 @@ void CIO::POCSAG_pin(bool on) #if defined(USE_ALTERNATE_POCSAG_LEDS) GPIO_WriteBit(PORT_DSTAR_LED, PIN_DSTAR_LED, on ? Bit_SET : Bit_RESET); GPIO_WriteBit(PORT_DMR_LED, PIN_DMR_LED, on ? Bit_SET : Bit_RESET); +#else + GPIO_WriteBit(PORT_POCSAG_LED, PIN_POCSAG_LED, on ? Bit_SET : Bit_RESET); #endif - // TODO: add a separate LED pin for POCSAG mode } void CIO::PTT_pin(bool on) From a9fed35d1c5aadd7f6856df06ad293980026916a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 9 Dec 2018 18:59:56 -0300 Subject: [PATCH 144/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 86b20d8..6c403c4 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "13" -#define VERSION_DATE "20181204" +#define VER_REV "14" +#define VERSION_DATE "20181209" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From e042c0c777c525d1aebb008a2dae220940cca070 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 12 Dec 2018 00:19:52 -0300 Subject: [PATCH 145/239] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 51fb61d..5ef7188 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ You could use some pi-star commands under SSH console: ### Windows -Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the [releases section](https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.2/ZUMSpotFW_setup.exe). +Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the [releases section](https://github.com/juribeparada/MMDVM_HS/releases). This utility includes firmwares binaries and USB drivers for Windows 7/8/10. If you have problems with the installer, you can download [ZUMspotFW.zip](https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.2/ZUMspotFW.zip) for a manual installation. From 8d77ff32cf72f3b2e5811c4c10a87ea02932cd9e Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 16 Dec 2018 16:06:19 -0300 Subject: [PATCH 146/239] Prepare next release --- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv_npi.sh | 2 +- scripts/install_fw_nanodv_usb.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 559f29b..ed9d4f5 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 3019e69..cf73486 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 35fa0d3..1f75b00 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 6b71721..8283a65 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index eff3a25..8340ff8 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 3bb3d6a..2e055c3 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 0af6351..8348f0e 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index cfbaa5b..a92576c 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index f38968f..249c54c 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index eb2b5f2..13629c4 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index b49eaa4..7712d45 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 07832a8..f2e834c 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 50c1fe0..6121d51 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.12" +FW_VERSION="v1.4.14" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem1441" From d50d0c070badd0dcb6edd91e5c1379ec345b2053 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 31 Jan 2019 17:36:38 +0100 Subject: [PATCH 147/239] Add POCSAG cal basics --- Globals.h | 4 +++- MMDVM_HS.cpp | 6 +++++- POCSAGTX.cpp | 30 +++++++++++++++++++++++++++--- POCSAGTX.h | 6 ++++++ SerialPort.cpp | 21 ++++++++++++++++++--- 5 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Globals.h b/Globals.h index 8bfacd2..aaffc73 100644 --- a/Globals.h +++ b/Globals.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2019 by Florian Wolters DF2ET * * 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 @@ -48,7 +49,8 @@ enum MMDVM_STATE { STATE_CWID = 97, STATE_DMRCAL = 98, STATE_DSTARCAL = 99, - STATE_INTCAL = 100 + STATE_INTCAL = 100, + STATE_POCSAGCAL = 101 }; const uint8_t MARK_SLOT1 = 0x08U; diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index 3c08431..bdf1586 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2016 by Mathis Schmieder DB9MAT * Copyright (C) 2016 by Colin Durbridge G4EML * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2019 by Florian Wolters DF2ET * * 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 @@ -120,8 +121,11 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); - if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) { + if (m_calState == STATE_POCSAGCAL) + pocsagTX.setCal(true); pocsagTX.process(); + } if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL) calDMR.process(); diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index 228f34a..4dae061 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2019 by Florian Wolters DF2ET * * 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 @@ -28,12 +29,18 @@ m_poBuffer(), m_poLen(0U), m_poPtr(0U), m_txDelay(POCSAG_PREAMBLE_LENGTH_BYTES), -m_delay(false) +m_delay(false), +m_cal(false) { } void CPOCSAGTX::process() { + if (m_cal) { + m_delay = false; + createCal(); + } + if (m_poLen == 0U && m_buffer.getData() > 0U) { if (!m_tx) { m_delay = true; @@ -80,8 +87,8 @@ bool CPOCSAGTX::busy() uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) { - if (length != POCSAG_FRAME_LENGTH_BYTES) - return 4U; + //if (length != POCSAG_FRAME_LENGTH_BYTES) + //return 4U; uint16_t space = m_buffer.getSpace(); if (space < POCSAG_FRAME_LENGTH_BYTES) @@ -120,3 +127,20 @@ uint8_t CPOCSAGTX::getSpace() const { return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES; } + +void CPOCSAGTX::setCal(bool start) +{ + m_cal = start ? true : false; +} + +void CPOCSAGTX::createCal() +{ + // 600 Hz square wave generation + for (unsigned int i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) { + m_poBuffer[i] = 0xAAU; + } + + m_poLen = POCSAG_FRAME_LENGTH_BYTES; + + m_poPtr = 0U; +} diff --git a/POCSAGTX.h b/POCSAGTX.h index 7391cad..88cfc9b 100644 --- a/POCSAGTX.h +++ b/POCSAGTX.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2019 by Florian Wolters DF2ET * * 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 @@ -28,6 +29,10 @@ public: void setTXDelay(uint8_t delay); + void setCal(bool); + + void createCal(); + uint8_t getSpace() const; void process(); @@ -41,6 +46,7 @@ private: uint16_t m_poPtr; uint16_t m_txDelay; bool m_delay; + bool m_cal; void writeByte(uint8_t c); }; diff --git a/SerialPort.cpp b/SerialPort.cpp index ad3d0fb..6196475 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2013,2015,2016,2018 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2019 by Florian Wolters DF2ET * * 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 @@ -234,7 +235,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) MMDVM_STATE modemState = MMDVM_STATE(data[3U]); - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_INTCAL && modemState != STATE_RSSICAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_INTCAL && modemState != STATE_RSSICAL && modemState != STATE_POCSAGCAL) return 4U; if (modemState == STATE_DSTAR && !dstarEnable) return 4U; @@ -289,6 +290,12 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.updateCal(); if (modemState == STATE_RSSICAL) io.ifConf(STATE_DMR, true); + } else if (modemState == STATE_POCSAGCAL) { + m_pocsagEnable = true; + m_modemState = STATE_POCSAG; + m_calState = modemState; + if (m_firstCal) + io.updateCal(); } else { m_modemState = modemState; @@ -342,7 +349,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.printConf(); #endif - if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) + if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL || modemState == STATE_POCSAGCAL) m_firstCal = true; return 0U; @@ -359,7 +366,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) if (modemState == m_modemState) return 0U; - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL && modemState != STATE_POCSAGCAL) return 4U; if (modemState == STATE_DSTAR && !m_dstarEnable) return 4U; @@ -380,6 +387,12 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) m_calState = modemState; if (m_firstCal) io.updateCal(); + } else if (modemState == STATE_POCSAGCAL) { + m_pocsagEnable = true; + tmpState = STATE_POCSAG; + m_calState = modemState; + if (m_firstCal) + io.updateCal(); } else { tmpState = modemState; @@ -592,6 +605,8 @@ void CSerialPort::process() case MMDVM_CAL_DATA: if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) { err = calDMR.write(m_buffer + 3U, m_len - 3U); + } else if (m_calState == STATE_POCSAGCAL) { + err = pocsagTX.writeData(m_buffer + 3U, m_len - 3U); } else if (m_calState == STATE_RSSICAL || m_calState == STATE_INTCAL) { err = 0U; } From 5932cc227b43cdbaf2c3e4d637287639609233e1 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 4 Feb 2019 13:51:45 -0300 Subject: [PATCH 148/239] Fix POCSAG cal TX on/off --- MMDVM_HS.cpp | 5 +---- POCSAGTX.cpp | 16 ++++++++++++---- POCSAGTX.h | 2 +- SerialPort.cpp | 13 +++++++------ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index bdf1586..de256e8 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -121,11 +121,8 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); - if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) { - if (m_calState == STATE_POCSAGCAL) - pocsagTX.setCal(true); + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); - } if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL) calDMR.process(); diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index 4dae061..493f44e 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -87,8 +87,8 @@ bool CPOCSAGTX::busy() uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length) { - //if (length != POCSAG_FRAME_LENGTH_BYTES) - //return 4U; + if (length != POCSAG_FRAME_LENGTH_BYTES) + return 4U; uint16_t space = m_buffer.getSpace(); if (space < POCSAG_FRAME_LENGTH_BYTES) @@ -128,9 +128,17 @@ uint8_t CPOCSAGTX::getSpace() const return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES; } -void CPOCSAGTX::setCal(bool start) +uint8_t CPOCSAGTX::setCal(const uint8_t* data, uint8_t length) { - m_cal = start ? true : false; + if (length != 1U) + return 4U; + + m_cal = data[0U] == 1U; + + if (!m_cal) + io.ifConf(STATE_POCSAG, true); + + return 0U; } void CPOCSAGTX::createCal() diff --git a/POCSAGTX.h b/POCSAGTX.h index 88cfc9b..077556b 100644 --- a/POCSAGTX.h +++ b/POCSAGTX.h @@ -29,7 +29,7 @@ public: void setTXDelay(uint8_t delay); - void setCal(bool); + uint8_t setCal(const uint8_t* data, uint8_t length); void createCal(); diff --git a/SerialPort.cpp b/SerialPort.cpp index 6196475..a05ca72 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -294,8 +294,9 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) m_pocsagEnable = true; m_modemState = STATE_POCSAG; m_calState = modemState; - if (m_firstCal) - io.updateCal(); + //if (m_firstCal) + // io.updateCal(); + io.ifConf(STATE_POCSAG, true); } else { m_modemState = modemState; @@ -329,7 +330,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.setLoDevYSF(ysfLoDev); - if (!m_firstCal || (modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL)) { + if (!m_firstCal || (modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL && modemState != STATE_POCSAGCAL)) { if(m_dstarEnable) io.ifConf(STATE_DSTAR, true); else if(m_dmrEnable) @@ -391,8 +392,8 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) m_pocsagEnable = true; tmpState = STATE_POCSAG; m_calState = modemState; - if (m_firstCal) - io.updateCal(); + //if (m_firstCal) + // io.updateCal(); } else { tmpState = modemState; @@ -606,7 +607,7 @@ void CSerialPort::process() if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) { err = calDMR.write(m_buffer + 3U, m_len - 3U); } else if (m_calState == STATE_POCSAGCAL) { - err = pocsagTX.writeData(m_buffer + 3U, m_len - 3U); + err = pocsagTX.setCal(m_buffer + 3U, m_len - 3U); } else if (m_calState == STATE_RSSICAL || m_calState == STATE_INTCAL) { err = 0U; } From 2903847ac232e6965abbdcbc605145e91bfdf023 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 4 Feb 2019 14:23:41 -0300 Subject: [PATCH 149/239] Change deviation and power for POCSAG cal --- ADF7021.cpp | 11 +++++++++-- SerialPort.cpp | 9 ++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 4def500..ef3d200 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -1007,8 +1007,15 @@ void CIO::updateCal() Send_AD7021_control(); ADF7021_REG2 = (uint32_t) 0b10 << 28; // invert data (and RC alpha = 0.5) - ADF7021_REG2 |= (uint32_t) (m_dmrDev / div2) << 19; // deviation - ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) + + if (m_modemState == STATE_DMR) { + ADF7021_REG2 |= (uint32_t) (m_dmrDev / div2) << 19; // DMR deviation + ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) + } else if (m_modemState == STATE_POCSAG) { + ADF7021_REG2 |= (uint32_t) (m_pocsagDev / div2) << 19; // POCSAG deviation + ADF7021_REG2 |= (uint32_t) 0b000 << 4; // modulation (2FSK) + } + ADF7021_REG2 |= (uint32_t) 0b0010; // register 2 ADF7021_REG2 |= (uint32_t) m_power << 13; // power level ADF7021_REG2 |= (uint32_t) 0b110001 << 7; // PA diff --git a/SerialPort.cpp b/SerialPort.cpp index a05ca72..dd7e045 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -294,9 +294,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) m_pocsagEnable = true; m_modemState = STATE_POCSAG; m_calState = modemState; - //if (m_firstCal) - // io.updateCal(); - io.ifConf(STATE_POCSAG, true); + if (m_firstCal) + io.updateCal(); } else { m_modemState = modemState; @@ -392,8 +391,8 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) m_pocsagEnable = true; tmpState = STATE_POCSAG; m_calState = modemState; - //if (m_firstCal) - // io.updateCal(); + if (m_firstCal) + io.updateCal(); } else { tmpState = modemState; From b401d06c1f24b2a36ac4fa93d303888999a5fcf7 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 4 Feb 2019 16:58:30 -0300 Subject: [PATCH 150/239] Fix DMR/POCSAG selection in CAL mode --- CalDMR.cpp | 2 +- POCSAGTX.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CalDMR.cpp b/CalDMR.cpp index d952eb1..fdb2882 100644 --- a/CalDMR.cpp +++ b/CalDMR.cpp @@ -144,7 +144,7 @@ uint8_t CCalDMR::write(const uint8_t* data, uint8_t length) if (m_transmit && m_state == DMRCAL1K_IDLE && m_calState == STATE_DMRDMO1K) m_state = DMRCAL1K_VH; - if (!m_transmit) + if (m_transmit) io.ifConf(STATE_DMR, true); return 0U; diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index 493f44e..56e2726 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -135,7 +135,7 @@ uint8_t CPOCSAGTX::setCal(const uint8_t* data, uint8_t length) m_cal = data[0U] == 1U; - if (!m_cal) + if (m_cal) io.ifConf(STATE_POCSAG, true); return 0U; From c72f357f2c040f20f8e6af0b7ba6f0a738a8b30c Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 4 Feb 2019 17:06:37 -0300 Subject: [PATCH 151/239] Update copyright --- ADF7021.cpp | 2 +- CalDMR.cpp | 2 +- Globals.h | 2 +- MMDVM_HS.cpp | 2 +- POCSAGTX.cpp | 2 +- POCSAGTX.h | 2 +- SerialPort.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index ef3d200..a9aaac9 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE * * Some of the code is based on work of Guus Van Dooren PE1PLM: diff --git a/CalDMR.cpp b/CalDMR.cpp index fdb2882..51f9be0 100644 --- a/CalDMR.cpp +++ b/CalDMR.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2009-2015 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/Globals.h b/Globals.h index aaffc73..d50e1c2 100644 --- a/Globals.h +++ b/Globals.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET * * This program is free software; you can redistribute it and/or modify diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index de256e8..f97a3be 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Mathis Schmieder DB9MAT * Copyright (C) 2016 by Colin Durbridge G4EML - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET * * This program is free software; you can redistribute it and/or modify diff --git a/POCSAGTX.cpp b/POCSAGTX.cpp index 56e2726..e8e9146 100644 --- a/POCSAGTX.cpp +++ b/POCSAGTX.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET * * This program is free software; you can redistribute it and/or modify diff --git a/POCSAGTX.h b/POCSAGTX.h index 077556b..6862304 100644 --- a/POCSAGTX.h +++ b/POCSAGTX.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET * * This program is free software; you can redistribute it and/or modify diff --git a/SerialPort.cpp b/SerialPort.cpp index dd7e045..9fb20a3 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2013,2015,2016,2018 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET * * This program is free software; you can redistribute it and/or modify From ed487bcad455158a2c1f0703ee5a5f09e809ae49 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 6 Feb 2019 12:03:34 -0300 Subject: [PATCH 152/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 6c403c4..c762939 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "14" -#define VERSION_DATE "20181209" +#define VER_REV "15" +#define VERSION_DATE "20190206" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 54208aa3173bed93a8865286c6c0067d7209b98c Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 7 Feb 2019 09:30:03 -0300 Subject: [PATCH 153/239] Update submodule STM32F10X_Lib --- STM32F10X_Lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STM32F10X_Lib b/STM32F10X_Lib index 74ff937..2cf6b77 160000 --- a/STM32F10X_Lib +++ b/STM32F10X_Lib @@ -1 +1 @@ -Subproject commit 74ff93791264faef4c2d8e871b2877d24e0bd1c1 +Subproject commit 2cf6b7712637a7961d52e0deee5f9b257bb9b9be From 544576e98d0bf0adbc48d70f3b6ec49362f6cb21 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 11 Feb 2019 14:49:59 -0300 Subject: [PATCH 154/239] Add i2c host support --- Config.h | 6 +- Globals.h | 7 +- I2CHost.cpp | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++ I2CHost.h | 55 ++++++++++++++ MMDVM_HS.cpp | 4 + STM32F10X_Lib | 2 +- SerialSTM.cpp | 23 ++++-- 7 files changed, 288 insertions(+), 10 deletions(-) create mode 100644 I2CHost.cpp create mode 100644 I2CHost.h diff --git a/Config.h b/Config.h index b7d146f..35c7e52 100644 --- a/Config.h +++ b/Config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 @@ -58,6 +58,10 @@ // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/Globals.h b/Globals.h index d50e1c2..ffc0ad8 100644 --- a/Globals.h +++ b/Globals.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET * * This program is free software; you can redistribute it and/or modify @@ -85,6 +85,7 @@ const uint8_t MARK_NONE = 0x00U; #include "CalDMR.h" #include "Debug.h" #include "Utils.h" +#include "I2CHost.h" extern MMDVM_STATE m_modemState; extern MMDVM_STATE m_calState; @@ -145,5 +146,9 @@ extern CCalRSSI calRSSI; extern CCWIdTX cwIdTX; +#if defined(STM32_I2C_HOST) +extern CI2CHost i2c; +#endif + #endif diff --git a/I2CHost.cpp b/I2CHost.cpp new file mode 100644 index 0000000..e80a096 --- /dev/null +++ b/I2CHost.cpp @@ -0,0 +1,201 @@ +/* + * Copyright (C) 2019 by Andy Uribe CA6JAU + * + * 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. + */ + +#include "Config.h" + +#if defined(STM32_I2C_HOST) + +#include "Globals.h" +#include "I2CHost.h" + +extern "C" { + void I2C2_EV_IRQHandler(void) { + i2c.I2C_EVHandler(); + } + + void I2C2_ER_IRQHandler(void) { + if (I2C_GetITStatus(I2C2, I2C_IT_AF)) { + I2C_ClearITPendingBit(I2C2, I2C_IT_AF); + } + } +} + +CI2CHost::CI2CHost() +{ +} + +void CI2CHost::Init(void) +{ + GPIO_InitTypeDef GPIO_InitStructure; + NVIC_InitTypeDef NVIC_InitStructure; + I2C_InitTypeDef I2C_InitStructure; + + RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2, ENABLE); + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); + RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); + + // Configure I2C GPIOs + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD; + GPIO_Init(GPIOB, &GPIO_InitStructure); + + // Configure the I2C event interrupt + NVIC_InitStructure.NVIC_IRQChannel = I2C2_EV_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init(&NVIC_InitStructure); + + // Configure the I2C error interrupt + NVIC_InitStructure.NVIC_IRQChannel = I2C2_ER_IRQn; + NVIC_Init(&NVIC_InitStructure); + + // I2C configuration + I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; + I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2; + I2C_InitStructure.I2C_OwnAddress1 = I2C_ADDR << 1; + I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; + I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; + I2C_InitStructure.I2C_ClockSpeed = I2C_CLK_FREQ; + + // Enable I2C + I2C_Cmd(I2C2, ENABLE); + // Apply I2C configuration + I2C_Init(I2C2, &I2C_InitStructure); + + I2C_ITConfig(I2C2, I2C_IT_EVT, ENABLE); + I2C_ITConfig(I2C2, I2C_IT_BUF, ENABLE); + I2C_ITConfig(I2C2, I2C_IT_ERR, ENABLE); + + // Initialize the FIFOs + txFIFO_head = 0U; + txFIFO_tail = 0U; + rxFIFO_head = 0U; + rxFIFO_tail = 0U; +} + +void CI2CHost::I2C_EVHandler(void) { + uint32_t event = I2C_GetLastEvent(I2C2); + + switch (event) { + case I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED: + break; + case I2C_EVENT_SLAVE_BYTE_RECEIVED: + if (rxFIFO_level() < I2C_RX_FIFO_SIZE) { + rxFIFO[rxFIFO_head] = I2C_ReceiveData(I2C2); + rxFIFO_head++; + if (rxFIFO_head >= I2C_RX_FIFO_SIZE) + rxFIFO_head = 0U; + } else + I2C_ReceiveData(I2C2); + break; + case I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED: + case I2C_EVENT_SLAVE_BYTE_TRANSMITTED: + if (txFIFO_level() > 0) { + I2C_SendData(I2C2, txFIFO[txFIFO_tail]); + txFIFO_tail++; + if (txFIFO_tail >= I2C_TX_FIFO_SIZE) + txFIFO_tail = 0U; + } else + I2C_SendData(I2C2, 0U); + break; + case I2C_EVENT_SLAVE_STOP_DETECTED: + I2C2_ClearFlag(); + break; + } +} + +void CI2CHost::I2C2_ClearFlag(void) { + // Clear ADDR flag + while((I2C2->SR1 & I2C_SR1_ADDR) == I2C_SR1_ADDR) { + I2C2->SR1; + I2C2->SR2; + } + + // Clear STOPF flag + while((I2C2->SR1 & I2C_SR1_STOPF) == I2C_SR1_STOPF) { + I2C2->SR1; + I2C2->CR1 |= 0x1; + } +} + +uint16_t CI2CHost::txFIFO_level(void) +{ + uint32_t tail = txFIFO_tail; + uint32_t head = txFIFO_head; + + if (tail > head) + return I2C_TX_FIFO_SIZE + head - tail; + else + return head - tail; +} + +uint16_t CI2CHost::rxFIFO_level(void) +{ + uint32_t tail = rxFIFO_tail; + uint32_t head = rxFIFO_head; + + if (tail > head) + return I2C_RX_FIFO_SIZE + head - tail; + else + return head - tail; +} + + +uint8_t CI2CHost::txFIFO_put(uint8_t next) +{ + if (txFIFO_level() < I2C_TX_FIFO_SIZE) { + txFIFO[txFIFO_head] = next; + + txFIFO_head++; + if (txFIFO_head >= I2C_TX_FIFO_SIZE) + txFIFO_head = 0U; + return 1U; + } else { + return 0U; + } +} + +uint8_t CI2CHost::AvailI2C(void) +{ + if (rxFIFO_level() > 0U) + return 1U; + else + return 0U; +} + + +uint8_t CI2CHost::ReadI2C(void) +{ + uint8_t data_c = rxFIFO[rxFIFO_tail]; + + rxFIFO_tail++; + if (rxFIFO_tail >= I2C_RX_FIFO_SIZE) + rxFIFO_tail = 0U; + + return data_c; +} + +void CI2CHost::WriteI2C(const uint8_t* data, uint16_t length) +{ + for (uint16_t i = 0U; i < length; i++) + txFIFO_put(data[i]); +} + +#endif \ No newline at end of file diff --git a/I2CHost.h b/I2CHost.h new file mode 100644 index 0000000..cb168ed --- /dev/null +++ b/I2CHost.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(I2CHost_H) +#define I2CHost_H + +#include "Config.h" + +#if defined(STM32_I2C_HOST) + +#define I2C_CLK_FREQ 100000U +#define I2C_TX_FIFO_SIZE 512U +#define I2C_RX_FIFO_SIZE 512U + +class CI2CHost { +public: + CI2CHost(); + + void Init(void); + void I2C_EVHandler(void); + uint8_t AvailI2C(void); + uint8_t ReadI2C(void); + void WriteI2C(const uint8_t* data, uint16_t length); + +private: + void I2C2_ClearFlag(void); + uint16_t txFIFO_level(void); + uint16_t rxFIFO_level(void); + uint8_t txFIFO_put(uint8_t next); + + volatile uint8_t txFIFO[I2C_TX_FIFO_SIZE]; + volatile uint8_t rxFIFO[I2C_RX_FIFO_SIZE]; + volatile uint16_t txFIFO_head, txFIFO_tail; + volatile uint16_t rxFIFO_head, rxFIFO_tail; + +}; + +#endif + +#endif diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index f97a3be..cd61683 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -86,6 +86,10 @@ CCWIdTX cwIdTX; CSerialPort serial; CIO io; +#if defined(STM32_I2C_HOST) +CI2CHost i2c; +#endif + void setup() { serial.start(); diff --git a/STM32F10X_Lib b/STM32F10X_Lib index 2cf6b77..1debc23 160000 --- a/STM32F10X_Lib +++ b/STM32F10X_Lib @@ -1 +1 @@ -Subproject commit 2cf6b7712637a7961d52e0deee5f9b257bb9b9be +Subproject commit 1debc23063f3942608e2bd62d04d5e1249c47fa3 diff --git a/SerialSTM.cpp b/SerialSTM.cpp index 4363039..aae4117 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM - * Copyright (C) 2016,2017 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * * 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 @@ -23,6 +23,7 @@ #include "Globals.h" #include "SerialPort.h" +#include "I2CHost.h" #if defined(STM32_USB_HOST) #include @@ -32,9 +33,9 @@ Pin definitions: - Host communication: -USART1 - TXD PA9 - RXD PA10 -or -USB VCOM +1) USART1 - TXD PA9 - RXD PA10 +2) USB VCOM +3) I2C - SCL PB10 - SDA PB11 - Serial repeater USART2 - TXD PA2 - RXD PA3 @@ -441,6 +442,8 @@ void CSerialPort::beginInt(uint8_t n, int speed) InitUSART1(speed); #elif defined(STM32_USB_HOST) usbserial.begin(); + #elif defined(STM32_I2C_HOST) + i2c.Init(); #endif break; case 3U: @@ -452,7 +455,7 @@ void CSerialPort::beginInt(uint8_t n, int speed) break; default: break; - } + } } int CSerialPort::availableInt(uint8_t n) @@ -463,6 +466,8 @@ int CSerialPort::availableInt(uint8_t n) return AvailUSART1(); #elif defined(STM32_USB_HOST) return usbserial.available(); + #elif defined(STM32_I2C_HOST) + return i2c.AvailI2C(); #endif case 3U: #if defined(SERIAL_REPEATER) @@ -483,6 +488,8 @@ uint8_t CSerialPort::readInt(uint8_t n) return ReadUSART1(); #elif defined(STM32_USB_HOST) return usbserial.read(); + #elif defined(STM32_I2C_HOST) + return i2c.ReadI2C(); #endif case 3U: #if defined(SERIAL_REPEATER) @@ -501,12 +508,14 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool case 1U: #if defined(STM32_USART1_HOST) WriteUSART1(data, length); - if (flush) - TXSerialFlush1(); + if (flush) + TXSerialFlush1(); #elif defined(STM32_USB_HOST) usbserial.write(data, length); if (flush) usbserial.flush(); + #elif defined(STM32_I2C_HOST) + i2c.WriteI2C(data, length); #endif break; case 3U: From ac75ffdb0f27857cce3a2de215ca5034bab4da46 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Mon, 11 Feb 2019 14:52:14 -0300 Subject: [PATCH 155/239] Update version --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index c762939..3606c71 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "15" -#define VERSION_DATE "20190206" +#define VER_REV "16" +#define VERSION_DATE "20190211" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 6419cad878f974bf57829b4edb672fba411d2483 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 17 Feb 2019 11:31:49 -0300 Subject: [PATCH 156/239] Update configs --- configs/MMDVM_HS_Dual_Hat-12mhz.h | 4 ++++ configs/MMDVM_HS_Dual_Hat.h | 4 ++++ configs/MMDVM_HS_Hat-12mhz.h | 4 ++++ configs/MMDVM_HS_Hat.h | 4 ++++ configs/NanoDV_NPI.h | 4 ++++ configs/NanoDV_USB.h | 4 ++++ configs/Nano_hotSPOT.h | 4 ++++ configs/ZUMspot_Libre.h | 4 ++++ configs/ZUMspot_RPi.h | 4 ++++ configs/ZUMspot_USB.h | 4 ++++ configs/ZUMspot_duplex.h | 4 ++++ configs/generic_duplex_gpio.h | 4 ++++ configs/generic_gpio.h | 4 ++++ 13 files changed, 52 insertions(+) diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 2a8def7..0da2989 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 5cf37ed..c968edd 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index f102194..45433fd 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 02105a4..c9f1a9d 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 96bf446..9bd4b64 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index 819f8e0..18272ad 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -58,6 +58,10 @@ // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 012eb32..cbe6d3d 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index b7d146f..b2d0678 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -58,6 +58,10 @@ // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 95be8d7..4f5a0f6 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index c5502b4..c65cff0 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -58,6 +58,10 @@ // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index f131e9a..4f5f9f6 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -58,6 +58,10 @@ // Host communication selection: // #define STM32_USART1_HOST #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 4bbad13..cea9e4c 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index b6d7519..6173f82 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -58,6 +58,10 @@ // Host communication selection: #define STM32_USART1_HOST // #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 // Enable mode detection: #define ENABLE_SCAN_MODE From 8cf46cab920ed559c49b5caadf062f45fbf8fee9 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 17 Feb 2019 11:37:28 -0300 Subject: [PATCH 157/239] Prepare next release --- scripts/install_fw_duplex.sh | 4 ++-- scripts/install_fw_duplex_gpio.sh | 4 ++-- scripts/install_fw_gen_gpio.sh | 4 ++-- scripts/install_fw_hsdualhat-12mhz.sh | 4 ++-- scripts/install_fw_hsdualhat.sh | 4 ++-- scripts/install_fw_hshat-12mhz.sh | 4 ++-- scripts/install_fw_hshat.sh | 4 ++-- scripts/install_fw_librekit.sh | 4 ++-- scripts/install_fw_nanodv_npi.sh | 4 ++-- scripts/install_fw_nanodv_usb.sh | 4 ++-- scripts/install_fw_nanohs.sh | 4 ++-- scripts/install_fw_rpi.sh | 4 ++-- scripts/install_fw_usb.sh | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index ed9d4f5..f15b213 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for ZUMspot Libre Kit curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_duplex_fw.bin diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index cf73486..a3301ed 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Generic Duplex GPIO curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_duplex_gpio_fw.bin diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 1f75b00..6d5a839 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Generic Simplex GPIO curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_gpio_fw.bin diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 8283a65..05dd5c1 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw-12mhz.bin diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 8340ff8..26e7497 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw.bin diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 2e055c3..6840e4a 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat with 12.288 MHz TCXO curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw-12mhz.bin diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 8348f0e..e4b544b 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw.bin diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index a92576c..655b403 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for ZUMspot Libre Kit curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_libre_fw.bin diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 249c54c..3b995d1 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Nano DV curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nanodv_npi_fw.bin diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 13629c4..09b6748 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for ZUMspot USB curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nanodv_usb_fw.bin diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 7712d45..cf6bdb7 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Nano hotSPOT curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nano_hotspot_fw.bin diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index f2e834c..fb09687 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for ZUMspot RPi (GPIO) curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_rpi_fw.bin diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 6121d51..12c0eda 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,10 +17,10 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.14" +FW_VERSION="v1.4.16" # Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem1441" +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for ZUMspot USB curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_usb_fw.bin From 91d0f939f32f4548ef40dade8563fb926088db43 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 20 Feb 2019 17:51:32 +0100 Subject: [PATCH 158/239] Add sleep to secure second stage flashing --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index aa22174..f33af1f 100644 --- a/Makefile +++ b/Makefile @@ -412,10 +412,12 @@ stlink-nobl: stlink-bl: $(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000 + sleep 3 $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 stlink-bl-old: $(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000 + sleep 3 $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 serial: @@ -426,10 +428,12 @@ serial-nobl: serial-bl: $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser) + sleep 3 $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) serial-bl-old: $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser) + sleep 3 $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) nano-hotspot: From 89fd1805a3e4919c891b7e3a50c4a6bf817a441b Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 6 Mar 2019 12:47:38 +0800 Subject: [PATCH 159/239] Update NanoDV_NPI.h --- configs/NanoDV_NPI.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 9bd4b64..f2aea7d 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -30,8 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) -#define NANO_DV_REV10 +// 6) NanoDV NPi or USB revisions 1.1 (BG4TGO & BG5HHP) +#define NANO_DV_REV11 // Enable ADF7021 support: #define ENABLE_ADF7021 @@ -91,7 +91,7 @@ // #define USE_ALTERNATE_NXDN_LEDS // Use the D-Star and DMR LEDs for POCSAG -#define USE_ALTERNATE_POCSAG_LEDS +// #define USE_ALTERNATE_POCSAG_LEDS // Enable for RPi 3B+, USB mode // #define LONG_USB_RESET From b2e79b2ea575b79eb6aa31ed31d4bf53519c4e6e Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 6 Mar 2019 12:48:29 +0800 Subject: [PATCH 160/239] Update NanoDV_USB.h --- configs/NanoDV_USB.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index 18272ad..ba74b85 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -30,8 +30,8 @@ // #define MMDVM_HS_DUAL_HAT_REV10 // 5) Nano hotSPOT (BI7JTA) // #define NANO_HOTSPOT -// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) -#define NANO_DV_REV10 +// 6) NanoDV NPi or USB revisions 1.1 (BG4TGO & BG5HHP) +#define NANO_DV_REV11 // Enable ADF7021 support: #define ENABLE_ADF7021 @@ -91,7 +91,7 @@ // #define USE_ALTERNATE_NXDN_LEDS // Use the D-Star and DMR LEDs for POCSAG -#define USE_ALTERNATE_POCSAG_LEDS +// #define USE_ALTERNATE_POCSAG_LEDS // Enable for RPi 3B+, USB mode #define LONG_USB_RESET From 5a45650c12f3ef8e95873259dfb011eac0dd700b Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 6 Mar 2019 12:50:02 +0800 Subject: [PATCH 161/239] Update install_fw_nanodv_npi.sh --- scripts/install_fw_nanodv_npi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 3b995d1..88a1382 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -73,5 +73,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w nanodv_npi_fw.bin -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w nanodv_npi_fw.bin -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 From d0db461a5624c1aebfc7aae45e002310bed079ce Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 6 Mar 2019 12:55:28 +0800 Subject: [PATCH 162/239] Update Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f33af1f..abbbe32 100644 --- a/Makefile +++ b/Makefile @@ -447,11 +447,11 @@ endif nano-dv: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 67,-66,66:-67,66 /dev/ttyAMA0 + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 endif zumspot-pi: From 1790bde63506348fc7b7a52af8e956a1a6b11dde Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 11 Mar 2019 20:52:23 +0800 Subject: [PATCH 163/239] Update version.h --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index 3606c71..03a57c4 100644 --- a/version.h +++ b/version.h @@ -35,7 +35,7 @@ #define BOARD_INFO "MMDVM_HS_Dual_Hat" #elif defined(NANO_HOTSPOT) #define BOARD_INFO "Nano_hotSPOT" -#elif defined(NANO_DV_REV10) +#elif defined(NANO_DV_REV11) #define BOARD_INFO "Nano_DV" #else #define BOARD_INFO "MMDVM_HS" From 0ec39c32c533a394c34f1a46f5d52cf87193a48a Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 11 Mar 2019 20:56:16 +0800 Subject: [PATCH 164/239] Update IOSTM.cpp --- IOSTM.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/IOSTM.cpp b/IOSTM.cpp index 1dc3465..0aa82c0 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -162,7 +162,7 @@ #define PIN_COS_LED GPIO_Pin_15 #define PORT_COS_LED GPIOB -#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) +#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -238,7 +238,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT or NANO_DV_REV10 need to be defined" +#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT or NANO_DV_REV11 need to be defined" #endif extern "C" { @@ -260,7 +260,7 @@ extern "C" { } #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -304,7 +304,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif @@ -478,7 +478,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -526,7 +526,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt From 88455a50dd54dd0ee1586a9f2c4a8aa93ff796a6 Mon Sep 17 00:00:00 2001 From: Garry Kraemer Date: Mon, 22 Apr 2019 13:29:25 -0700 Subject: [PATCH 165/239] Summary: Add USART2 serial message processing Description: 1. Update configs subdir files with high speed USART2 serial baud rate. Update Makefile with high speed USART1 baud rate 2. Implement Nextion serial message processing from USART2. This allows the Nextion display to be connected to the Nextion port on the hotspot PCB (Modem board). SerialPort.cpp and SerialPort.h updated. Tested on Simplex ZumSpot-RPi using 3.4" Nextion display and PD0DIB's "Model 8 - 3.5inch_GLOBE-SIMPLEX_v1.2" screens, with two touch areas ('REBOOT' and 'POWEROFF'). 3. Update README.md. Test: RPi 3B+ running Pi-Star:4.0.0-RC3, with ZumSpot-Rpi running 1.4.16 (updated with these changes) and using ON7LDS Nextion driver. Feel free to improve these changes for use with PD0DIB's Nextion display pages. --- Makefile | 24 +++++------ README.md | 11 ++--- SerialPort.cpp | 67 +++++++++++++++++++++++++++---- SerialPort.h | 8 ++++ configs/MMDVM_HS_Dual_Hat-12mhz.h | 1 + configs/MMDVM_HS_Dual_Hat.h | 1 + configs/MMDVM_HS_Hat-12mhz.h | 1 + configs/MMDVM_HS_Hat.h | 1 + configs/NanoDV_NPI.h | 1 + configs/NanoDV_USB.h | 1 + configs/Nano_hotSPOT.h | 1 + configs/ZUMspot_Libre.h | 1 + configs/ZUMspot_RPi.h | 1 + configs/ZUMspot_duplex.h | 1 + configs/generic_duplex_gpio.h | 1 + configs/generic_gpio.h | 1 + 16 files changed, 98 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index abbbe32..a5e5a36 100644 --- a/Makefile +++ b/Makefile @@ -421,46 +421,46 @@ stlink-bl-old: $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 serial: - $(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser) + $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 $(devser) serial-nobl: - $(STM32FLASH) -v -w bin/$(BINBIN_F1NOBL) -g 0x0 $(devser) + $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1NOBL) -g 0x0 $(devser) serial-bl: - $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser) + $(STM32FLASH) -b 115200 -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser) sleep 3 - $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) + $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) serial-bl-old: - $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser) + $(STM32FLASH) -b 115200 -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser) sleep 3 - $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) + $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) nano-hotspot: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 + /usr/local/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 + /usr/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 endif nano-dv: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 + /usr/local/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 + /usr/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 endif zumspot-pi: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + /usr/local/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + /usr/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 endif mmdvm_hs_hat: zumspot-pi diff --git a/README.md b/README.md index 5ef7188..45d6bfe 100644 --- a/README.md +++ b/README.md @@ -262,11 +262,12 @@ Install the necessary software tools: sudo apt-get update sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi - cd ~ - git clone https://git.code.sf.net/p/stm32flash/code stm32flash - cd stm32flash - make - sudo make install +Note: The Pi-Star image contains an executable for stm32flash. The next five steps can be skipped! +# cd ~ +# git clone https://git.code.sf.net/p/stm32flash/code stm32flash +# cd stm32flash +# make +# sudo make install Download the firmware sources: diff --git a/SerialPort.cpp b/SerialPort.cpp index 9fb20a3..0e8c8e3 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -82,6 +82,9 @@ CSerialPort::CSerialPort() : m_buffer(), m_ptr(0U), m_len(0U), +m_serial_buffer(), +m_serial_ptr(0U), +m_serial_len(0U), m_debug(false), m_firstCal(false) { @@ -136,7 +139,7 @@ void CSerialPort::getStatus() reply[3U] |= 0x10U; if (m_pocsagEnable) reply[3U] |= 0x20U; - + reply[4U] = uint8_t(m_modemState); reply[5U] = m_tx ? 0x01U : 0x00U; @@ -253,7 +256,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) uint8_t colorCode = data[6U]; if (colorCode > 15U) return 4U; - + #if defined(DUPLEX) uint8_t dmrDelay = data[7U]; #endif @@ -317,7 +320,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) nxdnTX.setTXDelay(txDelay); pocsagTX.setTXDelay(txDelay); dmrDMOTX.setTXDelay(txDelay); - + #if defined(DUPLEX) dmrTX.setColorCode(colorCode); dmrRX.setColorCode(colorCode); @@ -536,7 +539,7 @@ void CSerialPort::start() beginInt(1U, 115200); #if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) - beginInt(3U, 9600); + beginInt(3U, SERIAL_REPEATER_BAUD); #endif } @@ -859,12 +862,62 @@ void CSerialPort::process() } #if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) - // Drain any incoming serial data + // Check for any incoming serial data from a device/screen on UART2 + // !!Notice!! on powerup the Nextion screen dumps FF FF FF 88 FF FF FF to the serial port. while (availableInt(3U)) - readInt(3U); + { + uint8_t ch = readInt(3U); + // read UART2 + + m_serial_buffer[m_serial_ptr] = ch; + m_serial_ptr++; + // fill the buffer one char at a time + + if (m_serial_len > 128) + m_serial_len = 0U; + // if length is > 128 reset it + else + m_serial_len++; + // increase length + } + + if ((m_serial_buffer[m_serial_len - 3] == 0xFF) && (m_serial_buffer[m_serial_len - 2] == 0xFF) && (m_serial_buffer[m_serial_len - 1] == 0xFF)) + { + serial.writeSerialRpt(m_serial_buffer, m_serial_len); + // if the last 3 bytes are FF's then the screen is done sending data so send the m_serial_buffer to serial.writeSerialRpt() + + m_serial_ptr = 0U; + m_serial_len = 0U; + // set ptr and reset length of buffer data since last message was valid and get ready for new data + + } + #endif } +#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) +void CSerialPort::writeSerialRpt(const uint8_t* data, uint8_t length) +{ + if (m_modemState != STATE_IDLE) + return; + + uint8_t reply[131U]; + + reply[0U] = MMDVM_FRAME_START; + reply[1U] = 0U; + reply[2U] = MMDVM_SERIAL; + + uint8_t count = 3U; + for (uint8_t i = 0U; i < length; i++, count++) + reply[count] = data[i]; + + reply[1U] = count; + + writeInt(1U, reply, count); +} +#endif + + void CSerialPort::writeDStarHeader(const uint8_t* header, uint8_t length) { if (m_modemState != STATE_DSTAR && m_modemState != STATE_IDLE) @@ -1187,7 +1240,7 @@ void CSerialPort::writeDebugI(const char* text, int32_t n1) for (uint8_t i = 0U; text[i] != '\0'; i++, count++) reply[count] = text[i]; - reply[count++] = ' '; + reply[count++] = ' '; i2str(&reply[count], 130U - count, n1); diff --git a/SerialPort.h b/SerialPort.h index b1fa6b7..ffb4553 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -30,6 +30,10 @@ public: void process(); +#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) + void writeSerialRpt(const uint8_t* data, uint8_t length); +#endif + void writeDStarHeader(const uint8_t* header, uint8_t length); void writeDStarData(const uint8_t* data, uint8_t length); void writeDStarLost(); @@ -65,6 +69,10 @@ private: uint8_t m_buffer[256U]; uint8_t m_ptr; uint8_t m_len; + uint8_t m_serial_buffer[128U]; + uint8_t m_serial_ptr; + uint8_t m_serial_len; + bool m_debug; bool m_firstCal; diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 0da2989..0c9eb94 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index c968edd..9962883 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 45433fd..4c47dfb 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index c9f1a9d..f0234a0 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index f2aea7d..24560ff 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index ba74b85..a9f99b3 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index cbe6d3d..dec34f5 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index b2d0678..9dfa893 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 4f5a0f6..aa52621 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 4f5f9f6..73ba1e1 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index cea9e4c..70743ba 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index 6173f82..a83895f 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 115200 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 From 6781fa5c8bd8ec2ad8f1b1a001a8241d6a915494 Mon Sep 17 00:00:00 2001 From: Garry Kraemer Date: Mon, 22 Apr 2019 16:59:48 -0700 Subject: [PATCH 166/239] Summary: Correct README.md Description: Use GhostWriter to correct README.md, Now it displays properly. --- README.md | 617 +++++++++++++++++++++++++++--------------------------- 1 file changed, 309 insertions(+), 308 deletions(-) diff --git a/README.md b/README.md index 45d6bfe..7ee5133 100644 --- a/README.md +++ b/README.md @@ -1,308 +1,309 @@ -# Introduction - -This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital voice modes and POCSAG 1200 pager protocol. - -This software is intended to be run on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib). - -This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 limitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. - -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. - -# Features - -- Supported modes: D-Star, DMR, Yaesu Fusion, P25 Phase 1 and NXDN -- Other modes: POCSAG 1200 -- Automatic mode detection (scanning) -- G4KLX software suite: [MMDVMHost](https://github.com/g4klx/MMDVMHost), [ircDDBGateway](https://github.com/g4klx/ircDDBGateway), [YSFGateway](https://github.com/g4klx/YSFClients), [P25Gateway](https://github.com/g4klx/P25Clients), [DMRGateway](https://github.com/g4klx/DMRGateway), [NXDNGateway](https://github.com/g4klx/NXDNClients), -[DAPNETGateway](https://github.com/g4klx/DAPNETGateway) and [MMDVMCal](https://github.com/g4klx/MMDVMCal) -- Bands: 144, 220, 430 and 900 MHz (VHF requires external inductor) -- Status LEDs (PTT, COR and digital modes) -- Serial repeater port for Nextion displays -- Support for native USB port in STM32F103 CPU -- RSSI support -- CW ID support -- Full duplex support with two ADF7021 - -# Known issues - -## Common issues for simplex and duplex boards - -- High RX BER or not RX, poor TX audio (4FSK modes): adjust frequency offset, specially RXOffset. -- Not instantaneous mode detection (2 modes or more enabled): mode detection could be slow and sometimes you need to hold PTT several seconds, in order to activate the hotspot. There is no solution for that, since ADF7021 works only one mode at once. You can disable mode scanning, enabling just one mode. -- Poor audio with MD380: increase DMR deviation to 55 % or 60 %. -- Bad RX sensitivity: this is not a firmware issue, ADF7021 has a minimum signal detection around -109 dBm in DMR, but RX performance depends on RF board design, external RX noise, frequency, etc. At the moment only original ZUMspot RPi can reach the best RX sensitivity in 70 cm band. -- Not working with RPi 3B+ (USB): be sure your firmware version is >= 1.4.8 and update to new USB bootloader with long reset pulse (make stlink-bl, for example). -- Not working with USB (not RPi 3B+): compile with "LONG_USB_RESET" option disabled, and use old bootloader (make stlink-bl-old, for example). - -## Duplex boards - -- Very difficult DMR activation ("repeater fail" error): disable mode scanning, select just DMR mode. -- Not DMR activation ("repeater fail" error) with MD380, Ailunce HD1 or some other radios: increase DMR deviation to 55 % or 60 %. -- RX timeout: this is due to TX and RX clock differences, which does not have easy solution. Be sure your firmware version is >= 1.4.7, which minimizes this problem. - -# Notes for previous users of MMDVM boards - -MMDVM_HS boards do not need deviation calibration like MMDVM boards, but could be necessary some frequency offset calibration (ADF7021 does not have AFC for 4FSK modes). - -The following options in MMDVM.ini ([Modem] section) have not any effect for MMDVM_HS boards: - - TXInvert - RXInvert - PTTInvert - RXLevel - RXDCOffset - TXDCOffset - -The following options in MMDVM.ini ([Modem] section) are very important for MMDVM_HS boards: - - RXOffset: RX frequency offset (HS RX BER improvement) - TXOffset: TX frequency offset (radio RX improvement) - TXLevel: default deviation setting (recommended value: 50) - RFLevel: RF power output (recommended value: 100) - CWIdTXLevel: CW ID deviation setting (recommended value: 50) - D-StarTXLevel: D-Star deviation setting (recommended value: 50) - DMRTXLevel: DMR deviation setting (recommended value: 50) - YSFTXLevel: YSF deviation setting (recommended value: 50) - P25TXLevel: P25 deviation setting (recommended value: 50) - NXDNTXLevel: NXDN deviation setting (recommended value: 50) - POCSAGTXLevel: POCSAG deviation setting (recommended value: 50) - -# Important notes - -The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2.5 ppm of frequency stability or better. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TCXO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues. - -Please set TXLevel=50 in MMDVM.ini to configure default deviation levels for all modes. You could modify this value and other TXLevel paramenters to change deviation levels. Use [MMDVMCal](https://github.com/g4klx/MMDVMCal) to check DMR deviation level and TX frequency offset with calibrated test equipment. - -The jumper wire to CLKOUT in RF7021SE module is not longer required for lastest MMDVM_HS firmware. But CE pin connection of ADF7021 is required for proper operation of ZUMspot. - -Be aware that some Blue Pill STM32F103 board are defectives. If you have trouble with USB, please check this [link](http://wiki.stm32duino.com/index.php?title=Blue_Pill). - -VHF (144-148 MHz) support for ZUMSpot is added by an external 18 nH inductor between L1 and L2 pins of ADF7021. This will enable dual band (VHF/UHF) operation. - -Dual ADF7021 for full duplex operation (#define DUPLEX in Config.h) will work only with a big RX/TX frequency separation (5 MHz or more in UHF band for example) and proper antenna filtering. At the moment #define LIBRE_KIT_ADF7021 (Config.h) with STM32F103 platform is supported. Please see [BUILD.md](BUILD.md) for pinout details. - -If you can't decode any 4FSK modulation (DMR, YSF, P25 or NXDN) with your ZUMspot, the common solution is to adjust RX frequency offset (RXOffset) in your MMDVM.ini file. Please try with steps of +-100 Hz until you get low BER. If you don't have test equipment, the procedure is trial and error. In some cases TXOffset adjustment is also required for proper radio decoding. If you have test equipment, please use [MMDVMCal](https://github.com/g4klx/MMDVMCal). - -If you have problems updating firmware using USB bootloader (DFU mode) on Orange Pi or any other system different from RPi, you could compile the dfu tool directly. You could get the source code of a dfu tool [here](https://sourceforge.net/projects/dfu-programmer/files/dfu-programmer/0.7.0/). - -# Quick start - -Please see [BUILD.md](BUILD.md) for more details, and also [MMDVM](https://groups.yahoo.com/neo/groups/mmdvm/info) Yahoo Groups. You also can check at MMDVM_HS/scripts folder for some automatic tasks. - -## Binary firmware installation - -Please check the latest firmware [here](https://github.com/juribeparada/MMDVM_HS/releases). - -### Pi-Star binary firmware installation - -You could use some pi-star commands under SSH console: - -- sudo pistar-zumspotflash rpi: ZUMspot RPi board -- sudo pistar-zumspotflash rpi_duplex: ZUMSpot duplex board conected to GPIO -- sudo pistar-zumspotflash usb: ZUMspot USB dongle -- sudo pistar-zumspotflash libre: ZUMspot Libre Kit or generic MMDVM_HS board with USB -- sudo pistar-mmdvmhshatflash hs_hat: MMDVM_HS_Hat board (14.7456MHz TCXO) -- sudo pistar-mmdvmhshatflash hs_dual_hat: HS_DUAL_HAT board (14.7456MHz TCXO) -- sudo pistar-mmdvmhshatflash hs_hat-12mhz: MMDVM_HS_Hat board (12.288MHz TCXO) -- sudo pistar-mmdvmhshatflash hs_dual_hat-12mhz: HS_DUAL_HAT board (12.288MHz TCXO) -- sudo pistar-nanohsflash nano_hs: Nano hotSPOT board -- sudo pistar-nanodvflash pi: NanoDV NPi board -- sudo pistar-nanodvflash usb: NanoDV USB board - -### Windows - -Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the [releases section](https://github.com/juribeparada/MMDVM_HS/releases). - -This utility includes firmwares binaries and USB drivers for Windows 7/8/10. If you have problems with the installer, you can download [ZUMspotFW.zip](https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.2/ZUMspotFW.zip) for a manual installation. - -### Linux or macOS - -Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - -- install_fw_rpi.sh: only for ZUMspot RPi board (KI6ZUM & VE2GZI) -- install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET) -- install_fw_hshat-12mhz.sh: only for MMDVM_HS_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET) -- install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) -- install_fw_nanodv_npi.sh: only for NanoDV NPi board 1.0 (BG4TGO & BG5HHP) -- install_fw_nanodv_usb.sh: only for NanoDV USB board 1.0 (BG4TGO & BG5HHP) -- install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) -- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface -- install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) -- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with USB interface -- install_fw_gen_gpio.sh: only for generic MMDVM_HS board (EA7GIB) with GPIO serial interface -- install_fw_duplex_gpio.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with GPIO serial interface - -For example, download the ZUMspot RPi upgrade script: - - cd ~ - curl -OL https://raw.github.com/juribeparada/MMDVM_HS/master/scripts/install_fw_rpi.sh - -make the script executable: - - chmod +x install_fw_rpi.sh - -stop your MMDVMHost process and run (you will need the root password): - - ./install_fw_rpi.sh - -and wait to complete the upgrading process. - -## Build from the sources - -You could use example files from MMDVM_HS/configs folder and overwrite the Config.h file, in order to compile a firmware with default settings. There are a specific config file for each ZUMspot or any MMDVM_HS compatible boards. In general, there are two possible compilation ways: - -- Boards with USB interface: - -Boards with STM32_USB_HOST option enabled in Config.h (ZUMspot Libre Kit, ZUMspot USB, GIBSpot USB, NanoDV USB, etc). Those boards need to have the USB bootloader installed. For example: - - make clean - make bl - make dfu - -You can optionally install a firmware without bootloader, with USB support. Be aware you will need always a ST-Link or serial interface in order to install or update the firmware. For this reason, you should use USB bootloader, unless you have trouble with the bootloader. - - make clean - make nobl - make stlink-nobl - -- Boards with GPIO interface: - -Boards with STM32_USART1_HOST option enabled in Config.h (ZUMspot RPi, MMDVM_HS_Hat, MMDVM_HS_Dual_Hat, Nano hotSPOT, etc). No USB bootloader needed. For example: - - make clean - make - make zumspot-pi - -Some detailed examples as follows: - -### MMDVM_HS_Hat - -Please visit Mathis Schmieder GitHub [here](https://github.com/mathisschmieder/MMDVM_HS_Hat/blob/master/README.md) for detailed instructions. - -### ZUMspot Libre Kit (under Linux Raspbian) - -If you are using Pi-Star, expand filesystem (if you haven't done before): - - sudo pistar-expand - sudo reboot - -Enable RW filesystem if you are using Pi-Star: - - rpi-rw - -Install the necessary software tools: - - sudo apt-get update - sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi - -Download the sources: - - cd ~ - git clone https://github.com/juribeparada/MMDVM_HS - cd MMDVM_HS/ - git submodule init - git submodule update - -Build the firmware with USB bootloader support (the default Config.h is OK for Libre Kit): - - make bl - -If you are using Pi-Star, stop services: - - sudo pistar-watchdog.service stop - sudo systemctl stop mmdvmhost.timer - sudo systemctl stop mmdvmhost.service - -Upload the firmware to ZUMspot Libre Kit using the USB port (your Libre Kit has the bootloader already installed): - - sudo make dfu devser=/dev/ttyACM0 - -### ZUMspot RPi - -#### Enable serial port in Raspberry Pi 3 or Pi Zero W - -This this necessary only if you are installing a fresh copy of Raspbian OS. - -Edit /boot/cmdline.txt: - - sudo nano /boot/cmdline.txt - (remove the text: console=serial0,115200) - -Disable services: - - sudo systemctl disable serial-getty@ttyAMA0.service - sudo systemctl disable bluetooth.service - -Edit /boot/config.txt - - sudo nano /boot/config.txt - -and add the following lines at the end of /boot/config.txt: - - enable_uart=1 - dtoverlay=pi3-disable-bt - -Reboot your RPi: - - sudo reboot - -#### Build the firmware and upload to ZUMspot RPi - -If you are using Pi-Star, expand filesystem (if you haven't done before): - - sudo pistar-expand - sudo reboot - -Enable RW filesystem if you are using Pi-Star: - - rpi-rw - -Install the necessary software tools: - - sudo apt-get update - sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi - -Note: The Pi-Star image contains an executable for stm32flash. The next five steps can be skipped! -# cd ~ -# git clone https://git.code.sf.net/p/stm32flash/code stm32flash -# cd stm32flash -# make -# sudo make install - -Download the firmware sources: - - cd ~ - git clone https://github.com/juribeparada/MMDVM_HS - cd MMDVM_HS/ - git submodule init - git submodule update - -Edit Config.h - - nano Config.h - -and enable: - - #define ZUMSPOT_ADF7021 - #define ENABLE_ADF7021 - #define ADF7021_14_7456 - #define AD7021_GAIN_AUTO - #define STM32_USART1_HOST - #define ENABLE_SCAN_MODE - #define USE_ALTERNATE_NXDN_LEDS - #define USE_ALTERNATE_POCSAG_LEDS - -Build the firmware: - - make - -If you are using Pi-Star, stop services: - - sudo pistar-watchdog.service stop - sudo systemctl stop mmdvmhost.timer - sudo systemctl stop mmdvmhost.service - -Upload the firmware to ZUMspot RPi board: - - sudo make zumspot-pi - +# Introduction + +This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital voice modes and POCSAG 1200 pager protocol. + +This software is intended to be run on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib). + +This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 limitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware. + +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. + +# Features + +- Supported modes: D-Star, DMR, Yaesu Fusion, P25 Phase 1 and NXDN +- Other modes: POCSAG 1200 +- Automatic mode detection (scanning) +- G4KLX software suite: [MMDVMHost](https://github.com/g4klx/MMDVMHost), [ircDDBGateway](https://github.com/g4klx/ircDDBGateway), [YSFGateway](https://github.com/g4klx/YSFClients), [P25Gateway](https://github.com/g4klx/P25Clients), [DMRGateway](https://github.com/g4klx/DMRGateway), [NXDNGateway](https://github.com/g4klx/NXDNClients), +[DAPNETGateway](https://github.com/g4klx/DAPNETGateway) and [MMDVMCal](https://github.com/g4klx/MMDVMCal) +- Bands: 144, 220, 430 and 900 MHz (VHF requires external inductor) +- Status LEDs (PTT, COR and digital modes) +- Serial repeater port for Nextion displays +- Support for native USB port in STM32F103 CPU +- RSSI support +- CW ID support +- Full duplex support with two ADF7021 + +# Known issues + +## Common issues for simplex and duplex boards + +- High RX BER or not RX, poor TX audio (4FSK modes): adjust frequency offset, specially RXOffset. +- Not instantaneous mode detection (2 modes or more enabled): mode detection could be slow and sometimes you need to hold PTT several seconds, in order to activate the hotspot. There is no solution for that, since ADF7021 works only one mode at once. You can disable mode scanning, enabling just one mode. +- Poor audio with MD380: increase DMR deviation to 55 % or 60 %. +- Bad RX sensitivity: this is not a firmware issue, ADF7021 has a minimum signal detection around -109 dBm in DMR, but RX performance depends on RF board design, external RX noise, frequency, etc. At the moment only original ZUMspot RPi can reach the best RX sensitivity in 70 cm band. +- Not working with RPi 3B+ (USB): be sure your firmware version is >= 1.4.8 and update to new USB bootloader with long reset pulse (make stlink-bl, for example). +- Not working with USB (not RPi 3B+): compile with "LONG_USB_RESET" option disabled, and use old bootloader (make stlink-bl-old, for example). + +## Duplex boards + +- Very difficult DMR activation ("repeater fail" error): disable mode scanning, select just DMR mode. +- Not DMR activation ("repeater fail" error) with MD380, Ailunce HD1 or some other radios: increase DMR deviation to 55 % or 60 %. +- RX timeout: this is due to TX and RX clock differences, which does not have easy solution. Be sure your firmware version is >= 1.4.7, which minimizes this problem. + +# Notes for previous users of MMDVM boards + +MMDVM_HS boards do not need deviation calibration like MMDVM boards, but could be necessary some frequency offset calibration (ADF7021 does not have AFC for 4FSK modes). + +The following options in MMDVM.ini ([Modem] section) have not any effect for MMDVM_HS boards: + + TXInvert + RXInvert + PTTInvert + RXLevel + RXDCOffset + TXDCOffset + +The following options in MMDVM.ini ([Modem] section) are very important for MMDVM_HS boards: + + RXOffset: RX frequency offset (HS RX BER improvement) + TXOffset: TX frequency offset (radio RX improvement) + TXLevel: default deviation setting (recommended value: 50) + RFLevel: RF power output (recommended value: 100) + CWIdTXLevel: CW ID deviation setting (recommended value: 50) + D-StarTXLevel: D-Star deviation setting (recommended value: 50) + DMRTXLevel: DMR deviation setting (recommended value: 50) + YSFTXLevel: YSF deviation setting (recommended value: 50) + P25TXLevel: P25 deviation setting (recommended value: 50) + NXDNTXLevel: NXDN deviation setting (recommended value: 50) + POCSAGTXLevel: POCSAG deviation setting (recommended value: 50) + +# Important notes + +The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2.5 ppm of frequency stability or better. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TCXO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues. + +Please set TXLevel=50 in MMDVM.ini to configure default deviation levels for all modes. You could modify this value and other TXLevel paramenters to change deviation levels. Use [MMDVMCal](https://github.com/g4klx/MMDVMCal) to check DMR deviation level and TX frequency offset with calibrated test equipment. + +The jumper wire to CLKOUT in RF7021SE module is not longer required for lastest MMDVM_HS firmware. But CE pin connection of ADF7021 is required for proper operation of ZUMspot. + +Be aware that some Blue Pill STM32F103 board are defectives. If you have trouble with USB, please check this [link](http://wiki.stm32duino.com/index.php?title=Blue_Pill). + +VHF (144-148 MHz) support for ZUMSpot is added by an external 18 nH inductor between L1 and L2 pins of ADF7021. This will enable dual band (VHF/UHF) operation. + +Dual ADF7021 for full duplex operation (#define DUPLEX in Config.h) will work only with a big RX/TX frequency separation (5 MHz or more in UHF band for example) and proper antenna filtering. At the moment #define LIBRE_KIT_ADF7021 (Config.h) with STM32F103 platform is supported. Please see [BUILD.md](BUILD.md) for pinout details. + +If you can't decode any 4FSK modulation (DMR, YSF, P25 or NXDN) with your ZUMspot, the common solution is to adjust RX frequency offset (RXOffset) in your MMDVM.ini file. Please try with steps of +-100 Hz until you get low BER. If you don't have test equipment, the procedure is trial and error. In some cases TXOffset adjustment is also required for proper radio decoding. If you have test equipment, please use [MMDVMCal](https://github.com/g4klx/MMDVMCal). + +If you have problems updating firmware using USB bootloader (DFU mode) on Orange Pi or any other system different from RPi, you could compile the dfu tool directly. You could get the source code of a dfu tool [here](https://sourceforge.net/projects/dfu-programmer/files/dfu-programmer/0.7.0/). + +# Quick start + +Please see [BUILD.md](BUILD.md) for more details, and also [MMDVM](https://groups.yahoo.com/neo/groups/mmdvm/info) Yahoo Groups. You also can check at MMDVM_HS/scripts folder for some automatic tasks. + +## Binary firmware installation + +Please check the latest firmware [here](https://github.com/juribeparada/MMDVM_HS/releases). + +### Pi-Star binary firmware installation + +You could use some pi-star commands under SSH console: + +- sudo pistar-zumspotflash rpi: ZUMspot RPi board +- sudo pistar-zumspotflash rpi_duplex: ZUMSpot duplex board conected to GPIO +- sudo pistar-zumspotflash usb: ZUMspot USB dongle +- sudo pistar-zumspotflash libre: ZUMspot Libre Kit or generic MMDVM_HS board with USB +- sudo pistar-mmdvmhshatflash hs_hat: MMDVM_HS_Hat board (14.7456MHz TCXO) +- sudo pistar-mmdvmhshatflash hs_dual_hat: HS_DUAL_HAT board (14.7456MHz TCXO) +- sudo pistar-mmdvmhshatflash hs_hat-12mhz: MMDVM_HS_Hat board (12.288MHz TCXO) +- sudo pistar-mmdvmhshatflash hs_dual_hat-12mhz: HS_DUAL_HAT board (12.288MHz TCXO) +- sudo pistar-nanohsflash nano_hs: Nano hotSPOT board +- sudo pistar-nanodvflash pi: NanoDV NPi board +- sudo pistar-nanodvflash usb: NanoDV USB board + +### Windows + +Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the [releases section](https://github.com/juribeparada/MMDVM_HS/releases). + +This utility includes firmwares binaries and USB drivers for Windows 7/8/10. If you have problems with the installer, you can download [ZUMspotFW.zip](https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.2/ZUMspotFW.zip) for a manual installation. + +### Linux or macOS + +Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: + +- install_fw_rpi.sh: only for ZUMspot RPi board (KI6ZUM & VE2GZI) +- install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET) +- install_fw_hshat-12mhz.sh: only for MMDVM_HS_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET) +- install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) +- install_fw_nanodv_npi.sh: only for NanoDV NPi board 1.0 (BG4TGO & BG5HHP) +- install_fw_nanodv_usb.sh: only for NanoDV USB board 1.0 (BG4TGO & BG5HHP) +- install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) +- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface +- install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) +- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with USB interface +- install_fw_gen_gpio.sh: only for generic MMDVM_HS board (EA7GIB) with GPIO serial interface +- install_fw_duplex_gpio.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with GPIO serial interface + +For example, download the ZUMspot RPi upgrade script: + + cd ~ + curl -OL https://raw.github.com/juribeparada/MMDVM_HS/master/scripts/install_fw_rpi.sh + +make the script executable: + + chmod +x install_fw_rpi.sh + +stop your MMDVMHost process and run (you will need the root password): + + ./install_fw_rpi.sh + +and wait to complete the upgrading process. + +## Build from the sources + +You could use example files from MMDVM_HS/configs folder and overwrite the Config.h file, in order to compile a firmware with default settings. There are a specific config file for each ZUMspot or any MMDVM_HS compatible boards. In general, there are two possible compilation ways: + +- Boards with USB interface: + +Boards with STM32_USB_HOST option enabled in Config.h (ZUMspot Libre Kit, ZUMspot USB, GIBSpot USB, NanoDV USB, etc). Those boards need to have the USB bootloader installed. For example: + + make clean + make bl + make dfu + +You can optionally install a firmware without bootloader, with USB support. Be aware you will need always a ST-Link or serial interface in order to install or update the firmware. For this reason, you should use USB bootloader, unless you have trouble with the bootloader. + + make clean + make nobl + make stlink-nobl + +- Boards with GPIO interface: + +Boards with STM32_USART1_HOST option enabled in Config.h (ZUMspot RPi, MMDVM_HS_Hat, MMDVM_HS_Dual_Hat, Nano hotSPOT, etc). No USB bootloader needed. For example: + + make clean + make + make zumspot-pi + +Some detailed examples as follows: + +### MMDVM_HS_Hat + +Please visit Mathis Schmieder GitHub [here](https://github.com/mathisschmieder/MMDVM_HS_Hat/blob/master/README.md) for detailed instructions. + +### ZUMspot Libre Kit (under Linux Raspbian) + +If you are using Pi-Star, expand filesystem (if you haven't done before): + + sudo pistar-expand + sudo reboot + +Enable RW filesystem if you are using Pi-Star: + + rpi-rw + +Install the necessary software tools: + + sudo apt-get update + sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi + +Download the sources: + + cd ~ + git clone https://github.com/juribeparada/MMDVM_HS + cd MMDVM_HS/ + git submodule init + git submodule update + +Build the firmware with USB bootloader support (the default Config.h is OK for Libre Kit): + + make bl + +If you are using Pi-Star, stop services: + + sudo pistar-watchdog.service stop + sudo systemctl stop mmdvmhost.timer + sudo systemctl stop mmdvmhost.service + +Upload the firmware to ZUMspot Libre Kit using the USB port (your Libre Kit has the bootloader already installed): + + sudo make dfu devser=/dev/ttyACM0 + +### ZUMspot RPi + +#### Enable serial port in Raspberry Pi 3 or Pi Zero W + +This this necessary only if you are installing a fresh copy of Raspbian OS. + +Edit /boot/cmdline.txt: + + sudo nano /boot/cmdline.txt + (remove the text: console=serial0,115200) + +Disable services: + + sudo systemctl disable serial-getty@ttyAMA0.service + sudo systemctl disable bluetooth.service + +Edit /boot/config.txt + + sudo nano /boot/config.txt + +and add the following lines at the end of /boot/config.txt: + + enable_uart=1 + dtoverlay=pi3-disable-bt + +Reboot your RPi: + + sudo reboot + +#### Build the firmware and upload to ZUMspot RPi + +If you are using Pi-Star, expand filesystem (if you haven't done before): + + sudo pistar-expand + sudo reboot + +Enable RW filesystem if you are using Pi-Star: + + rpi-rw + +Install the necessary software tools: + + sudo apt-get update + sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi + +Note: The Pi-Star image contains an executable for stm32flash. The next five steps can be skipped! + + cd ~ + git clone https://git.code.sf.net/p/stm32flash/code stm32flash + cd stm32flash + make + sudo make install + +Download the firmware sources: + + cd ~ + git clone https://github.com/juribeparada/MMDVM_HS + cd MMDVM_HS/ + git submodule init + git submodule update + +Edit Config.h + + nano Config.h + +and enable: + + #define ZUMSPOT_ADF7021 + #define ENABLE_ADF7021 + #define ADF7021_14_7456 + #define AD7021_GAIN_AUTO + #define STM32_USART1_HOST + #define ENABLE_SCAN_MODE + #define USE_ALTERNATE_NXDN_LEDS + #define USE_ALTERNATE_POCSAG_LEDS + +Build the firmware: + + make + +If you are using Pi-Star, stop services: + + sudo pistar-watchdog.service stop + sudo systemctl stop mmdvmhost.timer + sudo systemctl stop mmdvmhost.service + +Upload the firmware to ZUMspot RPi board: + + sudo make zumspot-pi + From 269f6b435842d5540afa809b736a81c0a614615b Mon Sep 17 00:00:00 2001 From: Garry Kraemer Date: Tue, 23 Apr 2019 18:39:01 -0700 Subject: [PATCH 167/239] Summary: Change USART2 serial baud rate to 9600 Description: Andy, I apologize for these changes. My son and I submitted high serial baud rates and then figured out most users will be using 9600, so it is best to stick with it. We didn't have any issues running at 115200. 1. Update configs subdir files with USART2 serial baud rate of 9600. Update Makefile - remove high speed USART1 baud rate compile flag. 2. I used 'Compare-it' to diff the files and these files should closely match your original files (minimal changes from originals). 3. Thanks for all your work on the MMDVM code! I have been a ham since 1977 and just found DMR and hotspots. Amazing technology in use these days. Feel free to improve these changes for use with PD0DIB's Nextion display pages. Garry / WD0DUD --- Config.h | 1 + Makefile | 24 ++++++++++++------------ configs/MMDVM_HS_Dual_Hat-12mhz.h | 2 +- configs/MMDVM_HS_Dual_Hat.h | 2 +- configs/MMDVM_HS_Hat-12mhz.h | 2 +- configs/MMDVM_HS_Hat.h | 2 +- configs/NanoDV_NPI.h | 2 +- configs/NanoDV_USB.h | 2 +- configs/Nano_hotSPOT.h | 2 +- configs/ZUMspot_Libre.h | 2 +- configs/ZUMspot_RPi.h | 2 +- configs/ZUMspot_duplex.h | 2 +- configs/generic_duplex_gpio.h | 2 +- configs/generic_gpio.h | 2 +- 14 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Config.h b/Config.h index 35c7e52..bdfceac 100644 --- a/Config.h +++ b/Config.h @@ -71,6 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/Makefile b/Makefile index a5e5a36..abbbe32 100644 --- a/Makefile +++ b/Makefile @@ -421,46 +421,46 @@ stlink-bl-old: $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 serial: - $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 $(devser) + $(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser) serial-nobl: - $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1NOBL) -g 0x0 $(devser) + $(STM32FLASH) -v -w bin/$(BINBIN_F1NOBL) -g 0x0 $(devser) serial-bl: - $(STM32FLASH) -b 115200 -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser) + $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser) sleep 3 - $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) + $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) serial-bl-old: - $(STM32FLASH) -b 115200 -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser) + $(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser) sleep 3 - $(STM32FLASH) -b 115200 -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) + $(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser) nano-hotspot: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 endif nano-dv: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 endif zumspot-pi: ifneq ($(wildcard /usr/local/bin/stm32flash),) - /usr/local/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 endif ifneq ($(wildcard /usr/bin/stm32flash),) - /usr/bin/stm32flash -b 115200 -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 endif mmdvm_hs_hat: zumspot-pi diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 0c9eb94..794cba9 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 9962883..a8f5156 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 4c47dfb..04d3390 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index f0234a0..b53e98b 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 24560ff..ee95a38 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index a9f99b3..375f016 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index dec34f5..372d11e 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 9dfa893..bd380e4 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index aa52621..f9a1673 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 73ba1e1..9270598 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 70743ba..3d4399d 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index a83895f..d3059b2 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -71,7 +71,7 @@ // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER -#define SERIAL_REPEATER_BAUD 115200 +#define SERIAL_REPEATER_BAUD 9600 // Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 From fbeb5a39b7d6fc4414812eb9fd6dc6bf19299322 Mon Sep 17 00:00:00 2001 From: Abad-Vera Date: Wed, 8 May 2019 13:34:59 -0700 Subject: [PATCH 168/239] Changes for ZUM dual band board --- IO.cpp | 40 +++++++++++++++++++------- IO.h | 9 ++++-- IOSTM.cpp | 86 ++++++++++++++++++++++++++++++++++++++++++------------- 3 files changed, 101 insertions(+), 34 deletions(-) diff --git a/IO.cpp b/IO.cpp index 00521aa..344244e 100644 --- a/IO.cpp +++ b/IO.cpp @@ -1,8 +1,8 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU - * Copyright (C) 2017 by Danilo DB4PLE - + * Copyright (C) 2017 by Danilo DB4PLE + * 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 @@ -105,9 +105,9 @@ void CIO::process() uint8_t bit; uint32_t scantime; uint8_t control; - + m_ledCount++; - + if (m_started) { // Two seconds timeout if (m_watchdog >= 19200U) { @@ -194,7 +194,7 @@ void CIO::process() if (m_rxBuffer.getData() >= 1U) { m_rxBuffer.get(bit, control); - + switch (m_modemState_prev) { case STATE_DSTAR: dstarRX.databit(bit); @@ -229,9 +229,9 @@ void CIO::process() } void CIO::start() -{ +{ m_TotalModes = 0U; - + if(m_dstarEnable) { m_Modes[m_TotalModes] = STATE_DSTAR; m_TotalModes++; @@ -252,7 +252,7 @@ void CIO::start() m_Modes[m_TotalModes] = STATE_NXDN; m_TotalModes++; } - + #if defined(ENABLE_SCAN_MODE) if(m_TotalModes > 1U) m_scanEnable = true; @@ -267,9 +267,9 @@ void CIO::start() if (m_started) return; - + startInt(); - + m_started = true; } @@ -284,7 +284,7 @@ void CIO::write(uint8_t* data, uint16_t length, const uint8_t* control) else m_txBuffer.put(data[i], control[i]); } - + // Switch the transmitter on if needed if (!m_tx) { setTX(); @@ -338,6 +338,24 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po return 4U; #endif +// Check if we have a single, dualband or duplex board +#if defined (ZUMSPOT_ADF7021) + if (!(io.hasSingleADF7021())) { + // There are two ADF7021s on the board + if (io.isDualBand()) { + // Dual band + if ((frequency_tx <= VHF2_MAX) && (frequency_rx <= VHF2_MAX)) { + // Turn on VHF side + io.setBandVHF(true); + } else if ((frequency_tx >= UHF1_MIN) && (frequency_rx >= UHF1_MIN)) { + // Turn on UHF side + io.setBandVHF(false); + } + } + } + +#endif + // Configure frequency m_frequency_rx = frequency_rx; m_frequency_tx = frequency_tx; diff --git a/IO.h b/IO.h index b455cff..bbc546b 100644 --- a/IO.h +++ b/IO.h @@ -1,8 +1,8 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU - * Copyright (C) 2017 by Danilo DB4PLE - + * Copyright (C) 2017 by Danilo DB4PLE + * 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 @@ -124,6 +124,9 @@ public: uint32_t getWatchdog(void); void getIntCounter(uint16_t &int1, uint16_t &int2); void selfTest(void); + void setBandVHF(bool vhf_on); + bool hasSingleADF7021(void); + bool isDualBand(void); // RF interface API void setTX(void); @@ -164,7 +167,7 @@ private: uint16_t m_RX_F_divider; uint8_t m_TX_N_divider; uint16_t m_TX_F_divider; - + bool m_started; CBitRB m_rxBuffer; CBitRB m_txBuffer; diff --git a/IOSTM.cpp b/IOSTM.cpp index 0aa82c0..6dc7247 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -1,8 +1,8 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU - * Copyright (C) 2017 by Danilo DB4PLE - + * Copyright (C) 2017 by Danilo DB4PLE + * 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 @@ -115,6 +115,15 @@ #define PIN_RXD GPIO_Pin_4 #define PORT_RXD GPIOB +#define PIN_SGL_DBL GPIO_Pin_12 +#define PORT_SGL_DBL GPIOA + +#define PIN_DL_DPX GPIO_Pin_15 +#define PORT_DL_DPX GPIOC + +#define PIN_SET_BAND GPIO_Pin_15 +#define PORT_SET_BAND GPIOA + // TXD used in SPI Data mode of ADF7021 // TXD is TxRxCLK of ADF7021, standard TX/RX data interface #define PIN_TXD GPIO_Pin_3 @@ -301,13 +310,37 @@ void CIO::Init() #endif RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE); - + #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); #elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif +#if defined(ZUMSPOT_ADF7021) + // Pin defines if the board has a single ADF7021 or double + GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStruct.GPIO_Pin = PIN_SGL_DBL; + GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU; + GPIO_Init(PORT_SGL_DBL, &GPIO_InitStruct); + + // Pin defines if the board is dual band or duplex + GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStruct.GPIO_Pin = PIN_DL_DPX; + GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU; + GPIO_Init(PORT_DL_DPX, &GPIO_InitStruct); + + // Pin will set UHF or VHF + GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStruct.GPIO_Pin = PIN_SET_BAND; + GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_Init(PORT_SET_BAND, &GPIO_InitStruct); + // TODO: Remove this line + // GPIO_WriteBit(PORT_SET_BAND, PIN_SET_BAND, Bit_RESET); + +#endif + +#if defined(STM32_USB_HOST) // Pin PA11,PA12 = LOW, USB Reset GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12; @@ -316,6 +349,8 @@ void CIO::Init() GPIO_WriteBit(GPIOA, GPIO_Pin_11, Bit_RESET); GPIO_WriteBit(GPIOA, GPIO_Pin_12, Bit_RESET); +#endif + #if defined(LONG_USB_RESET) // 10 ms delay delay_us(10000U); @@ -343,7 +378,7 @@ void CIO::Init() GPIO_InitStruct.GPIO_Pin = PIN_SDATA; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_SDATA, &GPIO_InitStruct); - + // Pin SREAD GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_SREAD; @@ -355,14 +390,14 @@ void CIO::Init() GPIO_InitStruct.GPIO_Pin = PIN_SLE; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_SLE, &GPIO_InitStruct); - + #if defined(DUPLEX) // Pin SLE2 GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_SLE2; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_SLE2, &GPIO_InitStruct); - + // Pin RXD2 GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_RXD2; @@ -403,7 +438,7 @@ void CIO::Init() GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(PORT_CLKOUT, &GPIO_InitStruct); #endif - + // Pin LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_LED; @@ -416,37 +451,37 @@ void CIO::Init() GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_DEB, &GPIO_InitStruct); - // D-Star LED + // D-Star LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_DSTAR_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_DSTAR_LED, &GPIO_InitStruct); - // DMR LED + // DMR LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_DMR_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_DMR_LED, &GPIO_InitStruct); - // YSF LED + // YSF LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_YSF_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_YSF_LED, &GPIO_InitStruct); - // P25 LED + // P25 LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_P25_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_P25_LED, &GPIO_InitStruct); - // NXDN LED + // NXDN LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_NXDN_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_NXDN_LED, &GPIO_InitStruct); - // POCSAG LED + // POCSAG LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_POCSAG_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; @@ -458,7 +493,7 @@ void CIO::Init() GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_PTT_LED, &GPIO_InitStruct); - // COS LED + // COS LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_COS_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; @@ -505,7 +540,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); - + #if defined(DUPLEX) EXTI_InitStructure2.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure2.EXTI_Trigger = EXTI_Trigger_Rising; @@ -517,7 +552,7 @@ void CIO::Init() void CIO::startInt() { NVIC_InitTypeDef NVIC_InitStructure; - + #if defined(DUPLEX) NVIC_InitTypeDef NVIC_InitStructure2; #endif @@ -546,7 +581,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); - + #if defined(DUPLEX) NVIC_InitStructure2.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure2.NVIC_IRQChannelSubPriority = 15; @@ -557,18 +592,18 @@ void CIO::startInt() #if defined(BIDIR_DATA_PIN) // RXD pin is bidirectional in standard interfaces -void CIO::Data_dir_out(bool dir) +void CIO::Data_dir_out(bool dir) { GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_RXD; - + if(dir) GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; else GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; - + GPIO_Init(PORT_RXD, &GPIO_InitStruct); } #endif @@ -696,6 +731,17 @@ void CIO::COS_pin(bool on) GPIO_WriteBit(PORT_COS_LED, PIN_COS_LED, on ? Bit_SET : Bit_RESET); } +void CIO::setBandVHF(bool vhf_on) { + GPIO_WriteBit(PORT_SET_BAND, PIN_SET_BAND, vhf_on ? Bit_SET : Bit_RESET); +} + +bool CIO::hasSingleADF7021() { + return GPIO_ReadInputDataBit(PORT_SGL_DBL, PIN_SGL_DBL) == Bit_SET; +} + +bool CIO::isDualBand() { + return GPIO_ReadInputDataBit(PORT_DL_DPX, PIN_DL_DPX) == Bit_SET; +} /** * Function delay_us() from stm32duino project From 3cdeb26aa0b8dc8eb987da5a6b2cc253007c18cb Mon Sep 17 00:00:00 2001 From: Abad-Vera Date: Sat, 25 May 2019 20:30:32 -0700 Subject: [PATCH 169/239] Initial commit for Duplex board --- Config.h | 18 ++++++++--------- IOSTM.cpp | 60 ++++++++++++++++++++++++++++++++----------------------- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/Config.h b/Config.h index bdfceac..d111d99 100644 --- a/Config.h +++ b/Config.h @@ -21,9 +21,9 @@ // Select one board (STM32F103 based boards) // 1) ZUMspot RPi or ZUMspot USB: -// #define ZUMSPOT_ADF7021 +#define ZUMSPOT_ADF7021 // 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: -#define LIBRE_KIT_ADF7021 +// #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 // 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) @@ -37,7 +37,7 @@ #define ENABLE_ADF7021 // Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): -// #define DUPLEX +#define DUPLEX // TCXO of the ADF7021 // For 14.7456 MHz: @@ -50,14 +50,14 @@ #define AD7021_GAIN_AUTO // AGC automatic with high LNA linearity: // #define AD7021_GAIN_AUTO_LIN -// AGC OFF, lowest gain: +// AGC OFF, lowest gain: // #define AD7021_GAIN_LOW // AGC OFF, highest gain: // #define AD7021_GAIN_HIGH // Host communication selection: -// #define STM32_USART1_HOST -#define STM32_USB_HOST +#define STM32_USART1_HOST +// #define STM32_USB_HOST // #define STM32_I2C_HOST // I2C host address: @@ -67,7 +67,7 @@ #define ENABLE_SCAN_MODE // Send RSSI value: -// #define SEND_RSSI_DATA +#define SEND_RSSI_DATA // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER @@ -82,7 +82,7 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Engage a constant or descreet Service LED mode once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED // #define CONSTANT_SRV_LED_INVERTED // #define DISCREET_SRV_LED @@ -95,7 +95,7 @@ // #define USE_ALTERNATE_POCSAG_LEDS // Enable for RPi 3B+, USB mode -#define LONG_USB_RESET +// #define LONG_USB_RESET // Enable modem debug messages #define ENABLE_DEBUG diff --git a/IOSTM.cpp b/IOSTM.cpp index 0aa82c0..b45cc83 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -1,8 +1,8 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU - * Copyright (C) 2017 by Danilo DB4PLE - + * Copyright (C) 2017 by Danilo DB4PLE + * 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 @@ -115,6 +115,9 @@ #define PIN_RXD GPIO_Pin_4 #define PORT_RXD GPIOB +#define PIN_RXD2 GPIO_Pin_4 +#define PORT_RXD2 GPIOA + // TXD used in SPI Data mode of ADF7021 // TXD is TxRxCLK of ADF7021, standard TX/RX data interface #define PIN_TXD GPIO_Pin_3 @@ -122,6 +125,12 @@ #define PIN_TXD_INT GPIO_PinSource3 #define PORT_TXD_INT GPIO_PortSourceGPIOB +// TXD2 is TxRxCLK of the second ADF7021, standard TX/RX data interface +#define PIN_TXD2 GPIO_Pin_8 +#define PORT_TXD2 GPIOA +#define PIN_TXD2_INT GPIO_PinSource8 +#define PORT_TXD2_INT GPIO_PortSourceGPIOA + // CLKOUT used in SPI Data mode of ADF7021 #define PIN_CLKOUT GPIO_Pin_15 #define PORT_CLKOUT GPIOA @@ -131,8 +140,8 @@ #define PIN_LED GPIO_Pin_13 #define PORT_LED GPIOC -#define PIN_DEB GPIO_Pin_9 -#define PORT_DEB GPIOB +#define PIN_DEB GPIO_Pin_7 +#define PORT_DEB GPIOA #define PIN_DSTAR_LED GPIO_Pin_12 #define PORT_DSTAR_LED GPIOB @@ -280,9 +289,9 @@ extern "C" { #if defined(DUPLEX) void EXTI9_5_IRQHandler(void) { - if(EXTI_GetITStatus(EXTI_Line5)!=RESET) { + if(EXTI_GetITStatus(EXTI_Line8)!=RESET) { io.interrupt2(); - EXTI_ClearITPendingBit(EXTI_Line5); + EXTI_ClearITPendingBit(EXTI_Line8); } } #endif @@ -301,7 +310,7 @@ void CIO::Init() #endif RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE); - + #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); #elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) @@ -343,7 +352,7 @@ void CIO::Init() GPIO_InitStruct.GPIO_Pin = PIN_SDATA; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_SDATA, &GPIO_InitStruct); - + // Pin SREAD GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_SREAD; @@ -355,14 +364,14 @@ void CIO::Init() GPIO_InitStruct.GPIO_Pin = PIN_SLE; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_SLE, &GPIO_InitStruct); - + #if defined(DUPLEX) // Pin SLE2 GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_SLE2; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_SLE2, &GPIO_InitStruct); - + // Pin RXD2 GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_RXD2; @@ -393,6 +402,7 @@ void CIO::Init() #endif GPIO_Init(PORT_TXD, &GPIO_InitStruct); #if defined(DUPLEX) + GPIO_InitStruct.GPIO_Pin = PIN_TXD2; GPIO_Init(PORT_TXD2, &GPIO_InitStruct); #endif @@ -403,7 +413,7 @@ void CIO::Init() GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(PORT_CLKOUT, &GPIO_InitStruct); #endif - + // Pin LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_LED; @@ -416,37 +426,37 @@ void CIO::Init() GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_DEB, &GPIO_InitStruct); - // D-Star LED + // D-Star LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_DSTAR_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_DSTAR_LED, &GPIO_InitStruct); - // DMR LED + // DMR LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_DMR_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_DMR_LED, &GPIO_InitStruct); - // YSF LED + // YSF LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_YSF_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_YSF_LED, &GPIO_InitStruct); - // P25 LED + // P25 LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_P25_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_P25_LED, &GPIO_InitStruct); - // NXDN LED + // NXDN LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_NXDN_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_NXDN_LED, &GPIO_InitStruct); - // POCSAG LED + // POCSAG LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_POCSAG_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; @@ -458,7 +468,7 @@ void CIO::Init() GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(PORT_PTT_LED, &GPIO_InitStruct); - // COS LED + // COS LED GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_COS_LED; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; @@ -496,7 +506,7 @@ void CIO::Init() // Connect EXTI5 Line GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT); // Configure EXT5 line - EXTI_InitStructure2.EXTI_Line = EXTI_Line5; + EXTI_InitStructure2.EXTI_Line = EXTI_Line8; #endif #endif @@ -505,7 +515,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); - + #if defined(DUPLEX) EXTI_InitStructure2.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure2.EXTI_Trigger = EXTI_Trigger_Rising; @@ -517,7 +527,7 @@ void CIO::Init() void CIO::startInt() { NVIC_InitTypeDef NVIC_InitStructure; - + #if defined(DUPLEX) NVIC_InitTypeDef NVIC_InitStructure2; #endif @@ -546,7 +556,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); - + #if defined(DUPLEX) NVIC_InitStructure2.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure2.NVIC_IRQChannelSubPriority = 15; @@ -557,18 +567,18 @@ void CIO::startInt() #if defined(BIDIR_DATA_PIN) // RXD pin is bidirectional in standard interfaces -void CIO::Data_dir_out(bool dir) +void CIO::Data_dir_out(bool dir) { GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_RXD; - + if(dir) GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; else GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; - + GPIO_Init(PORT_RXD, &GPIO_InitStruct); } #endif From 7e924a21b68db36ea9acaaf91f9247121bb7859a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 29 May 2019 17:30:56 -0400 Subject: [PATCH 170/239] Working on D2RG MMDVM_HS support --- Config.h | 2 + IOSTM.cpp | 14 ++-- Makefile | 11 ++- configs/D2RG_MMDVM_HS.h | 111 ++++++++++++++++++++++++++++++ configs/MMDVM_HS_Dual_Hat-12mhz.h | 2 + configs/MMDVM_HS_Dual_Hat.h | 2 + configs/MMDVM_HS_Hat-12mhz.h | 2 + configs/MMDVM_HS_Hat.h | 2 + configs/NanoDV_NPI.h | 2 + configs/NanoDV_USB.h | 2 + configs/Nano_hotSPOT.h | 2 + configs/ZUMspot_Libre.h | 2 + configs/ZUMspot_RPi.h | 2 + configs/ZUMspot_USB.h | 2 + configs/ZUMspot_duplex.h | 2 + configs/generic_duplex_gpio.h | 2 + configs/generic_gpio.h | 2 + version.h | 8 ++- 18 files changed, 161 insertions(+), 11 deletions(-) create mode 100644 configs/D2RG_MMDVM_HS.h diff --git a/Config.h b/Config.h index bdfceac..2f41693 100644 --- a/Config.h +++ b/Config.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/IOSTM.cpp b/IOSTM.cpp index 0aa82c0..5b77e04 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE * This program is free software; you can redistribute it and/or modify @@ -162,7 +162,7 @@ #define PIN_COS_LED GPIO_Pin_15 #define PORT_COS_LED GPIOB -#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) +#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -238,7 +238,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT or NANO_DV_REV11 need to be defined" +#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV11 or D2RG_MMDVM_HS need to be defined" #endif extern "C" { @@ -260,7 +260,7 @@ extern "C" { } #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -304,7 +304,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif @@ -478,7 +478,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -526,7 +526,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt diff --git a/Makefile b/Makefile index abbbe32..92ebc9d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU +# Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU # Copyright (C) 2016 by Jim McLaughlin KI6ZUM # This program is free software; you can redistribute it and/or modify @@ -454,6 +454,15 @@ ifneq ($(wildcard /usr/bin/stm32flash),) /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 endif +d2rg_mmdvm_hs: +ifneq ($(wildcard /usr/local/bin/stm32flash),) + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0 +endif + +ifneq ($(wildcard /usr/bin/stm32flash),) + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0 +endif + zumspot-pi: ifneq ($(wildcard /usr/local/bin/stm32flash),) /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/configs/D2RG_MMDVM_HS.h b/configs/D2RG_MMDVM_HS.h new file mode 100644 index 0000000..abde186 --- /dev/null +++ b/configs/D2RG_MMDVM_HS.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +#define D2RG_MMDVM_HS + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 9600 + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Engage a constant or descreet Service LED mode once repeater is running +// #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED + +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + +// Enable modem debug messages +#define ENABLE_DEBUG + +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + +#endif diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 794cba9..2f738c5 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index a8f5156..9b4b696 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 04d3390..a130ff6 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index b53e98b..e70362f 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index ee95a38..65e1e3f 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.1 (BG4TGO & BG5HHP) #define NANO_DV_REV11 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index 375f016..73e2699 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.1 (BG4TGO & BG5HHP) #define NANO_DV_REV11 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 372d11e..e000ac3 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -32,6 +32,8 @@ #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index bd380e4..64521ad 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index f9a1673..974c57c 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index c65cff0..f6cdb7e 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 9270598..f7283d7 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 3d4399d..1d6eddc 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index d3059b2..60c387c 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -32,6 +32,8 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/version.h b/version.h index 03a57c4..c793bd2 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "4" -#define VER_REV "16" -#define VERSION_DATE "20190211" +#define VER_REV "17" +#define VERSION_DATE "20190529" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" @@ -37,6 +37,8 @@ #define BOARD_INFO "Nano_hotSPOT" #elif defined(NANO_DV_REV11) #define BOARD_INFO "Nano_DV" +#elif defined(D2RG_MMDVM_HS) +#define BOARD_INFO "D2RG_MMDVM_HS" #else #define BOARD_INFO "MMDVM_HS" #endif From cc451c403608f0caf7627c8897e6f2262f43ecb3 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 29 May 2019 17:57:15 -0400 Subject: [PATCH 171/239] Updating scripts --- configs/MMDVM_HS_Dual_Hat-12mhz.h | 2 +- configs/MMDVM_HS_Dual_Hat.h | 2 +- configs/MMDVM_HS_Hat-12mhz.h | 2 +- configs/MMDVM_HS_Hat.h | 2 +- configs/NanoDV_NPI.h | 2 +- configs/NanoDV_USB.h | 2 +- configs/Nano_hotSPOT.h | 2 +- configs/ZUMspot_Libre.h | 2 +- configs/ZUMspot_RPi.h | 2 +- configs/ZUMspot_USB.h | 2 +- configs/ZUMspot_duplex.h | 2 +- configs/generic_duplex_gpio.h | 2 +- configs/generic_gpio.h | 2 +- scripts/build_fw.sh | 6 +++ scripts/install_fw_d2rg_mmdvmhs.sh | 77 +++++++++++++++++++++++++++ scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv_npi.sh | 2 +- scripts/install_fw_nanodv_usb.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 28 files changed, 109 insertions(+), 26 deletions(-) create mode 100755 scripts/install_fw_d2rg_mmdvmhs.sh diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 2f738c5..df6d0d9 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET * * 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 diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 9b4b696..64e600d 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET * * 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 diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index a130ff6..56ad528 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET * * 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 diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index e70362f..a847690 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 65e1e3f..50bb008 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index 73e2699..eab6287 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index e000ac3..55d93e2 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 64521ad..2f41693 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 974c57c..653a0e5 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index f6cdb7e..59b926c 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index f7283d7..1a5a05d 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 1d6eddc..172ec76 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index 60c387c..9d95d06 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 1bae995..a70ea1b 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -86,6 +86,12 @@ make bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/nanodv_usb_fw.bin make clean +# Building D2RG MMDVM_HS +cp ~/MMDVM_HS/configs/D2RG_MMDVM_HS.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/d2rg_mmdvm_hs.bin +make clean + # Building Generic Simplex GPIO cp ~/MMDVM_HS/configs/generic_gpio.h ~/MMDVM_HS/Config.h make diff --git a/scripts/install_fw_d2rg_mmdvmhs.sh b/scripts/install_fw_d2rg_mmdvmhs.sh new file mode 100755 index 0000000..fbfecdd --- /dev/null +++ b/scripts/install_fw_d2rg_mmdvmhs.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.4.17" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" + +# Download latest firmware for MMDVM_HS_Hat +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/d2rg_mmdvm_hs.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w d2rg_mmdvm_hs.bin -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0 + diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index f15b213..bd42a4a 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index a3301ed..04f7199 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 6d5a839..023e97b 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 05dd5c1..0a4f2fd 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 26e7497..9090aca 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 6840e4a..735d08d 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index e4b544b..c8f2b61 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 655b403..fdce89b 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 88a1382..2c4ac23 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 09b6748..71f41bf 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index cf6bdb7..2168a03 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index fb09687..042f260 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 12c0eda..fc06b4c 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.16" +FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" From 97d270a1fe6aee7112271158013a576c9f17ad92 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 29 May 2019 21:42:23 -0400 Subject: [PATCH 172/239] Fix typo --- scripts/install_fw_d2rg_mmdvmhs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_fw_d2rg_mmdvmhs.sh b/scripts/install_fw_d2rg_mmdvmhs.sh index fbfecdd..93b9362 100755 --- a/scripts/install_fw_d2rg_mmdvmhs.sh +++ b/scripts/install_fw_d2rg_mmdvmhs.sh @@ -22,7 +22,7 @@ FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" -# Download latest firmware for MMDVM_HS_Hat +# Download latest firmware for D2RG MMDVM_HS curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/d2rg_mmdvm_hs.bin # Download STM32F10X_Lib (only for binary tools) From e1ef4539792b85533f237d58a6381be3dbe140e4 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Wed, 29 May 2019 21:54:12 -0400 Subject: [PATCH 173/239] Update docs --- BUILD.md | 10 ++++++++-- README.md | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/BUILD.md b/BUILD.md index ebcde77..79a09d0 100644 --- a/BUILD.md +++ b/BUILD.md @@ -479,9 +479,15 @@ Please check here for detailed instructions: - make bl: it builds a firmware with USB bootloader support. -- make zumspot-pi: upload the firmware to a ZUMspot RPi version (using internal RPi serial port) +- make zumspot-pi: upload the firmware to a ZUMspot RPi version (using internal RPi serial port) -- make mmdvm_hs_hat: upload the firmware to MMDVM_HS_Hat board (using internal RPi serial port) +- make mmdvm_hs_hat: upload the firmware to MMDVM_HS_Hat board (using internal RPi serial port) + +- make nano-hotspot: upload the firmware to Nano hotSPOT board (using internal serial port) + +- make nano-dv: upload the firmware to NanoDV board (using internal serial port) + +- make d2rg_mmdvm_hs: upload the firmware to D2RG MMDVM_HS board (using internal serial port) - make dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional, and it corresponds to the USB serial port device name. This option permits to perform a reset to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button of the ZUMspot just before using this command. diff --git a/README.md b/README.md index 7ee5133..66aafce 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) - install_fw_nanodv_npi.sh: only for NanoDV NPi board 1.0 (BG4TGO & BG5HHP) - install_fw_nanodv_usb.sh: only for NanoDV USB board 1.0 (BG4TGO & BG5HHP) +- install_fw_d2rg_mmdvmhs.sh: only for D2RG MMDVM_HS board (BG3MDO, VE2GZI, CA6JAU) - install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) - install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface - install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) From 279251d48410717a1bf06787fbf893c924b8dee8 Mon Sep 17 00:00:00 2001 From: Shawn Chain Date: Fri, 31 May 2019 18:31:29 +0800 Subject: [PATCH 174/239] add udid support to the firmware --- SerialPort.cpp | 8 +++++++- SerialSTM.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index 0e8c8e3..ea0af12 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -78,6 +78,8 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; const uint8_t PROTOCOL_VERSION = 1U; +char UDID[] = "00000000000000000000000000000000"; + CSerialPort::CSerialPort() : m_buffer(), m_ptr(0U), @@ -198,7 +200,7 @@ void CSerialPort::getStatus() void CSerialPort::getVersion() { - uint8_t reply[100U]; + uint8_t reply[132U]; reply[0U] = MMDVM_FRAME_START; reply[1U] = 0U; @@ -210,6 +212,10 @@ void CSerialPort::getVersion() for (uint8_t i = 0U; HARDWARE[i] != 0x00U; i++, count++) reply[count] = HARDWARE[i]; + reply[count++] = '\0'; + for (uint8_t i = 0U; UDID[i] != 0x00U; i++, count++) + reply[count] = UDID[i]; + reply[1U] = count; writeInt(1U, reply, count); diff --git a/SerialSTM.cpp b/SerialSTM.cpp index aae4117..a086bef 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -433,9 +433,33 @@ void WriteUSART2(const uint8_t* data, uint16_t length) #endif ///////////////////////////////////////////////////////////////// +extern char UDID[]; +extern "C" { + #include +} void CSerialPort::beginInt(uint8_t n, int speed) { +#if defined(STM32F4XX) + uint32_t *id0 = (uint32_t *) (0x1FFF7A10); + uint32_t *id1 = (uint32_t *) (0x1FFF7A10 + 0x04); + uint32_t *id2 = (uint32_t *) (0x1FFF7A10 + 0x08); + ::sprintf(UDID, "%08X%08X%08X", *id0,*id1,*id2); + +#elif defined(STM32F7XX) + uint32_t *id0 = (uint32_t *) (0x1FF0F420); + uint32_t *id1 = (uint32_t *) (0x1FF0F420 + 0x04); + uint32_t *id2 = (uint32_t *) (0x1FF0F420 + 0x08); + ::sprintf(UDID, "%08X%08X%08X", *id0,*id1,*id2); + +#elif defined(STM32F10X_MD) + uint16_t *id00 = (uint16_t *) (0x1FFFF7E8); + uint16_t *id01 = (uint16_t *) (0x1FFFF7E8 + 0x02); + uint32_t *id1 = (uint32_t *) (0x1FFFF7E8 + 0x04); + uint32_t *id2 = (uint32_t *) (0x1FFFF7E8 + 0x08); + ::sprintf(UDID, "%04X%04X%08X%08X", *id00,*id01,*id1,*id2); +#endif + switch (n) { case 1U: #if defined(STM32_USART1_HOST) From 8e5e06de30f82d18d712ad9839c088dbe506b89b Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 2 Jun 2019 12:47:32 -0400 Subject: [PATCH 175/239] Remove unused DEV_USB_SER from scripts --- scripts/install_fw_d2rg_mmdvmhs.sh | 6 +----- scripts/install_fw_duplex_gpio.sh | 7 +------ scripts/install_fw_gen_gpio.sh | 7 +------ scripts/install_fw_hsdualhat-12mhz.sh | 7 +------ scripts/install_fw_hsdualhat.sh | 7 +------ scripts/install_fw_hshat-12mhz.sh | 7 +------ scripts/install_fw_hshat.sh | 7 +------ scripts/install_fw_nanodv_npi.sh | 7 +------ scripts/install_fw_nanohs.sh | 7 +------ scripts/install_fw_rpi.sh | 7 +------ 10 files changed, 10 insertions(+), 59 deletions(-) diff --git a/scripts/install_fw_d2rg_mmdvmhs.sh b/scripts/install_fw_d2rg_mmdvmhs.sh index 93b9362..33da9f4 100755 --- a/scripts/install_fw_d2rg_mmdvmhs.sh +++ b/scripts/install_fw_d2rg_mmdvmhs.sh @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for D2RG MMDVM_HS curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/d2rg_mmdvm_hs.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" @@ -73,5 +68,6 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware +# Note: /dev/ttySC0 should be enabled, see: https://github.com/bg3mdo/D2RG_MMDVM_HS_ambe_uart_service eval sudo $STM32FLASH -v -w d2rg_mmdvm_hs.bin -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0 diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 04f7199..8c8cbcf 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Generic Duplex GPIO curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_duplex_gpio_fw.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 023e97b..e0779e7 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Generic Simplex GPIO curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_gpio_fw.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 0a4f2fd..5bcc132 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw-12mhz.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 9090aca..a967630 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 735d08d..ad1e280 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU, Florian Wolters DF2ET +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat with 12.288 MHz TCXO curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw-12mhz.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index c8f2b61..76ae591 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for MMDVM_HS_Hat curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 2c4ac23..895cef1 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2018 by Andy Uribe CA6JAU +# Copyright (C) 2018,2019 by Andy Uribe CA6JAU # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Nano DV curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nanodv_npi_fw.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index 2168a03..d650f57 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2018 by Andy Uribe CA6JAU +# Copyright (C) 2018,2019 by Andy Uribe CA6JAU # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for Nano hotSPOT curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nano_hotspot_fw.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 042f260..6b160f5 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU # 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 @@ -18,9 +18,6 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" # Download latest firmware for ZUMspot RPi (GPIO) curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_rpi_fw.bin @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" From 06e02d54f904c33a7d12979fbdf1c954893d6a18 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 2 Jun 2019 13:00:25 -0400 Subject: [PATCH 176/239] Update README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 66aafce..4c36398 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,10 @@ Some detailed examples as follows: Please visit Mathis Schmieder GitHub [here](https://github.com/mathisschmieder/MMDVM_HS_Hat/blob/master/README.md) for detailed instructions. +### D2RG MMDVM_HS board + +This hotspot needs Raspbian support for SPI-UART converter included in this board. If you don't see /dev/ttySC0, please visit Yuan BG3MDO GitHub [here](https://github.com/bg3mdo/D2RG_MMDVM_HS_ambe_uart_service) for driver installation instructions. + ### ZUMspot Libre Kit (under Linux Raspbian) If you are using Pi-Star, expand filesystem (if you haven't done before): From c305359ce5c6752ab9b99b61f2b3c503b8b18603 Mon Sep 17 00:00:00 2001 From: Shawn Chain Date: Tue, 13 Aug 2019 00:43:31 +0800 Subject: [PATCH 177/239] Improve the modem serial repeat --- SerialPort.cpp | 54 ++++++++++++++++++++++---------------------------- SerialPort.h | 1 - 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index ea0af12..d660966 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -85,7 +85,6 @@ m_buffer(), m_ptr(0U), m_len(0U), m_serial_buffer(), -m_serial_ptr(0U), m_serial_len(0U), m_debug(false), m_firstCal(false) @@ -871,55 +870,50 @@ void CSerialPort::process() // Check for any incoming serial data from a device/screen on UART2 // !!Notice!! on powerup the Nextion screen dumps FF FF FF 88 FF FF FF to the serial port. while (availableInt(3U)) - { - uint8_t ch = readInt(3U); + { // read UART2 + m_serial_buffer[m_serial_len++] = readInt(3U); - m_serial_buffer[m_serial_ptr] = ch; - m_serial_ptr++; - // fill the buffer one char at a time + if (m_serial_len >=3 && (m_serial_buffer[m_serial_len - 3] == 0xFF) && (m_serial_buffer[m_serial_len - 2] == 0xFF) && (m_serial_buffer[m_serial_len - 1] == 0xFF)) + { + if (m_serial_len > 3) + serial.writeSerialRpt(m_serial_buffer, m_serial_len); - if (m_serial_len > 128) + // if the last 3 bytes are FF's then the screen is done sending data so send the m_serial_buffer to serial.writeSerialRpt() + // + // TODO - BG5HHP + // modem serial data repeat should be generic instead of coupling with the nextion protocol. + // m_serial_len = 0U; - // if length is > 128 reset it - else - m_serial_len++; - // increase length + continue; } - if ((m_serial_buffer[m_serial_len - 3] == 0xFF) && (m_serial_buffer[m_serial_len - 2] == 0xFF) && (m_serial_buffer[m_serial_len - 1] == 0xFF)) - { - serial.writeSerialRpt(m_serial_buffer, m_serial_len); - // if the last 3 bytes are FF's then the screen is done sending data so send the m_serial_buffer to serial.writeSerialRpt() - - m_serial_ptr = 0U; - m_serial_len = 0U; - // set ptr and reset length of buffer data since last message was valid and get ready for new data - - } - + if (m_serial_len == sizeof(m_serial_buffer)) + { + // buffer overflow + m_serial_len = 0U; + continue; + } + } #endif } #if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) void CSerialPort::writeSerialRpt(const uint8_t* data, uint8_t length) { - if (m_modemState != STATE_IDLE) + if (length == 0 || length > 127) return; uint8_t reply[131U]; reply[0U] = MMDVM_FRAME_START; - reply[1U] = 0U; + reply[1U] = length + 3; reply[2U] = MMDVM_SERIAL; - uint8_t count = 3U; - for (uint8_t i = 0U; i < length; i++, count++) - reply[count] = data[i]; + for (uint8_t i = 0U; i < length; i++) + reply[i+3] = data[i]; - reply[1U] = count; - - writeInt(1U, reply, count); + writeInt(1U, reply, length + 3); } #endif diff --git a/SerialPort.h b/SerialPort.h index ffb4553..7061b33 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -70,7 +70,6 @@ private: uint8_t m_ptr; uint8_t m_len; uint8_t m_serial_buffer[128U]; - uint8_t m_serial_ptr; uint8_t m_serial_len; bool m_debug; From c909c2dbc5c6f323250e294516855b4bdb678979 Mon Sep 17 00:00:00 2001 From: Shawn Chain Date: Tue, 13 Aug 2019 00:54:26 +0800 Subject: [PATCH 178/239] optimize writeSerialRpt() --- SerialPort.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index d660966..91e9d3d 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -901,19 +901,16 @@ void CSerialPort::process() #if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) void CSerialPort::writeSerialRpt(const uint8_t* data, uint8_t length) { - if (length == 0 || length > 127) + if (length == 0) return; - uint8_t reply[131U]; + uint8_t head[3]; + head[0U] = MMDVM_FRAME_START; + head[1U] = length + 3; + head[2U] = MMDVM_SERIAL; - reply[0U] = MMDVM_FRAME_START; - reply[1U] = length + 3; - reply[2U] = MMDVM_SERIAL; - - for (uint8_t i = 0U; i < length; i++) - reply[i+3] = data[i]; - - writeInt(1U, reply, length + 3); + writeInt(1U, head, 3U); + writeInt(1U, data, length, true); } #endif From 4669198c77f65f1ce6108b7b90e0b452bc87af62 Mon Sep 17 00:00:00 2001 From: Abad-Vera Date: Wed, 18 Sep 2019 15:29:12 -0700 Subject: [PATCH 179/239] Added changes to prevent conflict with other Duplex boards --- IOSTM.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/IOSTM.cpp b/IOSTM.cpp index b45cc83..7fb5d84 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -115,9 +115,6 @@ #define PIN_RXD GPIO_Pin_4 #define PORT_RXD GPIOB -#define PIN_RXD2 GPIO_Pin_4 -#define PORT_RXD2 GPIOA - // TXD used in SPI Data mode of ADF7021 // TXD is TxRxCLK of ADF7021, standard TX/RX data interface #define PIN_TXD GPIO_Pin_3 @@ -125,11 +122,16 @@ #define PIN_TXD_INT GPIO_PinSource3 #define PORT_TXD_INT GPIO_PortSourceGPIOB +#if defined(DUPLEX) +#define PIN_RXD2 GPIO_Pin_11 +#define PORT_RXD2 GPIOA + // TXD2 is TxRxCLK of the second ADF7021, standard TX/RX data interface #define PIN_TXD2 GPIO_Pin_8 #define PORT_TXD2 GPIOA #define PIN_TXD2_INT GPIO_PinSource8 #define PORT_TXD2_INT GPIO_PortSourceGPIOA +#endif // CLKOUT used in SPI Data mode of ADF7021 #define PIN_CLKOUT GPIO_Pin_15 @@ -140,8 +142,8 @@ #define PIN_LED GPIO_Pin_13 #define PORT_LED GPIOC -#define PIN_DEB GPIO_Pin_7 -#define PORT_DEB GPIOA +#define PIN_DEB GPIO_Pin_9 +#define PORT_DEB GPIOB #define PIN_DSTAR_LED GPIO_Pin_12 #define PORT_DSTAR_LED GPIOB @@ -289,10 +291,17 @@ extern "C" { #if defined(DUPLEX) void EXTI9_5_IRQHandler(void) { + #if defined(ZUMSPOT_ADF7021) if(EXTI_GetITStatus(EXTI_Line8)!=RESET) { io.interrupt2(); EXTI_ClearITPendingBit(EXTI_Line8); } + #else + if(EXTI_GetITStatus(EXTI_Line5)!=RESET) { + io.interrupt2(); + EXTI_ClearITPendingBit(EXTI_Line5); + } + #endif } #endif @@ -506,7 +515,11 @@ void CIO::Init() // Connect EXTI5 Line GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT); // Configure EXT5 line + #if defined(ZUMSPOT_ADF7021) EXTI_InitStructure2.EXTI_Line = EXTI_Line8; + #else + EXTI_InitStructure2.EXTI_Line = EXTI_Line5; + #endif #endif #endif From c34f5d511d748a13a1542f57c4fd454651dcab49 Mon Sep 17 00:00:00 2001 From: Abad-Vera Date: Thu, 19 Sep 2019 16:39:49 -0700 Subject: [PATCH 180/239] Added changes for both ZUMspot duplex and dualband boards --- Config.h | 18 +++--- IO.cpp | 6 ++ SerialPort.cpp | 5 ++ configs/ZUMspot_dualband.h | 109 +++++++++++++++++++++++++++++++++++++ configs/ZUMspot_duplex.h | 20 +++---- scripts/build_fw.sh | 8 ++- 6 files changed, 146 insertions(+), 20 deletions(-) create mode 100644 configs/ZUMspot_dualband.h diff --git a/Config.h b/Config.h index d111d99..bdfceac 100644 --- a/Config.h +++ b/Config.h @@ -21,9 +21,9 @@ // Select one board (STM32F103 based boards) // 1) ZUMspot RPi or ZUMspot USB: -#define ZUMSPOT_ADF7021 +// #define ZUMSPOT_ADF7021 // 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: -// #define LIBRE_KIT_ADF7021 +#define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 // 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) @@ -37,7 +37,7 @@ #define ENABLE_ADF7021 // Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): -#define DUPLEX +// #define DUPLEX // TCXO of the ADF7021 // For 14.7456 MHz: @@ -50,14 +50,14 @@ #define AD7021_GAIN_AUTO // AGC automatic with high LNA linearity: // #define AD7021_GAIN_AUTO_LIN -// AGC OFF, lowest gain: +// AGC OFF, lowest gain: // #define AD7021_GAIN_LOW // AGC OFF, highest gain: // #define AD7021_GAIN_HIGH // Host communication selection: -#define STM32_USART1_HOST -// #define STM32_USB_HOST +// #define STM32_USART1_HOST +#define STM32_USB_HOST // #define STM32_I2C_HOST // I2C host address: @@ -67,7 +67,7 @@ #define ENABLE_SCAN_MODE // Send RSSI value: -#define SEND_RSSI_DATA +// #define SEND_RSSI_DATA // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER @@ -82,7 +82,7 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Engage a constant or descreet Service LED mode once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED // #define CONSTANT_SRV_LED_INVERTED // #define DISCREET_SRV_LED @@ -95,7 +95,7 @@ // #define USE_ALTERNATE_POCSAG_LEDS // Enable for RPi 3B+, USB mode -// #define LONG_USB_RESET +#define LONG_USB_RESET // Enable modem debug messages #define ENABLE_DEBUG diff --git a/IO.cpp b/IO.cpp index 344244e..b419cfe 100644 --- a/IO.cpp +++ b/IO.cpp @@ -351,6 +351,12 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po // Turn on UHF side io.setBandVHF(false); } + } else if (!io.isDualBand()) { + // Duplex board + if ((frequency_tx < UHF1_MIN) || (frequency_rx < UHF1_MIN)) { + // Reject VHF frequencies + return 4U; + } } } diff --git a/SerialPort.cpp b/SerialPort.cpp index 0e8c8e3..1965a02 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -312,6 +312,11 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) DEBUG1("Full duplex not supported with this firmware"); return 6U; } +#elif defined(DUPLEX) && defined(ZUMSPOT_ADF7021) + if (io.isDualBand() && m_duplex && m_calState == STATE_IDLE && modemState != STATE_DSTARCAL) { + DEBUG1("Full duplex is not supported on this board"); + return 6U; + } #endif dstarTX.setTXDelay(txDelay); diff --git a/configs/ZUMspot_dualband.h b/configs/ZUMspot_dualband.h new file mode 100644 index 0000000..f21c673 --- /dev/null +++ b/configs/ZUMspot_dualband.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +#define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 9600 + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Engage a constant or descreet Service LED mode once repeater is running +// #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED + +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + +// Enable modem debug messages +#define ENABLE_DEBUG + +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + +#endif diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 9270598..d111d99 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU * * 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 @@ -21,9 +21,9 @@ // Select one board (STM32F103 based boards) // 1) ZUMspot RPi or ZUMspot USB: -// #define ZUMSPOT_ADF7021 +#define ZUMSPOT_ADF7021 // 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: -#define LIBRE_KIT_ADF7021 +// #define LIBRE_KIT_ADF7021 // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // #define MMDVM_HS_HAT_REV12 // 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) @@ -50,14 +50,14 @@ #define AD7021_GAIN_AUTO // AGC automatic with high LNA linearity: // #define AD7021_GAIN_AUTO_LIN -// AGC OFF, lowest gain: +// AGC OFF, lowest gain: // #define AD7021_GAIN_LOW // AGC OFF, highest gain: // #define AD7021_GAIN_HIGH // Host communication selection: -// #define STM32_USART1_HOST -#define STM32_USB_HOST +#define STM32_USART1_HOST +// #define STM32_USB_HOST // #define STM32_I2C_HOST // I2C host address: @@ -67,7 +67,7 @@ #define ENABLE_SCAN_MODE // Send RSSI value: -// #define SEND_RSSI_DATA +#define SEND_RSSI_DATA // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): #define SERIAL_REPEATER @@ -82,7 +82,7 @@ // Disable mode LEDs blink during scan mode: // #define QUIET_MODE_LEDS -// Engage a constant or descreet Service LED mode once repeater is running +// Engage a constant or descreet Service LED mode once repeater is running // #define CONSTANT_SRV_LED // #define CONSTANT_SRV_LED_INVERTED // #define DISCREET_SRV_LED @@ -95,10 +95,10 @@ // #define USE_ALTERNATE_POCSAG_LEDS // Enable for RPi 3B+, USB mode -#define LONG_USB_RESET +// #define LONG_USB_RESET // Enable modem debug messages -// #define ENABLE_DEBUG +#define ENABLE_DEBUG // Disable frequency bands check // #define DISABLE_FREQ_CHECK diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 1bae995..d395390 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -40,10 +40,16 @@ make clean # Building ZUMspot Duplex cp ~/MMDVM_HS/configs/ZUMspot_duplex.h ~/MMDVM_HS/Config.h -make bl +make mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin make clean +# Building ZUMspot Dualband +cp ~/MMDVM_HS/configs/ZUMspot_dualband.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_dualband_fw.bin +make clean + # Building MMDVM_HS_Hat cp ~/MMDVM_HS/configs/MMDVM_HS_Hat.h ~/MMDVM_HS/Config.h make From 3c63f30a08d69b714e22127a488cbea13763a95a Mon Sep 17 00:00:00 2001 From: Abad-Vera Date: Mon, 23 Sep 2019 14:44:27 -0700 Subject: [PATCH 181/239] Fixed issue with POCSAG under dualband board --- ADF7021.cpp | 46 +++++++++++++++++++++------------------- IO.cpp | 60 ++++++++++++++++++++++++++++++++++++----------------- IO.h | 2 ++ 3 files changed, 68 insertions(+), 40 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index a9aaac9..6ccfc07 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -1,8 +1,8 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU - * Copyright (C) 2017 by Danilo DB4PLE - * + * Copyright (C) 2017 by Danilo DB4PLE + * * Some of the code is based on work of Guus Van Dooren PE1PLM: * https://github.com/ki6zum/gmsk-dstar/blob/master/firmware/dvmega/dvmega.ino * @@ -216,6 +216,10 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) m_frequency_rx = m_pocsag_freq_tx; } + #if defined (ZUMSPOT_ADF7021) + io.checkBand(m_frequency_rx, m_frequency_tx); + #endif + // Toggle CE pin for ADF7021 reset if(reset) { CE_pin(LOW); @@ -321,7 +325,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) case STATE_CWID: // CW ID base configuration: DMR // Dev: +1 symb (variable), symb rate = 4800 - + ADF7021_REG3 = ADF7021_REG3_DMR; ADF7021_REG10 = ADF7021_REG10_DMR; @@ -510,7 +514,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) // DEMOD (4) AD7021_control_word = ADF7021_REG4; Send_AD7021_control(); - + // IF fine cal (6) AD7021_control_word = ADF7021_REG6; Send_AD7021_control(); @@ -518,7 +522,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) // IF coarse cal (5) AD7021_control_word = ADF7021_REG5; Send_AD7021_control(); - + // Delay for filter calibration delay_IFcal(); @@ -528,7 +532,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) // MODULATION (2) ADF7021_REG2 |= (uint32_t) 0b0010; // register 2 ADF7021_REG2 |= (uint32_t) m_power << 13; // power level - ADF7021_REG2 |= (uint32_t) 0b110001 << 7; // PA + ADF7021_REG2 |= (uint32_t) 0b110001 << 7; // PA AD7021_control_word = ADF7021_REG2; Send_AD7021_control(); @@ -569,7 +573,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) Send_AD7021_control(); #if defined(TEST_TX) - PTT_pin(HIGH); + PTT_pin(HIGH); AD7021_control_word = ADF7021_TX_REG0; Send_AD7021_control(); // TEST MODE (TX carrier only) (15) @@ -751,7 +755,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) // MODULATION (2) ADF7021_REG2 |= (uint32_t) 0b0010; // register 2 ADF7021_REG2 |= (uint32_t) (m_power & 0x3F) << 13; // power level - ADF7021_REG2 |= (uint32_t) 0b110001 << 7; // PA + ADF7021_REG2 |= (uint32_t) 0b110001 << 7; // PA AD7021_control_word = ADF7021_REG2; Send_AD7021_control2(); @@ -801,7 +805,7 @@ void CIO::interrupt() // is used to trigger the interrupt !!!! // TODO: figure out why sending the control word seems to issue interrupts // possibly this is a design problem of the RF7021 board or too long wires - // on the breadboard build + // on the breadboard build // but normally this will not hurt too much if (clk == last_clk) { return; @@ -828,14 +832,14 @@ void CIO::interrupt() #endif // wait a brief period before raising SLE - if (totx_request == true) { + if (totx_request == true) { asm volatile("nop \n\t" "nop \n\t" "nop \n\t" ); - // SLE Pulse, should be moved out of here into class method - // according to datasheet in 4FSK we have to deliver this before 1/4 tbit == 26uS + // SLE Pulse, should be moved out of here into class method + // according to datasheet in 4FSK we have to deliver this before 1/4 tbit == 26uS SLE_pin(HIGH); asm volatile("nop \n\t" "nop \n\t" @@ -861,12 +865,12 @@ void CIO::interrupt() m_rxBuffer.put(bit, m_control); } - if (torx_request == true && even == ADF7021_EVEN_BIT && m_tx && clk == 0U) { + if (torx_request == true && even == ADF7021_EVEN_BIT && m_tx && clk == 0U) { // that is absolutely crucial in 4FSK, see datasheet: - // enable sle after 1/4 tBit == 26uS when sending MSB (even == false) and clock is low + // enable sle after 1/4 tBit == 26uS when sending MSB (even == false) and clock is low delay_us(26U); - // SLE Pulse, should be moved out of here into class method + // SLE Pulse, should be moved out of here into class method SLE_pin(HIGH); asm volatile("nop \n\t" "nop \n\t" @@ -913,11 +917,11 @@ void CIO::interrupt2() #endif void CIO::setTX() -{ +{ // PTT pin on (doing it earlier helps to measure timing impact) - PTT_pin(HIGH); + PTT_pin(HIGH); - // Send register 0 for TX operation, but do not activate yet. + // Send register 0 for TX operation, but do not activate yet. // This is done in the interrupt at the correct time AD7021_control_word = ADF7021_TX_REG0; Send_AD7021_control(false); @@ -931,15 +935,15 @@ void CIO::setTX() } void CIO::setRX(bool doSle) -{ +{ // PTT pin off (doing it earlier helps to measure timing impact) PTT_pin(LOW); - // Send register 0 for RX operation, but do not activate yet. + // Send register 0 for RX operation, but do not activate yet. // This is done in the interrupt at the correct time AD7021_control_word = ADF7021_RX_REG0; Send_AD7021_control(doSle); - + #if defined(BIDIR_DATA_PIN) Data_dir_out(false); // Data pin input mode #endif diff --git a/IO.cpp b/IO.cpp index b419cfe..21b382b 100644 --- a/IO.cpp +++ b/IO.cpp @@ -307,6 +307,45 @@ bool CIO::hasRXOverflow() return m_rxBuffer.hasOverflowed(); } +void CIO::checkBand(uint32_t frequency_rx, uint32_t frequency_tx) { + if (!(io.hasSingleADF7021())) { + // There are two ADF7021s on the board + if (io.isDualBand()) { + // Dual band + if ((frequency_tx <= VHF2_MAX) && (frequency_rx <= VHF2_MAX)) { + // Turn on VHF side + io.setBandVHF(true); + } else if ((frequency_tx >= UHF1_MIN) && (frequency_rx >= UHF1_MIN)) { + // Turn on UHF side + io.setBandVHF(false); + } + } + } +} + +uint8_t CIO::checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx) { + if (!(io.hasSingleADF7021())) { + // There are two ADF7021s on the board + if (io.isDualBand()) { + // Dual band + if ((frequency_tx <= VHF2_MAX) && (frequency_rx <= VHF2_MAX)) { + // Turn on VHF side + io.setBandVHF(true); + } else if ((frequency_tx >= UHF1_MIN) && (frequency_rx >= UHF1_MIN)) { + // Turn on UHF side + io.setBandVHF(false); + } + } else if (!io.isDualBand()) { + // Duplex board + if ((frequency_tx < UHF1_MIN) || (frequency_rx < UHF1_MIN)) { + // Reject VHF frequencies + return 4U; + } + } + } + return 0U; +} + uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx) { // Configure power level @@ -340,26 +379,9 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po // Check if we have a single, dualband or duplex board #if defined (ZUMSPOT_ADF7021) - if (!(io.hasSingleADF7021())) { - // There are two ADF7021s on the board - if (io.isDualBand()) { - // Dual band - if ((frequency_tx <= VHF2_MAX) && (frequency_rx <= VHF2_MAX)) { - // Turn on VHF side - io.setBandVHF(true); - } else if ((frequency_tx >= UHF1_MIN) && (frequency_rx >= UHF1_MIN)) { - // Turn on UHF side - io.setBandVHF(false); - } - } else if (!io.isDualBand()) { - // Duplex board - if ((frequency_tx < UHF1_MIN) || (frequency_rx < UHF1_MIN)) { - // Reject VHF frequencies - return 4U; - } - } + if (checkZUMspot(frequency_rx, frequency_tx) > 0) { + return 4U; } - #endif // Configure frequency diff --git a/IO.h b/IO.h index bbc546b..e8bb5ff 100644 --- a/IO.h +++ b/IO.h @@ -115,6 +115,8 @@ public: void process(void); bool hasTXOverflow(void); bool hasRXOverflow(void); + void checkBand(uint32_t frequency_rx, uint32_t frequency_tx); + uint8_t checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx); uint8_t setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx); void setPower(uint8_t power); void setMode(MMDVM_STATE modemState); From 754a9c6657e78c25c05f7dc75af59961d4a44550 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 15:36:20 -0300 Subject: [PATCH 182/239] Fix binary build for ZUMspot dualband --- scripts/build_fw.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index d93c0c9..d2fd5a3 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -47,7 +47,7 @@ make clean # Building ZUMspot Dualband cp ~/MMDVM_HS/configs/ZUMspot_dualband.h ~/MMDVM_HS/Config.h make -mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_dualband_fw.bin +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_dualband_fw.bin make clean # Building MMDVM_HS_Hat From c1e279af7da53850df6f6e0c284d586489c979c9 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 15:55:20 -0300 Subject: [PATCH 183/239] Fix compilation for most of the boards --- IO.cpp | 2 ++ IO.h | 6 ++++-- IOSTM.cpp | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/IO.cpp b/IO.cpp index 21b382b..805c21e 100644 --- a/IO.cpp +++ b/IO.cpp @@ -307,6 +307,7 @@ bool CIO::hasRXOverflow() return m_rxBuffer.hasOverflowed(); } +#if defined(ZUMSPOT_ADF7021) void CIO::checkBand(uint32_t frequency_rx, uint32_t frequency_tx) { if (!(io.hasSingleADF7021())) { // There are two ADF7021s on the board @@ -345,6 +346,7 @@ uint8_t CIO::checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx) { } return 0U; } +#endif uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx) { diff --git a/IO.h b/IO.h index e8bb5ff..fac37fe 100644 --- a/IO.h +++ b/IO.h @@ -115,8 +115,6 @@ public: void process(void); bool hasTXOverflow(void); bool hasRXOverflow(void); - void checkBand(uint32_t frequency_rx, uint32_t frequency_tx); - uint8_t checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx); uint8_t setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx); void setPower(uint8_t power); void setMode(MMDVM_STATE modemState); @@ -126,9 +124,13 @@ public: uint32_t getWatchdog(void); void getIntCounter(uint16_t &int1, uint16_t &int2); void selfTest(void); +#if defined(ZUMSPOT_ADF7021) + void checkBand(uint32_t frequency_rx, uint32_t frequency_tx); + uint8_t checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx); void setBandVHF(bool vhf_on); bool hasSingleADF7021(void); bool isDualBand(void); +#endif // RF interface API void setTX(void); diff --git a/IOSTM.cpp b/IOSTM.cpp index 6c75837..208cdeb 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -754,6 +754,7 @@ void CIO::COS_pin(bool on) GPIO_WriteBit(PORT_COS_LED, PIN_COS_LED, on ? Bit_SET : Bit_RESET); } +#if defined(ZUMSPOT_ADF7021) void CIO::setBandVHF(bool vhf_on) { GPIO_WriteBit(PORT_SET_BAND, PIN_SET_BAND, vhf_on ? Bit_SET : Bit_RESET); } @@ -765,6 +766,7 @@ bool CIO::hasSingleADF7021() { bool CIO::isDualBand() { return GPIO_ReadInputDataBit(PORT_DL_DPX, PIN_DL_DPX) == Bit_SET; } +#endif /** * Function delay_us() from stm32duino project From fb931db47f1bed24e73742710e4ee97d3a8810f0 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 16:01:53 -0300 Subject: [PATCH 184/239] Fix binary fw for ZUMspot duplex --- scripts/build_fw.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index d2fd5a3..43fd722 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -41,7 +41,7 @@ make clean # Building ZUMspot Duplex cp ~/MMDVM_HS/configs/ZUMspot_duplex.h ~/MMDVM_HS/Config.h make -mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin make clean # Building ZUMspot Dualband From ce0ad59bccb66ba7e2d0b44cc6035a46d12ad9d6 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 19:03:11 -0300 Subject: [PATCH 185/239] Fix UDID compilation warning --- SerialSTM.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SerialSTM.cpp b/SerialSTM.cpp index a086bef..3977878 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -444,20 +444,20 @@ void CSerialPort::beginInt(uint8_t n, int speed) uint32_t *id0 = (uint32_t *) (0x1FFF7A10); uint32_t *id1 = (uint32_t *) (0x1FFF7A10 + 0x04); uint32_t *id2 = (uint32_t *) (0x1FFF7A10 + 0x08); - ::sprintf(UDID, "%08X%08X%08X", *id0,*id1,*id2); + ::sprintf(UDID, "%08X%08X%08X", *(unsigned int *)id0, *(unsigned int *)id1, *(unsigned int *)id2); #elif defined(STM32F7XX) uint32_t *id0 = (uint32_t *) (0x1FF0F420); uint32_t *id1 = (uint32_t *) (0x1FF0F420 + 0x04); uint32_t *id2 = (uint32_t *) (0x1FF0F420 + 0x08); - ::sprintf(UDID, "%08X%08X%08X", *id0,*id1,*id2); + ::sprintf(UDID, "%08X%08X%08X", *(unsigned int *)id0, *(unsigned int *)id1, *(unsigned int *)id2); #elif defined(STM32F10X_MD) uint16_t *id00 = (uint16_t *) (0x1FFFF7E8); uint16_t *id01 = (uint16_t *) (0x1FFFF7E8 + 0x02); uint32_t *id1 = (uint32_t *) (0x1FFFF7E8 + 0x04); uint32_t *id2 = (uint32_t *) (0x1FFFF7E8 + 0x08); - ::sprintf(UDID, "%04X%04X%08X%08X", *id00,*id01,*id1,*id2); + ::sprintf(UDID, "%04X%04X%08X%08X", *id00, *id01, *(unsigned int *)id1, *(unsigned int *)id2); #endif switch (n) { From 623d4bb3512959ca46b30ecea8a599749ffb6883 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 19:03:29 -0300 Subject: [PATCH 186/239] Add some building messages --- scripts/build_fw.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 43fd722..6729d12 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -16,95 +16,143 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +echo "******************************************************" +echo "********* Cleaning objects and updating code *********" +echo "******************************************************" cd ~/MMDVM_HS/ make clean git pull # Building ZUMspot Libre Kit +echo "*******************************************************" +echo "********* Building ZUMspot Libre Kit firmware *********" +echo "*******************************************************" cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h make bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_libre_fw.bin make clean # Building ZUMspot RPi +echo "*************************************************" +echo "********* Building ZUMspot RPi firmware *********" +echo "*************************************************" cp ~/MMDVM_HS/configs/ZUMspot_RPi.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_rpi_fw.bin make clean # Building ZUMspot USB +echo "*************************************************" +echo "********* Building ZUMspot USB firmware *********" +echo "*************************************************" cp ~/MMDVM_HS/configs/ZUMspot_USB.h ~/MMDVM_HS/Config.h make bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_usb_fw.bin make clean # Building ZUMspot Duplex +echo "****************************************************" +echo "********* Building ZUMspot Duplex firmware *********" +echo "****************************************************" cp ~/MMDVM_HS/configs/ZUMspot_duplex.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin make clean # Building ZUMspot Dualband +echo "******************************************************" +echo "********* Building ZUMspot Dualband firmware *********" +echo "******************************************************" cp ~/MMDVM_HS/configs/ZUMspot_dualband.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_dualband_fw.bin make clean # Building MMDVM_HS_Hat +echo "**************************************************" +echo "********* Building MMDVM_HS_Hat firmware *********" +echo "**************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Hat.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw.bin make clean # Building MMDVM_HS_Hat (12.288 MHz TCXO) +echo "********************************************************************" +echo "********* Building MMDVM_HS_Hat (12.288 MHz TCXO) firmware *********" +echo "********************************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Hat-12mhz.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw-12mhz.bin make clean # Building MMDVM_HS_Dual_Hat +echo "*******************************************************" +echo "********* Building MMDVM_HS_Dual_Hat firmware *********" +echo "*******************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw.bin make clean # Building MMDVM_HS_Dual_Hat (12.288 MHz TCXO) +echo "*************************************************************************" +echo "********* Building MMDVM_HS_Dual_Hat (12.288 MHz TCXO) firmware *********" +echo "*************************************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat-12mhz.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw-12mhz.bin make clean # Building Nano hotSPOT +echo "**************************************************" +echo "********* Building Nano hotSPOT firmware *********" +echo "**************************************************" cp ~/MMDVM_HS/configs/Nano_hotSPOT.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_hotspot_fw.bin make clean # Building NanoDV NPi +echo "************************************************" +echo "********* Building NanoDV NPi firmware *********" +echo "************************************************" cp ~/MMDVM_HS/configs/NanoDV_NPi.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nanodv_npi_fw.bin make clean # Building NanoDV USB +echo "************************************************" +echo "********* Building NanoDV USB firmware *********" +echo "************************************************" cp ~/MMDVM_HS/configs/NanoDV_USB.h ~/MMDVM_HS/Config.h make bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/nanodv_usb_fw.bin make clean # Building D2RG MMDVM_HS +echo "***************************************************" +echo "********* Building D2RG MMDVM_HS firmware *********" +echo "***************************************************" cp ~/MMDVM_HS/configs/D2RG_MMDVM_HS.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/d2rg_mmdvm_hs.bin make clean # Building Generic Simplex GPIO +echo "**********************************************************" +echo "********* Building Generic Simplex GPIO firmware *********" +echo "**********************************************************" cp ~/MMDVM_HS/configs/generic_gpio.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_gpio_fw.bin make clean # Building Generic Duplex GPIO +echo "*********************************************************" +echo "********* Building Generic Duplex GPIO firmware *********" +echo "*********************************************************" cp ~/MMDVM_HS/configs/generic_duplex_gpio.h ~/MMDVM_HS/Config.h make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_duplex_gpio_fw.bin From 5fdf64d7d066d5943f4ebf163be7023ec86741ed Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 19:55:35 -0300 Subject: [PATCH 187/239] Add binary fw for generic duplex usb boards (old ZUMspot duplex) --- configs/generic_duplex_usb.h | 111 +++++++++++++++++++++++++++++++++++ scripts/build_fw.sh | 9 +++ 2 files changed, 120 insertions(+) create mode 100644 configs/generic_duplex_usb.h diff --git a/configs/generic_duplex_usb.h b/configs/generic_duplex_usb.h new file mode 100644 index 0000000..1a5a05d --- /dev/null +++ b/configs/generic_duplex_usb.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +#define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +#define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + +// Host communication selection: +// #define STM32_USART1_HOST +#define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +// #define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 9600 + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Engage a constant or descreet Service LED mode once repeater is running +// #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED + +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + +// Enable for RPi 3B+, USB mode +#define LONG_USB_RESET + +// Enable modem debug messages +// #define ENABLE_DEBUG + +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + +#endif diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 6729d12..4ea323e 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -158,4 +158,13 @@ make mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_duplex_gpio_fw.bin make clean +# Building Generic Duplex USB +echo "********************************************************" +echo "********* Building Generic Duplex USB firmware *********" +echo "********************************************************" +cp ~/MMDVM_HS/configs/generic_duplex_usb.h ~/MMDVM_HS/Config.h +make bl +mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/generic_duplex_usb_fw.bin +make clean + cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h From bdb610e973bdadaa531263fd421a66326ca44a13 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 19:57:04 -0300 Subject: [PATCH 188/239] Updating installer scripts --- scripts/install_fw_dualband.sh | 72 +++++++++++++++++++++++++++ scripts/install_fw_duplex.sh | 17 ++----- scripts/install_fw_duplex_usb.sh | 83 ++++++++++++++++++++++++++++++++ scripts/install_fw_librekit.sh | 2 +- 4 files changed, 159 insertions(+), 15 deletions(-) create mode 100755 scripts/install_fw_dualband.sh create mode 100755 scripts/install_fw_duplex_usb.sh diff --git a/scripts/install_fw_dualband.sh b/scripts/install_fw_dualband.sh new file mode 100755 index 0000000..4e46fa3 --- /dev/null +++ b/scripts/install_fw_dualband.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.4.17" + +# Download latest firmware for ZUMspot Dualband (GPIO) +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_dualband_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w zumspot_dualband_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index bd42a4a..6865ca9 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU # 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 @@ -18,11 +18,8 @@ # Configure latest version FW_VERSION="v1.4.17" - -# Change USB-serial port name ONLY in macOS -MAC_DEV_USB_SER="/dev/cu.usbmodem14401" -# Download latest firmware for ZUMspot Libre Kit +# Download latest firmware for ZUMspot Duplex (GPIO) curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_duplex_fw.bin # Download STM32F10X_Lib (only for binary tools) @@ -32,7 +29,6 @@ fi # Configure vars depending on OS if [ $(uname -s) == "Linux" ]; then - DEV_USB_SER="/dev/ttyACM0" if [ $(uname -m) == "x86_64" ]; then echo "Linux 64-bit detected" DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" @@ -62,7 +58,6 @@ fi if [ $(uname -s) == "Darwin" ]; then echo "macOS detected" - DEV_USB_SER=$MAC_DEV_USB_SER DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" @@ -72,12 +67,6 @@ fi # Stop MMDVMHost process to free serial port sudo killall MMDVMHost >/dev/null 2>&1 -# Reset ZUMspot to enter bootloader mode -eval sudo $DFU_RST $DEV_USB_SER 750 - # Upload the firmware -eval sudo $DFU_UTIL -D zumspot_duplex_fw.bin -d 1eaf:0003 -a 2 -R -R +eval sudo $STM32FLASH -v -w zumspot_duplex_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 -echo -echo "Please RESET your ZUMspot !" -echo diff --git a/scripts/install_fw_duplex_usb.sh b/scripts/install_fw_duplex_usb.sh new file mode 100755 index 0000000..028ddb4 --- /dev/null +++ b/scripts/install_fw_duplex_usb.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.4.17" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" + +# Download latest firmware for Generic duplex USB boards +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_duplex_usb_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Reset ZUMspot to enter bootloader mode +eval sudo $DFU_RST $DEV_USB_SER 750 + +# Upload the firmware +eval sudo $DFU_UTIL -D generic_duplex_usb_fw.bin -d 1eaf:0003 -a 2 -R -R + +echo +echo "Please RESET your MMDVM_HS board !" +echo diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index fdce89b..09b2e58 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -79,5 +79,5 @@ eval sudo $DFU_RST $DEV_USB_SER 750 eval sudo $DFU_UTIL -D zumspot_libre_fw.bin -d 1eaf:0003 -a 2 -R -R echo -echo "Please RESET your ZUMspot !" +echo "Please RESET your ZUMspot Libre Kit !" echo From 146e6fb3e629e05302326bad8a27b8e8526ccca3 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 20:28:55 -0300 Subject: [PATCH 189/239] Update docs --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4c36398..16011b4 100644 --- a/README.md +++ b/README.md @@ -119,19 +119,22 @@ This utility includes firmwares binaries and USB drivers for Windows 7/8/10. If Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: +- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface - install_fw_rpi.sh: only for ZUMspot RPi board (KI6ZUM & VE2GZI) +- install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM) +- install_fw_duplex.sh: only for ZUMspot Duplex for RPi (KI6ZUM) +- install_fw_dualband.sh: only for ZUMspot Dualband for RPi (KI6ZUM) - install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET) - install_fw_hshat-12mhz.sh: only for MMDVM_HS_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET) +- install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) +- install_fw_hsdualhat-12mhz.sh: only for MMDVM_HS_Dual_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET & DO7EN) - install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA) - install_fw_nanodv_npi.sh: only for NanoDV NPi board 1.0 (BG4TGO & BG5HHP) - install_fw_nanodv_usb.sh: only for NanoDV USB board 1.0 (BG4TGO & BG5HHP) - install_fw_d2rg_mmdvmhs.sh: only for D2RG MMDVM_HS board (BG3MDO, VE2GZI, CA6JAU) -- install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN) -- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface -- install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM & VE2GZI) -- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with USB interface - install_fw_gen_gpio.sh: only for generic MMDVM_HS board (EA7GIB) with GPIO serial interface - install_fw_duplex_gpio.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with GPIO serial interface +- install_fw_duplex_usb.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with USB interface For example, download the ZUMspot RPi upgrade script: From 1210748cdb8bd0f4eabdc3445800ce257982609f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 21:20:26 -0300 Subject: [PATCH 190/239] UDID is now optional (disabled in some boards to save flash memory) --- Config.h | 3 +++ SerialPort.cpp | 4 ++++ SerialSTM.cpp | 4 ++++ configs/D2RG_MMDVM_HS.h | 3 +++ configs/MMDVM_HS_Dual_Hat-12mhz.h | 3 +++ configs/MMDVM_HS_Dual_Hat.h | 3 +++ configs/MMDVM_HS_Hat-12mhz.h | 3 +++ configs/MMDVM_HS_Hat.h | 3 +++ configs/NanoDV_NPI.h | 3 +++ configs/NanoDV_USB.h | 3 +++ configs/Nano_hotSPOT.h | 3 +++ configs/ZUMspot_Libre.h | 3 +++ configs/ZUMspot_RPi.h | 3 +++ configs/ZUMspot_USB.h | 3 +++ configs/ZUMspot_dualband.h | 3 +++ configs/ZUMspot_duplex.h | 3 +++ configs/generic_duplex_gpio.h | 3 +++ configs/generic_duplex_usb.h | 3 +++ configs/generic_gpio.h | 3 +++ 19 files changed, 59 insertions(+) diff --git a/Config.h b/Config.h index 2f41693..842d5df 100644 --- a/Config.h +++ b/Config.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +// #define ENABLE_UDID + #endif diff --git a/SerialPort.cpp b/SerialPort.cpp index e155220..1d5ff50 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -78,7 +78,9 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; const uint8_t PROTOCOL_VERSION = 1U; +#if defined(ENABLE_UDID) char UDID[] = "00000000000000000000000000000000"; +#endif CSerialPort::CSerialPort() : m_buffer(), @@ -211,9 +213,11 @@ void CSerialPort::getVersion() for (uint8_t i = 0U; HARDWARE[i] != 0x00U; i++, count++) reply[count] = HARDWARE[i]; +#if defined(ENABLE_UDID) reply[count++] = '\0'; for (uint8_t i = 0U; UDID[i] != 0x00U; i++, count++) reply[count] = UDID[i]; +#endif reply[1U] = count; diff --git a/SerialSTM.cpp b/SerialSTM.cpp index 3977878..61c20d3 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -433,13 +433,16 @@ void WriteUSART2(const uint8_t* data, uint16_t length) #endif ///////////////////////////////////////////////////////////////// +#if defined(ENABLE_UDID) extern char UDID[]; extern "C" { #include } +#endif void CSerialPort::beginInt(uint8_t n, int speed) { +#if defined(ENABLE_UDID) #if defined(STM32F4XX) uint32_t *id0 = (uint32_t *) (0x1FFF7A10); uint32_t *id1 = (uint32_t *) (0x1FFF7A10 + 0x04); @@ -458,6 +461,7 @@ void CSerialPort::beginInt(uint8_t n, int speed) uint32_t *id1 = (uint32_t *) (0x1FFFF7E8 + 0x04); uint32_t *id2 = (uint32_t *) (0x1FFFF7E8 + 0x08); ::sprintf(UDID, "%04X%04X%08X%08X", *id00, *id01, *(unsigned int *)id1, *(unsigned int *)id2); +#endif #endif switch (n) { diff --git a/configs/D2RG_MMDVM_HS.h b/configs/D2RG_MMDVM_HS.h index abde186..9c55cf2 100644 --- a/configs/D2RG_MMDVM_HS.h +++ b/configs/D2RG_MMDVM_HS.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +// #define ENABLE_UDID + #endif diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index df6d0d9..88779ef 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index 64e600d..ace2477 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 56ad528..34d38f2 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index a847690..643a817 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 50bb008..8f987d7 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index eab6287..ce20034 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +// #define ENABLE_UDID + #endif diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 55d93e2..187cab6 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 2f41693..842d5df 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +// #define ENABLE_UDID + #endif diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index 653a0e5..f7cd5f6 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index 59b926c..b055bfb 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -107,4 +107,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +// #define ENABLE_UDID + #endif diff --git a/configs/ZUMspot_dualband.h b/configs/ZUMspot_dualband.h index f21c673..d974f08 100644 --- a/configs/ZUMspot_dualband.h +++ b/configs/ZUMspot_dualband.h @@ -106,4 +106,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index e90676f..80da2c5 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +// #define ENABLE_UDID + #endif diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 172ec76..96428b9 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif diff --git a/configs/generic_duplex_usb.h b/configs/generic_duplex_usb.h index 1a5a05d..b1e7b74 100644 --- a/configs/generic_duplex_usb.h +++ b/configs/generic_duplex_usb.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +// #define ENABLE_UDID + #endif diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index 9d95d06..e946f12 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -108,4 +108,7 @@ // Disable frequency restrictions (satellite, ISS, etc) // #define DISABLE_FREQ_BAN +// Enable UDID feature +#define ENABLE_UDID + #endif From 3c0c3abcc3add0403ed992b58c5e3526a0e90ceb Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 21:34:23 -0300 Subject: [PATCH 191/239] Changing version (beta) --- version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.h b/version.h index c793bd2..7b8019f 100644 --- a/version.h +++ b/version.h @@ -23,9 +23,9 @@ #include "ADF7021.h" #define VER_MAJOR "1" -#define VER_MINOR "4" -#define VER_REV "17" -#define VERSION_DATE "20190529" +#define VER_MINOR "5" +#define VER_REV "1b" +#define VERSION_DATE "20191201" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 98895e5939a87c7c999cb624759528a5a3210df1 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 22:36:45 -0300 Subject: [PATCH 192/239] Add beta fw support for installer scripts --- scripts/install_fw_d2rg_mmdvmhs.sh | 18 +++++++++++++++--- scripts/install_fw_dualband.sh | 18 +++++++++++++++--- scripts/install_fw_duplex.sh | 18 +++++++++++++++--- scripts/install_fw_duplex_gpio.sh | 19 +++++++++++++++++-- scripts/install_fw_duplex_usb.sh | 18 +++++++++++++++--- scripts/install_fw_gen_gpio.sh | 18 +++++++++++++++--- scripts/install_fw_hsdualhat-12mhz.sh | 18 +++++++++++++++--- scripts/install_fw_hsdualhat.sh | 18 +++++++++++++++--- scripts/install_fw_hshat-12mhz.sh | 18 +++++++++++++++--- scripts/install_fw_hshat.sh | 18 +++++++++++++++--- scripts/install_fw_librekit.sh | 18 +++++++++++++++--- scripts/install_fw_nanodv_npi.sh | 18 +++++++++++++++--- scripts/install_fw_nanodv_usb.sh | 18 +++++++++++++++--- scripts/install_fw_nanohs.sh | 18 +++++++++++++++--- scripts/install_fw_rpi.sh | 18 +++++++++++++++--- scripts/install_fw_usb.sh | 18 +++++++++++++++--- 16 files changed, 242 insertions(+), 47 deletions(-) diff --git a/scripts/install_fw_d2rg_mmdvmhs.sh b/scripts/install_fw_d2rg_mmdvmhs.sh index 33da9f4..ea5fca8 100755 --- a/scripts/install_fw_d2rg_mmdvmhs.sh +++ b/scripts/install_fw_d2rg_mmdvmhs.sh @@ -19,8 +19,20 @@ # Configure latest version FW_VERSION="v1.4.17" -# Download latest firmware for D2RG MMDVM_HS -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/d2rg_mmdvm_hs.bin +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="d2rg_mmdvm_hs.bin" + +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -69,5 +81,5 @@ sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware # Note: /dev/ttySC0 should be enabled, see: https://github.com/bg3mdo/D2RG_MMDVM_HS_ambe_uart_service -eval sudo $STM32FLASH -v -w d2rg_mmdvm_hs.bin -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0 diff --git a/scripts/install_fw_dualband.sh b/scripts/install_fw_dualband.sh index 4e46fa3..8ed3607 100755 --- a/scripts/install_fw_dualband.sh +++ b/scripts/install_fw_dualband.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="zumspot_dualband_fw.bin" -# Download latest firmware for ZUMspot Dualband (GPIO) -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_dualband_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w zumspot_dualband_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 6865ca9..ac46940 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="zumspot_duplex_fw.bin" -# Download latest firmware for ZUMspot Duplex (GPIO) -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_duplex_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w zumspot_duplex_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index 8c8cbcf..dd89633 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -18,9 +18,24 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="generic_duplex_gpio_fw.bin" +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi + # Download latest firmware for Generic Duplex GPIO -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_duplex_gpio_fw.bin +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/ # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +83,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w generic_duplex_gpio_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_duplex_usb.sh b/scripts/install_fw_duplex_usb.sh index 028ddb4..56aa0cc 100755 --- a/scripts/install_fw_duplex_usb.sh +++ b/scripts/install_fw_duplex_usb.sh @@ -21,9 +21,21 @@ FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="generic_duplex_usb_fw.bin" -# Download latest firmware for Generic duplex USB boards -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_duplex_usb_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -76,7 +88,7 @@ sudo killall MMDVMHost >/dev/null 2>&1 eval sudo $DFU_RST $DEV_USB_SER 750 # Upload the firmware -eval sudo $DFU_UTIL -D generic_duplex_usb_fw.bin -d 1eaf:0003 -a 2 -R -R +eval sudo $DFU_UTIL -D $FW_FILENAME -d 1eaf:0003 -a 2 -R -R echo echo "Please RESET your MMDVM_HS board !" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index e0779e7..8afeec9 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="generic_gpio_fw.bin" -# Download latest firmware for Generic Simplex GPIO -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/generic_gpio_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w generic_gpio_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 5bcc132..5bc76db 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="mmdvm_hs_dual_hat_fw-12mhz.bin" -# Download latest firmware for MMDVM_HS_Hat -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw-12mhz.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w mmdvm_hs_dual_hat_fw-12mhz.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index a967630..7123c55 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="mmdvm_hs_dual_hat_fw.bin" -# Download latest firmware for MMDVM_HS_Hat -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_dual_hat_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w mmdvm_hs_dual_hat_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index ad1e280..6e86483 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="mmdvm_hs_hat_fw-12mhz.bin" -# Download latest firmware for MMDVM_HS_Hat with 12.288 MHz TCXO -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw-12mhz.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w mmdvm_hs_hat_fw-12mhz.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 76ae591..7ffa5da 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="mmdvm_hs_hat_fw.bin" -# Download latest firmware for MMDVM_HS_Hat -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w mmdvm_hs_hat_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 09b2e58..118c640 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -21,9 +21,21 @@ FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="zumspot_libre_fw.bin" -# Download latest firmware for ZUMspot Libre Kit -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_libre_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -76,7 +88,7 @@ sudo killall MMDVMHost >/dev/null 2>&1 eval sudo $DFU_RST $DEV_USB_SER 750 # Upload the firmware -eval sudo $DFU_UTIL -D zumspot_libre_fw.bin -d 1eaf:0003 -a 2 -R -R +eval sudo $DFU_UTIL -D $FW_FILENAME -d 1eaf:0003 -a 2 -R -R echo echo "Please RESET your ZUMspot Libre Kit !" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 895cef1..1fe2349 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="nanodv_npi_fw.bin" -# Download latest firmware for Nano DV -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nanodv_npi_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w nanodv_npi_fw.bin -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0 diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 71f41bf..116acb6 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -21,9 +21,21 @@ FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="nanodv_usb_fw.bin" -# Download latest firmware for ZUMspot USB -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nanodv_usb_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -76,7 +88,7 @@ sudo killall MMDVMHost >/dev/null 2>&1 eval sudo $DFU_RST $DEV_USB_SER 750 # Upload the firmware -eval sudo $DFU_UTIL -D nanodv_usb_fw.bin -d 1eaf:0003 -a 2 -R -R +eval sudo $DFU_UTIL -D $FW_FILENAME -d 1eaf:0003 -a 2 -R -R echo echo "Please RESET your Nano DV !" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index d650f57..e345fa7 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="nano_hotspot_fw.bin" -# Download latest firmware for Nano hotSPOT -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/nano_hotspot_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w nano_hotspot_fw.bin -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0 diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 6b160f5..ae8639e 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -18,9 +18,21 @@ # Configure latest version FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="zumspot_rpi_fw.bin" -# Download latest firmware for ZUMspot RPi (GPIO) -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_rpi_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -68,5 +80,5 @@ fi sudo killall MMDVMHost >/dev/null 2>&1 # Upload the firmware -eval sudo $STM32FLASH -v -w zumspot_rpi_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index fc06b4c..3de199a 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -21,9 +21,21 @@ FW_VERSION="v1.4.17" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="zumspot_usb_fw.bin" -# Download latest firmware for ZUMspot USB -curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_usb_fw.bin +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi # Download STM32F10X_Lib (only for binary tools) if [ ! -d "./STM32F10X_Lib/utils" ]; then @@ -76,7 +88,7 @@ sudo killall MMDVMHost >/dev/null 2>&1 eval sudo $DFU_RST $DEV_USB_SER 750 # Upload the firmware -eval sudo $DFU_UTIL -D zumspot_usb_fw.bin -d 1eaf:0003 -a 2 -R -R +eval sudo $DFU_UTIL -D $FW_FILENAME -d 1eaf:0003 -a 2 -R -R echo echo "Please RESET your ZUMspot !" From f74043a040063cabad212121a20fd9d0a7005e77 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 1 Dec 2019 23:00:36 -0300 Subject: [PATCH 193/239] Update README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 16011b4..1750276 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,10 @@ stop your MMDVMHost process and run (you will need the root password): and wait to complete the upgrading process. +You could optionally install a beta firmware for testing: + + ./install_fw_rpi.sh beta + ## Build from the sources You could use example files from MMDVM_HS/configs folder and overwrite the Config.h file, in order to compile a firmware with default settings. There are a specific config file for each ZUMspot or any MMDVM_HS compatible boards. In general, there are two possible compilation ways: From 6dbb4360021117a7f294dc23f2bd4e7e4a6d934c Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 3 Dec 2019 11:11:54 +0300 Subject: [PATCH 194/239] add option to flash on orangepi pc\pc plus Add option to flash on orangepi pc\pc plus on /dev/ttyS3 --- Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Makefile b/Makefile index 92ebc9d..9c944e2 100644 --- a/Makefile +++ b/Makefile @@ -476,6 +476,19 @@ mmdvm_hs_hat: zumspot-pi mmdvm_hs_dual_hat: zumspot-pi +hotpot-opipc_opipcplus: +ifneq ($(wildcard /usr/local/bin/stm32flash),) + /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3 +endif + +ifneq ($(wildcard /usr/bin/stm32flash),) + /usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3 +endif + +mmdvm_hs_hat_opi: hotpot-opipc_opipcplus + +mmdvm_hs_dual_hat_opi: hotpot-opipc_opipcplus + dfu: ifdef devser $(DFU_RST) $(devser) 750 From dcc23cf6fae7a622b8c97e83b9e008f0b6c0cfa0 Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 3 Dec 2019 12:22:19 +0300 Subject: [PATCH 195/239] Install fw to opi Install fw to opi pc/pc plus --- scripts/install_fw_duplex_gpio_opi.sh | 86 +++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 scripts/install_fw_duplex_gpio_opi.sh diff --git a/scripts/install_fw_duplex_gpio_opi.sh b/scripts/install_fw_duplex_gpio_opi.sh new file mode 100644 index 0000000..ad60124 --- /dev/null +++ b/scripts/install_fw_duplex_gpio_opi.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.4.17" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="generic_duplex_gpio_fw.bin" + +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi + +# Download latest firmware for Generic Duplex GPIO +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/ + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3 From 4ce0878ca6c3798731a0cc7906ad4ac5c8868e7e Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 3 Dec 2019 16:38:08 +0300 Subject: [PATCH 196/239] added a description for orangepi added a description for orangepi --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 1750276..be8bb7b 100644 --- a/README.md +++ b/README.md @@ -319,3 +319,38 @@ Upload the firmware to ZUMspot RPi board: sudo make zumspot-pi +### MMDVM_HS_Dual_Hat\MMDVM_HS_Hat gpio fw update on OrangePI PC/PC Plus + +Install the necessary software tools: + + sudo apt-get update + sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi + +Download the sources: + + cd ~ + git clone https://github.com/juribeparada/MMDVM_HS + cd MMDVM_HS/ + git submodule init + git submodule update + +Install the tools for building fw + cd MMDVM_HS/scripts + ./install_buildtools.sh + +Copy /MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h or /MMDVM_HS/configs/MMDVM_HS_Hat.h (MMDVM_HS_Hat-12mhz.h) to /MMDVM_HS/Config.h and build the firmware: + + make + +Stop the MMDVMHost services: + + sudo systemctl stop mmdvmhost.timer + sudo systemctl stop mmdvmhost.service + +Upload the firmware to mmdvm_hs_dual_hat (mmdvm_hs_hat) on OrangePi PC\PC Plus: + + sudo make mmdvm_hs_dual_hat_opi (sudo make mmdvm_hs_hat_opi) +or + sudo /usr/local/bin/stm32flash -v -w bin/mmdvm_f1.bin -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3 + + From f212b8974cbe929d105eb5b54c17edaff6e933ef Mon Sep 17 00:00:00 2001 From: Sergei Date: Wed, 4 Dec 2019 18:00:36 +0300 Subject: [PATCH 197/239] edited the format in the command descriptions edited the format in the command descriptions --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index be8bb7b..bf0ebe9 100644 --- a/README.md +++ b/README.md @@ -319,7 +319,7 @@ Upload the firmware to ZUMspot RPi board: sudo make zumspot-pi -### MMDVM_HS_Dual_Hat\MMDVM_HS_Hat gpio fw update on OrangePI PC/PC Plus +### MMDVM_HS_Dual_Hat\MMDVM_HS_Hat gpio firmware update on OrangePI PC/PC2/PC Plus Install the necessary software tools: @@ -334,11 +334,12 @@ Download the sources: git submodule init git submodule update -Install the tools for building fw +Install the tools for building firmware + cd MMDVM_HS/scripts ./install_buildtools.sh -Copy /MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h or /MMDVM_HS/configs/MMDVM_HS_Hat.h (MMDVM_HS_Hat-12mhz.h) to /MMDVM_HS/Config.h and build the firmware: +Copy MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h or MMDVM_HS/configs/MMDVM_HS_Hat.h (MMDVM_HS_Hat-12mhz.h) to MMDVM_HS/Config.h and build the firmware: make @@ -347,10 +348,12 @@ Stop the MMDVMHost services: sudo systemctl stop mmdvmhost.timer sudo systemctl stop mmdvmhost.service -Upload the firmware to mmdvm_hs_dual_hat (mmdvm_hs_hat) on OrangePi PC\PC Plus: +Upload the firmware to mmdvm_hs_dual_hat (mmdvm_hs_hat) on OrangePi PC\PC2\PC Plus: sudo make mmdvm_hs_dual_hat_opi (sudo make mmdvm_hs_hat_opi) -or + +or + sudo /usr/local/bin/stm32flash -v -w bin/mmdvm_f1.bin -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3 From 414ea06098bc8d5abf628b53c2941ef77786891a Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Wed, 6 May 2020 09:50:30 +0100 Subject: [PATCH 198/239] Update CWIdTX.cpp Add "." to CWId - copied from G4KLX's commit - https://github.com/g4klx/MMDVM/commit/bd16d13531f04ca7a56500135b80681569e989d5 --- CWIdTX.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/CWIdTX.cpp b/CWIdTX.cpp index 8fb35b3..3963b6a 100644 --- a/CWIdTX.cpp +++ b/CWIdTX.cpp @@ -78,6 +78,7 @@ const struct { {',', 0xEEAEE000U, 22U}, {'-', 0xEAAE0000U, 18U}, {'=', 0xEAB80000U, 16U}, + {'.', 0xBAEB8000U, 20U}, {' ', 0x00000000U, 4U}, {0U, 0x00000000U, 0U} }; From 506740ba49a06d7cb51ddbc382d4004b968bd232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20S=C3=A1nchez=20Raya?= Date: Mon, 3 Aug 2020 09:15:35 +0200 Subject: [PATCH 199/239] 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 fa4a659..fda7430 100644 --- a/YSFRX.cpp +++ b/YSFRX.cpp @@ -25,7 +25,7 @@ const uint8_t SYNC_BIT_START_ERRS = 2U; const uint8_t SYNC_BIT_RUN_ERRS = 4U; -const unsigned int MAX_SYNC_FRAMES = 4U + 1U; +const unsigned int MAX_SYNC_FRAMES = 1U + 1U; const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; From bb9fe7f5611dea18313acd416f66651b9396722a Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 23 Oct 2020 14:43:06 +0100 Subject: [PATCH 200/239] Initial work on M17 support. ADF7021 parameters not correct or complete yet. --- ADF7021.cpp | 64 +++++++++++++- ADF7021.h | 15 ++++ Config.h | 3 + Globals.h | 9 +- IO.cpp | 30 ++++++- IO.h | 8 +- M17Defines.h | 47 ++++++++++ M17RX.cpp | 137 ++++++++++++++++++++++++++++++ M17RX.h | 51 +++++++++++ M17TX.cpp | 124 +++++++++++++++++++++++++++ M17TX.h | 50 +++++++++++ MMDVM_HS.cpp | 9 +- MMDVM_HS.ino | 9 +- SerialPort.cpp | 117 +++++++++++++++++++++---- SerialPort.h | 5 +- configs/D2RG_MMDVM_HS.h | 3 + configs/MMDVM_HS_Dual_Hat-12mhz.h | 3 + configs/MMDVM_HS_Dual_Hat.h | 3 + configs/MMDVM_HS_Hat-12mhz.h | 3 + configs/MMDVM_HS_Hat.h | 3 + configs/NanoDV_NPI.h | 3 + configs/NanoDV_USB.h | 3 + configs/Nano_hotSPOT.h | 3 + configs/ZUMspot_Libre.h | 3 + configs/ZUMspot_RPi.h | 3 + configs/ZUMspot_USB.h | 3 + configs/ZUMspot_dualband.h | 3 + configs/ZUMspot_duplex.h | 3 + configs/generic_duplex_gpio.h | 3 + configs/generic_duplex_usb.h | 3 + configs/generic_gpio.h | 3 + version.h | 2 +- 32 files changed, 702 insertions(+), 26 deletions(-) create mode 100644 M17Defines.h create mode 100644 M17RX.cpp create mode 100644 M17RX.h create mode 100644 M17TX.cpp create mode 100644 M17TX.h diff --git a/ADF7021.cpp b/ADF7021.cpp index 6ccfc07..da5c403 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -1,4 +1,5 @@ /* + * Copyright (C) 2020 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE @@ -48,6 +49,7 @@ uint16_t m_dmrDev; uint16_t m_ysfDev; uint16_t m_p25Dev; uint16_t m_nxdnDev; +uint16_t m_m17Dev; uint16_t m_pocsagDev; static void Send_AD7021_control_shift() @@ -273,6 +275,9 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) case STATE_NXDN: AFC_OFFSET = AFC_OFFSET_NXDN; break; + case STATE_M17: + AFC_OFFSET = AFC_OFFSET_M17; + break; default: break; } @@ -499,6 +504,33 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) #endif break; + case STATE_M17: + // Dev: +1 symb 600 Hz, symb rate = 4800 + + ADF7021_REG3 = ADF7021_REG3_M17; + ADF7021_REG10 = ADF7021_REG10_M17; + + // K=32 + ADF7021_REG4 = (uint32_t) 0b0100 << 0; // register 4 + ADF7021_REG4 |= (uint32_t) 0b011 << 4; // mode, 4FSK + ADF7021_REG4 |= (uint32_t) 0b0 << 7; + ADF7021_REG4 |= (uint32_t) 0b11 << 8; + ADF7021_REG4 |= (uint32_t) ADF7021_DISC_BW_M17 << 10; // Disc BW + ADF7021_REG4 |= (uint32_t) ADF7021_POST_BW_M17 << 20; // Post dem BW + ADF7021_REG4 |= (uint32_t) 0b00 << 30; // IF filter (12.5 kHz) + + ADF7021_REG13 = (uint32_t) 0b1101 << 0; // register 13 + ADF7021_REG13 |= (uint32_t) ADF7021_SLICER_TH_M17 << 4; // slicer threshold + + ADF7021_REG2 = (uint32_t) 0b10 << 28; // invert data (and RC alpha = 0.5) + ADF7021_REG2 |= (uint32_t) (m_m17Dev / div2) << 19; // deviation +#if defined(ADF7021_DISABLE_RC_4FSK) + ADF7021_REG2 |= (uint32_t) 0b011 << 4; // modulation (4FSK) +#else + ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) +#endif + break; + default: break; } @@ -721,6 +753,29 @@ void CIO::ifConf2(MMDVM_STATE modemState) ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) break; + case STATE_M17: + // Dev: +1 symb 600 Hz, symb rate = 4800 + + ADF7021_REG3 = ADF7021_REG3_M17; + ADF7021_REG10 = ADF7021_REG10_M17; + + // K=32 + ADF7021_REG4 = (uint32_t) 0b0100 << 0; // register 4 + ADF7021_REG4 |= (uint32_t) 0b011 << 4; // mode, 4FSK + ADF7021_REG4 |= (uint32_t) 0b0 << 7; + ADF7021_REG4 |= (uint32_t) 0b11 << 8; + ADF7021_REG4 |= (uint32_t) ADF7021_DISC_BW_M17 << 10; // Disc BW + ADF7021_REG4 |= (uint32_t) ADF7021_POST_BW_M17 << 20; // Post dem BW + ADF7021_REG4 |= (uint32_t) 0b00 << 30; // IF filter (12.5 kHz) + + ADF7021_REG13 = (uint32_t) 0b1101 << 0; // register 13 + ADF7021_REG13 |= (uint32_t) ADF7021_SLICER_TH_M17 << 4; // slicer threshold + + ADF7021_REG2 = (uint32_t) 0b10 << 28; // invert data (and RC alpha = 0.5) + ADF7021_REG2 |= (uint32_t) (m_m17Dev / div2) << 19; // deviation + ADF7021_REG2 |= (uint32_t) 0b111 << 4; // modulation (RC 4FSK) + break; + default: break; } @@ -959,7 +1014,7 @@ void CIO::setPower(uint8_t power) m_power = power >> 2; } -void CIO::setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, bool ysfLoDev) +void CIO::setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t m17TXLevel, uint8_t pocsagTXLevel, bool ysfLoDev) { m_dstarDev = uint16_t((ADF7021_DEV_DSTAR * uint16_t(dstarTXLevel)) / 128U); m_dmrDev = uint16_t((ADF7021_DEV_DMR * uint16_t(dmrTXLevel)) / 128U); @@ -971,6 +1026,7 @@ void CIO::setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXL m_p25Dev = uint16_t((ADF7021_DEV_P25 * uint16_t(p25TXLevel)) / 128U); m_nxdnDev = uint16_t((ADF7021_DEV_NXDN * uint16_t(nxdnTXLevel)) / 128U); + m_m17Dev = uint16_t((ADF7021_DEV_M17 * uint16_t(m17TXLevel)) / 128U); m_pocsagDev = uint16_t((ADF7021_DEV_POCSAG * uint16_t(pocsagTXLevel)) / 128U); } @@ -1090,6 +1146,11 @@ uint16_t CIO::devNXDN() return (uint16_t)((ADF7021_PFD * m_nxdnDev) / (f_div * 65536)); } +uint16_t CIO::devM17() +{ + return (uint16_t)((ADF7021_PFD * m_m17Dev) / (f_div * 65536)); +} + uint16_t CIO::devPOCSAG() { return (uint16_t)((ADF7021_PFD * m_pocsagDev) / (f_div * 65536)); @@ -1106,6 +1167,7 @@ void CIO::printConf() DEBUG2("YSF +1 sym dev (Hz):", devYSF()); DEBUG2("P25 +1 sym dev (Hz):", devP25()); DEBUG2("NXDN +1 sym dev (Hz):", devNXDN()); + DEBUG2("M17 +1 sym dev (Hz):", devM17()); DEBUG2("POCSAG dev (Hz):", devPOCSAG()); } diff --git a/ADF7021.h b/ADF7021.h index 19a2bb0..cd28ba6 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -87,6 +87,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 22U #endif #define ADF7021_DEV_NXDN 13U +#define ADF7021_DEV_M17 23U // XXX FIXME #define ADF7021_DEV_POCSAG 160U // TX/RX CLOCK register (REG 03) @@ -97,12 +98,14 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_YSF_H 0x2A4C0493 #define ADF7021_REG3_P25 0x2A4C04D3 #define ADF7021_REG3_NXDN 0x2A4C04D3 +#define ADF7021_REG3_M17 0x2A4C04D3 // XXX FIXME #else #define ADF7021_REG3_DMR 0x2A4C80D3 #define ADF7021_REG3_YSF_L 0x2A4C80D3 #define ADF7021_REG3_YSF_H 0x2A4CC093 #define ADF7021_REG3_P25 0x2A4C80D3 #define ADF7021_REG3_NXDN 0x2A4CC113 +#define ADF7021_REG3_M17 0x2A4C80D3 // XXX FIXME #endif #define ADF7021_REG3_POCSAG 0x2A4F0093 @@ -139,26 +142,31 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x01FE473A #define ADF7021_REG10_P25 0x01FE473A #define ADF7021_REG10_NXDN 0x01FE473A +#define ADF7021_REG10_M17 0x01FE473A #if defined(ADF7021_AFC_POS) #define AFC_OFFSET_DMR -250 #define AFC_OFFSET_YSF -250 #define AFC_OFFSET_P25 -250 #define AFC_OFFSET_NXDN -250 +#define AFC_OFFSET_M17 -250 #else #define AFC_OFFSET_DMR 250 #define AFC_OFFSET_YSF 250 #define AFC_OFFSET_P25 250 #define AFC_OFFSET_NXDN 250 +#define AFC_OFFSET_M17 250 #endif #else #define ADF7021_REG10_DMR 0x049E472A #define ADF7021_REG10_YSF 0x049E472A #define ADF7021_REG10_P25 0x049E472A #define ADF7021_REG10_NXDN 0x049E472A +#define ADF7021_REG10_M17 0x049E472A #define AFC_OFFSET_DMR 0 #define AFC_OFFSET_YSF 0 #define AFC_OFFSET_P25 0 #define AFC_OFFSET_NXDN 0 +#define AFC_OFFSET_M17 0 #endif /****** Support for 12.2880 MHz TCXO ******/ @@ -198,12 +206,14 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_YSF_H 0x29EC0493 #define ADF7021_REG3_P25 0x29EC0493 #define ADF7021_REG3_NXDN 0x29EC0493 +#define ADF7021_REG3_M17 0x29EC0493 #else #define ADF7021_REG3_DMR 0x29ECA093 #define ADF7021_REG3_YSF_L 0x29ECA093 #define ADF7021_REG3_YSF_H 0x29ECA093 #define ADF7021_REG3_P25 0x29ECA093 #define ADF7021_REG3_NXDN 0x29ECA113 +#define ADF7021_REG3_M17 0x29ECA093 #endif #define ADF7021_REG3_POCSAG 0x29EE8093 @@ -240,26 +250,31 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x01FE557A #define ADF7021_REG10_P25 0x01FE557A #define ADF7021_REG10_NXDN 0x01FE557A +#define ADF7021_REG10_M17 0x01FE557A #if defined(ADF7021_AFC_POS) #define AFC_OFFSET_DMR -250 #define AFC_OFFSET_YSF -250 #define AFC_OFFSET_P25 -250 #define AFC_OFFSET_NXDN -250 +#define AFC_OFFSET_M17 -250 #else #define AFC_OFFSET_DMR 250 #define AFC_OFFSET_YSF 250 #define AFC_OFFSET_P25 250 #define AFC_OFFSET_NXDN 250 +#define AFC_OFFSET_M17 250 #endif #else #define ADF7021_REG10_DMR 0x049E556A #define ADF7021_REG10_YSF 0x049E556A #define ADF7021_REG10_P25 0x049E556A #define ADF7021_REG10_NXDN 0x049E556A +#define ADF7021_REG10_M17 0x049E556A #define AFC_OFFSET_DMR 0 #define AFC_OFFSET_YSF 0 #define AFC_OFFSET_P25 0 #define AFC_OFFSET_NXDN 0 +#define AFC_OFFSET_M17 0 #endif #endif diff --git a/Config.h b/Config.h index 842d5df..faa6ee1 100644 --- a/Config.h +++ b/Config.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/Globals.h b/Globals.h index ffc0ad8..1bd5356 100644 --- a/Globals.h +++ b/Globals.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET * @@ -42,6 +42,7 @@ enum MMDVM_STATE { STATE_P25 = 4, STATE_NXDN = 5, STATE_POCSAG = 6, + STATE_M17 = 7, // Dummy states start at 90 STATE_DMRDMO1K = 92, @@ -77,6 +78,8 @@ const uint8_t MARK_NONE = 0x00U; #include "YSFTX.h" #include "P25RX.h" #include "P25TX.h" +#include "M17RX.h" +#include "M17TX.h" #include "NXDNRX.h" #include "NXDNTX.h" #include "POCSAGTX.h" @@ -103,6 +106,7 @@ extern bool m_dmrEnable; extern bool m_ysfEnable; extern bool m_p25Enable; extern bool m_nxdnEnable; +extern bool m_m17Enable; extern bool m_pocsagEnable; extern bool m_duplex; @@ -133,6 +137,9 @@ extern CYSFTX ysfTX; extern CP25RX p25RX; extern CP25TX p25TX; +extern CM17RX m17RX; +extern CM17TX m17TX; + extern CNXDNRX nxdnRX; extern CNXDNTX nxdnTX; diff --git a/IO.cpp b/IO.cpp index 805c21e..8c25acc 100644 --- a/IO.cpp +++ b/IO.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE @@ -51,6 +51,7 @@ m_int2counter(0U) YSF_pin(LOW); P25_pin(LOW); NXDN_pin(LOW); + M17_pin(LOW); POCSAG_pin(LOW); COS_pin(LOW); DEB_pin(LOW); @@ -89,6 +90,7 @@ void CIO::selfTest() YSF_pin(ledValue); P25_pin(ledValue); NXDN_pin(ledValue); + M17_pin(ledValue); POCSAG_pin(ledValue); COS_pin(ledValue); @@ -111,7 +113,7 @@ void CIO::process() if (m_started) { // Two seconds timeout if (m_watchdog >= 19200U) { - if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25 || m_modemState == STATE_NXDN) { + if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25 || m_modemState == STATE_NXDN || m_modemState == STATE_M17) { m_modemState = STATE_IDLE; setMode(m_modemState); } @@ -178,6 +180,8 @@ void CIO::process() scantime = SCAN_TIME; else if(m_modemState_prev == STATE_NXDN) scantime = SCAN_TIME; + else if(m_modemState_prev == STATE_M17) + scantime = SCAN_TIME; else scantime = SCAN_TIME; @@ -221,6 +225,9 @@ void CIO::process() case STATE_NXDN: nxdnRX.databit(bit); break; + case STATE_M17: + m17RX.databit(bit); + break; default: break; } @@ -252,6 +259,10 @@ void CIO::start() m_Modes[m_TotalModes] = STATE_NXDN; m_TotalModes++; } + if(m_m17Enable) { + m_Modes[m_TotalModes] = STATE_M17; + m_TotalModes++; + } #if defined(ENABLE_SCAN_MODE) if(m_TotalModes > 1U) @@ -412,6 +423,14 @@ void CIO::setMode(MMDVM_STATE modemState) #if defined(USE_ALTERNATE_NXDN_LEDS) } #endif +#if defined(USE_ALTERNATE_M17_LEDS) + if (modemState != STATE_M17) { +#endif + YSF_pin(modemState == STATE_DSTAR); + P25_pin(modemState == STATE_P25); +#if defined(USE_ALTERNATE_M17_LEDS) + } +#endif #if defined(USE_ALTERNATE_NXDN_LEDS) if (modemState != STATE_YSF && modemState != STATE_P25) { #endif @@ -426,6 +445,13 @@ void CIO::setMode(MMDVM_STATE modemState) #if defined(USE_ALTERNATE_POCSAG_LEDS) } #endif +#if defined(USE_ALTERNATE_M17_LEDS) + if (modemState != STATE_DSTAR && modemState != STATE_P25) { +#endif + M17_pin(modemState == STATE_M17); +#if defined(USE_ALTERNATE_M17_LEDS) + } +#endif } void CIO::setDecode(bool dcd) diff --git a/IO.h b/IO.h index fac37fe..5fec7fd 100644 --- a/IO.h +++ b/IO.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE @@ -98,6 +98,7 @@ public: void YSF_pin(bool on); void P25_pin(bool on); void NXDN_pin(bool on); + void M17_pin(bool on); void POCSAG_pin(bool on); void COS_pin(bool on); void interrupt(void); @@ -141,7 +142,7 @@ public: #endif void start(void); void startInt(void); - void setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t pocsagTXLevel, bool ysfLoDev); + void setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t m17TXLevel, uint8_t pocsagTXLevel, bool ysfLoDev); void updateCal(void); #if defined(SEND_RSSI_DATA) @@ -162,6 +163,7 @@ public: uint16_t devYSF(void); uint16_t devP25(void); uint16_t devNXDN(void); + uint16_t devM17(void); uint16_t devPOCSAG(void); void printConf(); #endif @@ -181,7 +183,7 @@ private: uint32_t m_scanPauseCnt; uint8_t m_scanPos; uint8_t m_TotalModes; - MMDVM_STATE m_Modes[5]; + MMDVM_STATE m_Modes[6]; bool m_ledValue; volatile uint32_t m_watchdog; volatile uint16_t m_int1counter; diff --git a/M17Defines.h b/M17Defines.h new file mode 100644 index 0000000..4947341 --- /dev/null +++ b/M17Defines.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2016,2017,2018,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 + * 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. + */ + +#if !defined(M17DEFINES_H) +#define M17DEFINES_H + +const unsigned int M17_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate + +const unsigned int M17_FRAME_LENGTH_BITS = 384U; +const unsigned int M17_FRAME_LENGTH_BYTES = M17_FRAME_LENGTH_BITS / 8U; +const unsigned int M17_FRAME_LENGTH_SYMBOLS = M17_FRAME_LENGTH_BITS / 2U; +const unsigned int M17_FRAME_LENGTH_SAMPLES = M17_FRAME_LENGTH_SYMBOLS * M17_RADIO_SYMBOL_LENGTH; + +const unsigned int M17_SYNC_LENGTH_BITS = 16U; +const unsigned int M17_SYNC_LENGTH_SYMBOLS = M17_SYNC_LENGTH_BITS / 2U; +const unsigned int M17_SYNC_LENGTH_SAMPLES = M17_SYNC_LENGTH_SYMBOLS * M17_RADIO_SYMBOL_LENGTH; + +const uint8_t M17_SYNC_BYTES[] = {0x32U, 0x43U}; +const uint8_t M17_SYNC_BYTES_LENGTH = 2U; + +const uint16_t M17_SYNC_BITS = 0x3243U; + +// 3 2 4 3 +// 00 11 00 10 01 00 00 11 +// +1 -3 +1 -1 +3 +1 +1 -3 + +const int8_t M17_SYNC_SYMBOLS_VALUES[] = {+1, -3, +1, -1, +3, +1, +1, -3}; + +const uint8_t M17_SYNC_SYMBOLS = 0xAEU; + +#endif + diff --git a/M17RX.cpp b/M17RX.cpp new file mode 100644 index 0000000..78c21f6 --- /dev/null +++ b/M17RX.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2009-2017,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#include "Config.h" +#include "Globals.h" +#include "M17RX.h" +#include "Utils.h" + +const uint8_t MAX_SYNC_BIT_START_ERRS = 0U; +const uint8_t MAX_SYNC_BIT_RUN_ERRS = 2U; + +const unsigned int MAX_SYNC_FRAMES = 5U + 1U; + +const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; + +#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7]) + +CM17RX::CM17RX() : +m_state(M17RXS_NONE), +m_bitBuffer(0x00U), +m_outBuffer(), +m_buffer(NULL), +m_bufferPtr(0U), +m_lostCount(0U) +{ + m_buffer = m_outBuffer + 1U; +} + +void CM17RX::reset() +{ + m_state = M17RXS_NONE; + m_bitBuffer = 0x00U; + m_bufferPtr = 0U; + m_lostCount = 0U; +} + +void CM17RX::databit(bool bit) +{ + if (m_state == M17RXS_NONE) + processNone(bit); + else + processData(bit); +} + +void CM17RX::processNone(bool bit) +{ + m_bitBuffer <<= 1; + if (bit) + m_bitBuffer |= 0x01U; + + // Fuzzy matching of the data sync bit sequence + if (countBits32(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { + DEBUG1("M17RX: sync found in None"); + for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) + m_buffer[i] = M17_SYNC_BYTES[i]; + + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + m_state = M17RXS_DATA; + + io.setDecode(true); + } + +} + +void CM17RX::processData(bool bit) +{ + m_bitBuffer <<= 1; + if (bit) + m_bitBuffer |= 0x01U; + + WRITE_BIT1(m_buffer, m_bufferPtr, bit); + + m_bufferPtr++; + if (m_bufferPtr > M17_FRAME_LENGTH_BITS) + reset(); + + // Only search for a sync in the right place +-2 symbols + if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { + // Fuzzy matching of the data sync bit sequence + if (countBits32(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + } + } + + // Send a data frame to the host if the required number of bits have been received + if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { + // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE + m_lostCount--; + if (m_lostCount == 0U) { + DEBUG1("M17RX: sync timed out, lost lock"); + io.setDecode(false); + serial.writeM17Lost(); + reset(); + } else { + // Write data to host + m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; + writeRSSIData(m_outBuffer); + + // Start the next frame + ::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U); + m_bufferPtr = 0U; + } + } +} + +void CM17RX::writeRSSIData(uint8_t* data) +{ +#if defined(SEND_RSSI_DATA) + uint16_t rssi = io.readRSSI(); + + data[49U] = (rssi >> 8) & 0xFFU; + data[50U] = (rssi >> 0) & 0xFFU; + + serial.writeM17Data(data, M17_FRAME_LENGTH_BYTES + 3U); +#else + serial.writeM17Data(data, M17_FRAME_LENGTH_BYTES + 1U); +#endif +} diff --git a/M17RX.h b/M17RX.h new file mode 100644 index 0000000..9ec7976 --- /dev/null +++ b/M17RX.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(M17RX_H) +#define M17RX_H + +#include "M17Defines.h" + +enum M17RX_STATE { + M17RXS_NONE, + M17RXS_DATA +}; + +class CM17RX { +public: + CM17RX(); + + void databit(bool bit); + + void reset(); + +private: + M17RX_STATE m_state; + uint32_t m_bitBuffer; + uint8_t m_outBuffer[M17_FRAME_LENGTH_BYTES + 3U]; + uint8_t* m_buffer; + uint16_t m_bufferPtr; + uint16_t m_lostCount; + + void processNone(bool bit); + void processData(bool bit); + void writeRSSIData(uint8_t* data); +}; + +#endif diff --git a/M17TX.cpp b/M17TX.cpp new file mode 100644 index 0000000..4123ed5 --- /dev/null +++ b/M17TX.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2009-2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2017 by Andy Uribe CA6JAU + * + * 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. + */ + +#include "Config.h" +#include "Globals.h" +#include "M17TX.h" + +#include "M17Defines.h" + +const uint8_t M17_SYNC = 0x77U; +const uint8_t M17_PREAMBLE = 0x77U; + +CM17TX::CM17TX() : +m_buffer(1500U), +m_poBuffer(), +m_poLen(0U), +m_poPtr(0U), +m_txDelay(240U), // 200ms +m_delay(false) +{ +} + +void CM17TX::process() +{ + if (m_buffer.getData() == 0U && m_poLen == 0U) + return; + + if (m_poLen == 0U) { + if (!m_tx) { + m_delay = true; + m_poLen = m_txDelay; + } else { + m_delay = false; + for (uint8_t i = 0U; i < M17_FRAME_LENGTH_BYTES; i++) + m_poBuffer[m_poLen++] = m_buffer.get(); + } + + m_poPtr = 0U; + } + + if (m_poLen > 0U) { + uint16_t space = io.getSpace(); + + while (space > 8U) { + if (m_delay) { + writeByte(M17_SYNC); + m_poPtr++; + } else + writeByte(m_poBuffer[m_poPtr++]); + + space -= 8U; + + if (m_poPtr >= m_poLen) { + if (m_delay) { + m_delay = false; + m_poPtr = 0U; + m_poLen = 3U; + } else { + m_poPtr = 0U; + m_poLen = 0U; + m_delay = false; + return; + } + } + } + } +} + +uint8_t CM17TX::writeData(const uint8_t* data, uint8_t length) +{ + if (length != (M17_FRAME_LENGTH_BYTES + 1U)) + return 4U; + + uint16_t space = m_buffer.getSpace(); + if (space < M17_FRAME_LENGTH_BYTES) + return 5U; + + for (uint8_t i = 0U; i < M17_FRAME_LENGTH_BYTES; i++) + m_buffer.put(data[i + 1U]); + + return 0U; +} + +void CM17TX::writeByte(uint8_t c) +{ + uint8_t bit; + uint8_t mask = 0x80U; + + for (uint8_t i = 0U; i < 8U; i++, c <<= 1) { + if ((c & mask) == mask) + bit = 1U; + else + bit = 0U; + + io.write(&bit, 1); + } +} + +void CM17TX::setTXDelay(uint8_t delay) +{ + m_txDelay = 600U + uint16_t(delay) * 12U; // 500ms + tx delay +} + +uint8_t CM17TX::getSpace() const +{ + return m_buffer.getSpace() / M17_FRAME_LENGTH_BYTES; +} + diff --git a/M17TX.h b/M17TX.h new file mode 100644 index 0000000..799794f --- /dev/null +++ b/M17TX.h @@ -0,0 +1,50 @@ +/* + * 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 + * 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. + */ + +#if !defined(M17TX_H) +#define M17TX_H + +#include "Config.h" + +#include "SerialRB.h" + +class CM17TX { +public: + CM17TX(); + + uint8_t writeData(const uint8_t* data, uint8_t length); + + void process(); + + void setTXDelay(uint8_t delay); + + uint8_t getSpace() const; + +private: + CSerialRB m_buffer; + uint8_t m_poBuffer[1200U]; + uint16_t m_poLen; + uint16_t m_poPtr; + uint16_t m_txDelay; + bool m_delay; + + void writeByte(uint8_t c); +}; + +#endif + diff --git a/MMDVM_HS.cpp b/MMDVM_HS.cpp index cd61683..aa6944c 100644 --- a/MMDVM_HS.cpp +++ b/MMDVM_HS.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Mathis Schmieder DB9MAT * Copyright (C) 2016 by Colin Durbridge G4EML * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU @@ -43,6 +43,7 @@ bool m_dmrEnable = true; bool m_ysfEnable = true; bool m_p25Enable = true; bool m_nxdnEnable = true; +bool m_m17Enable = true; bool m_pocsagEnable = true; bool m_duplex = false; @@ -70,6 +71,9 @@ CYSFTX ysfTX; CP25RX p25RX; CP25TX p25TX; +CM17RX m17RX; +CM17TX m17TX; + CNXDNRX nxdnRX; CNXDNTX nxdnTX; @@ -125,6 +129,9 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); + if (m_m17Enable && m_modemState == STATE_M17) + m17TX.process(); + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); diff --git a/MMDVM_HS.ino b/MMDVM_HS.ino index 7d55012..a302968 100644 --- a/MMDVM_HS.ino +++ b/MMDVM_HS.ino @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML * Copyright (C) 2016,2017 by Andy Uribe CA6JAU * @@ -38,6 +38,7 @@ bool m_dmrEnable = true; bool m_ysfEnable = true; bool m_p25Enable = true; bool m_nxdnEnable = true; +bool m_m17Enable = true; bool m_pocsagEnable = true; bool m_duplex = false; @@ -65,6 +66,9 @@ CYSFTX ysfTX; CP25RX p25RX; CP25TX p25TX; +CM17RX m17RX; +CM17TX m17TX; + CNXDNRX nxdnRX; CNXDNTX nxdnTX; @@ -115,6 +119,9 @@ void loop() if (m_nxdnEnable && m_modemState == STATE_NXDN) nxdnTX.process(); + if (m_m17Enable && m_modemState == STATE_M17) + m17TX.process(); + if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy())) pocsagTX.process(); diff --git a/SerialPort.cpp b/SerialPort.cpp index 1d5ff50..bd936c6 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013,2015,2016,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2013,2015,2016,2018,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET @@ -60,6 +60,9 @@ const uint8_t MMDVM_P25_LOST = 0x32U; const uint8_t MMDVM_NXDN_DATA = 0x40U; const uint8_t MMDVM_NXDN_LOST = 0x41U; +const uint8_t MMDVM_M17_DATA = 0x45U; +const uint8_t MMDVM_M17_LOST = 0x46U; + const uint8_t MMDVM_POCSAG_DATA = 0x50U; const uint8_t MMDVM_ACK = 0x70U; @@ -126,7 +129,7 @@ void CSerialPort::getStatus() // Send all sorts of interesting internal values reply[0U] = MMDVM_FRAME_START; - reply[1U] = 13U; + reply[1U] = 14U; reply[2U] = MMDVM_GET_STATUS; reply[3U] = 0x00U; @@ -142,6 +145,8 @@ void CSerialPort::getStatus() reply[3U] |= 0x10U; if (m_pocsagEnable) reply[3U] |= 0x20U; + if (m_m17Enable) + reply[3U] |= 0x80U; reply[4U] = uint8_t(m_modemState); @@ -196,7 +201,12 @@ void CSerialPort::getStatus() else reply[12U] = 0U; - writeInt(1U, reply, 13); + if (m_m17Enable) + reply[13U] = m17TX.getSpace(); + else + reply[13U] = 0U; + + writeInt(1U, reply, 14); } void CSerialPort::getVersion() @@ -226,7 +236,7 @@ void CSerialPort::getVersion() uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) { - if (length < 13U) + if (length < 23U) return 4U; bool ysfLoDev = (data[0U] & 0x08U) == 0x08U; @@ -240,6 +250,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) bool p25Enable = (data[1U] & 0x08U) == 0x08U; bool nxdnEnable = (data[1U] & 0x10U) == 0x10U; bool pocsagEnable = (data[1U] & 0x20U) == 0x20U; + bool m17Enable = (data[1U] & 0x80U) == 0x80U; uint8_t txDelay = data[2U]; if (txDelay > 50U) @@ -247,7 +258,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) MMDVM_STATE modemState = MMDVM_STATE(data[3U]); - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_INTCAL && modemState != STATE_RSSICAL && modemState != STATE_POCSAGCAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_M17 && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_INTCAL && modemState != STATE_RSSICAL && modemState != STATE_POCSAGCAL) return 4U; if (modemState == STATE_DSTAR && !dstarEnable) return 4U; @@ -261,6 +272,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) return 4U; if (modemState == STATE_POCSAG && !pocsagEnable) return 4U; + if (modemState == STATE_M17 && !m17Enable) + return 4U; uint8_t colorCode = data[6U]; if (colorCode > 15U) @@ -276,22 +289,18 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) uint8_t dmrTXLevel = data[10U]; uint8_t ysfTXLevel = data[11U]; uint8_t p25TXLevel = data[12U]; - uint8_t nxdnTXLevel = 128U; - uint8_t pocsagTXLevel = 128U; + uint8_t nxdnTXLevel = data[15U]; + uint8_t pocsagTXLevel = data[17U]; + uint8_t m17TXLevel = data[21U]; - if (length >= 16U) - nxdnTXLevel = data[15U]; - - if (length >= 18U) - pocsagTXLevel = data[17U]; - - io.setDeviations(dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, pocsagTXLevel, ysfLoDev); + io.setDeviations(dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, m17TXLevel, pocsagTXLevel, ysfLoDev); m_dstarEnable = dstarEnable; m_dmrEnable = dmrEnable; m_ysfEnable = ysfEnable; m_p25Enable = p25Enable; m_nxdnEnable = nxdnEnable; + m_m17Enable = m17Enable; m_pocsagEnable = pocsagEnable; if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) { @@ -332,6 +341,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) ysfTX.setTXDelay(txDelay); p25TX.setTXDelay(txDelay); nxdnTX.setTXDelay(txDelay); + m17TX.setTXDelay(txDelay); pocsagTX.setTXDelay(txDelay); dmrDMOTX.setTXDelay(txDelay); @@ -357,6 +367,8 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) io.ifConf(STATE_P25, true); else if(m_nxdnEnable) io.ifConf(STATE_NXDN, true); + else if(m_m17Enable) + io.ifConf(STATE_M17, true); else if(m_pocsagEnable) io.ifConf(STATE_POCSAG, true); } @@ -383,7 +395,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) if (modemState == m_modemState) return 0U; - if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL && modemState != STATE_POCSAGCAL) + if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_M17 && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL && modemState != STATE_POCSAGCAL) return 4U; if (modemState == STATE_DSTAR && !m_dstarEnable) return 4U; @@ -395,6 +407,8 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) return 4U; if (modemState == STATE_NXDN && !m_nxdnEnable) return 4U; + if (modemState == STATE_M17 && !m_m17Enable) + return 4U; if (modemState == STATE_POCSAG && !m_pocsagEnable) return 4U; @@ -469,6 +483,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState) ysfRX.reset(); p25RX.reset(); nxdnRX.reset(); + m17RX.reset(); cwIdTX.reset(); break; case STATE_DSTAR: @@ -481,6 +496,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState) ysfRX.reset(); p25RX.reset(); nxdnRX.reset(); + m17RX.reset(); cwIdTX.reset(); break; case STATE_YSF: @@ -493,6 +509,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState) dstarRX.reset(); p25RX.reset(); nxdnRX.reset(); + m17RX.reset(); cwIdTX.reset(); break; case STATE_P25: @@ -505,6 +522,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState) dstarRX.reset(); ysfRX.reset(); nxdnRX.reset(); + m17RX.reset(); cwIdTX.reset(); break; case STATE_NXDN: @@ -517,6 +535,20 @@ void CSerialPort::setMode(MMDVM_STATE modemState) dstarRX.reset(); ysfRX.reset(); p25RX.reset(); + m17RX.reset(); + cwIdTX.reset(); + break; + case STATE_M17: + DEBUG1("Mode set to M17"); +#if defined(DUPLEX) + dmrIdleRX.reset(); + dmrRX.reset(); +#endif + dmrDMORX.reset(); + dstarRX.reset(); + ysfRX.reset(); + p25RX.reset(); + nxdnRX.reset(); cwIdTX.reset(); break; case STATE_POCSAG: @@ -530,6 +562,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState) ysfRX.reset(); p25RX.reset(); nxdnRX.reset(); + m17RX.reset(); cwIdTX.reset(); break; default: @@ -831,6 +864,20 @@ void CSerialPort::process() } break; + case MMDVM_M17_DATA: + if (m_m17Enable) { + if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) + err = m17TX.writeData(m_buffer + 3U, m_len - 3U); + } + if (err == 0U) { + if (m_modemState == STATE_IDLE) + setMode(STATE_M17); + } else { + DEBUG2("Received invalid M17 data", err); + sendNAK(err); + } + break; + case MMDVM_POCSAG_DATA: if (m_pocsagEnable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_POCSAG) { @@ -1186,6 +1233,46 @@ void CSerialPort::writeNXDNLost() writeInt(1U, reply, 3); } +void CSerialPort::writeM17Data(const uint8_t* data, uint8_t length) +{ + if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) + return; + + if (!m_m17Enable) + return; + + uint8_t reply[130U]; + + reply[0U] = MMDVM_FRAME_START; + reply[1U] = 0U; + reply[2U] = MMDVM_M17_DATA; + + uint8_t count = 3U; + for (uint8_t i = 0U; i < length; i++, count++) + reply[count] = data[i]; + + reply[1U] = count; + + writeInt(1U, reply, count); +} + +void CSerialPort::writeM17Lost() +{ + if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) + return; + + if (!m_m17Enable) + return; + + uint8_t reply[3U]; + + reply[0U] = MMDVM_FRAME_START; + reply[1U] = 3U; + reply[2U] = MMDVM_M17_LOST; + + writeInt(1U, reply, 3); +} + #if defined(SEND_RSSI_DATA) void CSerialPort::writeRSSIData(const uint8_t* data, uint8_t length) diff --git a/SerialPort.h b/SerialPort.h index 7061b33..c9cbddb 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2018,2020 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -52,6 +52,9 @@ public: void writeNXDNData(const uint8_t* data, uint8_t length); void writeNXDNLost(); + void writeM17Data(const uint8_t* data, uint8_t length); + void writeM17Lost(); + #if defined(SEND_RSSI_DATA) void writeRSSIData(const uint8_t* data, uint8_t length); #endif diff --git a/configs/D2RG_MMDVM_HS.h b/configs/D2RG_MMDVM_HS.h index 9c55cf2..0a69e69 100644 --- a/configs/D2RG_MMDVM_HS.h +++ b/configs/D2RG_MMDVM_HS.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 88779ef..6fdda74 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index ace2477..d6dfd04 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 34d38f2..f5cffff 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 643a817..a1d3cea 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 8f987d7..c5b5769 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index ce20034..c539483 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 187cab6..0d99096 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 842d5df..faa6ee1 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index f7cd5f6..dd86a47 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index b055bfb..a2e2a16 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -92,6 +92,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/ZUMspot_dualband.h b/configs/ZUMspot_dualband.h index d974f08..162478f 100644 --- a/configs/ZUMspot_dualband.h +++ b/configs/ZUMspot_dualband.h @@ -91,6 +91,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 80da2c5..e837fbc 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 96428b9..d8f1d1c 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/generic_duplex_usb.h b/configs/generic_duplex_usb.h index b1e7b74..4789c55 100644 --- a/configs/generic_duplex_usb.h +++ b/configs/generic_duplex_usb.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index e946f12..eb93ed1 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -93,6 +93,9 @@ // Use the YSF and P25 LEDs for NXDN // #define USE_ALTERNATE_NXDN_LEDS +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + // Use the D-Star and DMR LEDs for POCSAG // #define USE_ALTERNATE_POCSAG_LEDS diff --git a/version.h b/version.h index 7b8019f..531c923 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "1b" -#define VERSION_DATE "20191201" +#define VERSION_DATE "20201023" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From fc9cb227f3fc9a5a0ad825a23bce29d4d59b33f0 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 23 Oct 2020 17:05:16 +0100 Subject: [PATCH 201/239] Add M17 LED support. --- ADF7021.h | 19 +++++++++++++------ IOSTM.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/ADF7021.h b/ADF7021.h index cd28ba6..7508439 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -117,6 +117,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 516U // K=28 #define ADF7021_DISC_BW_P25 394U // K=32 #define ADF7021_DISC_BW_NXDN 295U // K=32 +#define ADF7021_DISC_BW_M17 393U // XXX FIXME #define ADF7021_DISC_BW_POCSAG 406U // K=22 // Post demodulator bandwith (REG 04) @@ -125,6 +126,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 7U +#define ADF7021_POST_BW_M17 7U // XXX FIXME #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) @@ -142,7 +144,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x01FE473A #define ADF7021_REG10_P25 0x01FE473A #define ADF7021_REG10_NXDN 0x01FE473A -#define ADF7021_REG10_M17 0x01FE473A +#define ADF7021_REG10_M17 0x01FE473A // XXX FIXME #if defined(ADF7021_AFC_POS) #define AFC_OFFSET_DMR -250 #define AFC_OFFSET_YSF -250 @@ -161,7 +163,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x049E472A #define ADF7021_REG10_P25 0x049E472A #define ADF7021_REG10_NXDN 0x049E472A -#define ADF7021_REG10_M17 0x049E472A +#define ADF7021_REG10_M17 0x049E472A // XXX FIXME #define AFC_OFFSET_DMR 0 #define AFC_OFFSET_YSF 0 #define AFC_OFFSET_P25 0 @@ -196,6 +198,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 13U #endif #define ADF7021_DEV_NXDN 8U +#define ADF7021_DEV_M17 14U // XXX FIXME #define ADF7021_DEV_POCSAG 96U // TX/RX CLOCK register (REG 03) @@ -206,14 +209,14 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_YSF_H 0x29EC0493 #define ADF7021_REG3_P25 0x29EC0493 #define ADF7021_REG3_NXDN 0x29EC0493 -#define ADF7021_REG3_M17 0x29EC0493 +#define ADF7021_REG3_M17 0x29EC0493 // XXX FIXME #else #define ADF7021_REG3_DMR 0x29ECA093 #define ADF7021_REG3_YSF_L 0x29ECA093 #define ADF7021_REG3_YSF_H 0x29ECA093 #define ADF7021_REG3_P25 0x29ECA093 #define ADF7021_REG3_NXDN 0x29ECA113 -#define ADF7021_REG3_M17 0x29ECA093 +#define ADF7021_REG3_M17 0x29ECA093 // XXX FIXME #endif #define ADF7021_REG3_POCSAG 0x29EE8093 @@ -225,6 +228,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 430U // K=28 #define ADF7021_DISC_BW_P25 493U // K=32 #define ADF7021_DISC_BW_NXDN 246U // K=32 +#define ADF7021_DISC_BW_M17 393U // XXX FIXME #define ADF7021_DISC_BW_POCSAG 338U // K=22 // Post demodulator bandwith (REG 04) @@ -233,6 +237,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 8U +#define ADF7021_POST_BW_M17 7U // XXX FIXME #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) @@ -250,7 +255,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x01FE557A #define ADF7021_REG10_P25 0x01FE557A #define ADF7021_REG10_NXDN 0x01FE557A -#define ADF7021_REG10_M17 0x01FE557A +#define ADF7021_REG10_M17 0x01FE557A // XXX FIXME #if defined(ADF7021_AFC_POS) #define AFC_OFFSET_DMR -250 #define AFC_OFFSET_YSF -250 @@ -269,7 +274,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x049E556A #define ADF7021_REG10_P25 0x049E556A #define ADF7021_REG10_NXDN 0x049E556A -#define ADF7021_REG10_M17 0x049E556A +#define ADF7021_REG10_M17 0x049E556A // XXX FIXME #define AFC_OFFSET_DMR 0 #define AFC_OFFSET_YSF 0 #define AFC_OFFSET_P25 0 @@ -288,6 +293,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_SLICER_TH_YSF_H 69U #define ADF7021_SLICER_TH_P25 43U #define ADF7021_SLICER_TH_NXDN 26U +#define ADF7021_SLICER_TH_M17 26U // XXX FIXME #else @@ -297,6 +303,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_SLICER_TH_YSF_H 75U #define ADF7021_SLICER_TH_P25 47U #define ADF7021_SLICER_TH_NXDN 26U +#define ADF7021_SLICER_TH_M17 26U // XXX FIXME #endif diff --git a/IOSTM.cpp b/IOSTM.cpp index 208cdeb..2d31f83 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -1,4 +1,5 @@ /* + * Copyright (C) 2020 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE @@ -83,6 +84,10 @@ #define PIN_NXDN_LED GPIO_Pin_8 #define PORT_NXDN_LED GPIOA +// XXX FIXME +#define PIN_M17_LED GPIO_Pin_8 +#define PORT_M17_LED GPIOA + #define PIN_POCSAG_LED GPIO_Pin_5 #define PORT_POCSAG_LED GPIOA @@ -173,6 +178,14 @@ #endif #define PORT_NXDN_LED GPIOA +// XXX FIXME +#if defined(STM32_USB_HOST) +#define PIN_M17_LED GPIO_Pin_1 +#else +#define PIN_M17_LED GPIO_Pin_7 +#endif +#define PORT_M17_LED GPIOA + #define PIN_POCSAG_LED GPIO_Pin_5 #define PORT_POCSAG_LED GPIOA @@ -248,6 +261,10 @@ #define PIN_NXDN_LED GPIO_Pin_8 #define PORT_NXDN_LED GPIOA +// XXX FIXME +#define PIN_M17_LED GPIO_Pin_8 +#define PORT_M17_LED GPIOA + #define PIN_POCSAG_LED GPIO_Pin_7 #define PORT_POCSAG_LED GPIOA @@ -734,6 +751,16 @@ void CIO::NXDN_pin(bool on) #endif } +void CIO::M17_pin(bool on) +{ +#if defined(USE_ALTERNATE_M17_LEDS) + GPIO_WriteBit(PORT_DSTAR_LED, PIN_DSTAR_LED, on ? Bit_SET : Bit_RESET); + GPIO_WriteBit(PORT_P25_LED, PIN_P25_LED, on ? Bit_SET : Bit_RESET); +#else + GPIO_WriteBit(PORT_M17_LED, PIN_M17_LED, on ? Bit_SET : Bit_RESET); +#endif +} + void CIO::POCSAG_pin(bool on) { #if defined(USE_ALTERNATE_POCSAG_LEDS) From 3f83f671a35054129fb48acb66e4c9f6625cd7b7 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 23 Oct 2020 18:10:53 +0100 Subject: [PATCH 202/239] Fix the synchronisation processing for M17. --- ADF7021.cpp | 4 ++-- ADF7021.h | 10 +++++----- M17Defines.h | 12 ------------ M17RX.cpp | 4 ++-- M17RX.h | 2 +- Utils.cpp | 11 ++++++++++- Utils.h | 4 +++- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index da5c403..156a7b1 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -505,7 +505,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) break; case STATE_M17: - // Dev: +1 symb 600 Hz, symb rate = 4800 + // Dev: +1 symb 2400 Hz, symb rate = 4800 ADF7021_REG3 = ADF7021_REG3_M17; ADF7021_REG10 = ADF7021_REG10_M17; @@ -754,7 +754,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) break; case STATE_M17: - // Dev: +1 symb 600 Hz, symb rate = 4800 + // Dev: +1 symb 2400 Hz, symb rate = 4800 ADF7021_REG3 = ADF7021_REG3_M17; ADF7021_REG10 = ADF7021_REG10_M17; diff --git a/ADF7021.h b/ADF7021.h index 7508439..5323bba 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -87,7 +87,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 22U #endif #define ADF7021_DEV_NXDN 13U -#define ADF7021_DEV_M17 23U // XXX FIXME +#define ADF7021_DEV_M17 28U // XXX FIXME #define ADF7021_DEV_POCSAG 160U // TX/RX CLOCK register (REG 03) @@ -117,7 +117,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 516U // K=28 #define ADF7021_DISC_BW_P25 394U // K=32 #define ADF7021_DISC_BW_NXDN 295U // K=32 -#define ADF7021_DISC_BW_M17 393U // XXX FIXME +#define ADF7021_DISC_BW_M17 459U // XXX FIXME #define ADF7021_DISC_BW_POCSAG 406U // K=22 // Post demodulator bandwith (REG 04) @@ -126,7 +126,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 7U -#define ADF7021_POST_BW_M17 7U // XXX FIXME +#define ADF7021_POST_BW_M17 20U // XXX FIXME #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) @@ -198,7 +198,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 13U #endif #define ADF7021_DEV_NXDN 8U -#define ADF7021_DEV_M17 14U // XXX FIXME +#define ADF7021_DEV_M17 17U // XXX FIXME #define ADF7021_DEV_POCSAG 96U // TX/RX CLOCK register (REG 03) @@ -237,7 +237,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 8U -#define ADF7021_POST_BW_M17 7U // XXX FIXME +#define ADF7021_POST_BW_M17 20U // XXX FIXME #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) diff --git a/M17Defines.h b/M17Defines.h index 4947341..776bf8e 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -23,25 +23,13 @@ const unsigned int M17_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate const unsigned int M17_FRAME_LENGTH_BITS = 384U; const unsigned int M17_FRAME_LENGTH_BYTES = M17_FRAME_LENGTH_BITS / 8U; -const unsigned int M17_FRAME_LENGTH_SYMBOLS = M17_FRAME_LENGTH_BITS / 2U; -const unsigned int M17_FRAME_LENGTH_SAMPLES = M17_FRAME_LENGTH_SYMBOLS * M17_RADIO_SYMBOL_LENGTH; const unsigned int M17_SYNC_LENGTH_BITS = 16U; -const unsigned int M17_SYNC_LENGTH_SYMBOLS = M17_SYNC_LENGTH_BITS / 2U; -const unsigned int M17_SYNC_LENGTH_SAMPLES = M17_SYNC_LENGTH_SYMBOLS * M17_RADIO_SYMBOL_LENGTH; const uint8_t M17_SYNC_BYTES[] = {0x32U, 0x43U}; const uint8_t M17_SYNC_BYTES_LENGTH = 2U; const uint16_t M17_SYNC_BITS = 0x3243U; -// 3 2 4 3 -// 00 11 00 10 01 00 00 11 -// +1 -3 +1 -1 +3 +1 +1 -3 - -const int8_t M17_SYNC_SYMBOLS_VALUES[] = {+1, -3, +1, -1, +3, +1, +1, -3}; - -const uint8_t M17_SYNC_SYMBOLS = 0xAEU; - #endif diff --git a/M17RX.cpp b/M17RX.cpp index 78c21f6..b00ebc6 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -65,7 +65,7 @@ void CM17RX::processNone(bool bit) m_bitBuffer |= 0x01U; // Fuzzy matching of the data sync bit sequence - if (countBits32(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { + if (countBits16(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { DEBUG1("M17RX: sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) m_buffer[i] = M17_SYNC_BYTES[i]; @@ -94,7 +94,7 @@ void CM17RX::processData(bool bit) // Only search for a sync in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the data sync bit sequence - if (countBits32(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + if (countBits16(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { DEBUG2("M17RX: found sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; diff --git a/M17RX.h b/M17RX.h index 9ec7976..8448179 100644 --- a/M17RX.h +++ b/M17RX.h @@ -37,7 +37,7 @@ public: private: M17RX_STATE m_state; - uint32_t m_bitBuffer; + uint16_t m_bitBuffer; uint8_t m_outBuffer[M17_FRAME_LENGTH_BYTES + 3U]; uint8_t* m_buffer; uint16_t m_bufferPtr; diff --git a/Utils.cpp b/Utils.cpp index 03b2258..61a3423 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 by Jonathan Naylor G4KLX + * Copyright (C) 2015,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,6 +31,15 @@ uint8_t countBits8(uint8_t bits) return BITS_TABLE[bits]; } +uint8_t countBits16(uint16_t bits) +{ + uint8_t* p = (uint8_t*)&bits; + uint8_t n = 0U; + n += BITS_TABLE[p[0U]]; + n += BITS_TABLE[p[1U]]; + return n; +} + uint8_t countBits32(uint32_t bits) { uint8_t* p = (uint8_t*)&bits; diff --git a/Utils.h b/Utils.h index 4ab35b7..c51043f 100644 --- a/Utils.h +++ b/Utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -34,6 +34,8 @@ uint8_t countBits8(uint8_t bits); +uint8_t countBits16(uint16_t bits); + uint8_t countBits32(uint32_t bits); uint8_t countBits64(uint64_t bits); From dc2171bef7f0c7837420e53ae085459da9f8dae1 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 25 Oct 2020 14:07:40 +0000 Subject: [PATCH 203/239] Update the ADF7021 parameters for M17. --- ADF7021.cpp | 4 ++-- ADF7021.h | 29 +++++++++++++++-------------- version.h | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 156a7b1..e7e44b1 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -424,7 +424,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) break; case STATE_YSF: - // Dev: +1 symb 900 Hz, symb rate = 4800 + // Dev: +1 symb 2700/900 Hz, symb rate = 4800 ADF7021_REG3 = (m_LoDevYSF ? ADF7021_REG3_YSF_L : ADF7021_REG3_YSF_H); ADF7021_REG10 = ADF7021_REG10_YSF; @@ -685,7 +685,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) break; case STATE_YSF: - // Dev: +1 symb 900 Hz, symb rate = 4800 + // Dev: +1 symb 2700/900 Hz, symb rate = 4800 ADF7021_REG3 = (m_LoDevYSF ? ADF7021_REG3_YSF_L : ADF7021_REG3_YSF_H); ADF7021_REG10 = ADF7021_REG10_YSF; diff --git a/ADF7021.h b/ADF7021.h index 5323bba..76d0893 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2020 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE @@ -52,7 +53,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // Support for ADF7021-N version: // #define ADF7021_N_VER -// Enable AFC support for DMR, YSF and P25 (experimental): +// Enable AFC support for DMR, YSF, P25, and M17 (experimental): // (AFC is already enabled by default in D-Star) // #define ADF7021_ENABLE_4FSK_AFC @@ -65,7 +66,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // R = 4 // DEMOD_CLK = 2.4576 MHz (DSTAR) // DEMOD_CLK = 4.9152 MHz (DMR, YSF_L, P25) -// DEMOD_CLK = 7.3728 MHz (YSF_H) +// DEMOD_CLK = 7.3728 MHz (YSF_H, M17) // DEMOD CLK = 3.6864 MHz (NXDN) // DEMOD_CLK = 7.3728 MHz (POCSAG) #define ADF7021_PFD 3686400.0 @@ -87,7 +88,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 22U #endif #define ADF7021_DEV_NXDN 13U -#define ADF7021_DEV_M17 28U // XXX FIXME +#define ADF7021_DEV_M17 28U #define ADF7021_DEV_POCSAG 160U // TX/RX CLOCK register (REG 03) @@ -98,7 +99,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_YSF_H 0x2A4C0493 #define ADF7021_REG3_P25 0x2A4C04D3 #define ADF7021_REG3_NXDN 0x2A4C04D3 -#define ADF7021_REG3_M17 0x2A4C04D3 // XXX FIXME +#define ADF7021_REG3_M17 0x2A4C04D3 #else #define ADF7021_REG3_DMR 0x2A4C80D3 #define ADF7021_REG3_YSF_L 0x2A4C80D3 @@ -117,7 +118,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 516U // K=28 #define ADF7021_DISC_BW_P25 394U // K=32 #define ADF7021_DISC_BW_NXDN 295U // K=32 -#define ADF7021_DISC_BW_M17 459U // XXX FIXME +#define ADF7021_DISC_BW_M17 393U // K=32 XXX FIXME #define ADF7021_DISC_BW_POCSAG 406U // K=22 // Post demodulator bandwith (REG 04) @@ -144,7 +145,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x01FE473A #define ADF7021_REG10_P25 0x01FE473A #define ADF7021_REG10_NXDN 0x01FE473A -#define ADF7021_REG10_M17 0x01FE473A // XXX FIXME +#define ADF7021_REG10_M17 0x01FE473A #if defined(ADF7021_AFC_POS) #define AFC_OFFSET_DMR -250 #define AFC_OFFSET_YSF -250 @@ -163,7 +164,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x049E472A #define ADF7021_REG10_P25 0x049E472A #define ADF7021_REG10_NXDN 0x049E472A -#define ADF7021_REG10_M17 0x049E472A // XXX FIXME +#define ADF7021_REG10_M17 0x049E472A #define AFC_OFFSET_DMR 0 #define AFC_OFFSET_YSF 0 #define AFC_OFFSET_P25 0 @@ -176,7 +177,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf // R = 2 // DEMOD_CLK = 2.4576 MHz (DSTAR) -// DEMOD_CLK = 6.1440 MHz (DMR, YSF_H, YSF_L, P25) +// DEMOD_CLK = 6.1440 MHz (DMR, YSF_H, YSF_L, P25, M17) // DEMOD_CLK = 3.0720 MHz (NXDN) // DEMOD_CLK = 6.1440 MHz (POCSAG) #define ADF7021_PFD 6144000.0 @@ -198,7 +199,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DEV_P25 13U #endif #define ADF7021_DEV_NXDN 8U -#define ADF7021_DEV_M17 17U // XXX FIXME +#define ADF7021_DEV_M17 17U #define ADF7021_DEV_POCSAG 96U // TX/RX CLOCK register (REG 03) @@ -209,14 +210,14 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_YSF_H 0x29EC0493 #define ADF7021_REG3_P25 0x29EC0493 #define ADF7021_REG3_NXDN 0x29EC0493 -#define ADF7021_REG3_M17 0x29EC0493 // XXX FIXME +#define ADF7021_REG3_M17 0x29EC0493 #else #define ADF7021_REG3_DMR 0x29ECA093 #define ADF7021_REG3_YSF_L 0x29ECA093 #define ADF7021_REG3_YSF_H 0x29ECA093 #define ADF7021_REG3_P25 0x29ECA093 #define ADF7021_REG3_NXDN 0x29ECA113 -#define ADF7021_REG3_M17 0x29ECA093 // XXX FIXME +#define ADF7021_REG3_M17 0x29ECA093 #endif #define ADF7021_REG3_POCSAG 0x29EE8093 @@ -228,7 +229,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 430U // K=28 #define ADF7021_DISC_BW_P25 493U // K=32 #define ADF7021_DISC_BW_NXDN 246U // K=32 -#define ADF7021_DISC_BW_M17 393U // XXX FIXME +#define ADF7021_DISC_BW_M17 491U // K=32 XXX FIXME #define ADF7021_DISC_BW_POCSAG 338U // K=22 // Post demodulator bandwith (REG 04) @@ -255,7 +256,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x01FE557A #define ADF7021_REG10_P25 0x01FE557A #define ADF7021_REG10_NXDN 0x01FE557A -#define ADF7021_REG10_M17 0x01FE557A // XXX FIXME +#define ADF7021_REG10_M17 0x01FE557A #if defined(ADF7021_AFC_POS) #define AFC_OFFSET_DMR -250 #define AFC_OFFSET_YSF -250 @@ -274,7 +275,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG10_YSF 0x049E556A #define ADF7021_REG10_P25 0x049E556A #define ADF7021_REG10_NXDN 0x049E556A -#define ADF7021_REG10_M17 0x049E556A // XXX FIXME +#define ADF7021_REG10_M17 0x049E556A #define AFC_OFFSET_DMR 0 #define AFC_OFFSET_YSF 0 #define AFC_OFFSET_P25 0 diff --git a/version.h b/version.h index 531c923..27fded5 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "1b" -#define VERSION_DATE "20201023" +#define VERSION_DATE "20201025" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 956ee1a81cdf5af01fe020383fedd4f79dc809af Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 8 Nov 2020 13:13:54 -0300 Subject: [PATCH 204/239] Add support for BridgeCom SkyBridge HS --- ADF7021.cpp | 4 +- BUILD.md | 2 + Config.h | 4 +- IO.cpp | 6 +- IO.h | 4 +- IOArduino.cpp | 8 +- IOSTM.cpp | 22 +++--- Makefile | 2 + README.md | 1 + SerialPort.cpp | 2 +- configs/D2RG_MMDVM_HS.h | 4 +- configs/MMDVM_HS_Dual_Hat-12mhz.h | 4 +- configs/MMDVM_HS_Dual_Hat.h | 4 +- configs/MMDVM_HS_Hat-12mhz.h | 4 +- configs/MMDVM_HS_Hat.h | 4 +- configs/NanoDV_NPI.h | 4 +- configs/NanoDV_USB.h | 4 +- configs/Nano_hotSPOT.h | 4 +- configs/SkyBridge_RPi.h | 116 ++++++++++++++++++++++++++++ configs/ZUMspot_Libre.h | 4 +- configs/ZUMspot_RPi.h | 4 +- configs/ZUMspot_USB.h | 4 +- configs/ZUMspot_dualband.h | 6 +- configs/ZUMspot_duplex.h | 4 +- configs/generic_duplex_gpio.h | 4 +- configs/generic_duplex_usb.h | 4 +- configs/generic_gpio.h | 4 +- scripts/build_fw.sh | 43 +++++++---- scripts/install_fw_skybridge_rpi.sh | 84 ++++++++++++++++++++ version.h | 8 +- 30 files changed, 312 insertions(+), 60 deletions(-) create mode 100644 configs/SkyBridge_RPi.h create mode 100755 scripts/install_fw_skybridge_rpi.sh diff --git a/ADF7021.cpp b/ADF7021.cpp index 6ccfc07..3d3d33f 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM - * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE * * Some of the code is based on work of Guus Van Dooren PE1PLM: @@ -216,7 +216,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) m_frequency_rx = m_pocsag_freq_tx; } - #if defined (ZUMSPOT_ADF7021) + #if defined (ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) io.checkBand(m_frequency_rx, m_frequency_tx); #endif diff --git a/BUILD.md b/BUILD.md index 79a09d0..8a6b265 100644 --- a/BUILD.md +++ b/BUILD.md @@ -489,6 +489,8 @@ Please check here for detailed instructions: - make d2rg_mmdvm_hs: upload the firmware to D2RG MMDVM_HS board (using internal serial port) +- make skybridge: upload the firmware to SkyBridge HotSpot board (using internal serial port) + - make dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional, and it corresponds to the USB serial port device name. This option permits to perform a reset to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button of the ZUMspot just before using this command. - make serial devser=/dev/ttyXXX: upload standard firmware using serial port bootloader method. diff --git a/Config.h b/Config.h index 842d5df..167f4e8 100644 --- a/Config.h +++ b/Config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/IO.cpp b/IO.cpp index 805c21e..88d5501 100644 --- a/IO.cpp +++ b/IO.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE * This program is free software; you can redistribute it and/or modify @@ -307,7 +307,7 @@ bool CIO::hasRXOverflow() return m_rxBuffer.hasOverflowed(); } -#if defined(ZUMSPOT_ADF7021) +#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) void CIO::checkBand(uint32_t frequency_rx, uint32_t frequency_tx) { if (!(io.hasSingleADF7021())) { // There are two ADF7021s on the board @@ -380,7 +380,7 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po #endif // Check if we have a single, dualband or duplex board -#if defined (ZUMSPOT_ADF7021) +#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) if (checkZUMspot(frequency_rx, frequency_tx) > 0) { return 4U; } diff --git a/IO.h b/IO.h index fac37fe..23f19d9 100644 --- a/IO.h +++ b/IO.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE * This program is free software; you can redistribute it and/or modify @@ -124,7 +124,7 @@ public: uint32_t getWatchdog(void); void getIntCounter(uint16_t &int1, uint16_t &int2); void selfTest(void); -#if defined(ZUMSPOT_ADF7021) +#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) void checkBand(uint32_t frequency_rx, uint32_t frequency_tx); uint8_t checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx); void setBandVHF(bool vhf_on); diff --git a/IOArduino.cpp b/IOArduino.cpp index 967a38c..835b2e8 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ // STM32F1 pin definitions, using STM32duino -#if defined(ZUMSPOT_ADF7021) +#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) #define PIN_SCLK PB5 #define PIN_SREAD PB6 @@ -81,7 +81,7 @@ #define PIN_COS_LED PB15 #else -#error "Either ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT or NANO_DV_REV10 need to be defined" +#error "Either ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV10 or SKYBRIDGE_HS need to be defined" #endif #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) @@ -156,7 +156,7 @@ void CIO::Init() { #if defined (__STM32F1__) -#if defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) +#if defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) || defined(SKYBRIDGE_HS) afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY); #endif diff --git a/IOSTM.cpp b/IOSTM.cpp index 208cdeb..0610ad4 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 by Jim McLaughlin KI6ZUM - * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE * This program is free software; you can redistribute it and/or modify @@ -92,7 +92,7 @@ #define PIN_COS_LED GPIO_Pin_13 #define PORT_COS_LED GPIOB -#elif defined(ZUMSPOT_ADF7021) +#elif defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -258,7 +258,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV11 or D2RG_MMDVM_HS need to be defined" +#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV11, D2RG_MMDVM_HS or SKYBRIDGE_HS need to be defined" #endif extern "C" { @@ -280,7 +280,7 @@ extern "C" { } #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -300,7 +300,7 @@ extern "C" { #if defined(DUPLEX) void EXTI9_5_IRQHandler(void) { - #if defined(ZUMSPOT_ADF7021) + #if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) if(EXTI_GetITStatus(EXTI_Line8)!=RESET) { io.interrupt2(); EXTI_ClearITPendingBit(EXTI_Line8); @@ -331,11 +331,11 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif -#if defined(ZUMSPOT_ADF7021) +#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) // Pin defines if the board has a single ADF7021 or double GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_SGL_DBL; @@ -532,7 +532,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -550,7 +550,7 @@ void CIO::Init() // Connect EXTI5 Line GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT); // Configure EXT5 line - #if defined(ZUMSPOT_ADF7021) + #if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) EXTI_InitStructure2.EXTI_Line = EXTI_Line8; #else EXTI_InitStructure2.EXTI_Line = EXTI_Line5; @@ -584,7 +584,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt @@ -754,7 +754,7 @@ void CIO::COS_pin(bool on) GPIO_WriteBit(PORT_COS_LED, PIN_COS_LED, on ? Bit_SET : Bit_RESET); } -#if defined(ZUMSPOT_ADF7021) +#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) void CIO::setBandVHF(bool vhf_on) { GPIO_WriteBit(PORT_SET_BAND, PIN_SET_BAND, vhf_on ? Bit_SET : Bit_RESET); } diff --git a/Makefile b/Makefile index 9c944e2..b30ef7c 100644 --- a/Makefile +++ b/Makefile @@ -476,6 +476,8 @@ mmdvm_hs_hat: zumspot-pi mmdvm_hs_dual_hat: zumspot-pi +skybridge: zumspot-pi + hotpot-opipc_opipcplus: ifneq ($(wildcard /usr/local/bin/stm32flash),) /usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3 diff --git a/README.md b/README.md index bf0ebe9..ad55656 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - install_fw_gen_gpio.sh: only for generic MMDVM_HS board (EA7GIB) with GPIO serial interface - install_fw_duplex_gpio.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with GPIO serial interface - install_fw_duplex_usb.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with USB interface +- install_fw_skybridge_rpi.sh: only for BridgeCom SkyBridge HotSpot For example, download the ZUMspot RPi upgrade script: diff --git a/SerialPort.cpp b/SerialPort.cpp index 1d5ff50..ff1238e 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -321,7 +321,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) DEBUG1("Full duplex not supported with this firmware"); return 6U; } -#elif defined(DUPLEX) && defined(ZUMSPOT_ADF7021) +#elif defined(DUPLEX) && (defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS)) if (io.isDualBand() && m_duplex && m_calState == STATE_IDLE && modemState != STATE_DSTARCAL) { DEBUG1("Full duplex is not supported on this board"); return 6U; diff --git a/configs/D2RG_MMDVM_HS.h b/configs/D2RG_MMDVM_HS.h index 9c55cf2..4a78537 100644 --- a/configs/D2RG_MMDVM_HS.h +++ b/configs/D2RG_MMDVM_HS.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Dual_Hat-12mhz.h b/configs/MMDVM_HS_Dual_Hat-12mhz.h index 88779ef..d54e9d5 100644 --- a/configs/MMDVM_HS_Dual_Hat-12mhz.h +++ b/configs/MMDVM_HS_Dual_Hat-12mhz.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU, Florian Wolters DF2ET * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Dual_Hat.h b/configs/MMDVM_HS_Dual_Hat.h index ace2477..2e09050 100644 --- a/configs/MMDVM_HS_Dual_Hat.h +++ b/configs/MMDVM_HS_Dual_Hat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU, Florian Wolters DF2ET * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Hat-12mhz.h b/configs/MMDVM_HS_Hat-12mhz.h index 34d38f2..0675cf5 100644 --- a/configs/MMDVM_HS_Hat-12mhz.h +++ b/configs/MMDVM_HS_Hat-12mhz.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU, Florian Wolters DF2ET + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU, Florian Wolters DF2ET * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h index 643a817..8a875a7 100644 --- a/configs/MMDVM_HS_Hat.h +++ b/configs/MMDVM_HS_Hat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/NanoDV_NPI.h b/configs/NanoDV_NPI.h index 8f987d7..ec1c700 100644 --- a/configs/NanoDV_NPI.h +++ b/configs/NanoDV_NPI.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ #define NANO_DV_REV11 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/NanoDV_USB.h b/configs/NanoDV_USB.h index ce20034..e4934d8 100644 --- a/configs/NanoDV_USB.h +++ b/configs/NanoDV_USB.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ #define NANO_DV_REV11 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/Nano_hotSPOT.h b/configs/Nano_hotSPOT.h index 187cab6..2547921 100644 --- a/configs/Nano_hotSPOT.h +++ b/configs/Nano_hotSPOT.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/SkyBridge_RPi.h b/configs/SkyBridge_RPi.h new file mode 100644 index 0000000..b9fda1a --- /dev/null +++ b/configs/SkyBridge_RPi.h @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +#define SKYBRIDGE_HS + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER +#define SERIAL_REPEATER_BAUD 9600 + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Engage a constant or descreet Service LED mode once repeater is running +// #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED + +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + +// Enable for RPi 3B+, USB mode +// #define LONG_USB_RESET + +// Enable modem debug messages +#define ENABLE_DEBUG + +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + +// Enable UDID feature +#define ENABLE_UDID + +#endif diff --git a/configs/ZUMspot_Libre.h b/configs/ZUMspot_Libre.h index 842d5df..167f4e8 100644 --- a/configs/ZUMspot_Libre.h +++ b/configs/ZUMspot_Libre.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_RPi.h b/configs/ZUMspot_RPi.h index f7cd5f6..6611d2f 100644 --- a/configs/ZUMspot_RPi.h +++ b/configs/ZUMspot_RPi.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_USB.h b/configs/ZUMspot_USB.h index b055bfb..0441521 100644 --- a/configs/ZUMspot_USB.h +++ b/configs/ZUMspot_USB.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_dualband.h b/configs/ZUMspot_dualband.h index d974f08..5fd896e 100644 --- a/configs/ZUMspot_dualband.h +++ b/configs/ZUMspot_dualband.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -32,6 +32,10 @@ // #define NANO_HOTSPOT // 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) // #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/ZUMspot_duplex.h b/configs/ZUMspot_duplex.h index 80da2c5..25e8761 100644 --- a/configs/ZUMspot_duplex.h +++ b/configs/ZUMspot_duplex.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/generic_duplex_gpio.h b/configs/generic_duplex_gpio.h index 96428b9..42402c0 100644 --- a/configs/generic_duplex_gpio.h +++ b/configs/generic_duplex_gpio.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/generic_duplex_usb.h b/configs/generic_duplex_usb.h index b1e7b74..769e3fb 100644 --- a/configs/generic_duplex_usb.h +++ b/configs/generic_duplex_usb.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/configs/generic_gpio.h b/configs/generic_gpio.h index e946f12..619393d 100644 --- a/configs/generic_gpio.h +++ b/configs/generic_gpio.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -34,6 +34,8 @@ // #define NANO_DV_REV10 // 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) // #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 4ea323e..5eab4f2 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2017,2018 by Andy Uribe CA6JAU +# Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU # 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 @@ -28,7 +28,7 @@ echo "*******************************************************" echo "********* Building ZUMspot Libre Kit firmware *********" echo "*******************************************************" cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h -make bl +make -j4 bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_libre_fw.bin make clean @@ -37,7 +37,7 @@ echo "*************************************************" echo "********* Building ZUMspot RPi firmware *********" echo "*************************************************" cp ~/MMDVM_HS/configs/ZUMspot_RPi.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_rpi_fw.bin make clean @@ -46,7 +46,7 @@ echo "*************************************************" echo "********* Building ZUMspot USB firmware *********" echo "*************************************************" cp ~/MMDVM_HS/configs/ZUMspot_USB.h ~/MMDVM_HS/Config.h -make bl +make -j4 bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_usb_fw.bin make clean @@ -55,7 +55,7 @@ echo "****************************************************" echo "********* Building ZUMspot Duplex firmware *********" echo "****************************************************" cp ~/MMDVM_HS/configs/ZUMspot_duplex.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin make clean @@ -64,7 +64,7 @@ echo "******************************************************" echo "********* Building ZUMspot Dualband firmware *********" echo "******************************************************" cp ~/MMDVM_HS/configs/ZUMspot_dualband.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_dualband_fw.bin make clean @@ -73,7 +73,7 @@ echo "**************************************************" echo "********* Building MMDVM_HS_Hat firmware *********" echo "**************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Hat.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw.bin make clean @@ -82,7 +82,7 @@ echo "********************************************************************" echo "********* Building MMDVM_HS_Hat (12.288 MHz TCXO) firmware *********" echo "********************************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Hat-12mhz.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw-12mhz.bin make clean @@ -91,7 +91,7 @@ echo "*******************************************************" echo "********* Building MMDVM_HS_Dual_Hat firmware *********" echo "*******************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw.bin make clean @@ -100,7 +100,7 @@ echo "*************************************************************************" echo "********* Building MMDVM_HS_Dual_Hat (12.288 MHz TCXO) firmware *********" echo "*************************************************************************" cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat-12mhz.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw-12mhz.bin make clean @@ -109,7 +109,7 @@ echo "**************************************************" echo "********* Building Nano hotSPOT firmware *********" echo "**************************************************" cp ~/MMDVM_HS/configs/Nano_hotSPOT.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_hotspot_fw.bin make clean @@ -118,7 +118,7 @@ echo "************************************************" echo "********* Building NanoDV NPi firmware *********" echo "************************************************" cp ~/MMDVM_HS/configs/NanoDV_NPi.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nanodv_npi_fw.bin make clean @@ -127,7 +127,7 @@ echo "************************************************" echo "********* Building NanoDV USB firmware *********" echo "************************************************" cp ~/MMDVM_HS/configs/NanoDV_USB.h ~/MMDVM_HS/Config.h -make bl +make -j4 bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/nanodv_usb_fw.bin make clean @@ -136,7 +136,7 @@ echo "***************************************************" echo "********* Building D2RG MMDVM_HS firmware *********" echo "***************************************************" cp ~/MMDVM_HS/configs/D2RG_MMDVM_HS.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/d2rg_mmdvm_hs.bin make clean @@ -145,7 +145,7 @@ echo "**********************************************************" echo "********* Building Generic Simplex GPIO firmware *********" echo "**********************************************************" cp ~/MMDVM_HS/configs/generic_gpio.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_gpio_fw.bin make clean @@ -154,7 +154,7 @@ echo "*********************************************************" echo "********* Building Generic Duplex GPIO firmware *********" echo "*********************************************************" cp ~/MMDVM_HS/configs/generic_duplex_gpio.h ~/MMDVM_HS/Config.h -make +make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_duplex_gpio_fw.bin make clean @@ -163,8 +163,17 @@ echo "********************************************************" echo "********* Building Generic Duplex USB firmware *********" echo "********************************************************" cp ~/MMDVM_HS/configs/generic_duplex_usb.h ~/MMDVM_HS/Config.h -make bl +make -j4 bl mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/generic_duplex_usb_fw.bin make clean +# Building SkyBridge RPi HS +echo "******************************************************" +echo "********* Building SkyBridge RPi HS firmware *********" +echo "******************************************************" +cp ~/MMDVM_HS/configs/SkyBridge_RPi.h ~/MMDVM_HS/Config.h +make -j4 +mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/skybridge_rpi_fw.bin +make clean + cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h diff --git a/scripts/install_fw_skybridge_rpi.sh b/scripts/install_fw_skybridge_rpi.sh new file mode 100755 index 0000000..50480ad --- /dev/null +++ b/scripts/install_fw_skybridge_rpi.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.5.2" + +# Configure beta version +FW_VERSION_BETA="v1.5.1b" + +# Firmware filename +FW_FILENAME="skybridge_rpi_fw.bin" + +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 + diff --git a/version.h b/version.h index 7b8019f..c0a6589 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU * * 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 @@ -24,8 +24,8 @@ #define VER_MAJOR "1" #define VER_MINOR "5" -#define VER_REV "1b" -#define VERSION_DATE "20191201" +#define VER_REV "2" +#define VERSION_DATE "20201108" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" @@ -39,6 +39,8 @@ #define BOARD_INFO "Nano_DV" #elif defined(D2RG_MMDVM_HS) #define BOARD_INFO "D2RG_MMDVM_HS" +#elif defined(SKYBRIDGE_HS) +#define BOARD_INFO "SkyBridge" #else #define BOARD_INFO "MMDVM_HS" #endif From 69d08790bdf1d367ea9518712895ed4abe4a323a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 8 Nov 2020 19:37:05 -0300 Subject: [PATCH 205/239] Fix new firmware version for installer scripts --- scripts/install_fw_d2rg_mmdvmhs.sh | 2 +- scripts/install_fw_dualband.sh | 2 +- scripts/install_fw_duplex.sh | 2 +- scripts/install_fw_duplex_gpio.sh | 2 +- scripts/install_fw_duplex_gpio_opi.sh | 2 +- scripts/install_fw_duplex_usb.sh | 2 +- scripts/install_fw_gen_gpio.sh | 2 +- scripts/install_fw_hsdualhat-12mhz.sh | 2 +- scripts/install_fw_hsdualhat.sh | 2 +- scripts/install_fw_hshat-12mhz.sh | 2 +- scripts/install_fw_hshat.sh | 2 +- scripts/install_fw_librekit.sh | 2 +- scripts/install_fw_nanodv_npi.sh | 2 +- scripts/install_fw_nanodv_usb.sh | 2 +- scripts/install_fw_nanohs.sh | 2 +- scripts/install_fw_rpi.sh | 2 +- scripts/install_fw_usb.sh | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/install_fw_d2rg_mmdvmhs.sh b/scripts/install_fw_d2rg_mmdvmhs.sh index ea5fca8..4651d8c 100755 --- a/scripts/install_fw_d2rg_mmdvmhs.sh +++ b/scripts/install_fw_d2rg_mmdvmhs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_dualband.sh b/scripts/install_fw_dualband.sh index 8ed3607..7c50de0 100755 --- a/scripts/install_fw_dualband.sh +++ b/scripts/install_fw_dualband.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index ac46940..49b5ceb 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index dd89633..acb7ea8 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_duplex_gpio_opi.sh b/scripts/install_fw_duplex_gpio_opi.sh index ad60124..909fccd 100644 --- a/scripts/install_fw_duplex_gpio_opi.sh +++ b/scripts/install_fw_duplex_gpio_opi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_duplex_usb.sh b/scripts/install_fw_duplex_usb.sh index 56aa0cc..053c891 100755 --- a/scripts/install_fw_duplex_usb.sh +++ b/scripts/install_fw_duplex_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 8afeec9..2faa0e1 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 5bc76db..18b3977 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 7123c55..29c12aa 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 6e86483..82f0190 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 7ffa5da..671940b 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 118c640..1298b10 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index 1fe2349..aae6890 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index 116acb6..d301bfc 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index e345fa7..b61b8a9 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index ae8639e..9965a25 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Configure beta version FW_VERSION_BETA="v1.5.1b" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index 3de199a..beca5d0 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Configure latest version -FW_VERSION="v1.4.17" +FW_VERSION="v1.5.2" # Change USB-serial port name ONLY in macOS MAC_DEV_USB_SER="/dev/cu.usbmodem14401" From 743d0ca12ff772b7171caa14f5965b98bfe09921 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 9 Nov 2020 14:25:18 +0000 Subject: [PATCH 206/239] Update the serial protocol. --- SerialPort.cpp | 2 +- version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index bd936c6..dece371 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -250,7 +250,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) bool p25Enable = (data[1U] & 0x08U) == 0x08U; bool nxdnEnable = (data[1U] & 0x10U) == 0x10U; bool pocsagEnable = (data[1U] & 0x20U) == 0x20U; - bool m17Enable = (data[1U] & 0x80U) == 0x80U; + bool m17Enable = (data[1U] & 0x40U) == 0x40U; uint8_t txDelay = data[2U]; if (txDelay > 50U) diff --git a/version.h b/version.h index 27fded5..80ec5e0 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "1b" -#define VERSION_DATE "20201025" +#define VERSION_DATE "20201109" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 818a27d114cf032a39bf72aa02e8d613bd0219f6 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 10 Nov 2020 16:56:44 +0000 Subject: [PATCH 207/239] Revert the M17 enable bit change. --- SerialPort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index 1cb0211..fdc5037 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -250,7 +250,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) bool p25Enable = (data[1U] & 0x08U) == 0x08U; bool nxdnEnable = (data[1U] & 0x10U) == 0x10U; bool pocsagEnable = (data[1U] & 0x20U) == 0x20U; - bool m17Enable = (data[1U] & 0x40U) == 0x40U; + bool m17Enable = (data[1U] & 0x80U) == 0x80U; uint8_t txDelay = data[2U]; if (txDelay > 50U) From cde5b19080196b14661e82d8220e329423170d50 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 11 Nov 2020 11:50:02 +0000 Subject: [PATCH 208/239] Move the M17 enable bit position. --- SerialPort.cpp | 2 +- version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index fdc5037..1cb0211 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -250,7 +250,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) bool p25Enable = (data[1U] & 0x08U) == 0x08U; bool nxdnEnable = (data[1U] & 0x10U) == 0x10U; bool pocsagEnable = (data[1U] & 0x20U) == 0x20U; - bool m17Enable = (data[1U] & 0x80U) == 0x80U; + bool m17Enable = (data[1U] & 0x40U) == 0x40U; uint8_t txDelay = data[2U]; if (txDelay > 50U) diff --git a/version.h b/version.h index 1d77c9c..e16d8dc 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20201109" +#define VERSION_DATE "20201111" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From fb4c543211dcbc985e902bf52e19963bbfd34e2a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Thu, 12 Nov 2020 12:25:54 -0300 Subject: [PATCH 209/239] Fix pin definitions in IOArduino.cpp --- IOArduino.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IOArduino.cpp b/IOArduino.cpp index 835b2e8..20e0113 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -37,9 +37,9 @@ #define PIN_SLE2 PA6 #define PIN_CE PC14 #define PIN_RXD PB4 -#define PIN_RXD2 PA4 +#define PIN_RXD2 PA11 #define PIN_TXD PB3 -#define PIN_TXD2 PA5 +#define PIN_TXD2 PA8 #define PIN_CLKOUT PA15 #define PIN_LED PC13 #define PIN_DEB PB9 From d732807ee34107c65206ae3a2062a307973dea81 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 15 Nov 2020 20:22:13 -0300 Subject: [PATCH 210/239] Change some ADF7021 register values for M17 (experimental) --- ADF7021.cpp | 6 +++--- ADF7021.h | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 4298f46..4e1af57 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -424,7 +424,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) break; case STATE_YSF: - // Dev: +1 symb 2700/900 Hz, symb rate = 4800 + // Dev: +1 symb 900 Hz, symb rate = 4800 ADF7021_REG3 = (m_LoDevYSF ? ADF7021_REG3_YSF_L : ADF7021_REG3_YSF_H); ADF7021_REG10 = ADF7021_REG10_YSF; @@ -505,7 +505,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) break; case STATE_M17: - // Dev: +1 symb 2400 Hz, symb rate = 4800 + // Dev: +1 symb 800 Hz, symb rate = 4800 ADF7021_REG3 = ADF7021_REG3_M17; ADF7021_REG10 = ADF7021_REG10_M17; @@ -517,7 +517,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_REG4 |= (uint32_t) 0b11 << 8; ADF7021_REG4 |= (uint32_t) ADF7021_DISC_BW_M17 << 10; // Disc BW ADF7021_REG4 |= (uint32_t) ADF7021_POST_BW_M17 << 20; // Post dem BW - ADF7021_REG4 |= (uint32_t) 0b00 << 30; // IF filter (12.5 kHz) + ADF7021_REG4 |= (uint32_t) 0b10 << 30; // IF filter (25 kHz) ADF7021_REG13 = (uint32_t) 0b1101 << 0; // register 13 ADF7021_REG13 |= (uint32_t) ADF7021_SLICER_TH_M17 << 4; // slicer threshold diff --git a/ADF7021.h b/ADF7021.h index 76d0893..7b58c5f 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -106,7 +106,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_REG3_YSF_H 0x2A4CC093 #define ADF7021_REG3_P25 0x2A4C80D3 #define ADF7021_REG3_NXDN 0x2A4CC113 -#define ADF7021_REG3_M17 0x2A4C80D3 // XXX FIXME +#define ADF7021_REG3_M17 0x2A4CC093 #endif #define ADF7021_REG3_POCSAG 0x2A4F0093 @@ -118,7 +118,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 516U // K=28 #define ADF7021_DISC_BW_P25 394U // K=32 #define ADF7021_DISC_BW_NXDN 295U // K=32 -#define ADF7021_DISC_BW_M17 393U // K=32 XXX FIXME +#define ADF7021_DISC_BW_M17 571U // K=31 #define ADF7021_DISC_BW_POCSAG 406U // K=22 // Post demodulator bandwith (REG 04) @@ -127,7 +127,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 7U -#define ADF7021_POST_BW_M17 20U // XXX FIXME +#define ADF7021_POST_BW_M17 20U // Test #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) @@ -229,7 +229,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 430U // K=28 #define ADF7021_DISC_BW_P25 493U // K=32 #define ADF7021_DISC_BW_NXDN 246U // K=32 -#define ADF7021_DISC_BW_M17 491U // K=32 XXX FIXME +#define ADF7021_DISC_BW_M17 476U // K=31 #define ADF7021_DISC_BW_POCSAG 338U // K=22 // Post demodulator bandwith (REG 04) @@ -238,7 +238,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 8U -#define ADF7021_POST_BW_M17 20U // XXX FIXME +#define ADF7021_POST_BW_M17 20U // Test #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) @@ -294,7 +294,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_SLICER_TH_YSF_H 69U #define ADF7021_SLICER_TH_P25 43U #define ADF7021_SLICER_TH_NXDN 26U -#define ADF7021_SLICER_TH_M17 26U // XXX FIXME +#define ADF7021_SLICER_TH_M17 59U // Test #else @@ -304,7 +304,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_SLICER_TH_YSF_H 75U #define ADF7021_SLICER_TH_P25 47U #define ADF7021_SLICER_TH_NXDN 26U -#define ADF7021_SLICER_TH_M17 26U // XXX FIXME +#define ADF7021_SLICER_TH_M17 59U // Test #endif From c9bd700100eca2f20076daeba1d464e776bdc65f Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 26 Nov 2020 10:22:03 +0000 Subject: [PATCH 211/239] Update to the latest M17 specification. --- M17Defines.h | 7 ++-- M17RX.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++------ M17RX.h | 3 ++ SerialPort.cpp | 42 +++++++++++++++++++++-- SerialPort.h | 1 + version.h | 2 +- 6 files changed, 130 insertions(+), 15 deletions(-) diff --git a/M17Defines.h b/M17Defines.h index 776bf8e..4952fdc 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -26,10 +26,13 @@ const unsigned int M17_FRAME_LENGTH_BYTES = M17_FRAME_LENGTH_BITS / 8U; const unsigned int M17_SYNC_LENGTH_BITS = 16U; -const uint8_t M17_SYNC_BYTES[] = {0x32U, 0x43U}; +const uint8_t M17_HEADER_SYNC_BYTES[] = {0x5DU, 0xDDU}; +const uint8_t M17_DATA_SYNC_BYTES[] = {0xDDU, 0xDDU}; + const uint8_t M17_SYNC_BYTES_LENGTH = 2U; -const uint16_t M17_SYNC_BITS = 0x3243U; +const uint16_t M17_HEADER_SYNC_BITS = 0x5DDDU; +const uint16_t M17_DATA_SYNC_BITS = 0xDDDDU; #endif diff --git a/M17RX.cpp b/M17RX.cpp index b00ebc6..56405ce 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -52,10 +52,17 @@ void CM17RX::reset() void CM17RX::databit(bool bit) { - if (m_state == M17RXS_NONE) - processNone(bit); - else - processData(bit); + switch (m_state) { + case M17RXS_NONE: + processNone(bit); + break; + case M17RXS_HEADER: + processHeader(bit); + break; + default: + processData(bit); + break; + } } void CM17RX::processNone(bool bit) @@ -64,11 +71,24 @@ void CM17RX::processNone(bool bit) if (bit) m_bitBuffer |= 0x01U; - // Fuzzy matching of the data sync bit sequence - if (countBits16(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { - DEBUG1("M17RX: sync found in None"); + // Fuzzy matching of the header sync bit sequence + if (countBits16(m_bitBuffer ^ M17_HEADER_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { + DEBUG1("M17RX: header sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) - m_buffer[i] = M17_SYNC_BYTES[i]; + m_buffer[i] = M17_HEADER_SYNC_BYTES[i]; + + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + m_state = M17RXS_HEADER; + + io.setDecode(true); + } + + // Fuzzy matching of the data sync bit sequence + if (countBits16(m_bitBuffer ^ M17_DATA_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { + DEBUG1("M17RX: data sync found in None"); + for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) + m_buffer[i] = M17_DATA_SYNC_BYTES[i]; m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; @@ -76,7 +96,43 @@ void CM17RX::processNone(bool bit) io.setDecode(true); } +} +void CM17RX::processHeader(bool bit) +{ + m_bitBuffer <<= 1; + if (bit) + m_bitBuffer |= 0x01U; + + WRITE_BIT1(m_buffer, m_bufferPtr, bit); + + m_bufferPtr++; + if (m_bufferPtr > M17_FRAME_LENGTH_BITS) + reset(); + + // Only search for a sync in the right place +-2 symbols + if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { + // Fuzzy matching of the data sync bit sequence + if (countBits16(m_bitBuffer ^ M17_HEADER_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found header sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + } + } + + // Send a data frame to the host if the required number of bits have been received + if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { + m_lostCount--; + + // Write data to host + m_outBuffer[0U] = 0x01U; + writeRSSIHeader(m_outBuffer); + + // Start the next frame + ::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U); + m_state = M17RXS_DATA; + m_bufferPtr = 0U; + } } void CM17RX::processData(bool bit) @@ -94,8 +150,8 @@ void CM17RX::processData(bool bit) // Only search for a sync in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the data sync bit sequence - if (countBits16(m_bitBuffer ^ M17_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + if (countBits16(m_bitBuffer ^ M17_DATA_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found data sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; } @@ -122,6 +178,20 @@ void CM17RX::processData(bool bit) } } +void CM17RX::writeRSSIHeader(uint8_t* data) +{ +#if defined(SEND_RSSI_DATA) + uint16_t rssi = io.readRSSI(); + + data[49U] = (rssi >> 8) & 0xFFU; + data[50U] = (rssi >> 0) & 0xFFU; + + serial.writeM17Header(data, M17_FRAME_LENGTH_BYTES + 3U); +#else + serial.writeM17Header(data, M17_FRAME_LENGTH_BYTES + 1U); +#endif +} + void CM17RX::writeRSSIData(uint8_t* data) { #if defined(SEND_RSSI_DATA) diff --git a/M17RX.h b/M17RX.h index 8448179..1a9b08e 100644 --- a/M17RX.h +++ b/M17RX.h @@ -24,6 +24,7 @@ enum M17RX_STATE { M17RXS_NONE, + M17RXS_HEADER, M17RXS_DATA }; @@ -44,7 +45,9 @@ private: uint16_t m_lostCount; void processNone(bool bit); + void processHeader(bool bit); void processData(bool bit); + void writeRSSIHeader(uint8_t* data); void writeRSSIData(uint8_t* data); }; diff --git a/SerialPort.cpp b/SerialPort.cpp index 1cb0211..edc3287 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -60,8 +60,9 @@ const uint8_t MMDVM_P25_LOST = 0x32U; const uint8_t MMDVM_NXDN_DATA = 0x40U; const uint8_t MMDVM_NXDN_LOST = 0x41U; -const uint8_t MMDVM_M17_DATA = 0x45U; -const uint8_t MMDVM_M17_LOST = 0x46U; +const uint8_t MMDVM_M17_HEADER = 0x45U; +const uint8_t MMDVM_M17_DATA = 0x46U; +const uint8_t MMDVM_M17_LOST = 0x47U; const uint8_t MMDVM_POCSAG_DATA = 0x50U; @@ -864,6 +865,20 @@ void CSerialPort::process() } break; + case MMDVM_M17_HEADER: + if (m_m17Enable) { + if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) + err = m17TX.writeData(m_buffer + 3U, m_len - 3U); + } + if (err == 0U) { + if (m_modemState == STATE_IDLE) + setMode(STATE_M17); + } else { + DEBUG2("Received invalid M17 header", err); + sendNAK(err); + } + break; + case MMDVM_M17_DATA: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) @@ -1233,6 +1248,29 @@ void CSerialPort::writeNXDNLost() writeInt(1U, reply, 3); } +void CSerialPort::writeM17Header(const uint8_t* data, uint8_t length) +{ + if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) + return; + + if (!m_m17Enable) + return; + + uint8_t reply[130U]; + + reply[0U] = MMDVM_FRAME_START; + reply[1U] = 0U; + reply[2U] = MMDVM_M17_HEADER; + + uint8_t count = 3U; + for (uint8_t i = 0U; i < length; i++, count++) + reply[count] = data[i]; + + reply[1U] = count; + + writeInt(1U, reply, count); +} + void CSerialPort::writeM17Data(const uint8_t* data, uint8_t length) { if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) diff --git a/SerialPort.h b/SerialPort.h index c9cbddb..38d2139 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -52,6 +52,7 @@ public: void writeNXDNData(const uint8_t* data, uint8_t length); void writeNXDNLost(); + void writeM17Header(const uint8_t* data, uint8_t length); void writeM17Data(const uint8_t* data, uint8_t length); void writeM17Lost(); diff --git a/version.h b/version.h index e16d8dc..043fee8 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20201111" +#define VERSION_DATE "20201126" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 0f7a64115dbec1dcd333bce5a99635345187a229 Mon Sep 17 00:00:00 2001 From: Tim Stewart Date: Sat, 5 Dec 2020 19:08:30 -0500 Subject: [PATCH 212/239] 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 dac1841..c4fb5cc 100644 --- a/DStarRX.cpp +++ b/DStarRX.cpp @@ -40,8 +40,8 @@ const uint32_t DATA_SYNC_MASK = 0x00FFFFFFU; const uint8_t DATA_SYNC_ERRS = 3U; // 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}; @@ -239,6 +239,7 @@ const uint16_t CCITT_TABLE[] = { CDStarRX::CDStarRX() : m_rxState(DSRXS_NONE), m_patternBuffer(0x00U), +m_patternBuffer64(0x00U), m_rxBuffer(), m_rxBufferBits(0U), m_dataBits(0U), @@ -256,6 +257,7 @@ void CDStarRX::reset() { m_rxState = DSRXS_NONE; m_patternBuffer = 0x00U; + m_patternBuffer64 = 0x00U; m_rxBufferBits = 0U; m_dataBits = 0U; } @@ -283,6 +285,10 @@ void CDStarRX::processNone(bool bit) if (bit) m_patternBuffer |= 0x01U; + m_patternBuffer64 <<= 1; + if (bit) + m_patternBuffer64 |= 0x01U; + // Fuzzy matching of the preamble sync sequence if (countBits32((m_patternBuffer & PREAMBLE_MASK) ^ PREAMBLE_DATA) <= PREAMBLE_ERRS) { @@ -329,6 +335,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++; @@ -363,6 +373,10 @@ 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++; @@ -370,7 +384,7 @@ void CDStarRX::processData(bool bit) reset(); // 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 e8a4b68..33df092 100644 --- a/DStarRX.h +++ b/DStarRX.h @@ -41,6 +41,7 @@ public: private: DSRX_STATE m_rxState; uint32_t m_patternBuffer; + uint64_t m_patternBuffer64; uint8_t m_rxBuffer[DSTAR_BUFFER_LENGTH_BITS / 8U]; unsigned int m_rxBufferBits; unsigned int m_dataBits; From 6c4f2041cb27bf9abeddcfd208f523f6088b82fd Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sat, 26 Dec 2020 12:51:35 +0000 Subject: [PATCH 213/239] Update the M17 sync vectors. --- M17Defines.h | 10 ++++++---- M17RX.cpp | 12 ++++++------ version.h | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/M17Defines.h b/M17Defines.h index 4952fdc..2f8e98e 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -26,13 +26,15 @@ const unsigned int M17_FRAME_LENGTH_BYTES = M17_FRAME_LENGTH_BITS / 8U; const unsigned int M17_SYNC_LENGTH_BITS = 16U; -const uint8_t M17_HEADER_SYNC_BYTES[] = {0x5DU, 0xDDU}; -const uint8_t M17_DATA_SYNC_BYTES[] = {0xDDU, 0xDDU}; +const uint8_t M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U}; +const uint8_t M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU}; +const uint8_t M17_PACKET_SYNC_BYTES[] = {0x75U, 0xFFU}; const uint8_t M17_SYNC_BYTES_LENGTH = 2U; -const uint16_t M17_HEADER_SYNC_BITS = 0x5DDDU; -const uint16_t M17_DATA_SYNC_BITS = 0xDDDDU; +const uint16_t M17_LINK_SETUP_SYNC_BITS = 0x55F7U; +const uint16_t M17_STREAM_SYNC_BITS = 0xFF5DU; +const uint16_t M17_PACKET_SYNC_BITS = 0x75FFU; #endif diff --git a/M17RX.cpp b/M17RX.cpp index 56405ce..d29d6d8 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -72,10 +72,10 @@ void CM17RX::processNone(bool bit) m_bitBuffer |= 0x01U; // Fuzzy matching of the header sync bit sequence - if (countBits16(m_bitBuffer ^ M17_HEADER_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { + if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { DEBUG1("M17RX: header sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) - m_buffer[i] = M17_HEADER_SYNC_BYTES[i]; + m_buffer[i] = M17_LINK_SETUP_SYNC_BYTES[i]; m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; @@ -85,10 +85,10 @@ void CM17RX::processNone(bool bit) } // Fuzzy matching of the data sync bit sequence - if (countBits16(m_bitBuffer ^ M17_DATA_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { + if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { DEBUG1("M17RX: data sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) - m_buffer[i] = M17_DATA_SYNC_BYTES[i]; + m_buffer[i] = M17_STREAM_SYNC_BYTES[i]; m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; @@ -113,7 +113,7 @@ void CM17RX::processHeader(bool bit) // Only search for a sync in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the data sync bit sequence - if (countBits16(m_bitBuffer ^ M17_HEADER_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { DEBUG2("M17RX: found header sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; @@ -150,7 +150,7 @@ void CM17RX::processData(bool bit) // Only search for a sync in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the data sync bit sequence - if (countBits16(m_bitBuffer ^ M17_DATA_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { DEBUG2("M17RX: found data sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; diff --git a/version.h b/version.h index 043fee8..a19dad5 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20201126" +#define VERSION_DATE "20201226" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 08a6c21c17caf7872dd0046c00feeecceaf7bc69 Mon Sep 17 00:00:00 2001 From: Tim Stewart Date: Wed, 30 Dec 2020 17:11:30 -0500 Subject: [PATCH 214/239] Simplify the D-Star fast data support. --- DStarRX.cpp | 44 +++++++++++++++----------------------------- DStarRX.h | 5 ++--- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/DStarRX.cpp b/DStarRX.cpp index c4fb5cc..e41d5f0 100644 --- a/DStarRX.cpp +++ b/DStarRX.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2016 by Jonathan Naylor G4KLX + * Copyright (C) 2009-2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -25,18 +25,18 @@ const unsigned int MAX_SYNC_BITS = 100U * DSTAR_DATA_LENGTH_BITS; // D-Star preamble sequence (only 32 bits of 101010...) -const uint32_t PREAMBLE_MASK = 0xFFFFFFFFU; -const uint32_t PREAMBLE_DATA = 0xAAAAAAAAU; +const uint64_t PREAMBLE_MASK = 0x00000000FFFFFFFFU; +const uint64_t PREAMBLE_DATA = 0x00000000AAAAAAAAU; const uint8_t PREAMBLE_ERRS = 2U; // 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 = 3U; // D-Star bit order version of 0x55 0x55 0xC8 0x7A @@ -239,7 +239,6 @@ const uint16_t CCITT_TABLE[] = { CDStarRX::CDStarRX() : m_rxState(DSRXS_NONE), m_patternBuffer(0x00U), -m_patternBuffer64(0x00U), m_rxBuffer(), m_rxBufferBits(0U), m_dataBits(0U), @@ -257,7 +256,6 @@ void CDStarRX::reset() { m_rxState = DSRXS_NONE; m_patternBuffer = 0x00U; - m_patternBuffer64 = 0x00U; m_rxBufferBits = 0U; m_dataBits = 0U; } @@ -285,12 +283,8 @@ void CDStarRX::processNone(bool bit) if (bit) m_patternBuffer |= 0x01U; - m_patternBuffer64 <<= 1; - if (bit) - m_patternBuffer64 |= 0x01U; - // Fuzzy matching of the preamble sync sequence - if (countBits32((m_patternBuffer & PREAMBLE_MASK) ^ PREAMBLE_DATA) <= PREAMBLE_ERRS) { + if (countBits64((m_patternBuffer & PREAMBLE_MASK) ^ PREAMBLE_DATA) <= PREAMBLE_ERRS) { // Extend scan period in D-Star, once preamble is detected m_modeTimerCnt = 0; @@ -301,7 +295,7 @@ void CDStarRX::processNone(bool bit) } // 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, fuzzy"); ::memset(m_rxBuffer, 0x00U, DSTAR_FEC_SECTION_LENGTH_BYTES); @@ -312,7 +306,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, exact"); io.setDecode(true); @@ -335,10 +329,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++; @@ -373,10 +363,6 @@ 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++; @@ -384,7 +370,7 @@ void CDStarRX::processData(bool bit) reset(); // 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); @@ -397,7 +383,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; @@ -407,9 +393,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 33df092..98cf79f 100644 --- a/DStarRX.h +++ b/DStarRX.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -40,8 +40,7 @@ public: private: DSRX_STATE m_rxState; - uint32_t m_patternBuffer; - uint64_t m_patternBuffer64; + uint64_t m_patternBuffer; uint8_t m_rxBuffer[DSTAR_BUFFER_LENGTH_BITS / 8U]; unsigned int m_rxBufferBits; unsigned int m_dataBits; From 4f1ed20d7785204f9b2bc3d50b91ec0d302f3aec Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 1 Jan 2021 12:57:57 +0000 Subject: [PATCH 215/239] Add M17 packet mode processing. --- M17RX.cpp | 93 +++++++++++++++++++++++++++++++++++++++++++++---------- M17RX.h | 10 +++--- version.h | 2 +- 3 files changed, 84 insertions(+), 21 deletions(-) diff --git a/M17RX.cpp b/M17RX.cpp index d29d6d8..b16ce9a 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2009-2017,2018,2020 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2009-2018,2020,2021 by Jonathan Naylor G4KLX + * Copyright (C) 2016-2018 by Andy Uribe CA6JAU * * 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 @@ -59,8 +59,11 @@ void CM17RX::databit(bool bit) case M17RXS_HEADER: processHeader(bit); break; + case M17RXS_PACKET: + processPacket(bit); + break; default: - processData(bit); + processStream(bit); break; } } @@ -84,15 +87,28 @@ void CM17RX::processNone(bool bit) io.setDecode(true); } - // Fuzzy matching of the data sync bit sequence + // Fuzzy matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { - DEBUG1("M17RX: data sync found in None"); + DEBUG1("M17RX: stream sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) m_buffer[i] = M17_STREAM_SYNC_BYTES[i]; m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; - m_state = M17RXS_DATA; + m_state = M17RXS_STREAM; + + io.setDecode(true); + } + + // Fuzzy matching of the packet sync bit sequence + if (countBits16(m_bitBuffer ^ M17_PACKET_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { + DEBUG1("M17RX: packet sync found in None"); + for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) + m_buffer[i] = M17_PACKET_SYNC_BYTES[i]; + + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + m_state = M17RXS_PACKET; io.setDecode(true); } @@ -128,14 +144,14 @@ void CM17RX::processHeader(bool bit) m_outBuffer[0U] = 0x01U; writeRSSIHeader(m_outBuffer); - // Start the next frame + // Start the next frame, but we don't know the type ::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U); - m_state = M17RXS_DATA; + m_state = M17RXS_NONE; m_bufferPtr = 0U; } } -void CM17RX::processData(bool bit) +void CM17RX::processStream(bool bit) { m_bitBuffer <<= 1; if (bit) @@ -147,28 +163,73 @@ void CM17RX::processData(bool bit) if (m_bufferPtr > M17_FRAME_LENGTH_BITS) reset(); - // Only search for a sync in the right place +-2 symbols + // Only search for a stream sync in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { - // Fuzzy matching of the data sync bit sequence + // Fuzzy matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found data sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + DEBUG2("M17RX: found stream sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; } } - // Send a data frame to the host if the required number of bits have been received + // Send a stream frame to the host if the required number of bits have been received if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { - // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE + // We've not seen a stream sync for too long, signal RXLOST and change to RX_NONE m_lostCount--; if (m_lostCount == 0U) { - DEBUG1("M17RX: sync timed out, lost lock"); + DEBUG1("M17RX: stream sync timed out, lost lock"); io.setDecode(false); serial.writeM17Lost(); reset(); } else { // Write data to host - m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; + m_outBuffer[0U] = 0x00U; // Stream data + m_outBuffer[0U] |= m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; + writeRSSIData(m_outBuffer); + + // Start the next frame + ::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U); + m_bufferPtr = 0U; + } + } +} + +void CM17RX::processPacket(bool bit) +{ + m_bitBuffer <<= 1; + if (bit) + m_bitBuffer |= 0x01U; + + WRITE_BIT1(m_buffer, m_bufferPtr, bit); + + m_bufferPtr++; + if (m_bufferPtr > M17_FRAME_LENGTH_BITS) + reset(); + + // Only search for a packet sync in the right place +-2 symbols + if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { + // Fuzzy matching of the packet sync bit sequence + if (countBits16(m_bitBuffer ^ M17_PACKET_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found packet sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + } + } + + // Send a packet frame to the host if the required number of bits have been received + if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { + // We've not seen a packet sync for too long, signal RXLOST and change to RX_NONE + m_lostCount--; + if (m_lostCount == 0U) { + DEBUG1("M17RX: packet sync timed out, lost lock"); + io.setDecode(false); + serial.writeM17Lost(); + reset(); + } else { + // Write data to host + m_outBuffer[0U] = 0x02U; // Packet data + m_outBuffer[0U] |= m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; writeRSSIData(m_outBuffer); // Start the next frame diff --git a/M17RX.h b/M17RX.h index 1a9b08e..417e5ab 100644 --- a/M17RX.h +++ b/M17RX.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX - * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU + * Copyright (C) 2015-2018,2020,2021 by Jonathan Naylor G4KLX + * Copyright (C) 2016-2018 by Andy Uribe CA6JAU * * 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 @@ -25,7 +25,8 @@ enum M17RX_STATE { M17RXS_NONE, M17RXS_HEADER, - M17RXS_DATA + M17RXS_STREAM, + M17RXS_PACKET }; class CM17RX { @@ -46,7 +47,8 @@ private: void processNone(bool bit); void processHeader(bool bit); - void processData(bool bit); + void processStream(bool bit); + void processPacket(bool bit); void writeRSSIHeader(uint8_t* data); void writeRSSIData(uint8_t* data); }; diff --git a/version.h b/version.h index a19dad5..94c0c84 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20201226" +#define VERSION_DATE "20210101" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 2f52282c47207c26f7aad268dd4b6fa946c219cf Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sat, 2 Jan 2021 12:28:19 +0000 Subject: [PATCH 216/239] Clean up the M17 synchronisation. --- M17RX.cpp | 38 +++++++++++++------------------------- M17RX.h | 4 ++-- version.h | 2 +- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/M17RX.cpp b/M17RX.cpp index b16ce9a..e3a6696 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -25,7 +25,7 @@ const uint8_t MAX_SYNC_BIT_START_ERRS = 0U; const uint8_t MAX_SYNC_BIT_RUN_ERRS = 2U; -const unsigned int MAX_SYNC_FRAMES = 5U + 1U; +const unsigned int MAX_SYNC_FRAMES = 3U + 1U; const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U}; @@ -53,17 +53,17 @@ void CM17RX::reset() void CM17RX::databit(bool bit) { switch (m_state) { - case M17RXS_NONE: - processNone(bit); + case M17RXS_LINK_SETUP: + processLinkSetup(bit); break; - case M17RXS_HEADER: - processHeader(bit); + case M17RXS_STREAM: + processStream(bit); break; case M17RXS_PACKET: processPacket(bit); break; default: - processStream(bit); + processNone(bit); break; } } @@ -74,15 +74,15 @@ void CM17RX::processNone(bool bit) if (bit) m_bitBuffer |= 0x01U; - // Fuzzy matching of the header sync bit sequence + // Fuzzy matching of the link setup sync bit sequence if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { - DEBUG1("M17RX: header sync found in None"); + DEBUG1("M17RX: link setup sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) m_buffer[i] = M17_LINK_SETUP_SYNC_BYTES[i]; m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; - m_state = M17RXS_HEADER; + m_state = M17RXS_LINK_SETUP; io.setDecode(true); } @@ -114,7 +114,7 @@ void CM17RX::processNone(bool bit) } } -void CM17RX::processHeader(bool bit) +void CM17RX::processLinkSetup(bool bit) { m_bitBuffer <<= 1; if (bit) @@ -126,16 +126,6 @@ void CM17RX::processHeader(bool bit) if (m_bufferPtr > M17_FRAME_LENGTH_BITS) reset(); - // Only search for a sync in the right place +-2 symbols - if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { - // Fuzzy matching of the data sync bit sequence - if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found header sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = M17_SYNC_LENGTH_BITS; - } - } - // Send a data frame to the host if the required number of bits have been received if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { m_lostCount--; @@ -145,9 +135,7 @@ void CM17RX::processHeader(bool bit) writeRSSIHeader(m_outBuffer); // Start the next frame, but we don't know the type - ::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U); - m_state = M17RXS_NONE; - m_bufferPtr = 0U; + reset(); } } @@ -167,7 +155,7 @@ void CM17RX::processStream(bool bit) if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found stream sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + DEBUG2("M17RX: found stream sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; } @@ -211,7 +199,7 @@ void CM17RX::processPacket(bool bit) if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the packet sync bit sequence if (countBits16(m_bitBuffer ^ M17_PACKET_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found packet sync in Data, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + DEBUG2("M17RX: found packet sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; } diff --git a/M17RX.h b/M17RX.h index 417e5ab..0cf3626 100644 --- a/M17RX.h +++ b/M17RX.h @@ -24,7 +24,7 @@ enum M17RX_STATE { M17RXS_NONE, - M17RXS_HEADER, + M17RXS_LINK_SETUP, M17RXS_STREAM, M17RXS_PACKET }; @@ -46,7 +46,7 @@ private: uint16_t m_lostCount; void processNone(bool bit); - void processHeader(bool bit); + void processLinkSetup(bool bit); void processStream(bool bit); void processPacket(bool bit); void writeRSSIHeader(uint8_t* data); diff --git a/version.h b/version.h index 94c0c84..d48ac89 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210101" +#define VERSION_DATE "20210102" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From cf00e2f34752bd23fc3abbe6e4f05d391dc62d1d Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 9 Feb 2021 13:55:17 +0000 Subject: [PATCH 217/239] Update install_fw_nanohs.sh If this runs on a Nano Pi board running on Pi-Star, reset some gpio pins to put the modem in the correct state. Only affects this single Modem (as far as I know) --- scripts/install_fw_nanohs.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index b61b8a9..a8b72f7 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -16,6 +16,17 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# If we run this on a NanoPi board set the GPIO pins +if [ -f /etc/pistar-release ]; then + hardware=$(grep -i hardware /etc/pistar-release | awk -F "= " '{print $2}') + if [[ ${hardware} == "NanoPi" ]]; then + echo 3 > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio3/direction + echo 1 > /sys/class/gpio/gpio3/value + echo 3 > /sys/class/gpio/unexport + fi +fi + # Configure latest version FW_VERSION="v1.5.2" From df3a1401739ee4590ea806b893a91f11923dd4ef Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 14 Mar 2021 18:13:05 +0000 Subject: [PATCH 218/239] Fix and simplify the M17 receiver. --- M17RX.cpp | 142 ++++++++++++++++++++----------------------------- M17RX.h | 10 ++-- SerialPort.cpp | 62 ++++++++++++++++----- SerialPort.h | 7 +-- version.h | 2 +- 5 files changed, 119 insertions(+), 104 deletions(-) diff --git a/M17RX.cpp b/M17RX.cpp index e3a6696..3954eb9 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -54,13 +54,9 @@ void CM17RX::databit(bool bit) { switch (m_state) { case M17RXS_LINK_SETUP: - processLinkSetup(bit); - break; case M17RXS_STREAM: - processStream(bit); - break; case M17RXS_PACKET: - processPacket(bit); + processData(bit); break; default: processNone(bit); @@ -114,7 +110,7 @@ void CM17RX::processNone(bool bit) } } -void CM17RX::processLinkSetup(bool bit) +void CM17RX::processData(bool bit) { m_bitBuffer <<= 1; if (bit) @@ -126,30 +122,16 @@ void CM17RX::processLinkSetup(bool bit) if (m_bufferPtr > M17_FRAME_LENGTH_BITS) reset(); - // Send a data frame to the host if the required number of bits have been received - if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { - m_lostCount--; - - // Write data to host - m_outBuffer[0U] = 0x01U; - writeRSSIHeader(m_outBuffer); - - // Start the next frame, but we don't know the type - reset(); + // Only search for a link setup sync in the right place +-2 symbols + if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { + // Fuzzy matching of the stream sync bit sequence + if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found link setup sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + m_state = M17RXS_LINK_SETUP; + } } -} - -void CM17RX::processStream(bool bit) -{ - m_bitBuffer <<= 1; - if (bit) - m_bitBuffer |= 0x01U; - - WRITE_BIT1(m_buffer, m_bufferPtr, bit); - - m_bufferPtr++; - if (m_bufferPtr > M17_FRAME_LENGTH_BITS) - reset(); // Only search for a stream sync in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { @@ -158,15 +140,27 @@ void CM17RX::processStream(bool bit) DEBUG2("M17RX: found stream sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; + m_state = M17RXS_STREAM; } } - // Send a stream frame to the host if the required number of bits have been received + // Only search for a packet sync in the right place +-2 symbols + if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { + // Fuzzy matching of the stream sync bit sequence + if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found packet sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + m_state = M17RXS_PACKET; + } + } + + // Send a frame to the host if the required number of bits have been received if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { - // We've not seen a stream sync for too long, signal RXLOST and change to RX_NONE + // We've not seen a sync for too long, signal RXLOST and change to RX_NONE m_lostCount--; if (m_lostCount == 0U) { - DEBUG1("M17RX: stream sync timed out, lost lock"); + DEBUG1("M17RX: sync timed out, lost lock"); io.setDecode(false); serial.writeM17Lost(); reset(); @@ -174,7 +168,18 @@ void CM17RX::processStream(bool bit) // Write data to host m_outBuffer[0U] = 0x00U; // Stream data m_outBuffer[0U] |= m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; - writeRSSIData(m_outBuffer); + + switch (m_state) { + case M17RXS_LINK_SETUP: + writeRSSILinkSetup(m_outBuffer); + break; + case M17RXS_STREAM: + writeRSSIStream(m_outBuffer); + break; + default: + writeRSSIPacket(m_outBuffer); + break; + } // Start the next frame ::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U); @@ -183,51 +188,7 @@ void CM17RX::processStream(bool bit) } } -void CM17RX::processPacket(bool bit) -{ - m_bitBuffer <<= 1; - if (bit) - m_bitBuffer |= 0x01U; - - WRITE_BIT1(m_buffer, m_bufferPtr, bit); - - m_bufferPtr++; - if (m_bufferPtr > M17_FRAME_LENGTH_BITS) - reset(); - - // Only search for a packet sync in the right place +-2 symbols - if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { - // Fuzzy matching of the packet sync bit sequence - if (countBits16(m_bitBuffer ^ M17_PACKET_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found packet sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = M17_SYNC_LENGTH_BITS; - } - } - - // Send a packet frame to the host if the required number of bits have been received - if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { - // We've not seen a packet sync for too long, signal RXLOST and change to RX_NONE - m_lostCount--; - if (m_lostCount == 0U) { - DEBUG1("M17RX: packet sync timed out, lost lock"); - io.setDecode(false); - serial.writeM17Lost(); - reset(); - } else { - // Write data to host - m_outBuffer[0U] = 0x02U; // Packet data - m_outBuffer[0U] |= m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; - writeRSSIData(m_outBuffer); - - // Start the next frame - ::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U); - m_bufferPtr = 0U; - } - } -} - -void CM17RX::writeRSSIHeader(uint8_t* data) +void CM17RX::writeRSSILinkSetup(uint8_t* data) { #if defined(SEND_RSSI_DATA) uint16_t rssi = io.readRSSI(); @@ -235,13 +196,13 @@ void CM17RX::writeRSSIHeader(uint8_t* data) data[49U] = (rssi >> 8) & 0xFFU; data[50U] = (rssi >> 0) & 0xFFU; - serial.writeM17Header(data, M17_FRAME_LENGTH_BYTES + 3U); + serial.writeM17LinkSetup(data, M17_FRAME_LENGTH_BYTES + 3U); #else - serial.writeM17Header(data, M17_FRAME_LENGTH_BYTES + 1U); + serial.writeM17LinkSetup(data, M17_FRAME_LENGTH_BYTES + 1U); #endif } -void CM17RX::writeRSSIData(uint8_t* data) +void CM17RX::writeRSSIStream(uint8_t* data) { #if defined(SEND_RSSI_DATA) uint16_t rssi = io.readRSSI(); @@ -249,8 +210,23 @@ void CM17RX::writeRSSIData(uint8_t* data) data[49U] = (rssi >> 8) & 0xFFU; data[50U] = (rssi >> 0) & 0xFFU; - serial.writeM17Data(data, M17_FRAME_LENGTH_BYTES + 3U); + serial.writeM17Stream(data, M17_FRAME_LENGTH_BYTES + 3U); #else - serial.writeM17Data(data, M17_FRAME_LENGTH_BYTES + 1U); + serial.writeM17Stream(data, M17_FRAME_LENGTH_BYTES + 1U); #endif } + +void CM17RX::writeRSSIPacket(uint8_t* data) +{ +#if defined(SEND_RSSI_DATA) + uint16_t rssi = io.readRSSI(); + + data[49U] = (rssi >> 8) & 0xFFU; + data[50U] = (rssi >> 0) & 0xFFU; + + serial.writeM17Packet(data, M17_FRAME_LENGTH_BYTES + 3U); +#else + serial.writeM17Packet(data, M17_FRAME_LENGTH_BYTES + 1U); +#endif +} + diff --git a/M17RX.h b/M17RX.h index 0cf3626..3329b81 100644 --- a/M17RX.h +++ b/M17RX.h @@ -46,11 +46,11 @@ private: uint16_t m_lostCount; void processNone(bool bit); - void processLinkSetup(bool bit); - void processStream(bool bit); - void processPacket(bool bit); - void writeRSSIHeader(uint8_t* data); - void writeRSSIData(uint8_t* data); + void processData(bool bit); + void writeRSSILinkSetup(uint8_t* data); + void writeRSSIStream(uint8_t* data); + void writeRSSIPacket(uint8_t* data); }; #endif + diff --git a/SerialPort.cpp b/SerialPort.cpp index edc3287..d230247 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013,2015,2016,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2013,2015,2016,2018,2020,2021 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET @@ -60,9 +60,10 @@ const uint8_t MMDVM_P25_LOST = 0x32U; const uint8_t MMDVM_NXDN_DATA = 0x40U; const uint8_t MMDVM_NXDN_LOST = 0x41U; -const uint8_t MMDVM_M17_HEADER = 0x45U; -const uint8_t MMDVM_M17_DATA = 0x46U; -const uint8_t MMDVM_M17_LOST = 0x47U; +const uint8_t MMDVM_M17_LINK_SETUP = 0x45U; +const uint8_t MMDVM_M17_STREAM = 0x46U; +const uint8_t MMDVM_M17_PACKET = 0x47U; +const uint8_t MMDVM_M17_LOST = 0x48U; const uint8_t MMDVM_POCSAG_DATA = 0x50U; @@ -865,7 +866,7 @@ void CSerialPort::process() } break; - case MMDVM_M17_HEADER: + case MMDVM_M17_LINK_SETUP: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) err = m17TX.writeData(m_buffer + 3U, m_len - 3U); @@ -874,12 +875,12 @@ void CSerialPort::process() if (m_modemState == STATE_IDLE) setMode(STATE_M17); } else { - DEBUG2("Received invalid M17 header", err); + DEBUG2("Received invalid M17 link setup data", err); sendNAK(err); } break; - case MMDVM_M17_DATA: + case MMDVM_M17_STREAM: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) err = m17TX.writeData(m_buffer + 3U, m_len - 3U); @@ -888,7 +889,21 @@ void CSerialPort::process() if (m_modemState == STATE_IDLE) setMode(STATE_M17); } else { - DEBUG2("Received invalid M17 data", err); + DEBUG2("Received invalid M17 stream data", err); + sendNAK(err); + } + break; + + case MMDVM_M17_PACKET: + if (m_m17Enable) { + if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) + err = m17TX.writeData(m_buffer + 3U, m_len - 3U); + } + if (err == 0U) { + if (m_modemState == STATE_IDLE) + setMode(STATE_M17); + } else { + DEBUG2("Received invalid M17 packet data", err); sendNAK(err); } break; @@ -1248,7 +1263,7 @@ void CSerialPort::writeNXDNLost() writeInt(1U, reply, 3); } -void CSerialPort::writeM17Header(const uint8_t* data, uint8_t length) +void CSerialPort::writeM17LinkSetup(const uint8_t* data, uint8_t length) { if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) return; @@ -1260,7 +1275,7 @@ void CSerialPort::writeM17Header(const uint8_t* data, uint8_t length) reply[0U] = MMDVM_FRAME_START; reply[1U] = 0U; - reply[2U] = MMDVM_M17_HEADER; + reply[2U] = MMDVM_M17_LINK_SETUP; uint8_t count = 3U; for (uint8_t i = 0U; i < length; i++, count++) @@ -1271,7 +1286,7 @@ void CSerialPort::writeM17Header(const uint8_t* data, uint8_t length) writeInt(1U, reply, count); } -void CSerialPort::writeM17Data(const uint8_t* data, uint8_t length) +void CSerialPort::writeM17Stream(const uint8_t* data, uint8_t length) { if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) return; @@ -1283,7 +1298,30 @@ void CSerialPort::writeM17Data(const uint8_t* data, uint8_t length) reply[0U] = MMDVM_FRAME_START; reply[1U] = 0U; - reply[2U] = MMDVM_M17_DATA; + reply[2U] = MMDVM_M17_STREAM; + + uint8_t count = 3U; + for (uint8_t i = 0U; i < length; i++, count++) + reply[count] = data[i]; + + reply[1U] = count; + + writeInt(1U, reply, count); +} + +void CSerialPort::writeM17Packet(const uint8_t* data, uint8_t length) +{ + if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) + return; + + if (!m_m17Enable) + return; + + uint8_t reply[130U]; + + reply[0U] = MMDVM_FRAME_START; + reply[1U] = 0U; + reply[2U] = MMDVM_M17_PACKET; uint8_t count = 3U; for (uint8_t i = 0U; i < length; i++, count++) diff --git a/SerialPort.h b/SerialPort.h index 38d2139..f397c52 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2018,2020,2021 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -52,8 +52,9 @@ public: void writeNXDNData(const uint8_t* data, uint8_t length); void writeNXDNLost(); - void writeM17Header(const uint8_t* data, uint8_t length); - void writeM17Data(const uint8_t* data, uint8_t length); + void writeM17LinkSetup(const uint8_t* data, uint8_t length); + void writeM17Stream(const uint8_t* data, uint8_t length); + void writeM17Packet(const uint8_t* data, uint8_t length); void writeM17Lost(); #if defined(SEND_RSSI_DATA) diff --git a/version.h b/version.h index d48ac89..3d379e6 100644 --- a/version.h +++ b/version.h @@ -25,7 +25,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210102" +#define VERSION_DATE "20210314" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 3fee6b47cdb7ead134baaa844177fa339e7c30e8 Mon Sep 17 00:00:00 2001 From: Guybrush Date: Sat, 17 Apr 2021 22:35:15 +0200 Subject: [PATCH 219/239] use st-flash from path if exists and add option --flash=128k --- Makefile | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b30ef7c..c73834e 100644 --- a/Makefile +++ b/Makefile @@ -110,10 +110,20 @@ else MDDIRS=mkdir $@ ifeq ($(shell uname -s),Linux) + ST_FLASH_ON_PATH=$(shell which st-flash) + ST_FLASH_IS_ON_PATH=$(.SHELLSTATUS) ifeq ($(shell uname -m),x86_64) DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util - ST_FLASH=./$(F1_LIB_PATH)/utils/linux64/st-flash + DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset + DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util + ifeq ($(ST_FLASH_IS_ON_PATH),0) + ST_FLASH=$(ST_FLASH_ON_PATH) + ST_FLASH_OPTS=--flash=128k + else + ST_FLASH=./$(F1_LIB_PATH)/utils/linux64/st-flash + ST_FLASH_OPTS= + endif STM32FLASH=./$(F1_LIB_PATH)/utils/linux64/stm32flash else ifeq ($(shell uname -m),armv7l) DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset @@ -128,7 +138,13 @@ else else DFU_RST=./$(F1_LIB_PATH)/utils/linux/upload-reset DFU_UTIL=./$(F1_LIB_PATH)/utils/linux/dfu-util - ST_FLASH=./$(F1_LIB_PATH)/utils/linux/st-flash + ifeq ($(ST_FLASH_IS_ON_PATH),0) + ST_FLASH=$(ST_FLASH_ON_PATH) + ST_FLASH_OPTS=--flash=128k + else + ST_FLASH=./$(F1_LIB_PATH)/utils/linux/st-flash + ST_FLASH_OPTS= + endif STM32FLASH=./$(F1_LIB_PATH)/utils/linux/stm32flash endif endif @@ -405,20 +421,20 @@ clean: $(RM) GitVersion.h stlink: - $(ST_FLASH) write bin/$(BINBIN_F1) 0x8000000 + $(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1) 0x8000000 stlink-nobl: - $(ST_FLASH) write bin/$(BINBIN_F1NOBL) 0x8000000 + $(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1NOBL) 0x8000000 stlink-bl: - $(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000 + $(ST_FLASH) $(ST_FLASH_OPTS) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000 sleep 3 - $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 + $(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1BL) 0x8002000 stlink-bl-old: - $(ST_FLASH) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000 + $(ST_FLASH) $(ST_FLASH_OPTS) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000 sleep 3 - $(ST_FLASH) write bin/$(BINBIN_F1BL) 0x8002000 + $(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1BL) 0x8002000 serial: $(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser) From e3cadb7f32c17dc5c74ab63723672bfbc8690847 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 22 Aug 2021 13:27:18 +0100 Subject: [PATCH 220/239] Remove M17 packet mode. --- M17Defines.h | 4 +--- M17RX.cpp | 40 ---------------------------------------- M17RX.h | 4 +--- SerialPort.cpp | 23 ----------------------- SerialPort.h | 1 - version.h | 3 ++- 6 files changed, 4 insertions(+), 71 deletions(-) diff --git a/M17Defines.h b/M17Defines.h index 2f8e98e..3cc28b9 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017,2018,2020,2021 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 @@ -28,13 +28,11 @@ const unsigned int M17_SYNC_LENGTH_BITS = 16U; const uint8_t M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U}; const uint8_t M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU}; -const uint8_t M17_PACKET_SYNC_BYTES[] = {0x75U, 0xFFU}; const uint8_t M17_SYNC_BYTES_LENGTH = 2U; const uint16_t M17_LINK_SETUP_SYNC_BITS = 0x55F7U; const uint16_t M17_STREAM_SYNC_BITS = 0xFF5DU; -const uint16_t M17_PACKET_SYNC_BITS = 0x75FFU; #endif diff --git a/M17RX.cpp b/M17RX.cpp index 3954eb9..9cd81b2 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -55,7 +55,6 @@ void CM17RX::databit(bool bit) switch (m_state) { case M17RXS_LINK_SETUP: case M17RXS_STREAM: - case M17RXS_PACKET: processData(bit); break; default: @@ -95,19 +94,6 @@ void CM17RX::processNone(bool bit) io.setDecode(true); } - - // Fuzzy matching of the packet sync bit sequence - if (countBits16(m_bitBuffer ^ M17_PACKET_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { - DEBUG1("M17RX: packet sync found in None"); - for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) - m_buffer[i] = M17_PACKET_SYNC_BYTES[i]; - - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = M17_SYNC_LENGTH_BITS; - m_state = M17RXS_PACKET; - - io.setDecode(true); - } } void CM17RX::processData(bool bit) @@ -144,17 +130,6 @@ void CM17RX::processData(bool bit) } } - // Only search for a packet sync in the right place +-2 symbols - if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { - // Fuzzy matching of the stream sync bit sequence - if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found packet sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = M17_SYNC_LENGTH_BITS; - m_state = M17RXS_PACKET; - } - } - // Send a frame to the host if the required number of bits have been received if (m_bufferPtr == M17_FRAME_LENGTH_BITS) { // We've not seen a sync for too long, signal RXLOST and change to RX_NONE @@ -177,7 +152,6 @@ void CM17RX::processData(bool bit) writeRSSIStream(m_outBuffer); break; default: - writeRSSIPacket(m_outBuffer); break; } @@ -216,17 +190,3 @@ void CM17RX::writeRSSIStream(uint8_t* data) #endif } -void CM17RX::writeRSSIPacket(uint8_t* data) -{ -#if defined(SEND_RSSI_DATA) - uint16_t rssi = io.readRSSI(); - - data[49U] = (rssi >> 8) & 0xFFU; - data[50U] = (rssi >> 0) & 0xFFU; - - serial.writeM17Packet(data, M17_FRAME_LENGTH_BYTES + 3U); -#else - serial.writeM17Packet(data, M17_FRAME_LENGTH_BYTES + 1U); -#endif -} - diff --git a/M17RX.h b/M17RX.h index 3329b81..1284a29 100644 --- a/M17RX.h +++ b/M17RX.h @@ -25,8 +25,7 @@ enum M17RX_STATE { M17RXS_NONE, M17RXS_LINK_SETUP, - M17RXS_STREAM, - M17RXS_PACKET + M17RXS_STREAM }; class CM17RX { @@ -49,7 +48,6 @@ private: void processData(bool bit); void writeRSSILinkSetup(uint8_t* data); void writeRSSIStream(uint8_t* data); - void writeRSSIPacket(uint8_t* data); }; #endif diff --git a/SerialPort.cpp b/SerialPort.cpp index d230247..bd73f02 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1309,29 +1309,6 @@ void CSerialPort::writeM17Stream(const uint8_t* data, uint8_t length) writeInt(1U, reply, count); } -void CSerialPort::writeM17Packet(const uint8_t* data, uint8_t length) -{ - if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) - return; - - if (!m_m17Enable) - return; - - uint8_t reply[130U]; - - reply[0U] = MMDVM_FRAME_START; - reply[1U] = 0U; - reply[2U] = MMDVM_M17_PACKET; - - uint8_t count = 3U; - for (uint8_t i = 0U; i < length; i++, count++) - reply[count] = data[i]; - - reply[1U] = count; - - writeInt(1U, reply, count); -} - void CSerialPort::writeM17Lost() { if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) diff --git a/SerialPort.h b/SerialPort.h index f397c52..f38c9f0 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -54,7 +54,6 @@ public: void writeM17LinkSetup(const uint8_t* data, uint8_t length); void writeM17Stream(const uint8_t* data, uint8_t length); - void writeM17Packet(const uint8_t* data, uint8_t length); void writeM17Lost(); #if defined(SEND_RSSI_DATA) diff --git a/version.h b/version.h index 3d379e6..ccb44a5 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU + * Copyright (C) 2020,2021 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 @@ -25,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210314" +#define VERSION_DATE "20210822" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 800ec4fe140d1971334f6ac38249998b812b33eb Mon Sep 17 00:00:00 2001 From: Mathis Schmieder Date: Mon, 23 Aug 2021 18:41:29 +0100 Subject: [PATCH 221/239] Updated ADF7021 register values for M17 --- ADF7021.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ADF7021.h b/ADF7021.h index 7b58c5f..b638a91 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -118,7 +118,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 516U // K=28 #define ADF7021_DISC_BW_P25 394U // K=32 #define ADF7021_DISC_BW_NXDN 295U // K=32 -#define ADF7021_DISC_BW_M17 571U // K=31 +#define ADF7021_DISC_BW_M17 590U // K=32 #define ADF7021_DISC_BW_POCSAG 406U // K=22 // Post demodulator bandwith (REG 04) @@ -127,7 +127,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 7U -#define ADF7021_POST_BW_M17 20U // Test +#define ADF7021_POST_BW_M17 8U // Test #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) @@ -229,7 +229,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 430U // K=28 #define ADF7021_DISC_BW_P25 493U // K=32 #define ADF7021_DISC_BW_NXDN 246U // K=32 -#define ADF7021_DISC_BW_M17 476U // K=31 +#define ADF7021_DISC_BW_M17 491U // K=32 #define ADF7021_DISC_BW_POCSAG 338U // K=22 // Post demodulator bandwith (REG 04) @@ -238,7 +238,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 8U -#define ADF7021_POST_BW_M17 20U // Test +#define ADF7021_POST_BW_M17 8U // Test #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) From a80dc06ed67a83c39d4eef1991e8915bd56f870d Mon Sep 17 00:00:00 2001 From: Mathis Schmieder Date: Mon, 23 Aug 2021 18:44:32 +0100 Subject: [PATCH 222/239] Updated version.h --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index ccb44a5..461bc92 100644 --- a/version.h +++ b/version.h @@ -26,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210822" +#define VERSION_DATE "20210823" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 36f607250aedd714ee818869572ee3f8459da77c Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 26 Aug 2021 18:14:05 +0100 Subject: [PATCH 223/239] Add support for the new EOF sync pattern. --- M17Defines.h | 3 +++ M17RX.cpp | 13 +++++++++---- M17TX.cpp | 31 +++++++++++++++++++++++++++++-- M17TX.h | 6 ++++-- SerialPort.cpp | 28 +++++++++++++++++++++++----- SerialPort.h | 1 + version.h | 2 +- 7 files changed, 70 insertions(+), 14 deletions(-) diff --git a/M17Defines.h b/M17Defines.h index 3cc28b9..65ac8a4 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -25,14 +25,17 @@ const unsigned int M17_FRAME_LENGTH_BITS = 384U; const unsigned int M17_FRAME_LENGTH_BYTES = M17_FRAME_LENGTH_BITS / 8U; const unsigned int M17_SYNC_LENGTH_BITS = 16U; +const unsigned int M17_SYNC_LENGTH_BYTES = M17_SYNC_LENGTH_BITS / 8U; const uint8_t M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U}; const uint8_t M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU}; +const uint8_t M17_EOF_SYNC_BYTES[] = {0x55U, 0x5DU}; const uint8_t M17_SYNC_BYTES_LENGTH = 2U; const uint16_t M17_LINK_SETUP_SYNC_BITS = 0x55F7U; const uint16_t M17_STREAM_SYNC_BITS = 0xFF5DU; +const uint16_t M17_EOF_SYNC_BITS = 0x555DU; #endif diff --git a/M17RX.cpp b/M17RX.cpp index 9cd81b2..657fa33 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -108,7 +108,7 @@ void CM17RX::processData(bool bit) if (m_bufferPtr > M17_FRAME_LENGTH_BITS) reset(); - // Only search for a link setup sync in the right place +-2 symbols + // Only search for the syncs in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { @@ -117,10 +117,7 @@ void CM17RX::processData(bool bit) m_bufferPtr = M17_SYNC_LENGTH_BITS; m_state = M17RXS_LINK_SETUP; } - } - // Only search for a stream sync in the right place +-2 symbols - if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { // Fuzzy matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { DEBUG2("M17RX: found stream sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); @@ -128,6 +125,14 @@ void CM17RX::processData(bool bit) m_bufferPtr = M17_SYNC_LENGTH_BITS; m_state = M17RXS_STREAM; } + + // Fuzzy matching of the eof sync bit sequence + if (countBits16(m_bitBuffer ^ M17_EOF_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found eof sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + io.setDecode(false); + serial.writeM17EOT(); + reset(); + } } // Send a frame to the host if the required number of bits have been received diff --git a/M17TX.cpp b/M17TX.cpp index 4123ed5..20c16b8 100644 --- a/M17TX.cpp +++ b/M17TX.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2018,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2009-2018,2020,2021 by Jonathan Naylor G4KLX * Copyright (C) 2017 by Andy Uribe CA6JAU * * This program is free software; you can redistribute it and/or modify @@ -82,7 +82,7 @@ void CM17TX::process() } } -uint8_t CM17TX::writeData(const uint8_t* data, uint8_t length) +uint8_t CM17TX::writeLinkSetup(const uint8_t* data, uint8_t length) { if (length != (M17_FRAME_LENGTH_BYTES + 1U)) return 4U; @@ -97,6 +97,33 @@ uint8_t CM17TX::writeData(const uint8_t* data, uint8_t length) return 0U; } +uint8_t CM17TX::writeStream(const uint8_t* data, uint8_t length) +{ + if (length != (M17_FRAME_LENGTH_BYTES + 1U)) + return 4U; + + uint16_t space = m_buffer.getSpace(); + if (space < M17_FRAME_LENGTH_BYTES) + return 5U; + + for (uint8_t i = 0U; i < M17_FRAME_LENGTH_BYTES; i++) + m_buffer.put(data[i + 1U]); + + return 0U; +} + +uint8_t CM17TX::writeEOT() +{ + uint16_t space = m_buffer.getSpace(); + if (space < M17_SYNC_LENGTH_BYTES) + return 5U; + + for (uint8_t i = 0U; i < M17_SYNC_LENGTH_BYTES; i++) + m_buffer.put(M17_EOF_SYNC_BYTES[i]); + + return 0U; +} + void CM17TX::writeByte(uint8_t c) { uint8_t bit; diff --git a/M17TX.h b/M17TX.h index 799794f..61b63c0 100644 --- a/M17TX.h +++ b/M17TX.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017,2020 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2017,2020,2021 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 @@ -27,7 +27,9 @@ class CM17TX { public: CM17TX(); - uint8_t writeData(const uint8_t* data, uint8_t length); + uint8_t writeLinkSetup(const uint8_t* data, uint8_t length); + uint8_t writeStream(const uint8_t* data, uint8_t length); + uint8_t writeEOT(); void process(); diff --git a/SerialPort.cpp b/SerialPort.cpp index bd73f02..6c7dc55 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -64,6 +64,7 @@ const uint8_t MMDVM_M17_LINK_SETUP = 0x45U; const uint8_t MMDVM_M17_STREAM = 0x46U; const uint8_t MMDVM_M17_PACKET = 0x47U; const uint8_t MMDVM_M17_LOST = 0x48U; +const uint8_t MMDVM_M17_EOT = 0x49U; const uint8_t MMDVM_POCSAG_DATA = 0x50U; @@ -869,7 +870,7 @@ void CSerialPort::process() case MMDVM_M17_LINK_SETUP: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) - err = m17TX.writeData(m_buffer + 3U, m_len - 3U); + err = m17TX.writeLinkSetup(m_buffer + 3U, m_len - 3U); } if (err == 0U) { if (m_modemState == STATE_IDLE) @@ -883,7 +884,7 @@ void CSerialPort::process() case MMDVM_M17_STREAM: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) - err = m17TX.writeData(m_buffer + 3U, m_len - 3U); + err = m17TX.writeStream(m_buffer + 3U, m_len - 3U); } if (err == 0U) { if (m_modemState == STATE_IDLE) @@ -894,16 +895,16 @@ void CSerialPort::process() } break; - case MMDVM_M17_PACKET: + case MMDVM_M17_EOT: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) - err = m17TX.writeData(m_buffer + 3U, m_len - 3U); + err = m17TX.writeEOT(); } if (err == 0U) { if (m_modemState == STATE_IDLE) setMode(STATE_M17); } else { - DEBUG2("Received invalid M17 packet data", err); + DEBUG2("Received invalid M17 EOT", err); sendNAK(err); } break; @@ -1309,6 +1310,23 @@ void CSerialPort::writeM17Stream(const uint8_t* data, uint8_t length) writeInt(1U, reply, count); } +void CSerialPort::writeM17EOT() +{ + if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) + return; + + if (!m_m17Enable) + return; + + uint8_t reply[3U]; + + reply[0U] = MMDVM_FRAME_START; + reply[1U] = 3U; + reply[2U] = MMDVM_M17_EOT; + + writeInt(1U, reply, 3); +} + void CSerialPort::writeM17Lost() { if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE) diff --git a/SerialPort.h b/SerialPort.h index f38c9f0..a8913f5 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -54,6 +54,7 @@ public: void writeM17LinkSetup(const uint8_t* data, uint8_t length); void writeM17Stream(const uint8_t* data, uint8_t length); + void writeM17EOT(); void writeM17Lost(); #if defined(SEND_RSSI_DATA) diff --git a/version.h b/version.h index ccb44a5..cc6658a 100644 --- a/version.h +++ b/version.h @@ -26,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210822" +#define VERSION_DATE "20210826" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 6781dec322f4056715cec405f4965b8267f81acc Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 26 Aug 2021 18:28:14 +0100 Subject: [PATCH 224/239] Remove unnecessary link setup sync detection --- M17RX.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/M17RX.cpp b/M17RX.cpp index 657fa33..bcc1d86 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -110,14 +110,6 @@ void CM17RX::processData(bool bit) // Only search for the syncs in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { - // Fuzzy matching of the stream sync bit sequence - if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found link setup sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); - m_lostCount = MAX_SYNC_FRAMES; - m_bufferPtr = M17_SYNC_LENGTH_BITS; - m_state = M17RXS_LINK_SETUP; - } - // Fuzzy matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { DEBUG2("M17RX: found stream sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); From d9621c5c8baf45c31aea55fcfe10520fc66ff4b7 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 8 Sep 2021 19:52:31 +0100 Subject: [PATCH 225/239] Disable M17 EOT transmission for now. --- M17TX.cpp | 3 ++- version.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/M17TX.cpp b/M17TX.cpp index 20c16b8..dceb8b3 100644 --- a/M17TX.cpp +++ b/M17TX.cpp @@ -114,13 +114,14 @@ uint8_t CM17TX::writeStream(const uint8_t* data, uint8_t length) uint8_t CM17TX::writeEOT() { +/* uint16_t space = m_buffer.getSpace(); if (space < M17_SYNC_LENGTH_BYTES) return 5U; for (uint8_t i = 0U; i < M17_SYNC_LENGTH_BYTES; i++) m_buffer.put(M17_EOF_SYNC_BYTES[i]); - +*/ return 0U; } diff --git a/version.h b/version.h index cc6658a..0e57912 100644 --- a/version.h +++ b/version.h @@ -26,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210826" +#define VERSION_DATE "20210908" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 6fc189793d89b8c2afa1ea22286e5c4f8b26945b Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 12 Sep 2021 20:59:59 +0100 Subject: [PATCH 226/239] Roll back some of recent changes. --- M17Defines.h | 4 ++-- M17RX.cpp | 18 +++++++++++++----- M17TX.cpp | 4 ++-- version.h | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/M17Defines.h b/M17Defines.h index 65ac8a4..d50dc08 100644 --- a/M17Defines.h +++ b/M17Defines.h @@ -29,13 +29,13 @@ const unsigned int M17_SYNC_LENGTH_BYTES = M17_SYNC_LENGTH_BITS / 8U; const uint8_t M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U}; const uint8_t M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU}; -const uint8_t M17_EOF_SYNC_BYTES[] = {0x55U, 0x5DU}; +const uint8_t M17_EOT_SYNC_BYTES[] = {0x55U, 0x5DU}; const uint8_t M17_SYNC_BYTES_LENGTH = 2U; const uint16_t M17_LINK_SETUP_SYNC_BITS = 0x55F7U; const uint16_t M17_STREAM_SYNC_BITS = 0xFF5DU; -const uint16_t M17_EOF_SYNC_BITS = 0x555DU; +const uint16_t M17_EOT_SYNC_BITS = 0x555DU; #endif diff --git a/M17RX.cpp b/M17RX.cpp index bcc1d86..9c514d2 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -110,6 +110,14 @@ void CM17RX::processData(bool bit) // Only search for the syncs in the right place +-2 symbols if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { + // Fuzzy matching of the link setup sync bit sequence + if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found link setup sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + m_lostCount = MAX_SYNC_FRAMES; + m_bufferPtr = M17_SYNC_LENGTH_BITS; + m_state = M17RXS_LINK_SETUP; + } + // Fuzzy matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { DEBUG2("M17RX: found stream sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); @@ -118,12 +126,13 @@ void CM17RX::processData(bool bit) m_state = M17RXS_STREAM; } - // Fuzzy matching of the eof sync bit sequence - if (countBits16(m_bitBuffer ^ M17_EOF_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { - DEBUG2("M17RX: found eof sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); + // Fuzzy matching of the EOT sync bit sequence + if (countBits16(m_bitBuffer ^ M17_EOT_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { + DEBUG2("M17RX: found eot sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); io.setDecode(false); serial.writeM17EOT(); reset(); + return; } } @@ -138,8 +147,7 @@ void CM17RX::processData(bool bit) reset(); } else { // Write data to host - m_outBuffer[0U] = 0x00U; // Stream data - m_outBuffer[0U] |= m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; + m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U; switch (m_state) { case M17RXS_LINK_SETUP: diff --git a/M17TX.cpp b/M17TX.cpp index dceb8b3..895dab6 100644 --- a/M17TX.cpp +++ b/M17TX.cpp @@ -116,11 +116,11 @@ uint8_t CM17TX::writeEOT() { /* uint16_t space = m_buffer.getSpace(); - if (space < M17_SYNC_LENGTH_BYTES) + if (space < M17_FRAME_LENGTH_BYTES) return 5U; for (uint8_t i = 0U; i < M17_SYNC_LENGTH_BYTES; i++) - m_buffer.put(M17_EOF_SYNC_BYTES[i]); + m_buffer.put(M17_EOT_SYNC_BYTES[i]); */ return 0U; } diff --git a/version.h b/version.h index 0e57912..2eae345 100644 --- a/version.h +++ b/version.h @@ -26,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210908" +#define VERSION_DATE "20210912" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From d408845f821d2a1f3a5fc80e71cc2d435e07d896 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 12 Sep 2021 21:47:08 +0100 Subject: [PATCH 227/239] Small optimisations of the sync decoding for M17 --- M17RX.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/M17RX.cpp b/M17RX.cpp index 9c514d2..06c5f16 100644 --- a/M17RX.cpp +++ b/M17RX.cpp @@ -69,7 +69,7 @@ void CM17RX::processNone(bool bit) if (bit) m_bitBuffer |= 0x01U; - // Fuzzy matching of the link setup sync bit sequence + // Exact matching of the link setup sync bit sequence if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { DEBUG1("M17RX: link setup sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) @@ -80,9 +80,11 @@ void CM17RX::processNone(bool bit) m_state = M17RXS_LINK_SETUP; io.setDecode(true); + + return; } - // Fuzzy matching of the stream sync bit sequence + // Exact matching of the stream sync bit sequence if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) { DEBUG1("M17RX: stream sync found in None"); for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++) @@ -93,6 +95,8 @@ void CM17RX::processNone(bool bit) m_state = M17RXS_STREAM; io.setDecode(true); + + return; } } @@ -108,14 +112,15 @@ void CM17RX::processData(bool bit) if (m_bufferPtr > M17_FRAME_LENGTH_BITS) reset(); - // Only search for the syncs in the right place +-2 symbols - if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 2U)) { + // Only search for the syncs in the right place +-1 bit + if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 1U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 1U)) { // Fuzzy matching of the link setup sync bit sequence if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) { DEBUG2("M17RX: found link setup sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS); m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; m_state = M17RXS_LINK_SETUP; + return; } // Fuzzy matching of the stream sync bit sequence @@ -124,6 +129,7 @@ void CM17RX::processData(bool bit) m_lostCount = MAX_SYNC_FRAMES; m_bufferPtr = M17_SYNC_LENGTH_BITS; m_state = M17RXS_STREAM; + return; } // Fuzzy matching of the EOT sync bit sequence From 023462a86dfd50740511de11c46ac4fc229f44d3 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 14 Sep 2021 19:16:05 +0100 Subject: [PATCH 228/239] Increase the IF bandwidth for duplex hotspots. --- ADF7021.cpp | 6 +++--- version.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 4e1af57..500720b 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 by Jonathan Naylor G4KLX + * Copyright (C) 2020,2021 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU * Copyright (C) 2017 by Danilo DB4PLE @@ -754,7 +754,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) break; case STATE_M17: - // Dev: +1 symb 2400 Hz, symb rate = 4800 + // Dev: +1 symb 800 Hz, symb rate = 4800 ADF7021_REG3 = ADF7021_REG3_M17; ADF7021_REG10 = ADF7021_REG10_M17; @@ -766,7 +766,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) ADF7021_REG4 |= (uint32_t) 0b11 << 8; ADF7021_REG4 |= (uint32_t) ADF7021_DISC_BW_M17 << 10; // Disc BW ADF7021_REG4 |= (uint32_t) ADF7021_POST_BW_M17 << 20; // Post dem BW - ADF7021_REG4 |= (uint32_t) 0b00 << 30; // IF filter (12.5 kHz) + ADF7021_REG4 |= (uint32_t) 0b10 << 30; // IF filter (25 kHz) ADF7021_REG13 = (uint32_t) 0b1101 << 0; // register 13 ADF7021_REG13 |= (uint32_t) ADF7021_SLICER_TH_M17 << 4; // slicer threshold diff --git a/version.h b/version.h index 2eae345..c3b873e 100644 --- a/version.h +++ b/version.h @@ -26,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210912" +#define VERSION_DATE "20210914" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 92597e0d00595203bd9fbba163c967c271a8cf35 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 14 Sep 2021 20:53:41 +0100 Subject: [PATCH 229/239] Some contextual cleanups. --- ADF7021.cpp | 97 ++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 56 deletions(-) diff --git a/ADF7021.cpp b/ADF7021.cpp index 500720b..8ec86de 100644 --- a/ADF7021.cpp +++ b/ADF7021.cpp @@ -54,10 +54,8 @@ uint16_t m_pocsagDev; static void Send_AD7021_control_shift() { - int AD7021_counter; - - for(AD7021_counter = 31; AD7021_counter >= 0; AD7021_counter--) { - if(bitRead(AD7021_control_word, AD7021_counter) == HIGH) + for (int AD7021_counter = 31; AD7021_counter >= 0; AD7021_counter--) { + if (bitRead(AD7021_control_word, AD7021_counter) == HIGH) io.SDATA_pin(HIGH); else io.SDATA_pin(LOW); @@ -67,6 +65,7 @@ static void Send_AD7021_control_shift() io.dlybit(); io.SCLK_pin(LOW); } + // to keep SDATA signal at defined level when idle (not required) io.SDATA_pin(LOW); } @@ -82,9 +81,8 @@ void Send_AD7021_control(bool doSle) { Send_AD7021_control_shift(); - if (doSle) { + if (doSle) Send_AD7021_control_slePulse(); - } } #if defined(DUPLEX) @@ -99,9 +97,8 @@ void Send_AD7021_control2(bool doSle) { Send_AD7021_control_shift(); - if (doSle) { + if (doSle) Send_AD7021_control_sle2Pulse(); - } } #endif @@ -110,15 +107,14 @@ uint16_t CIO::readRSSI() { uint32_t AD7021_RB; uint16_t RB_word = 0U; - int AD7021_counter; uint8_t RB_code, gain_code, gain_corr; // Register 7, readback enable, ADC RSSI mode AD7021_RB = 0x0147; // Send control register - for(AD7021_counter = 8; AD7021_counter >= 0; AD7021_counter--) { - if(bitRead(AD7021_RB, AD7021_counter) == HIGH) + for (int AD7021_counter = 8; AD7021_counter >= 0; AD7021_counter--) { + if (bitRead(AD7021_RB, AD7021_counter) == HIGH) SDATA_pin(HIGH); else SDATA_pin(LOW); @@ -143,16 +139,15 @@ uint16_t CIO::readRSSI() dlybit(); // Read SREAD pin - for(AD7021_counter = 17; AD7021_counter >= 0; AD7021_counter--) { + for (int AD7021_counter = 17; AD7021_counter >= 0; AD7021_counter--) { SCLK_pin(HIGH); dlybit(); - if( (AD7021_counter != 17) && (AD7021_counter != 0) ) - RB_word |= ( (SREAD_pin() & 0x01) << (AD7021_counter-1) ); + if ((AD7021_counter != 17) && (AD7021_counter != 0)) + RB_word |= ((SREAD_pin() & 0x01) << (AD7021_counter - 1)); SCLK_pin(LOW); dlybit(); - } #if defined(DUPLEX) @@ -223,7 +218,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) #endif // Toggle CE pin for ADF7021 reset - if(reset) { + if (reset) { CE_pin(LOW); delay_reset(); CE_pin(HIGH); @@ -231,28 +226,24 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) } // Check frequency band - if( (m_frequency_tx >= VHF1_MIN) && (m_frequency_tx < VHF1_MAX) ) { + if ((m_frequency_tx >= VHF1_MIN) && (m_frequency_tx < VHF1_MAX)) { ADF7021_REG1 = ADF7021_REG1_VHF1; // VHF1, external VCO div2 = 1U; - } - else if( (m_frequency_tx >= VHF2_MIN) && (m_frequency_tx < VHF2_MAX) ) { + } else if ((m_frequency_tx >= VHF2_MIN) && (m_frequency_tx < VHF2_MAX)) { ADF7021_REG1 = ADF7021_REG1_VHF2; // VHF1, external VCO div2 = 1U; - } - else if( (m_frequency_tx >= UHF1_MIN)&&(m_frequency_tx < UHF1_MAX) ) { + } else if ((m_frequency_tx >= UHF1_MIN)&&(m_frequency_tx < UHF1_MAX)) { ADF7021_REG1 = ADF7021_REG1_UHF1; // UHF1, internal VCO div2 = 1U; - } - else if( (m_frequency_tx >= UHF2_MIN)&&(m_frequency_tx < UHF2_MAX) ) { + } else if ((m_frequency_tx >= UHF2_MIN)&&(m_frequency_tx < UHF2_MAX)) { ADF7021_REG1 = ADF7021_REG1_UHF2; // UHF2, internal VCO div2 = 2U; - } - else { + } else { ADF7021_REG1 = ADF7021_REG1_UHF1; // UHF1, internal VCO div2 = 1U; } - if(div2 == 1U) + if (div2 == 1U) f_div = 2U; else f_div = 1U; @@ -282,10 +273,10 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) break; } - if( div2 == 1U ) + if (div2 == 1U) divider = (m_frequency_rx - 100000 + AFC_OFFSET) / (ADF7021_PFD / 2U); else - divider = (m_frequency_rx - 100000 + (2*AFC_OFFSET)) / ADF7021_PFD; + divider = (m_frequency_rx - 100000 + (2 * AFC_OFFSET)) / ADF7021_PFD; m_RX_N_divider = floor(divider); divider = (divider - m_RX_N_divider) * 32768; @@ -302,7 +293,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) ADF7021_RX_REG0 |= (uint32_t) m_RX_N_divider << 19; // frequency; ADF7021_RX_REG0 |= (uint32_t) m_RX_F_divider << 4; // frequency; - if( div2 == 1U ) + if (div2 == 1U) divider = m_frequency_tx / (ADF7021_PFD / 2U); else divider = m_frequency_tx / ADF7021_PFD; @@ -424,7 +415,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) break; case STATE_YSF: - // Dev: +1 symb 900 Hz, symb rate = 4800 + // Dev: +1 symb 900/450 Hz, symb rate = 4800 ADF7021_REG3 = (m_LoDevYSF ? ADF7021_REG3_YSF_L : ADF7021_REG3_YSF_H); ADF7021_REG10 = ADF7021_REG10_YSF; @@ -623,7 +614,7 @@ void CIO::ifConf(MMDVM_STATE modemState, bool reset) } #if defined(DUPLEX) -if(m_duplex && (modemState != STATE_CWID && modemState != STATE_POCSAG)) +if (m_duplex && (modemState != STATE_CWID && modemState != STATE_POCSAG)) ifConf2(modemState); #endif } @@ -685,7 +676,7 @@ void CIO::ifConf2(MMDVM_STATE modemState) break; case STATE_YSF: - // Dev: +1 symb 2700/900 Hz, symb rate = 4800 + // Dev: +1 symb 900/450 Hz, symb rate = 4800 ADF7021_REG3 = (m_LoDevYSF ? ADF7021_REG3_YSF_L : ADF7021_REG3_YSF_H); ADF7021_REG10 = ADF7021_REG10_YSF; @@ -862,25 +853,23 @@ void CIO::interrupt() // possibly this is a design problem of the RF7021 board or too long wires // on the breadboard build // but normally this will not hurt too much - if (clk == last_clk) { + if (clk == last_clk) return; - } else { + else last_clk = clk; - } // we set the TX bit at TXD low, sampling of ADF7021 happens at rising clock if (m_tx && clk == 0U) { - m_txBuffer.get(bit, m_control); even = !even; #if defined(BIDIR_DATA_PIN) - if(bit) + if (bit) RXD_pin_write(HIGH); else RXD_pin_write(LOW); #else - if(bit) + if (bit) TXD_pin(HIGH); else TXD_pin(LOW); @@ -912,7 +901,7 @@ void CIO::interrupt() // we sample the RX bit at rising TXD clock edge, so TXD must be 1 and we are not in tx mode if (!m_tx && clk == 1U && !m_duplex) { - if(RXD_pin()) + if (RXD_pin()) bit = 1U; else bit = 0U; @@ -920,7 +909,7 @@ void CIO::interrupt() m_rxBuffer.put(bit, m_control); } - if (torx_request == true && even == ADF7021_EVEN_BIT && m_tx && clk == 0U) { + if (torx_request && even == ADF7021_EVEN_BIT && m_tx && clk == 0U) { // that is absolutely crucial in 4FSK, see datasheet: // enable sle after 1/4 tBit == 26uS when sending MSB (even == false) and clock is low delay_us(26U); @@ -946,10 +935,10 @@ void CIO::interrupt() m_modeTimerCnt++; m_int1counter++; - if(m_scanPauseCnt >= SCAN_PAUSE) + if (m_scanPauseCnt >= SCAN_PAUSE) m_scanPauseCnt = 0U; - if(m_scanPauseCnt != 0U) + if (m_scanPauseCnt != 0U) m_scanPauseCnt++; } @@ -958,8 +947,8 @@ void CIO::interrupt2() { uint8_t bit = 0U; - if(m_duplex) { - if(RXD2_pin()) + if (m_duplex) { + if (RXD2_pin()) bit = 1U; else bit = 0U; @@ -1003,7 +992,7 @@ void CIO::setRX(bool doSle) Data_dir_out(false); // Data pin input mode #endif - if(!doSle) { + if (!doSle) { torx_request = true; while(torx_request) { asm volatile ("nop"); } } @@ -1036,28 +1025,24 @@ void CIO::updateCal() float divider; // Check frequency band - if( (m_frequency_tx >= VHF1_MIN) && (m_frequency_tx < VHF1_MAX) ) { + if ((m_frequency_tx >= VHF1_MIN) && (m_frequency_tx < VHF1_MAX)) { ADF7021_REG1 = ADF7021_REG1_VHF1; // VHF1, external VCO div2 = 1U; - } - else if( (m_frequency_tx >= VHF2_MIN) && (m_frequency_tx < VHF2_MAX) ) { + } else if ((m_frequency_tx >= VHF2_MIN) && (m_frequency_tx < VHF2_MAX)) { ADF7021_REG1 = ADF7021_REG1_VHF2; // VHF1, external VCO div2 = 1U; - } - else if( (m_frequency_tx >= UHF1_MIN)&&(m_frequency_tx < UHF1_MAX) ) { + } else if ((m_frequency_tx >= UHF1_MIN)&&(m_frequency_tx < UHF1_MAX)) { ADF7021_REG1 = ADF7021_REG1_UHF1; // UHF1, internal VCO div2 = 1U; - } - else if( (m_frequency_tx >= UHF2_MIN)&&(m_frequency_tx < UHF2_MAX) ) { + } else if ((m_frequency_tx >= UHF2_MIN)&&(m_frequency_tx < UHF2_MAX)) { ADF7021_REG1 = ADF7021_REG1_UHF2; // UHF2, internal VCO div2 = 2U; - } - else { + } else { ADF7021_REG1 = ADF7021_REG1_UHF1; // UHF1, internal VCO div2 = 1U; } - if(div2 == 1U) + if (div2 == 1U) f_div = 2U; else f_div = 1U; @@ -1083,7 +1068,7 @@ void CIO::updateCal() AD7021_control_word = ADF7021_REG2; Send_AD7021_control(); - if( div2 == 1U ) + if (div2 == 1U) divider = m_frequency_tx / (ADF7021_PFD / 2U); else divider = m_frequency_tx / ADF7021_PFD; From ab3c9a39a3b7767e3397dece738622591b8e137b Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 15 Sep 2021 23:25:49 +0100 Subject: [PATCH 230/239] Modify the ADF7021 parameters for M17. --- ADF7021.h | 4 ++-- version.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ADF7021.h b/ADF7021.h index b638a91..1ae9a4f 100644 --- a/ADF7021.h +++ b/ADF7021.h @@ -127,7 +127,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_POST_BW_YSF 20U #define ADF7021_POST_BW_P25 6U #define ADF7021_POST_BW_NXDN 7U -#define ADF7021_POST_BW_M17 8U // Test +#define ADF7021_POST_BW_M17 7U // Test #define ADF7021_POST_BW_POCSAG 1U // IF filter (REG 05) @@ -229,7 +229,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf #define ADF7021_DISC_BW_YSF_H 430U // K=28 #define ADF7021_DISC_BW_P25 493U // K=32 #define ADF7021_DISC_BW_NXDN 246U // K=32 -#define ADF7021_DISC_BW_M17 491U // K=32 +#define ADF7021_DISC_BW_M17 492U // K=32 #define ADF7021_DISC_BW_POCSAG 338U // K=22 // Post demodulator bandwith (REG 04) diff --git a/version.h b/version.h index c3b873e..bbacfaf 100644 --- a/version.h +++ b/version.h @@ -26,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210914" +#define VERSION_DATE "20210915" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 0f3a4fa24985603bdf269854e9a6c4ae1eae927d Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 19 Sep 2021 14:29:15 +0100 Subject: [PATCH 231/239] Change the EOT handling on M17 TX. --- M17TX.cpp | 30 +----------------------------- M17TX.h | 4 +--- SerialPort.cpp | 6 +++--- version.h | 2 +- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/M17TX.cpp b/M17TX.cpp index 895dab6..5dfc3ca 100644 --- a/M17TX.cpp +++ b/M17TX.cpp @@ -82,7 +82,7 @@ void CM17TX::process() } } -uint8_t CM17TX::writeLinkSetup(const uint8_t* data, uint8_t length) +uint8_t CM17TX::writeData(const uint8_t* data, uint8_t length) { if (length != (M17_FRAME_LENGTH_BYTES + 1U)) return 4U; @@ -97,34 +97,6 @@ uint8_t CM17TX::writeLinkSetup(const uint8_t* data, uint8_t length) return 0U; } -uint8_t CM17TX::writeStream(const uint8_t* data, uint8_t length) -{ - if (length != (M17_FRAME_LENGTH_BYTES + 1U)) - return 4U; - - uint16_t space = m_buffer.getSpace(); - if (space < M17_FRAME_LENGTH_BYTES) - return 5U; - - for (uint8_t i = 0U; i < M17_FRAME_LENGTH_BYTES; i++) - m_buffer.put(data[i + 1U]); - - return 0U; -} - -uint8_t CM17TX::writeEOT() -{ -/* - uint16_t space = m_buffer.getSpace(); - if (space < M17_FRAME_LENGTH_BYTES) - return 5U; - - for (uint8_t i = 0U; i < M17_SYNC_LENGTH_BYTES; i++) - m_buffer.put(M17_EOT_SYNC_BYTES[i]); -*/ - return 0U; -} - void CM17TX::writeByte(uint8_t c) { uint8_t bit; diff --git a/M17TX.h b/M17TX.h index 61b63c0..00c2a33 100644 --- a/M17TX.h +++ b/M17TX.h @@ -27,9 +27,7 @@ class CM17TX { public: CM17TX(); - uint8_t writeLinkSetup(const uint8_t* data, uint8_t length); - uint8_t writeStream(const uint8_t* data, uint8_t length); - uint8_t writeEOT(); + uint8_t writeData(const uint8_t* data, uint8_t length); void process(); diff --git a/SerialPort.cpp b/SerialPort.cpp index 6c7dc55..4dd8a8a 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -870,7 +870,7 @@ void CSerialPort::process() case MMDVM_M17_LINK_SETUP: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) - err = m17TX.writeLinkSetup(m_buffer + 3U, m_len - 3U); + err = m17TX.writeData(m_buffer + 3U, m_len - 3U); } if (err == 0U) { if (m_modemState == STATE_IDLE) @@ -884,7 +884,7 @@ void CSerialPort::process() case MMDVM_M17_STREAM: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) - err = m17TX.writeStream(m_buffer + 3U, m_len - 3U); + err = m17TX.writeData(m_buffer + 3U, m_len - 3U); } if (err == 0U) { if (m_modemState == STATE_IDLE) @@ -898,7 +898,7 @@ void CSerialPort::process() case MMDVM_M17_EOT: if (m_m17Enable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_M17) - err = m17TX.writeEOT(); + err = m17TX.writeData(m_buffer + 3U, m_len - 3U); } if (err == 0U) { if (m_modemState == STATE_IDLE) diff --git a/version.h b/version.h index bbacfaf..6b5aa28 100644 --- a/version.h +++ b/version.h @@ -26,7 +26,7 @@ #define VER_MAJOR "1" #define VER_MINOR "5" #define VER_REV "2" -#define VERSION_DATE "20210915" +#define VERSION_DATE "20210919" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 931cfde894ed38b8e743b48ef73c1f5e7ba39f7c Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 17 Oct 2021 18:44:14 +0100 Subject: [PATCH 232/239] Bump the minor version number. --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 6b5aa28..450efcb 100644 --- a/version.h +++ b/version.h @@ -24,8 +24,8 @@ #include "ADF7021.h" #define VER_MAJOR "1" -#define VER_MINOR "5" -#define VER_REV "2" +#define VER_MINOR "6" +#define VER_REV "0" #define VERSION_DATE "20210919" #if defined(ZUMSPOT_ADF7021) From 4d51976f6a293f7bf7665b90b96295ca16fa3d4f Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Mon, 22 Nov 2021 18:22:56 -0500 Subject: [PATCH 233/239] Add support for LoneStar USB Stick --- Config.h | 2 + IO.cpp | 4 +- IO.h | 2 +- IOArduino.cpp | 6 +- IOSTM.cpp | 18 ++--- SerialPort.cpp | 2 +- configs/LoneStar_USB.h | 120 +++++++++++++++++++++++++++++ scripts/build_fw.sh | 9 +++ scripts/install_fw_lonestar_usb.sh | 95 +++++++++++++++++++++++ version.h | 2 + 10 files changed, 244 insertions(+), 16 deletions(-) create mode 100644 configs/LoneStar_USB.h create mode 100755 scripts/install_fw_lonestar_usb.sh diff --git a/Config.h b/Config.h index 8384bf3..61a5ff6 100644 --- a/Config.h +++ b/Config.h @@ -36,6 +36,8 @@ // #define D2RG_MMDVM_HS // 8) BridgeCom SkyBridge HotSpot // #define SKYBRIDGE_HS +// 9) LoneStar USB Stick ADF7071 +// #define LONESTAR_USB // Enable ADF7021 support: #define ENABLE_ADF7021 diff --git a/IO.cpp b/IO.cpp index 9498372..ce16189 100644 --- a/IO.cpp +++ b/IO.cpp @@ -318,7 +318,7 @@ bool CIO::hasRXOverflow() return m_rxBuffer.hasOverflowed(); } -#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) +#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS) void CIO::checkBand(uint32_t frequency_rx, uint32_t frequency_tx) { if (!(io.hasSingleADF7021())) { // There are two ADF7021s on the board @@ -391,7 +391,7 @@ uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_po #endif // Check if we have a single, dualband or duplex board -#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) +#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS) if (checkZUMspot(frequency_rx, frequency_tx) > 0) { return 4U; } diff --git a/IO.h b/IO.h index 4f2c4f7..afe24fa 100644 --- a/IO.h +++ b/IO.h @@ -125,7 +125,7 @@ public: uint32_t getWatchdog(void); void getIntCounter(uint16_t &int1, uint16_t &int2); void selfTest(void); -#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) +#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS) void checkBand(uint32_t frequency_rx, uint32_t frequency_tx); uint8_t checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx); void setBandVHF(bool vhf_on); diff --git a/IOArduino.cpp b/IOArduino.cpp index 20e0113..c8e0165 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -28,7 +28,7 @@ // STM32F1 pin definitions, using STM32duino -#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) +#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS) #define PIN_SCLK PB5 #define PIN_SREAD PB6 @@ -81,7 +81,7 @@ #define PIN_COS_LED PB15 #else -#error "Either ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV10 or SKYBRIDGE_HS need to be defined" +#error "Either ZUMSPOT_ADF7021, LONESTAR_USB, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV10 or SKYBRIDGE_HS need to be defined" #endif #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) @@ -156,7 +156,7 @@ void CIO::Init() { #if defined (__STM32F1__) -#if defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) || defined(SKYBRIDGE_HS) +#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) || defined(SKYBRIDGE_HS) afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY); #endif diff --git a/IOSTM.cpp b/IOSTM.cpp index c506aa5..c621009 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -97,7 +97,7 @@ #define PIN_COS_LED GPIO_Pin_13 #define PORT_COS_LED GPIOB -#elif defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) || defined(LONESTAR_USB) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -275,7 +275,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV11, D2RG_MMDVM_HS or SKYBRIDGE_HS need to be defined" +#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LONESTAR_USB, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV11, D2RG_MMDVM_HS or SKYBRIDGE_HS need to be defined" #endif extern "C" { @@ -297,7 +297,7 @@ extern "C" { } #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -348,11 +348,11 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif -#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) +#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS) // Pin defines if the board has a single ADF7021 or double GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Pin = PIN_SGL_DBL; @@ -549,7 +549,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -567,7 +567,7 @@ void CIO::Init() // Connect EXTI5 Line GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT); // Configure EXT5 line - #if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) + #if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS) EXTI_InitStructure2.EXTI_Line = EXTI_Line8; #else EXTI_InitStructure2.EXTI_Line = EXTI_Line5; @@ -601,7 +601,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) +#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt @@ -781,7 +781,7 @@ void CIO::COS_pin(bool on) GPIO_WriteBit(PORT_COS_LED, PIN_COS_LED, on ? Bit_SET : Bit_RESET); } -#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) +#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS) void CIO::setBandVHF(bool vhf_on) { GPIO_WriteBit(PORT_SET_BAND, PIN_SET_BAND, vhf_on ? Bit_SET : Bit_RESET); } diff --git a/SerialPort.cpp b/SerialPort.cpp index 4dd8a8a..d451603 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -333,7 +333,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) DEBUG1("Full duplex not supported with this firmware"); return 6U; } -#elif defined(DUPLEX) && (defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS)) +#elif defined(DUPLEX) && (defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)) if (io.isDualBand() && m_duplex && m_calState == STATE_IDLE && modemState != STATE_DSTARCAL) { DEBUG1("Full duplex is not supported on this board"); return 6U; diff --git a/configs/LoneStar_USB.h b/configs/LoneStar_USB.h new file mode 100644 index 0000000..ed4bbf3 --- /dev/null +++ b/configs/LoneStar_USB.h @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU + * + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot RPi or ZUMspot USB: +// #define ZUMSPOT_ADF7021 +// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: +// #define LIBRE_KIT_ADF7021 +// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) +// #define MMDVM_HS_HAT_REV12 +// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) +// #define MMDVM_HS_DUAL_HAT_REV10 +// 5) Nano hotSPOT (BI7JTA) +// #define NANO_HOTSPOT +// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP) +// #define NANO_DV_REV10 +// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU) +// #define D2RG_MMDVM_HS +// 8) BridgeCom SkyBridge HotSpot +// #define SKYBRIDGE_HS +// 9) LoneStar USB Stick ADF7071 +#define LONESTAR_USB + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Configure receiver gain for ADF7021 +// AGC automatic, default settings: +#define AD7021_GAIN_AUTO +// AGC automatic with high LNA linearity: +// #define AD7021_GAIN_AUTO_LIN +// AGC OFF, lowest gain: +// #define AD7021_GAIN_LOW +// AGC OFF, highest gain: +// #define AD7021_GAIN_HIGH + +// Host communication selection: +// #define STM32_USART1_HOST +#define STM32_USB_HOST +// #define STM32_I2C_HOST + +// I2C host address: +#define I2C_ADDR 0x22 + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +#define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +// #define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +// Engage a constant or descreet Service LED mode once repeater is running +// #define CONSTANT_SRV_LED +// #define CONSTANT_SRV_LED_INVERTED +// #define DISCREET_SRV_LED +// #define DISCREET_SRV_LED_INVERTED + +// Use the YSF and P25 LEDs for NXDN +// #define USE_ALTERNATE_NXDN_LEDS + +// Use the D-Star and P25 LEDs for M17 +// #define USE_ALTERNATE_M17_LEDS + +// Use the D-Star and DMR LEDs for POCSAG +// #define USE_ALTERNATE_POCSAG_LEDS + +// Enable for RPi 3B+, USB mode +#define LONG_USB_RESET + +// Enable modem debug messages +#define ENABLE_DEBUG + +// Disable frequency bands check +// #define DISABLE_FREQ_CHECK + +// Disable frequency restrictions (satellite, ISS, etc) +// #define DISABLE_FREQ_BAN + +// Enable UDID feature +// #define ENABLE_UDID + +#endif diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 5eab4f2..30257c0 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -176,4 +176,13 @@ make -j4 mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/skybridge_rpi_fw.bin make clean +# Building LoneStar USB +echo "*************************************************" +echo "********* Building LoneStar USB firmware *********" +echo "*************************************************" +cp ~/MMDVM_HS/configs/LoneStar_USB.h ~/MMDVM_HS/Config.h +make -j4 bl +mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/lonestar_usb_fw.bin +make clean + cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h diff --git a/scripts/install_fw_lonestar_usb.sh b/scripts/install_fw_lonestar_usb.sh new file mode 100755 index 0000000..4225916 --- /dev/null +++ b/scripts/install_fw_lonestar_usb.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +# Copyright (C) 2017,2018 by Andy Uribe CA6JAU + +# 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. + +# Configure latest version +FW_VERSION="v1.6.0" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem14401" + +# Configure beta version +FW_VERSION_BETA="v1.6.0b" + +# Firmware filename +FW_FILENAME="lonestar_usb_fw.bin" + +# Download latest firmware +if [ $1 = "beta" ]; then + echo "Downloading beta firmware..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME +else + echo "Downloading latest firmware (stable)..." + curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME +fi + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Reset ZUMspot to enter bootloader mode +eval sudo $DFU_RST $DEV_USB_SER 750 + +# Upload the firmware +eval sudo $DFU_UTIL -D $FW_FILENAME -d 1eaf:0003 -a 2 -R -R + +echo +echo "Please RESET your LoneStar device !" +echo diff --git a/version.h b/version.h index 450efcb..5d19b16 100644 --- a/version.h +++ b/version.h @@ -42,6 +42,8 @@ #define BOARD_INFO "D2RG_MMDVM_HS" #elif defined(SKYBRIDGE_HS) #define BOARD_INFO "SkyBridge" +#elif defined(LONESTAR_USB) +#define BOARD_INFO "LS_USB_STICK" #else #define BOARD_INFO "MMDVM_HS" #endif From 3dfd2264ad626643519c06a9dccc0a0ab90d259a Mon Sep 17 00:00:00 2001 From: DO1OLI Date: Tue, 23 Aug 2022 09:01:03 +0200 Subject: [PATCH 234/239] added .vscode to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c092581..2009393 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ bin/ GitVersion\.h +.vscode/ From ba19e266300a0b0ec5bb1d4b6040f0efdaf7005f Mon Sep 17 00:00:00 2001 From: DO1OLI Date: Tue, 23 Aug 2022 09:18:20 +0200 Subject: [PATCH 235/239] YSF LED was not functional --- IO.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IO.cpp b/IO.cpp index ce16189..6a22d6d 100644 --- a/IO.cpp +++ b/IO.cpp @@ -426,7 +426,7 @@ void CIO::setMode(MMDVM_STATE modemState) #if defined(USE_ALTERNATE_M17_LEDS) if (modemState != STATE_M17) { #endif - YSF_pin(modemState == STATE_DSTAR); + YSF_pin(modemState == STATE_YSF); P25_pin(modemState == STATE_P25); #if defined(USE_ALTERNATE_M17_LEDS) } From 520f39148a61b367428f82d2f057235856eccd52 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 26 Apr 2023 16:12:12 +0100 Subject: [PATCH 236/239] Make the configuration backward compatible with 1.5.2, change version to 1.6.1. --- SerialPort.cpp | 21 +++++++++++++++------ version.h | 6 +++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index d451603..ce82755 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013,2015,2016,2018,2020,2021 by Jonathan Naylor G4KLX + * Copyright (C) 2013,2015,2016,2018,2020,2021,2023 by Jonathan Naylor G4KLX * Copyright (C) 2016 by Colin Durbridge G4EML * Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2019 by Florian Wolters DF2ET @@ -239,7 +239,7 @@ void CSerialPort::getVersion() uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) { - if (length < 23U) + if (length < 13U) return 4U; bool ysfLoDev = (data[0U] & 0x08U) == 0x08U; @@ -286,15 +286,24 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) uint8_t dmrDelay = data[7U]; #endif - m_cwIdTXLevel = data[5U]>>2; + m_cwIdTXLevel = data[5U] >> 2; uint8_t dstarTXLevel = data[9U]; uint8_t dmrTXLevel = data[10U]; uint8_t ysfTXLevel = data[11U]; uint8_t p25TXLevel = data[12U]; - uint8_t nxdnTXLevel = data[15U]; - uint8_t pocsagTXLevel = data[17U]; - uint8_t m17TXLevel = data[21U]; + uint8_t nxdnTXLevel = 128U; + uint8_t pocsagTXLevel = 128U; + uint8_t m17TXLevel = 128U; + + if (length >= 16U) + nxdnTXLevel = data[15U]; + + if (length >= 18U) + pocsagTXLevel = data[17U]; + + if (length >= 22U) + m17TXLevel = data[21U]; io.setDeviations(dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, m17TXLevel, pocsagTXLevel, ysfLoDev); diff --git a/version.h b/version.h index 5d19b16..93f2023 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU - * Copyright (C) 2020,2021 by Jonathan Naylor G4KLX + * Copyright (C) 2020,2021,2023 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 @@ -25,8 +25,8 @@ #define VER_MAJOR "1" #define VER_MINOR "6" -#define VER_REV "0" -#define VERSION_DATE "20210919" +#define VER_REV "1" +#define VERSION_DATE "20230426" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" From 070bf8ee7ac29825348be7bd2b489f2a6b626522 Mon Sep 17 00:00:00 2001 From: Chipster Date: Fri, 26 May 2023 07:44:18 -0500 Subject: [PATCH 237/239] Add BOARD_INFO type string ("MMDVM_HS_Dual_Hat") for MMDVM_HS_HAT_REV12 boards with DUPLEX defined. --- version.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 93f2023..4239a85 100644 --- a/version.h +++ b/version.h @@ -26,11 +26,13 @@ #define VER_MAJOR "1" #define VER_MINOR "6" #define VER_REV "1" -#define VERSION_DATE "20230426" +#define VERSION_DATE "20230526" #if defined(ZUMSPOT_ADF7021) #define BOARD_INFO "ZUMspot" -#elif defined(MMDVM_HS_HAT_REV12) +#elif defined(MMDVM_HS_HAT_REV12) && defined(DUPLEX) +#define BOARD_INFO "MMDVM_HS_Dual_Hat" +#elif defined(MMDVM_HS_HAT_REV12) && !defined(DUPLEX) #define BOARD_INFO "MMDVM_HS_Hat" #elif defined(MMDVM_HS_DUAL_HAT_REV10) #define BOARD_INFO "MMDVM_HS_Dual_Hat" From f0586fdf74b52c3e9140b4445aee795c5d67472f Mon Sep 17 00:00:00 2001 From: Danny Quist Date: Sun, 27 Aug 2023 10:37:30 -0700 Subject: [PATCH 238/239] raspberry pi 4 arch detection --- scripts/install_fw_custom.sh | 6 ++++++ scripts/install_fw_d2rg_mmdvmhs.sh | 6 ++++++ scripts/install_fw_dualband.sh | 6 ++++++ scripts/install_fw_duplex.sh | 6 ++++++ scripts/install_fw_duplex_gpio.sh | 6 ++++++ scripts/install_fw_duplex_gpio_opi.sh | 6 ++++++ scripts/install_fw_duplex_usb.sh | 6 ++++++ scripts/install_fw_gen_gpio.sh | 6 ++++++ scripts/install_fw_hsdualhat-12mhz.sh | 6 ++++++ scripts/install_fw_hsdualhat.sh | 6 ++++++ scripts/install_fw_hshat-12mhz.sh | 6 ++++++ scripts/install_fw_hshat.sh | 6 ++++++ scripts/install_fw_librekit.sh | 6 ++++++ scripts/install_fw_lonestar_usb.sh | 6 ++++++ scripts/install_fw_nanodv_npi.sh | 6 ++++++ scripts/install_fw_nanodv_usb.sh | 6 ++++++ scripts/install_fw_nanohs.sh | 6 ++++++ scripts/install_fw_rpi.sh | 6 ++++++ scripts/install_fw_skybridge_rpi.sh | 6 ++++++ scripts/install_fw_usb.sh | 6 ++++++ 20 files changed, 120 insertions(+) diff --git a/scripts/install_fw_custom.sh b/scripts/install_fw_custom.sh index 2c4f5bc..01f8dc7 100755 --- a/scripts/install_fw_custom.sh +++ b/scripts/install_fw_custom.sh @@ -49,6 +49,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_d2rg_mmdvmhs.sh b/scripts/install_fw_d2rg_mmdvmhs.sh index 4651d8c..50b7fe7 100755 --- a/scripts/install_fw_d2rg_mmdvmhs.sh +++ b/scripts/install_fw_d2rg_mmdvmhs.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_dualband.sh b/scripts/install_fw_dualband.sh index 7c50de0..c259045 100755 --- a/scripts/install_fw_dualband.sh +++ b/scripts/install_fw_dualband.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_duplex.sh b/scripts/install_fw_duplex.sh index 49b5ceb..7ccaff8 100755 --- a/scripts/install_fw_duplex.sh +++ b/scripts/install_fw_duplex.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_duplex_gpio.sh b/scripts/install_fw_duplex_gpio.sh index acb7ea8..9e5e31a 100755 --- a/scripts/install_fw_duplex_gpio.sh +++ b/scripts/install_fw_duplex_gpio.sh @@ -50,6 +50,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_duplex_gpio_opi.sh b/scripts/install_fw_duplex_gpio_opi.sh index 909fccd..3ffe08e 100644 --- a/scripts/install_fw_duplex_gpio_opi.sh +++ b/scripts/install_fw_duplex_gpio_opi.sh @@ -50,6 +50,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_duplex_usb.sh b/scripts/install_fw_duplex_usb.sh index 053c891..e608461 100755 --- a/scripts/install_fw_duplex_usb.sh +++ b/scripts/install_fw_duplex_usb.sh @@ -51,6 +51,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_gen_gpio.sh b/scripts/install_fw_gen_gpio.sh index 2faa0e1..03ada49 100755 --- a/scripts/install_fw_gen_gpio.sh +++ b/scripts/install_fw_gen_gpio.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_hsdualhat-12mhz.sh b/scripts/install_fw_hsdualhat-12mhz.sh index 18b3977..817e46e 100755 --- a/scripts/install_fw_hsdualhat-12mhz.sh +++ b/scripts/install_fw_hsdualhat-12mhz.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_hsdualhat.sh b/scripts/install_fw_hsdualhat.sh index 29c12aa..378343a 100755 --- a/scripts/install_fw_hsdualhat.sh +++ b/scripts/install_fw_hsdualhat.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_hshat-12mhz.sh b/scripts/install_fw_hshat-12mhz.sh index 82f0190..bcbeb83 100755 --- a/scripts/install_fw_hshat-12mhz.sh +++ b/scripts/install_fw_hshat-12mhz.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh index 671940b..9371a8d 100755 --- a/scripts/install_fw_hshat.sh +++ b/scripts/install_fw_hshat.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_librekit.sh b/scripts/install_fw_librekit.sh index 1298b10..42fdf1f 100755 --- a/scripts/install_fw_librekit.sh +++ b/scripts/install_fw_librekit.sh @@ -51,6 +51,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_lonestar_usb.sh b/scripts/install_fw_lonestar_usb.sh index 4225916..d7457bc 100755 --- a/scripts/install_fw_lonestar_usb.sh +++ b/scripts/install_fw_lonestar_usb.sh @@ -51,6 +51,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_nanodv_npi.sh b/scripts/install_fw_nanodv_npi.sh index aae6890..6da32f4 100755 --- a/scripts/install_fw_nanodv_npi.sh +++ b/scripts/install_fw_nanodv_npi.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_nanodv_usb.sh b/scripts/install_fw_nanodv_usb.sh index d301bfc..7026bca 100755 --- a/scripts/install_fw_nanodv_usb.sh +++ b/scripts/install_fw_nanodv_usb.sh @@ -51,6 +51,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_nanohs.sh b/scripts/install_fw_nanohs.sh index a8b72f7..e4a196e 100755 --- a/scripts/install_fw_nanohs.sh +++ b/scripts/install_fw_nanohs.sh @@ -58,6 +58,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_rpi.sh b/scripts/install_fw_rpi.sh index 9965a25..19efb7d 100755 --- a/scripts/install_fw_rpi.sh +++ b/scripts/install_fw_rpi.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_skybridge_rpi.sh b/scripts/install_fw_skybridge_rpi.sh index 50480ad..1caf7b6 100755 --- a/scripts/install_fw_skybridge_rpi.sh +++ b/scripts/install_fw_skybridge_rpi.sh @@ -47,6 +47,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" diff --git a/scripts/install_fw_usb.sh b/scripts/install_fw_usb.sh index beca5d0..e1c4c9d 100755 --- a/scripts/install_fw_usb.sh +++ b/scripts/install_fw_usb.sh @@ -51,6 +51,12 @@ if [ $(uname -s) == "Linux" ]; then DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "aarch64" ] ; then + echo "Raspberry Pi 4 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" elif [ $(uname -m) == "armv7l" ]; then echo "Raspberry Pi 3 detected" DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" From 7ff74ed1ba663a282edcbbb5e0ec3d7132e6f2f5 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 5 Oct 2023 19:54:35 +0100 Subject: [PATCH 239/239] Fix the incoming serial data from the screen. --- SerialPort.cpp | 70 ++++++++++++++++++++++---------------------------- SerialPort.h | 10 ++++---- 2 files changed, 35 insertions(+), 45 deletions(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index ce82755..1274b34 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -88,12 +88,16 @@ const uint8_t PROTOCOL_VERSION = 1U; char UDID[] = "00000000000000000000000000000000"; #endif +// Parameters for batching serial data +const int MAX_SERIAL_DATA = 250; +const uint16_t MAX_SERIAL_COUNT = 100U; + CSerialPort::CSerialPort() : m_buffer(), m_ptr(0U), m_len(0U), -m_serial_buffer(), -m_serial_len(0U), +m_lastSerialAvail(0), +m_lastSerialAvailCount(0U), m_debug(false), m_firstCal(false) { @@ -479,9 +483,9 @@ uint8_t CSerialPort::setFreq(const uint8_t* data, uint8_t length) pocsag_freq_tx |= data[11U] << 8; pocsag_freq_tx |= data[12U] << 16; pocsag_freq_tx |= data[13U] << 24; - } - else + } else { pocsag_freq_tx = freq_tx; + } return io.setFreq(freq_rx, freq_tx, rf_power, pocsag_freq_tx); } @@ -613,8 +617,7 @@ void CSerialPort::process() m_buffer[0U] = c; m_ptr = 1U; m_len = 0U; - } - else { + } else { m_ptr = 0U; m_len = 0U; } @@ -736,7 +739,7 @@ void CSerialPort::process() break; case MMDVM_DMR_DATA1: - #if defined(DUPLEX) +#if defined(DUPLEX) if (m_dmrEnable) { if (m_modemState == STATE_IDLE || m_modemState == STATE_DMR) { if (m_duplex) @@ -750,7 +753,7 @@ void CSerialPort::process() DEBUG2("Received invalid DMR data", err); sendNAK(err); } - #endif +#endif break; case MMDVM_DMR_DATA2: @@ -776,7 +779,7 @@ void CSerialPort::process() break; case MMDVM_DMR_START: - #if defined(DUPLEX) +#if defined(DUPLEX) if (m_dmrEnable) { err = 4U; if (m_len == 4U) { @@ -795,29 +798,29 @@ void CSerialPort::process() DEBUG2("Received invalid DMR start", err); sendNAK(err); } - #endif +#endif break; case MMDVM_DMR_SHORTLC: - #if defined(DUPLEX) +#if defined(DUPLEX) if (m_dmrEnable) err = dmrTX.writeShortLC(m_buffer + 3U, m_len - 3U); if (err != 0U) { DEBUG2("Received invalid DMR Short LC", err); sendNAK(err); } - #endif +#endif break; case MMDVM_DMR_ABORT: - #if defined(DUPLEX) +#if defined(DUPLEX) if (m_dmrEnable) err = dmrTX.writeAbort(m_buffer + 3U, m_len - 3U); if (err != 0U) { DEBUG2("Received invalid DMR Abort", err); sendNAK(err); } - #endif +#endif break; case MMDVM_YSF_DATA: @@ -964,32 +967,20 @@ void CSerialPort::process() #if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1) // Check for any incoming serial data from a device/screen on UART2 - // !!Notice!! on powerup the Nextion screen dumps FF FF FF 88 FF FF FF to the serial port. - while (availableInt(3U)) - { - // read UART2 - m_serial_buffer[m_serial_len++] = readInt(3U); - - if (m_serial_len >=3 && (m_serial_buffer[m_serial_len - 3] == 0xFF) && (m_serial_buffer[m_serial_len - 2] == 0xFF) && (m_serial_buffer[m_serial_len - 1] == 0xFF)) - { - if (m_serial_len > 3) - serial.writeSerialRpt(m_serial_buffer, m_serial_len); - - // if the last 3 bytes are FF's then the screen is done sending data so send the m_serial_buffer to serial.writeSerialRpt() - // - // TODO - BG5HHP - // modem serial data repeat should be generic instead of coupling with the nextion protocol. - // - m_serial_len = 0U; - continue; - } - - if (m_serial_len == sizeof(m_serial_buffer)) - { - // buffer overflow - m_serial_len = 0U; - continue; + int serialAvail = availableInt(3U); + if ((serialAvail > 0 && serialAvail == m_lastSerialAvail && m_lastSerialAvailCount >= MAX_SERIAL_COUNT) || (serialAvail >= MAX_SERIAL_DATA)) { + uint8_t buffer[MAX_SERIAL_DATA]; + for (int i = 0; i < serialAvail && i < MAX_SERIAL_DATA; i++) { + buffer[i] = readInt(3U); + m_lastSerialAvail--; } + serial.writeSerialRpt(buffer, serialAvail - m_lastSerialAvail); + m_lastSerialAvailCount = 0U; + } else if (serialAvail > 0 && serialAvail == m_lastSerialAvail) { + m_lastSerialAvailCount++; + } else { + m_lastSerialAvail = serialAvail; + m_lastSerialAvailCount = 0U; } #endif } @@ -1010,7 +1001,6 @@ void CSerialPort::writeSerialRpt(const uint8_t* data, uint8_t length) } #endif - void CSerialPort::writeDStarHeader(const uint8_t* header, uint8_t length) { if (m_modemState != STATE_DSTAR && m_modemState != STATE_IDLE) diff --git a/SerialPort.h b/SerialPort.h index a8913f5..188766a 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -71,11 +71,11 @@ public: void writeDebug(const char* text, int16_t n1, int16_t n2); private: - uint8_t m_buffer[256U]; - uint8_t m_ptr; - uint8_t m_len; - uint8_t m_serial_buffer[128U]; - uint8_t m_serial_len; + uint8_t m_buffer[256U]; + uint8_t m_ptr; + uint8_t m_len; + int m_lastSerialAvail; + uint16_t m_lastSerialAvailCount; bool m_debug; bool m_firstCal;