From d50d0c070badd0dcb6edd91e5c1379ec345b2053 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 31 Jan 2019 17:36:38 +0100 Subject: [PATCH 01/91] 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 02/91] 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 03/91] 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 04/91] 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 05/91] 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 06/91] 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 07/91] 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 08/91] 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 09/91] 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 10/91] 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 11/91] 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 12/91] 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 13/91] 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 14/91] 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 15/91] 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 16/91] 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 17/91] 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 18/91] 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 19/91] 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 20/91] 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 21/91] 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 22/91] 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 23/91] 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 24/91] 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 25/91] 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 26/91] 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 27/91] 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 28/91] 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 29/91] 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 30/91] 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 31/91] 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 32/91] 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 33/91] 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 34/91] 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 35/91] 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 36/91] 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 37/91] 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 38/91] 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 39/91] 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 40/91] 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 41/91] 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 42/91] 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 43/91] 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 44/91] 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 45/91] 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 46/91] 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 47/91] 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 48/91] 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 49/91] 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 50/91] 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 51/91] 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 52/91] 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 53/91] 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 54/91] 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 55/91] 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 56/91] 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 57/91] 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 58/91] 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 59/91] 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 60/91] 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 61/91] 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 62/91] 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 63/91] 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 64/91] 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 65/91] 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 66/91] 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 67/91] 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 68/91] 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 69/91] 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 70/91] 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 71/91] 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 72/91] 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 73/91] 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 74/91] 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 75/91] 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 76/91] 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 77/91] 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 78/91] 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 79/91] 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 80/91] 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 81/91] 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 82/91] 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 83/91] 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 84/91] 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 85/91] 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 86/91] 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 87/91] 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 88/91] 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 89/91] 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 f0586fdf74b52c3e9140b4445aee795c5d67472f Mon Sep 17 00:00:00 2001 From: Danny Quist Date: Sun, 27 Aug 2023 10:37:30 -0700 Subject: [PATCH 90/91] 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 a3e1625a3f90bc7b3e3d23f11c1fb55dbfccc6be Mon Sep 17 00:00:00 2001 From: radongc Date: Sat, 21 Feb 2026 12:44:39 -0500 Subject: [PATCH 91/91] Reduce P25 hardcoded TX delay to allow for quick TX. --- P25TX.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/P25TX.cpp b/P25TX.cpp index 6831527..c16d209 100644 --- a/P25TX.cpp +++ b/P25TX.cpp @@ -30,7 +30,7 @@ m_buffer(1500U), m_poBuffer(), m_poLen(0U), m_poPtr(0U), -m_txDelay(240U), // 200ms +m_txDelay(60U), // 50ms (reduced for TPT support) m_delay(false) { } @@ -111,7 +111,7 @@ void CP25TX::writeByte(uint8_t c) void CP25TX::setTXDelay(uint8_t delay) { - m_txDelay = 600U + uint16_t(delay) * 12U; // 500ms + tx delay + m_txDelay = 60U + uint16_t(delay) * 12U; // 50ms + tx delay (reduced for TPT support) } uint16_t CP25TX::getSpace() const