From f69805f24727fde4e54f664930fd7ac8ddab7165 Mon Sep 17 00:00:00 2001 From: "Tony Corbett, G0WFV" Date: Sat, 15 Jul 2017 16:59:47 +0100 Subject: [PATCH 01/11] Serial repeater port changes Enables neater connection to erroneous boards with only 3 pins on USART2 like the one I have! USART1 is now the default for Nextion serial repeater unless you define STM32_USART1_HOST or ZUMSPOT_LIBRE in Config.h Needed to specify ZUMSPOT_LIBRE as separate board in Config.h as this only has a header for USART2 - Libre Kit will not use these changes. All other boards appear to break out all USARTs in some form or other (specifically USART1) EA7GIB's boards will now have a minor labelling error in that the header labelled Nextion (USART2) is no longer the Nextion port unless you define STM32_USART1_HOST or ZUMSPOT_LIBRE in Config.h. If like me your OCD triggers with this, define ZUMSPOT_LIBRE and the nextion will be forced to USART2 (as labelled!) --- Config.h | 4 +++- IOArduino.cpp | 6 +++--- IOSTM.cpp | 12 ++++++------ SerialSTM.cpp | 26 +++++++++++++++++++++----- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Config.h b/Config.h index 3fdec76..b9341dd 100644 --- a/Config.h +++ b/Config.h @@ -24,7 +24,9 @@ // #define PI_HAT_7021_REV_02 // 2) ZUM-Spot USB and ZUM-Spot Pi HAT: // #define PI_HAT_7021_REV_03 -// 3) ZUM-Spot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103 +// 3) ZUM-Spot Libre Kit +// #define ZUMSPOT_LIBRE +// 4) board with modified RF7021SE and Blue Pill STM32F103 #define ADF7021_CARRIER_BOARD // Enable ADF7021 support: diff --git a/IOArduino.cpp b/IOArduino.cpp index a74a324..25a40c2 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -65,7 +65,7 @@ #define PIN_PTT_LED PB14 #define PIN_COS_LED PB15 -#elif defined(ADF7021_CARRIER_BOARD) +#elif defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) #define PIN_SCLK PB5 #define PIN_SREAD PB7 @@ -85,7 +85,7 @@ #define PIN_COS_LED PB15 #else -#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, or ADF7021_CARRIER_BOARD need to be defined" +#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, ZUMSPOT_LIBRE or ADF7021_CARRIER_BOARD need to be defined" #endif #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) @@ -150,7 +150,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) afio_cfg_debug_ports(AFIO_DEBUG_NONE); -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY); #endif diff --git a/IOSTM.cpp b/IOSTM.cpp index 7abfb33..574297d 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -139,7 +139,7 @@ #define PIN_COS_LED GPIO_Pin_15 #define PORT_COS_LED GPIOB -#elif defined(ADF7021_CARRIER_BOARD) +#elif defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -197,7 +197,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, or ADF7021_CARRIER_BOARD need to be defined" +#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, ZUMSPOT_LIBRE or ADF7021_CARRIER_BOARD need to be defined" #endif extern "C" { @@ -219,7 +219,7 @@ extern "C" { } #endif -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -247,7 +247,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif @@ -391,7 +391,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -421,7 +421,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt diff --git a/SerialSTM.cpp b/SerialSTM.cpp index e02ea81..40de267 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -44,7 +44,7 @@ USART2 - TXD PA2 - RXD PA3 #define TX_SERIAL_FIFO_SIZE 256U #define RX_SERIAL_FIFO_SIZE 256U -#if defined(STM32_USART1_HOST) +#if defined(STM32_USART1_HOST) || defined(SERIAL_REPEATER) extern "C" { void USART1_IRQHandler(); @@ -439,10 +439,14 @@ void CSerialPort::beginInt(uint8_t n, int speed) usbserial.begin(); #endif break; - #if defined(SERIAL_REPEATER) + #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) case 3U: InitUSART2(speed); break; + #elif defined(SERIAL_REPEATER) + case 3U: + InitUSART1(speed); + break; #endif default: break; @@ -458,9 +462,12 @@ int CSerialPort::availableInt(uint8_t n) #elif defined(STM32_USB_HOST) return usbserial.available(); #endif - #if defined(SERIAL_REPEATER) + #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) case 3U: return AvailUSART2(); + #elif defined(SERIAL_REPEATER) + case 3U: + return AvailUSART1(); #endif default: return 0; @@ -476,9 +483,12 @@ uint8_t CSerialPort::readInt(uint8_t n) #elif defined(STM32_USB_HOST) return usbserial.read(); #endif - #if defined(SERIAL_REPEATER) + #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) case 3U: return ReadUSART2(); + #elif defined(SERIAL_REPEATER) + case 3U: + return ReadUSART1(); #endif default: return 0U; @@ -499,12 +509,18 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool usbserial.flush(); #endif break; - #if defined(SERIAL_REPEATER) + #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) case 3U: WriteUSART2(data, length); if (flush) TXSerialFlush2(); break; + #elif defined(SERIAL_REPEATER) + case 3U: + WriteUSART1(data, length); + if (flush) + TXSerialFlush1(); + break; #endif default: break; From 47bca81385d27c5239dc2026ccdbe4abe584ce10 Mon Sep 17 00:00:00 2001 From: "Tony Corbett, G0WFV" Date: Sat, 15 Jul 2017 17:33:02 +0100 Subject: [PATCH 02/11] Add STM32F10X_Lib directory to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 082d17a..ac00791 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ bin/ GitVersion\.h + +STM32F10X_Lib/ From 354496817bcc8bc987f1b39b3a585b7e2049d058 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 15 Jul 2017 14:16:32 -0400 Subject: [PATCH 03/11] Updating and formatting documentation --- BUILD.md | 613 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ BUILD.txt | 422 ------------------------------------- README.md | 101 ++++++++- 3 files changed, 713 insertions(+), 423 deletions(-) create mode 100644 BUILD.md delete mode 100644 BUILD.txt diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 0000000..1162726 --- /dev/null +++ b/BUILD.md @@ -0,0 +1,613 @@ +# Building instructions + +This is a detailed guide for building the firmware of MMDVM_HS from the source code. This +software runs on STM32F103 microcontroller. You can build this code using Arduino IDE with +STM32duino package, or using "make" with ARM GCC tools. 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. + +# Index + +- ZUMSpot RPi +- ZUMSpot Libre Kit +- ZUMSpot USB +- Makefile options +- Config.h options +- Pinout definitions + +# ZUMSpot RPi + +Download latest Raspbian image and install to a micro SD + +* See: https://www.raspberrypi.org/documentation/installation/installing-images/ +* Configure your SD before booting. Useful article: https://styxit.com/2017/03/14/headless-raspberry-setup.html + +Boot your Raspberry Pi. Run raspi-config and configure according to your preferences: + + sudo raspi-config + +Select at least: + +* Expand filesystem +* Change default password +* Enable "Wait for Network at Boot" +* Disable Desktop GUI if you don't plan to use it + +### Enable serial port in Raspberry Pi 3 or Pi Zero W + +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 + +### Enable serial port in Raspberry Pi 2 + +Edit /boot/cmdline.txt: + + sudo nano /boot/cmdline.txt + (remove the text: console=serial0,115200) + +Disable the service: + + sudo systemctl disable serial-getty@ttyAMA0.service + +Reboot your RPi: + + sudo reboot + +### Build de firmware and upload to ZUMSpot RPi + +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 + +Download the firmware sources: + + cd ~ + git clone https://github.com/juribeparada/MMDVM_HS + cd MMDVM_HS/ + git clone https://github.com/juribeparada/STM32F10X_Lib + +(Please do not download any different code inside MMDVM_HS folder) + +Edit Config.h + + nano Config.h + +and enable: + + #define PI_HAT_7021_REV_03 + #define ENABLE_ADF7021 + #define BIDIR_DATA_PIN + #define ADF7021_14_7456 + #define STM32_USART1_HOST + #define ENABLE_SCAN_MODE + +Build the firmware: + + make + +Upload the firmware to ZUMSpot RPi board: + + sudo make zumspot-pi + +Install MMDVMHost: + + cd ~ + git clone https://github.com/g4klx/MMDVMHost/ + cd MMDVMHost/ + make + +Edit MMDVM.ini according your preferences + + nano MMDVM.ini + (use Port=/dev/ttyAMA0 in [Modem]) + +Execute MMDVMHost: + + ./MMDVMHost MMDVM.ini + +# ZUMSpot Libre Kit + +## Windows + +Download and install the Arduino IDE: + + https://www.arduino.cc/en/Main/Software + +Run Arduino IDE. On the Tools menu, select the Boards manager, and install the "Arduino SAM" from the list of available boards. + +Download STM32duino (Arduino for STM32) from this URL: + + https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot + +Unzip and change the extracted folder name "Arduino_STM32-ZUMSpot" to "Arduino_STM32" + +Copy Arduino_STM32 folder in: + + My Documents/Arduino/hardware + +Install the USB bootloader to STM32F103. Follow the instructions: + + https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/stm32duino-bootloader + +Connect the ZUMSpot Libre Kit to your PC. Install the USB Mapple driver using the bat file +(you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation): + + My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat + +You have to be sure that Windows detect your ZUMSpot as an USB serial device COMx (please +see Windows Device Manager). + +Download the source (zip file) of MMDVM_HS from: + + https://github.com/juribeparada/MMDVM_HS + +Do not download or install the STM32F103 library (STM32F10X_Lib) this is not necessary +under STM32duino. + +Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this +folder can't have spaces. + +Start the Arduino IDE. Open the MMDVM_HS.ino file in the MMDVM_HS folder. + +Under the menu "Tools" select "Board" and then select: + + Board: Generic STM32F103C Series + Variant: STM32F103C8 (20k RAM, 64k Flash) + CPU Speed: 72 MHz (Normal) + Upload method: STM32duino bootloader (you have transfered the USB bootloader before) + Serial port: COMx (Maple Mini) + +Edit Config.h: + + #define ADF7021_CARRIER_BOARD + #define ENABLE_ADF7021 + #define BIDIR_DATA_PIN + #define ADF7021_14_7456 + #define STM32_USB_HOST + #define ENABLE_SCAN_MODE + +Click the Upload button in the IDE and wait for the transfer. + +Once the transfer is completed, press the RESET button of the board or disconnect and +connect the USB cable. You will see the LED (PC13) of the blue pill blinking. Once you connect +with MMDVMHost, the LED will blink fast. + +## Linux Raspbian + +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 clone https://github.com/juribeparada/STM32F10X_Lib + +(Please do not download any different code inside MMDVM_HS folder) + +Edit Config.h: + + nano Config.h + +and enable: + + #define ADF7021_CARRIER_BOARD + #define ENABLE_ADF7021 + #define BIDIR_DATA_PIN + #define ADF7021_14_7456 + #define STM32_USB_HOST + #define ENABLE_SCAN_MODE + +Build the firmware with bootloader support: + + make bl + +Upload bootloader and firmware to ZUMSpot Libre Kit, using serial port first (you +are using an USB-serial converter with device name /dev/ttyUSB0). Move BOOT0 +jumper to 1, next press and release RESET and execute: + + sudo make serial-bl devser=/dev/ttyUSB0 + +Move BOOT0 jumper to 0. + +For following firmware updates, you could use the USB port directly: + + sudo make dfu devser=/dev/ttyACM0 + +Install MMDVMHost: + + cd ~ + git clone https://github.com/g4klx/MMDVMHost/ + cd MMDVMHost/ + make + +Edit MMDVM.ini according your preferences + + nano MMDVM.ini + (use Port=/dev/ttyACM0 in [Modem]) + +Execute MMDVMHost: + + ./MMDVMHost MMDVM.ini + +# ZUMSpot USB + +## Windows + +Download and install the Arduino IDE: + + https://www.arduino.cc/en/Main/Software + +Run Arduino IDE. On the Tools menu, select the Boards manager, and install the "Arduino SAM" from the list of available boards. + +Download STM32duino (Arduino for STM32) from this URL: + + https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot + +Unzip and change the extracted folder name "Arduino_STM32-ZUMSpot" to "Arduino_STM32" + +Copy Arduino_STM32 folder in: + + My Documents/Arduino/hardware + +Connect the ZUMSpot USB to your PC. Install the USB Mapple driver using the bat file: + + My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat + (you may also check: http://wiki.stm32duino.com/index.php?title=Windows_driver_installation) + +You have to be sure that Windows detect your ZUMSpot as an USB serial device COMx (please +see Windows Device Manager) + +Download the source (zip file) of MMDVM_HS from: + + https://github.com/juribeparada/MMDVM_HS + +Do not download or install the STM32F103 library, STM32F10X_Lib, this is not necessary +under STM32duino. + +Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this +folder can't have spaces. + +Start the Arduino IDE. Open the MMDVM_HS.ino file in the MMDVM_HS folder. + +Under the menu "Tools" select "Board" and then select: + + Board: Generic STM32F103C Series + Variant: STM32F103C8 (20k RAM, 64k Flash) + CPU Speed: 72 MHz (Normal) + Upload method: STM32duino bootloader (you have transfered the USB bootloader before) + Serial port: COMx (Maple Mini) + +Edit Config.h: + + #define PI_HAT_7021_REV_03 + #define ENABLE_ADF7021 + #define BIDIR_DATA_PIN + #define ADF7021_14_7456 + #define STM32_USB_HOST + #define ENABLE_SCAN_MODE + +Click the Upload button in the IDE and wait for the transfer. + +Once the transfer is completed, press the RESET button of the board or disconnect and +connect the USB cable. + +## Linux Raspbian + +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 clone https://github.com/juribeparada/STM32F10X_Lib + +(Please do not download any different code inside MMDVM_HS folder) + +Edit Config.h + + nano Config.h + +and enable: + + #define PI_HAT_7021_REV_03 + #define ENABLE_ADF7021 + #define BIDIR_DATA_PIN + #define ADF7021_14_7456 + #define STM32_USB_HOST + #define ENABLE_SCAN_MODE + +Build the firmware with bootloader support: + + make bl + +Upload the firmware to ZUMSpot USB: + + sudo make dfu devser=/dev/ttyACM0 + +Install MMDVMHost: + + cd ~ + git clone https://github.com/g4klx/MMDVMHost/ + cd MMDVMHost/ + make + +Edit MMDVM.ini according your preferences + + nano MMDVM.ini + (use Port=/dev/ttyACM0 in [Modem]) + +Execute MMDVMHost: + + ./MMDVMHost MMDVM.ini + +# Makefile options + +- make clean: delete all objects files *.o, for starting a new firmware building. + +- make: it builds a standard firmware (without USB bootloader support). + +- 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 dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional, +and it corresponds to the USB serial port device name. This option permits to perform a reset +to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button +of the ZUMSpot just before using this command. + +- make serial devser=/dev/ttyXXX: upload standard firmware using serial port bootloader method. + +- make serial-bl devser=/dev/ttyXXX: upload firmware with USB bootloader support using serial +port bootloader method. + +- make stlink: upload standard firmware using ST-Link interface. + +- make stlink-bl: upload firmware with USB bootloader support using ST-Link interface. + +- make ocd: upload standard firmware using ST-Link interface. This method uses a local +openocd installation. + +- make ocd-bl: upload firmware with USB bootloader support using ST-Link interface. This +method uses a local openocd installation. + +## Common Makefile commands + +Serial programming (first programming, transfer the USB bootloader): + + make clean + make bl + sudo make serial-bl devser=/dev/ttyUSB0 + +USB programming (you have already transfered the USB bootloader): + + make clean + make bl + sudo make dfu (reset ZUMSpot before) or + sudo make dfu devser=/dev/ttyACM0 (/dev/ttyACM0 is the device name of ZUMSpot USB under Raspbian) + +ZUMSpot RPi (no USB support needed): + + make clean + make + sudo make zumspot-pi + +# Config.h options + +- #define PI_HAT_7021_REV_02: enable pinouts for first revision of ZUMSpot RPi. In general is +not used. + +- #define PI_HAT_7021_REV_03: enable pinouts support for ZUMSpot RPi or ZUMSpot USB. You have +to enable this option if you have one of these products. + +- #define ADF7021_CARRIER_BOARD: enable this option if you have a ZUMSpot Libre Kit (Board with +modified RF7021SE and Blue Pill STM32F103). + +- #define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default). + +- #define ADF7021_N_VER: enable support for narrow band version of ADF7021 (ADF7021N). Disabled +by default, in general all boards will have just ADF7021. + +- #define DUPLEX: enable duplex mode with dual ADF7021. It is still under development. + +- #define BIDIR_DATA_PIN: enable Standard TX/RX Data Interface of ADF7021 (enabled by default, +needed for scanning mode detection feature). + +- #define ADF7021_14_7456: select this option if your board uses a 14.7456 MHz (enabled by default). + +- #define ADF7021_12_2880: select this option if your board uses a 12.2880 MHz. + +- #define ADF7021_ENABLE_4FSK_AFC: enable AFC support for DMR, YSF and P25. This is experimental, +depending on your frequency offset this option will improve or not your BER reception. + +- #define ADF7021_AFC_POS: enable this option if you can not receive any signal after enable the +ADF7021_ENABLE_4FSK_AFC option. + +- #define STM32_USART1_HOST: enable direct serial host communication with ZUMSpot (using USART1 +PA9 and PA10 pins). Disable STM32_USB_HOST if you enable this option. Enable this if you have +a ZUMSpot RPi. You don't need to enable this option if you will transfer the bootloader. + +- #define STM32_USB_HOST: enable USB host communication with ZUMSpot (using STM32F103 USB +interface). Disable STM32_USART1_HOST if you enable this option. Enable this if you have +a ZUMSpot USB or ZUMSpot Libre Kit. + +- #define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMSpot. This is based on +scanning over all enabled modes, and you could have some detection delay. Enabled by default. + +- #define SEND_RSSI_DATA: enable RSSI reports to MMDVMHost. It is already converted to dBm. + +- #define SERIAL_REPEATER: enable a second serial port (USART2, pins PA2 and PA3) for Nextion +LCD display. + +- #define ENABLE_P25_WIDE: enable support for Motorola Wide P25 mod/demod in XTS3000 radios. Using +this mode improves RX BER. You need to enable this mode in your radio for each conventional +personalities. + +# Pinout definitions + +## Pinout definitions for ZUMSpot Libre Kit + +This is the carrier board or any board with RF7021SE + STM32F103. + +Main RF7021SE board: + + CE PC14 + SLE PB8 + SREAD PB7 + SDATA PB6 + SCLK PB5 + DATA PB4 (TxRxData)* + DCLK PB3 (TxRxCLK)* + CLKOUT PA15 (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) + PAC PB14 (PTT LED) + VCC 3.3 V + GND Ground + +Second RF7021SE board (duplex mode, experimental): + + SLE PA6 + DATA PA4 (TxRxData)* + DCLK PA5 (TxRxCLK)* + PAC NC + CLKOUT NC + VCC 3.3 V + GND Ground + + SDATA, SREAD, SCLK and CE are shared with the main ADF7021. + +Serial ports: + + TXD PA9 (serial port host communication) + RXD PA10 (serial port host communication) + DISP_TXD PA2 (Nextion LCD serial repeater) + DISP_RXD PA3 (Nextion LCD serial repeater) + +Status LEDs: + + COS_LED PB15 + PTT_LED PB14 + P25_LED PB0 + YSF_LED PB1 + DMR_LED PB13 + DSTAR_LED PB12 + +Misc pins: + + PIN_LED PC13 (status led) + PIN_DEB PB9 (debugging pin) + +You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for +reducing EMI. + +## Pinout definitions for Arduino Due/Zero + RF7021SE + +Use Arduino IDE with SAM support for building the code. + +Main RF7021SE board: + + CE 12 + SLE 6 + SREAD 5 + SDATA 4 // 2 in Arduino Zero Pro + SCLK 3 + DATA 7 (TxRxData)* + DCLK 8 (TxRxCLK)* + CLKOUT 2 // 4 in Arduino Zero Pro (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) + PAC 9 (PTT LED) + VCC 3.3 V + GND Ground + +Serial ports: + + USB Arduino Programming Port (host communication) + +Status LEDs: + + COS_LED 10 + PTT_LED 9 + P25_LED 17 + YSF_LED 16 + DMR_LED 15 + DSTAR_LED 14 + +Misc pins: + + PIN_LED 13 + PIN_DEB 11 + +You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for +reducing EMI. + +## Pinout definitions for Teensy (3.1, 3.2, 3.5 or 3.6) + RF7021SE: + +Use Teensyduino + Arduino IDE for building the code. + +Main RF7021SE board: + + CE 6 + SLE 5 + SREAD 4 + SDATA 3 + SCLK 2 + DATA 7 (TxRxData)* + DCLK 8 (TxRxCLK)* + CLKOUT 22 (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) + PAC 14 (PTT LED) + VCC 3.3 V + GND Ground + +Serial ports: + + Teensy USB Port (host communication) + DISP_TXD 1 (Nextion LCD serial repeater) + DISP_RXD 0 (Nextion LCD serial repeater) + +Status LEDs: + + COS_LED 15 + PTT_LED 14 + P25_LED 19 + YSF_LED 18 + DMR_LED 17 + DSTAR_LED 16 + +Misc pins: + + PIN_LED 13 + PIN_DEB 23 + +You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for +reducing EMI. diff --git a/BUILD.txt b/BUILD.txt deleted file mode 100644 index 4d749f0..0000000 --- a/BUILD.txt +++ /dev/null @@ -1,422 +0,0 @@ -Building instructions: -===================== -1) Raspberry Pi with ZUMSpot Pi: - -* Download latest Raspbian image and install to a micro SD -- See: https://www.raspberrypi.org/documentation/installation/installing-images/ -- Configure your SD before booting. Useful article: - https://styxit.com/2017/03/14/headless-raspberry-setup.html -- Boot your Raspberry Pi -- Run raspi-config and configure according your preferences: -sudo raspi-config -(at least expand filesystem and change default password. It's a good idea to enable "Wait -for Network at Boot" and disable Desktop GUI if you don't plan to use it) - -* Enable serial port /dev/ttyAMA0 (Raspberry Pi 3 or Pi Zero W only): -- 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 -(add the following lines): -enable_uart=1 -dtoverlay=pi3-disable-bt - -- Reboot the RPi: -sudo reboot - -* Enable serial port /dev/ttyAMA0 (Raspberry Pi 2 only): -- Edit /boot/cmdline.txt -sudo nano /boot/cmdline.txt -(remove the text: console=serial0,115200) - -- Disable services: -sudo systemctl disable serial-getty@ttyAMA0.service - -- Reboot the RPi: -sudo reboot - -* Build de firmware and upload to ZUMSpot: -cd ~ -- 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 -git clone https://git.code.sf.net/p/stm32flash/code stm32flash -cd stm32flash -make -sudo make install -cd ~ - -- Download the sources: -git clone https://github.com/juribeparada/MMDVM_HS -cd MMDVM_HS/ -git clone https://github.com/juribeparada/STM32F10X_Lib - -(Please do not download any different code inside MMDVM_HS folder) - -- Edit Config.h -nano Config.h -(and enable): -#define PI_HAT_7021_REV_03 -#define ENABLE_ADF7021 -#define ADF7021_N_VER (only if your board uses ADF7021N) -#define BIDIR_DATA_PIN -#define ADF7021_14_7456 -#define STM32_USART1_HOST -#define ENABLE_SCAN_MODE - -- Build the firmware: -make - -- Upload the firmware to ZUMSpot Pi board: -sudo make zumspot-pi - -* Install MMDVMHost: -cd ~ -git clone https://github.com/g4klx/MMDVMHost/ -cd MMDVMHost/ -make - -- Edit MMDVM.ini according your preferences -nano MMDVM.ini -(use Port=/dev/ttyAMA0 in [Modem]) - -- Execute MMDVMHost: -./MMDVMHost MMDVM.ini - -2) ZUMSpot Libre Kit and ZUMSpot USB: - -* Windows: -- Download and install the Arduino IDE: -https://www.arduino.cc/en/Main/Software - -- Run Arduino IDE. On the Tools menu, select the Boards manager, and install the "Arduino SAM" -Boards from the list of available boards. - -- Download STM32duino (Arduino for STM32) from this URL: -https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot - -- Unzip and change the main folder "Arduino_STM32-ZUMSpot" to "Arduino_STM32" - -- Copy Arduino_STM32 folder in: -My Documents/Arduino/hardware - -- Install the USB bootloader to STM32F103. Follow the instructions: -https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/stm32duino-bootloader - -- Connect the ZUMSpot USB to your PC. Install the USB Mapple driver using the bat file: -My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat -(you may also check: http://wiki.stm32duino.com/index.php?title=Windows_driver_installation) - -- You have to be sure that Windows detect your ZUMSpot as an USB serial device COMx (please -see Windows Device Manager) - -- Download the source (zip file) of MMDVM_HS from https://github.com/juribeparada/MMDVM_HS -(Do not download or install the STM32F103 library, STM32F10X_Lib, this is not necessary -under STM32duino). - -- Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this -folder can't have spaces. - -- Start the Arduino IDE. Open the MMDVM_HS.ino file in the MMDVM_HS folder. - -- Under the menu "Tools" select "Board" and then select: -Board: Generic STM32F103C Series -Variant: STM32F103C8 (20k RAM, 64k Flash) -CPU Speed: 72 MHz (Normal) -Upload method: STM32duino bootloader (you have transfered the USB bootloader before) -Serial port: COMx (Maple Mini) - -- Edit Config.h according your board: -#define PI_HAT_7021_REV_03 (only if your board is ZUMSpot USB) -#define ADF7021_CARRIER_BOARD (only if your board is ZUMSpot Libre Kit) -#define ENABLE_ADF7021 -#define ADF7021_N_VER (only if your board uses ADF7021N) -#define BIDIR_DATA_PIN -#define ADF7021_14_7456 -#define STM32_USB_HOST -#define ENABLE_SCAN_MODE - -- Click the Upload button in the IDE and wait for the transfer. - -- Once the transfer is completed, press the RESET button of the board or disconnect and -connect the USB cable. In the case of ZUMSpot Libre Kit, you will see the LED (PC13) of -the blue pill blinking. - -- Once you connect with MMDVMHost, the LED will blink fast in the ZUMSpot Libre Kit. - -* Linux Raspbian: -cd ~ -- 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: -git clone https://github.com/juribeparada/MMDVM_HS -cd MMDVM_HS/ -git clone https://github.com/juribeparada/STM32F10X_Lib - -(Please do not download any different code inside MMDVM_HS folder) - -- Edit Config.h -nano Config.h -(and enable): -#define PI_HAT_7021_REV_03 (only if your board is ZUMSpot USB) -#define ADF7021_CARRIER_BOARD (only if your board is ZUMSpot Libre Kit) -#define ENABLE_ADF7021 -#define ADF7021_N_VER (only if your board uses ADF7021N) -#define BIDIR_DATA_PIN -#define ADF7021_14_7456 -#define STM32_USB_HOST -#define ENABLE_SCAN_MODE - -- Build the firmware with bootloader support: -make bl - -- Upload bootloader and firmware to ZUMSpot USB board, using serial port first (you -are using an USB-serial converter with device name /dev/ttyUSB0): - -Hold BOOT0 (or move BOOT0 jumper to 1), next press and release RESET - -sudo make serial-bl devser=/dev/ttyUSB0 - -Release BOOT0 (or move BOOT0 jumper to 0) - -- For following firmware updates, you could use the USB port directly: -sudo make dfu devser=/dev/ttyACM0 - -* Install MMDVMHost: -cd ~ -git clone https://github.com/g4klx/MMDVMHost/ -cd MMDVMHost/ -make - -- Edit MMDVM.ini according your preferences -nano MMDVM.ini -(use Port=/dev/ttyACM0 in [Modem]) - -- Execute MMDVMHost: -./MMDVMHost MMDVM.ini - -3) Makefile options: - -make clean: delete all objects files *.o, for starting a new firmware building. - -make: it builds a standard firmware (without USB bootloader support). - -make bl: it builds a firmware with USB bootloader support. - -make zumspot-pi: upload the firmware to a ZUMSpot Pi version (using internal RPi serial port) - -make dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional, -and it corresponds to the USB serial port device name. This option permits to perform a reset -to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button -of the ZUMSpot just before using this command. - -make serial devser=/dev/ttyXXX: upload standard firmware using serial port bootloader method. - -make serial-bl devser=/dev/ttyXXX: upload firmware with USB bootloader support using serial -port bootloader method. - -make stlink: upload standard firmware using ST-Link interface. - -make stlink-bl: upload firmware with USB bootloader support using ST-Link interface. - -make ocd: upload standard firmware using ST-Link interface. This method uses a local -openocd installation. - -make ocd-bl: upload firmware with USB bootloader support using ST-Link interface. This -method uses a local openocd installation. - -* Common Makefile commands: -- Serial programming (first programming, transfer the USB bootloader): -make clean -make bl -sudo make serial-bl devser=/dev/ttyUSB0 - -- USB programming (you have already transfered the USB bootloader): -make clean -make bl -sudo make dfu (reset ZUMSpot before) or -sudo make dfu devser=/dev/ttyACM0 (/dev/ttyACM0 is the device name of ZUMSpot USB under -Raspbian) - -- ZUMSpot Pi (no USB support needed): -make clean -make -sudo make zumspot-pi - -4) Config.h options: - -#define PI_HAT_7021_REV_02: enable pinouts for first revision of ZUMSpot Pi. In general is -not used. - -#define PI_HAT_7021_REV_03: enable pinouts support for ZUMSpot Pi or ZUMSpot USB. You have -to enable this option if you have one of these products. - -#define ADF7021_CARRIER_BOARD: enable this option if you have a ZUMSpot Libre Kit (Board with -modified RF7021SE and Blue Pill STM32F103). - -#define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default). - -#define ADF7021_N_VER: enable support for narrow band version of ADF7021 (ADF7021N). Disabled -by default, in general all boards will have just ADF7021. - -#define DUPLEX: enable duplex mode with dual ADF7021. It is still under development. - -#define BIDIR_DATA_PIN: enable Standard TX/RX Data Interface of ADF7021 (enabled by default, -needed for scanning mode detection feature). - -#define ADF7021_14_7456: select this option if your board uses a 14.7456 MHz (enabled by default). - -#define ADF7021_12_2880: select this option if your board uses a 12.2880 MHz. - -#define ADF7021_ENABLE_4FSK_AFC: enable AFC support for DMR, YSF and P25. This is experimental, -depending on your frequency offset this option will improve or not your BER reception. - -#define ADF7021_AFC_POS: enable this option if you can not receive any signal after enable the -ADF7021_ENABLE_4FSK_AFC option. - -#define STM32_USART1_HOST: enable direct serial host communication with ZUMSpot (using USART1 -PA9 and PA10 pins). Disable STM32_USB_HOST if you enable this option. Enable this if you have -a ZUMSpot Pi. You don't need to enable this option if you will transfer the bootloader. - -#define STM32_USB_HOST: enable USB host communication with ZUMSpot (using STM32F103 USB -interface). Disable STM32_USART1_HOST if you enable this option. Enable this if you have -a ZUMSpot USB or ZUMSpot Libre Kit. - -#define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMSpot. This is based on -scanning over all enabled modes, and you could have some detection delay. Enabled by default. - -#define SEND_RSSI_DATA: enable RSSI reports to MMDVMHost. It is already converted to dBm. - -#define SERIAL_REPEATER: enable a second serial port (USART2, pins PA2 and PA3) for Nextion -LCD display. - -#define ENABLE_P25_WIDE: enable support for Motorola Wide P25 mod/demod in XTS3000 radios. Using -this mode improves RX BER. You need to enable this mode in your radio for each conventional -personalities. - -Pinout definitions for ZUMSpot Libre Kit (Carrier board, RF7021SE + STM32F103 board): -===================================================================================== -- Main RF7021SE board: -CE PC14 -SLE PB8 -SREAD PB7 -SDATA PB6 -SCLK PB5 -DATA PB4 (TxRxData)* -DCLK PB3 (TxRxCLK)* -CLKOUT PA15 (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) -PAC PB14 (PTT LED) -VCC 3.3 V -GND Ground - -- Second RF7021SE board (duplex mode, experimental): -SLE PA6 -DATA PA4 (TxRxData)* -DCLK PA5 (TxRxCLK)* -PAC NC -CLKOUT NC -VCC 3.3 V -GND Ground - -SDATA, SREAD, SCLK and CE are shared with the main ADF7021. - -- Serial ports: -TXD PA9 (serial port host communication) -RXD PA10 (serial port host communication) -DISP_TXD PA2 (Nextion LCD serial repeater) -DISP_RXD PA3 (Nextion LCD serial repeater) - -- Status LEDs: -COS_LED PB15 -PTT_LED PB14 -P25_LED PB0 -YSF_LED PB1 -DMR_LED PB13 -DSTAR_LED PB12 - -- Misc pins: -PIN_LED PC13 (status led) -PIN_DEB PB9 (debugging pin) - -* You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for -reducing EMI. - -Pinout definitions for Arduino Due/Zero + RF7021SE: -=================================================== -Use Arduino IDE for building the code - -- Main RF7021SE board: -CE 12 -SLE 6 -SREAD 5 -SDATA 4 // 2 in Arduino Zero Pro -SCLK 3 -DATA 7 (TxRxData)* -DCLK 8 (TxRxCLK)* -CLKOUT 2 // 4 in Arduino Zero Pro (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) -PAC 9 (PTT LED) -VCC 3.3 V -GND Ground - -- Serial ports: -USB Arduino Programming Port (host communication) - -- Status LEDs: -COS_LED 10 -PTT_LED 9 -P25_LED 17 -YSF_LED 16 -DMR_LED 15 -DSTAR_LED 14 - -- Misc pins: -PIN_LED 13 -PIN_DEB 11 - -* You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for -reducing EMI. - -Pinout definitions for Teensy (3.1, 3.2, 3.5 or 3.6) + RF7021SE: -=================================================== -Use Teensyduino + Arduino IDE for building the code - -- Main RF7021SE board: -CE 6 -SLE 5 -SREAD 4 -SDATA 3 -SCLK 2 -DATA 7 (TxRxData)* -DCLK 8 (TxRxCLK)* -CLKOUT 22 (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) -PAC 14 (PTT LED) -VCC 3.3 V -GND Ground - -- Serial ports: -Teensy USB Port (host communication) -DISP_TXD 1 (Nextion LCD serial repeater) -DISP_RXD 0 (Nextion LCD serial repeater) - -- Status LEDs: -COS_LED 15 -PTT_LED 14 -P25_LED 19 -YSF_LED 18 -DMR_LED 17 -DSTAR_LED 16 - -- Misc pins: -PIN_LED 13 -PIN_DEB 23 - -* You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for -reducing EMI. diff --git a/README.md b/README.md index 17fe0ae..3ae2266 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,104 @@ +# Introduction + This is the source code of ZUMSpot, personal hotspot (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's MMDVM software. This firmware supports D-Star, DMR, System Fusion and P25 digital modes. -This software is intended to be run on STM32F103 microcontroller. You can build this code using Arduino IDE with STM32duino package, or using "make" with ARM GCC tools. 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. Please see BUILD.txt for more details, and also MMDVM Yahoo Groups. +This software is intended to be run on STM32F103 microcontroller. You can build this code using Arduino IDE with STM32duino package, or using "make" with ARM GCC tools. 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. 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. + +# Quick start + +Please see BUILD.md for more details, and also MMDVM Yahoo Groups. + +## ZUMSpot Libre Kit (under Linux Raspbian) + +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 clone https://github.com/juribeparada/STM32F10X_Lib + +Build the firmware with USB bootloader support (the default Config.h is OK for Libre Kit): + + make bl + +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 de firmware and upload to ZUMSpot RPi + +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 + +Download the firmware sources: + + cd ~ + git clone https://github.com/juribeparada/MMDVM_HS + cd MMDVM_HS/ + git clone https://github.com/juribeparada/STM32F10X_Lib + +Edit Config.h + + nano Config.h + +and enable: + + #define PI_HAT_7021_REV_03 + #define ENABLE_ADF7021 + #define BIDIR_DATA_PIN + #define ADF7021_14_7456 + #define STM32_USART1_HOST + #define ENABLE_SCAN_MODE + +Build the firmware: + + make + +Upload the firmware to ZUMSpot RPi board: + + sudo make zumspot-pi + From 8240961fabc846e418b3935dfe893cd65275f1a4 Mon Sep 17 00:00:00 2001 From: Tony Corbett Date: Sat, 15 Jul 2017 19:25:06 +0100 Subject: [PATCH 04/11] Update Config.h --- Config.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Config.h b/Config.h index b9341dd..79902fd 100644 --- a/Config.h +++ b/Config.h @@ -24,9 +24,7 @@ // #define PI_HAT_7021_REV_02 // 2) ZUM-Spot USB and ZUM-Spot Pi HAT: // #define PI_HAT_7021_REV_03 -// 3) ZUM-Spot Libre Kit -// #define ZUMSPOT_LIBRE -// 4) board with modified RF7021SE and Blue Pill STM32F103 +// 3) ZUM-Spot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103 #define ADF7021_CARRIER_BOARD // Enable ADF7021 support: @@ -60,8 +58,10 @@ // Send RSSI value: // #define SEND_RSSI_DATA -// Enable Nextion LCD serial port repeater: +// Enable Nextion LCD serial port repeater on USART2: // #define SERIAL_REPEATER +// Enable Nextion LCD serial port repeater on USART1 (not compatible with ZUM-Spot Libre or STM32_USART1_HOST): +// #define SERIAL_REPEATER_USART1 // Enable P25 Wide modulation // #define ENABLE_P25_WIDE From d2c0a232d593daeb4d9dbda3d06f1493ba9b14df Mon Sep 17 00:00:00 2001 From: Tony Corbett Date: Sat, 15 Jul 2017 19:27:41 +0100 Subject: [PATCH 05/11] Update IOArduino.cpp --- IOArduino.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IOArduino.cpp b/IOArduino.cpp index 25a40c2..4be1dc3 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -65,7 +65,7 @@ #define PIN_PTT_LED PB14 #define PIN_COS_LED PB15 -#elif defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) +#elif defined(ADF7021_CARRIER_BOARD) #define PIN_SCLK PB5 #define PIN_SREAD PB7 @@ -85,7 +85,7 @@ #define PIN_COS_LED PB15 #else -#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, ZUMSPOT_LIBRE or ADF7021_CARRIER_BOARD need to be defined" +#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03 or ADF7021_CARRIER_BOARD need to be defined" #endif #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) @@ -150,7 +150,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) afio_cfg_debug_ports(AFIO_DEBUG_NONE); -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY); #endif From cc72d91f513957b2b17f77d1e8d83366a8fbc50a Mon Sep 17 00:00:00 2001 From: Tony Corbett Date: Sat, 15 Jul 2017 19:29:28 +0100 Subject: [PATCH 06/11] Update IOSTM.cpp --- IOSTM.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/IOSTM.cpp b/IOSTM.cpp index 574297d..90b2c85 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -139,7 +139,7 @@ #define PIN_COS_LED GPIO_Pin_15 #define PORT_COS_LED GPIOB -#elif defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) +#elif defined(ADF7021_CARRIER_BOARD) #define PIN_SCLK GPIO_Pin_5 #define PORT_SCLK GPIOB @@ -197,7 +197,7 @@ #define PORT_COS_LED GPIOB #else -#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, ZUMSPOT_LIBRE or ADF7021_CARRIER_BOARD need to be defined" +#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03 or ADF7021_CARRIER_BOARD need to be defined" #endif extern "C" { @@ -219,7 +219,7 @@ extern "C" { } #endif -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) #if defined(BIDIR_DATA_PIN) void EXTI3_IRQHandler(void) { @@ -247,7 +247,7 @@ void CIO::Init() #if defined(PI_HAT_7021_REV_02) GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); #endif @@ -391,7 +391,7 @@ void CIO::Init() EXTI_InitStructure.EXTI_Line = EXTI_Line14; #endif -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) #if defined(BIDIR_DATA_PIN) // Connect EXTI3 Line @@ -421,7 +421,7 @@ void CIO::startInt() NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; -#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(ZUMSPOT_LIBRE) +#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) #if defined(BIDIR_DATA_PIN) // Enable and set EXTI3 Interrupt From 0d39ef58cd2b8432dffe52df4f8096cf54adf140 Mon Sep 17 00:00:00 2001 From: Tony Corbett Date: Sat, 15 Jul 2017 19:33:44 +0100 Subject: [PATCH 07/11] Update SerialSTM.cpp --- SerialSTM.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SerialSTM.cpp b/SerialSTM.cpp index 40de267..9397299 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -44,7 +44,7 @@ USART2 - TXD PA2 - RXD PA3 #define TX_SERIAL_FIFO_SIZE 256U #define RX_SERIAL_FIFO_SIZE 256U -#if defined(STM32_USART1_HOST) || defined(SERIAL_REPEATER) +#if defined(STM32_USART1_HOST) || defined(SERIAL_REPEATER_USART1) extern "C" { void USART1_IRQHandler(); @@ -439,11 +439,11 @@ void CSerialPort::beginInt(uint8_t n, int speed) usbserial.begin(); #endif break; - #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) + #if defined(SERIAL_REPEATER) case 3U: InitUSART2(speed); break; - #elif defined(SERIAL_REPEATER) + #elif defined(SERIAL_REPEATER_USART1) case 3U: InitUSART1(speed); break; @@ -462,10 +462,10 @@ int CSerialPort::availableInt(uint8_t n) #elif defined(STM32_USB_HOST) return usbserial.available(); #endif - #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) + #if defined(SERIAL_REPEATER) case 3U: return AvailUSART2(); - #elif defined(SERIAL_REPEATER) + #elif defined(SERIAL_REPEATER_USART1) case 3U: return AvailUSART1(); #endif @@ -483,10 +483,10 @@ uint8_t CSerialPort::readInt(uint8_t n) #elif defined(STM32_USB_HOST) return usbserial.read(); #endif - #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) + #if defined(SERIAL_REPEATER) case 3U: return ReadUSART2(); - #elif defined(SERIAL_REPEATER) + #elif defined(SERIAL_REPEATER_USART1) case 3U: return ReadUSART1(); #endif @@ -509,13 +509,13 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool usbserial.flush(); #endif break; - #if defined(SERIAL_REPEATER) && (defined(STM32_USART1_HOST) || defined(ZUMSPOT_LIBRE)) + #if defined(SERIAL_REPEATER) case 3U: WriteUSART2(data, length); if (flush) TXSerialFlush2(); break; - #elif defined(SERIAL_REPEATER) + #elif defined(SERIAL_REPEATER_USART1) case 3U: WriteUSART1(data, length); if (flush) From a68946e0b2b23ae28eb5ef838a795aa66bbd621f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 15 Jul 2017 15:20:45 -0400 Subject: [PATCH 08/11] Updating some comments and text --- BUILD.md | 60 +++++++++++++++++++++++++++---------------------------- Config.h | 11 +++++----- README.md | 12 +++++------ 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/BUILD.md b/BUILD.md index 1162726..b505412 100644 --- a/BUILD.md +++ b/BUILD.md @@ -7,14 +7,14 @@ Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. # Index -- ZUMSpot RPi -- ZUMSpot Libre Kit -- ZUMSpot USB +- ZUMspot RPi +- ZUMspot Libre Kit +- ZUMspot USB - Makefile options - Config.h options - Pinout definitions -# ZUMSpot RPi +# ZUMspot RPi Download latest Raspbian image and install to a micro SD @@ -72,7 +72,7 @@ Reboot your RPi: sudo reboot -### Build de firmware and upload to ZUMSpot RPi +### Build de firmware and upload to ZUMspot RPi Install the necessary software tools: @@ -111,7 +111,7 @@ Build the firmware: make -Upload the firmware to ZUMSpot RPi board: +Upload the firmware to ZUMspot RPi board: sudo make zumspot-pi @@ -131,7 +131,7 @@ Execute MMDVMHost: ./MMDVMHost MMDVM.ini -# ZUMSpot Libre Kit +# ZUMspot Libre Kit ## Windows @@ -145,7 +145,7 @@ Download STM32duino (Arduino for STM32) from this URL: https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot -Unzip and change the extracted folder name "Arduino_STM32-ZUMSpot" to "Arduino_STM32" +Unzip and change the extracted folder name "Arduino_STM32-ZUMspot" to "Arduino_STM32" Copy Arduino_STM32 folder in: @@ -155,12 +155,12 @@ Install the USB bootloader to STM32F103. Follow the instructions: https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/stm32duino-bootloader -Connect the ZUMSpot Libre Kit to your PC. Install the USB Mapple driver using the bat file +Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file (you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation): My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat -You have to be sure that Windows detect your ZUMSpot as an USB serial device COMx (please +You have to be sure that Windows detect your ZUMspot as an USB serial device COMx (please see Windows Device Manager). Download the source (zip file) of MMDVM_HS from: @@ -231,7 +231,7 @@ Build the firmware with bootloader support: make bl -Upload bootloader and firmware to ZUMSpot Libre Kit, using serial port first (you +Upload bootloader and firmware to ZUMspot Libre Kit, using serial port first (you are using an USB-serial converter with device name /dev/ttyUSB0). Move BOOT0 jumper to 1, next press and release RESET and execute: @@ -259,7 +259,7 @@ Execute MMDVMHost: ./MMDVMHost MMDVM.ini -# ZUMSpot USB +# ZUMspot USB ## Windows @@ -273,18 +273,18 @@ Download STM32duino (Arduino for STM32) from this URL: https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot -Unzip and change the extracted folder name "Arduino_STM32-ZUMSpot" to "Arduino_STM32" +Unzip and change the extracted folder name "Arduino_STM32-ZUMspot" to "Arduino_STM32" Copy Arduino_STM32 folder in: My Documents/Arduino/hardware -Connect the ZUMSpot USB to your PC. Install the USB Mapple driver using the bat file: +Connect the ZUMspot USB to your PC. Install the USB Mapple driver using the bat file: My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat (you may also check: http://wiki.stm32duino.com/index.php?title=Windows_driver_installation) -You have to be sure that Windows detect your ZUMSpot as an USB serial device COMx (please +You have to be sure that Windows detect your ZUMspot as an USB serial device COMx (please see Windows Device Manager) Download the source (zip file) of MMDVM_HS from: @@ -354,7 +354,7 @@ Build the firmware with bootloader support: make bl -Upload the firmware to ZUMSpot USB: +Upload the firmware to ZUMspot USB: sudo make dfu devser=/dev/ttyACM0 @@ -382,12 +382,12 @@ Execute MMDVMHost: - 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 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. +of the ZUMspot just before using this command. - make serial devser=/dev/ttyXXX: upload standard firmware using serial port bootloader method. @@ -416,10 +416,10 @@ USB programming (you have already transfered the USB bootloader): make clean make bl - sudo make dfu (reset ZUMSpot before) or - sudo make dfu devser=/dev/ttyACM0 (/dev/ttyACM0 is the device name of ZUMSpot USB under Raspbian) + sudo make dfu (reset ZUMspot before) or + sudo make dfu devser=/dev/ttyACM0 (/dev/ttyACM0 is the device name of ZUMspot USB under Raspbian) -ZUMSpot RPi (no USB support needed): +ZUMspot RPi (no USB support needed): make clean make @@ -427,13 +427,13 @@ ZUMSpot RPi (no USB support needed): # Config.h options -- #define PI_HAT_7021_REV_02: enable pinouts for first revision of ZUMSpot RPi. In general is +- #define PI_HAT_7021_REV_02: enable pinouts for first revision of ZUMspot RPi. In general is not used. -- #define PI_HAT_7021_REV_03: enable pinouts support for ZUMSpot RPi or ZUMSpot USB. You have +- #define PI_HAT_7021_REV_03: enable pinouts support for ZUMspot RPi or ZUMspot USB. You have to enable this option if you have one of these products. -- #define ADF7021_CARRIER_BOARD: enable this option if you have a ZUMSpot Libre Kit (Board with +- #define ADF7021_CARRIER_BOARD: enable this option if you have a ZUMspot Libre Kit (Board with modified RF7021SE and Blue Pill STM32F103). - #define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default). @@ -456,15 +456,15 @@ depending on your frequency offset this option will improve or not your BER rece - #define ADF7021_AFC_POS: enable this option if you can not receive any signal after enable the ADF7021_ENABLE_4FSK_AFC option. -- #define STM32_USART1_HOST: enable direct serial host communication with ZUMSpot (using USART1 +- #define STM32_USART1_HOST: enable direct serial host communication with ZUMspot (using USART1 PA9 and PA10 pins). Disable STM32_USB_HOST if you enable this option. Enable this if you have -a ZUMSpot RPi. You don't need to enable this option if you will transfer the bootloader. +a ZUMspot RPi. You don't need to enable this option if you will transfer the bootloader. -- #define STM32_USB_HOST: enable USB host communication with ZUMSpot (using STM32F103 USB +- #define STM32_USB_HOST: enable USB host communication with ZUMspot (using STM32F103 USB interface). Disable STM32_USART1_HOST if you enable this option. Enable this if you have -a ZUMSpot USB or ZUMSpot Libre Kit. +a ZUMspot USB or ZUMspot Libre Kit. -- #define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMSpot. This is based on +- #define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMspot. This is based on scanning over all enabled modes, and you could have some detection delay. Enabled by default. - #define SEND_RSSI_DATA: enable RSSI reports to MMDVMHost. It is already converted to dBm. @@ -478,7 +478,7 @@ personalities. # Pinout definitions -## Pinout definitions for ZUMSpot Libre Kit +## Pinout definitions for ZUMspot Libre Kit This is the carrier board or any board with RF7021SE + STM32F103. diff --git a/Config.h b/Config.h index 79902fd..3cb1103 100644 --- a/Config.h +++ b/Config.h @@ -20,11 +20,11 @@ #define CONFIG_H // Select one board (STM32F103 based boards): -// 1) Initial release of ZUM-Spot Pi: +// 1) Initial release of ZUMspot RPi: // #define PI_HAT_7021_REV_02 -// 2) ZUM-Spot USB and ZUM-Spot Pi HAT: +// 2) ZUMspot USB and ZUMspot RPi HAT: // #define PI_HAT_7021_REV_03 -// 3) ZUM-Spot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103 +// 3) ZUMspot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103 #define ADF7021_CARRIER_BOARD // Enable ADF7021 support: @@ -58,9 +58,10 @@ // Send RSSI value: // #define SEND_RSSI_DATA -// Enable Nextion LCD serial port repeater on USART2: +// 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 (not compatible with ZUM-Spot Libre or STM32_USART1_HOST): + +// Enable Nextion LCD serial port repeater on USART1: // #define SERIAL_REPEATER_USART1 // Enable P25 Wide modulation diff --git a/README.md b/README.md index 3ae2266..f374ffd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Introduction -This is the source code of ZUMSpot, personal hotspot (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's MMDVM software. This firmware supports D-Star, DMR, System Fusion and P25 digital modes. +This is the source code of ZUMspot, personal hotspot (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's MMDVM software. This firmware supports D-Star, DMR, System Fusion and P25 digital modes. This software is intended to be run on STM32F103 microcontroller. You can build this code using Arduino IDE with STM32duino package, or using "make" with ARM GCC tools. 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. @@ -10,7 +10,7 @@ This software is licenced under the GPL v2 and is intended for amateur and educa Please see BUILD.md for more details, and also MMDVM Yahoo Groups. -## ZUMSpot Libre Kit (under Linux Raspbian) +## ZUMspot Libre Kit (under Linux Raspbian) Install the necessary software tools: @@ -28,11 +28,11 @@ Build the firmware with USB bootloader support (the default Config.h is OK for L make bl -Upload the firmware to ZUMSpot Libre Kit using the USB port (your Libre Kit has the bootloader already installed): +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 +## ZUMspot RPi ### Enable serial port in Raspberry Pi 3 or Pi Zero W @@ -61,7 +61,7 @@ Reboot your RPi: sudo reboot -### Build de firmware and upload to ZUMSpot RPi +### Build de firmware and upload to ZUMspot RPi Install the necessary software tools: @@ -98,7 +98,7 @@ Build the firmware: make -Upload the firmware to ZUMSpot RPi board: +Upload the firmware to ZUMspot RPi board: sudo make zumspot-pi From 47a2dca8b015793a150531c3b97ab1bdc35c0c0f Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 15 Jul 2017 15:21:21 -0400 Subject: [PATCH 09/11] Small changes --- SerialSTM.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/SerialSTM.cpp b/SerialSTM.cpp index 9397299..7cff8af 100644 --- a/SerialSTM.cpp +++ b/SerialSTM.cpp @@ -439,15 +439,13 @@ void CSerialPort::beginInt(uint8_t n, int speed) usbserial.begin(); #endif break; - #if defined(SERIAL_REPEATER) case 3U: + #if defined(SERIAL_REPEATER) InitUSART2(speed); - break; #elif defined(SERIAL_REPEATER_USART1) - case 3U: InitUSART1(speed); - break; #endif + break; default: break; } @@ -462,11 +460,10 @@ int CSerialPort::availableInt(uint8_t n) #elif defined(STM32_USB_HOST) return usbserial.available(); #endif - #if defined(SERIAL_REPEATER) case 3U: + #if defined(SERIAL_REPEATER) return AvailUSART2(); #elif defined(SERIAL_REPEATER_USART1) - case 3U: return AvailUSART1(); #endif default: @@ -483,11 +480,10 @@ uint8_t CSerialPort::readInt(uint8_t n) #elif defined(STM32_USB_HOST) return usbserial.read(); #endif - #if defined(SERIAL_REPEATER) case 3U: + #if defined(SERIAL_REPEATER) return ReadUSART2(); #elif defined(SERIAL_REPEATER_USART1) - case 3U: return ReadUSART1(); #endif default: @@ -509,19 +505,17 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool usbserial.flush(); #endif break; - #if defined(SERIAL_REPEATER) case 3U: + #if defined(SERIAL_REPEATER) WriteUSART2(data, length); if (flush) TXSerialFlush2(); - break; #elif defined(SERIAL_REPEATER_USART1) - case 3U: WriteUSART1(data, length); if (flush) TXSerialFlush1(); - break; #endif + break; default: break; } From fd2204996e309adb576fe4457708770e3918cf8e Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 15 Jul 2017 15:44:13 -0400 Subject: [PATCH 10/11] Updating comments in Config.h --- Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config.h b/Config.h index 3cb1103..fb53f5f 100644 --- a/Config.h +++ b/Config.h @@ -61,7 +61,7 @@ // 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: +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): // #define SERIAL_REPEATER_USART1 // Enable P25 Wide modulation From 922653aa7a016860ac758e5b73e3caf579aad100 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sat, 15 Jul 2017 15:46:46 -0400 Subject: [PATCH 11/11] Updating build instructions --- BUILD.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BUILD.md b/BUILD.md index b505412..d48b813 100644 --- a/BUILD.md +++ b/BUILD.md @@ -472,6 +472,9 @@ scanning over all enabled modes, and you could have some detection delay. Enable - #define SERIAL_REPEATER: enable a second serial port (USART2, pins PA2 and PA3) for Nextion LCD display. +- #define SERIAL_REPEATER_USART1: enable USART1 (pins PA9 and PA10) for Nextion LCD display. Do +not use with STM32_USART1_HOST enabled, only with USB host communication. + - #define ENABLE_P25_WIDE: enable support for Motorola Wide P25 mod/demod in XTS3000 radios. Using this mode improves RX BER. You need to enable this mode in your radio for each conventional personalities.