diff --git a/BUILD.md b/BUILD.md index 656038f..2f51ba9 100644 --- a/BUILD.md +++ b/BUILD.md @@ -7,6 +7,7 @@ This is a detailed guide for building the firmware of MMDVM_HS from the source c - ZUMspot RPi - ZUMspot Libre Kit - ZUMspot USB +- MMDVM_HS_Hat - Makefile options - Config.h options - Pinout definitions @@ -72,6 +73,15 @@ Reboot your RPi: ### Build de 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 @@ -108,6 +118,12 @@ 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 @@ -256,6 +272,15 @@ Press the reset button of ZUMspot and upload the firmware: ## 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 @@ -286,6 +311,12 @@ Build the firmware with bootloader support: 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 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: @@ -377,6 +408,15 @@ connect the USB cable. ## 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 @@ -407,6 +447,12 @@ Build the firmware with bootloader support: 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 USB: sudo make dfu devser=/dev/ttyACM0 @@ -426,6 +472,12 @@ Edit MMDVM.ini according your preferences Execute MMDVMHost: ./MMDVMHost MMDVM.ini + +# MMDVM_HS_Hat + +Please check here for detailed instructions: + + https://github.com/mathisschmieder/MMDVM_HS_Hat/blob/master/README.md # Makefile options @@ -437,6 +489,8 @@ Execute MMDVMHost: - 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 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 @@ -486,6 +540,8 @@ 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 MMDVM_HS_HAT_REV12: enable this option if you have a MMDVM_HS_Hat board for RPi. + - #define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default). - #define DUPLEX: enable duplex mode with dual ADF7021. It is still under development. diff --git a/README.md b/README.md index 021e714..0295ef5 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/MMDVM_HS, 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. @@ -16,7 +16,7 @@ This software is licenced under the GPL v2 and is intended for amateur and educa - Serial repeater port for Nextion displays - Support for native USB port in STM32F103 CPU - RSSI support -- Full duplex support with two ADF7021 (experimental) +- Full duplex support with two ADF7021 # Important notes @@ -46,20 +46,26 @@ Please check the latest firmware: Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the releases section: - https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.0/ZUMSpotFW_setup.exe + https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.2/ZUMSpotFW_setup.exe 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 for a manual installation. ### Linux or macOS -Download the script (*.sh) that matches with your ZUMspot board: +Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board: - install_fw_rpi.sh: only for ZUMspot RPi board -- install_fw_librekit.sh: only for ZUMspot Libre Kit board or generic ZUMspot board +- install_fw_hshat.sh: only for MMDVM_HS_Hat board +- install_fw_librekit.sh: only for ZUMspot Libre Kit board or generic MMDVM_HS board - install_fw_usb.sh: only for ZUMspot USB dongle -- install_fw_duplex.sh: only for ZUMspot with dual ADF7021 +- install_fw_duplex.sh: only for MMDVM_HS with dual ADF7021 -make the script executable (for example for ZUMspot RPi): +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 @@ -73,8 +79,23 @@ and wait to complete the upgrading process. You could check at MMDVM_HS/configs for common Config.h examples, using different ZUMspot boards. +### MMDVM_HS_Hat + +Please check here for detailed instructions: + + https://github.com/mathisschmieder/MMDVM_HS_Hat/blob/master/README.md + ### 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 @@ -91,6 +112,12 @@ Build the firmware with USB bootloader support (the default Config.h is OK for L 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 @@ -126,6 +153,15 @@ Reboot your RPi: #### Build de 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 @@ -160,6 +196,12 @@ 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 diff --git a/configs/MMDVM_HS_Hat.h b/configs/MMDVM_HS_Hat.h new file mode 100644 index 0000000..4f8c6f7 --- /dev/null +++ b/configs/MMDVM_HS_Hat.h @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#if !defined(CONFIG_H) +#define CONFIG_H + +// Select one board (STM32F103 based boards) +// 1) ZUMspot USB and ZUMspot RPi: +// #define PI_HAT_7021_REV_03 +// 2) ZUMspot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103: +// #define ADF7021_CARRIER_BOARD +// 3) MMDVM_HS_Hat revisions 1.1 and 1.2 (DB9MAT & DF2ET) +#define MMDVM_HS_HAT_REV12 + +// Enable ADF7021 support: +#define ENABLE_ADF7021 + +// Enable full duplex support with dual ADF7021: +// #define DUPLEX + +// TCXO of the ADF7021 +// For 14.7456 MHz: +#define ADF7021_14_7456 +// For 12.2880 MHz: +// #define ADF7021_12_2880 + +// Host communication selection: +#define STM32_USART1_HOST +// #define STM32_USB_HOST + +// Enable mode detection: +#define ENABLE_SCAN_MODE + +// Send RSSI value: +// #define SEND_RSSI_DATA + +// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): +#define SERIAL_REPEATER + +// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled): +// #define SERIAL_REPEATER_USART1 + +// Enable P25 Wide modulation: +// #define ENABLE_P25_WIDE + +// Disable mode LEDs blink during scan mode: +// #define QUIET_MODE_LEDS + +#endif diff --git a/scripts/build_fw.sh b/scripts/build_fw.sh index 83e2e49..452c448 100755 --- a/scripts/build_fw.sh +++ b/scripts/build_fw.sh @@ -44,4 +44,10 @@ make bl mv ~/MMDVM_HS/bin/outp.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin make clean +# Building MMDVM_HS_Hat +cp ~/MMDVM_HS/configs/MMDVM_HS_Hat.h ~/MMDVM_HS/Config.h +make +mv ~/MMDVM_HS/bin/outp.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw.bin +make clean + cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h diff --git a/scripts/install_fw_hshat.sh b/scripts/install_fw_hshat.sh new file mode 100755 index 0000000..4aa8773 --- /dev/null +++ b/scripts/install_fw_hshat.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# 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. + +# Configure latest version +FW_VERSION="v1.0.2" + +# Change USB-serial port name ONLY in macOS +MAC_DEV_USB_SER="/dev/cu.usbmodem1441" + +# Download latest firmware for MMDVM_HS_Hat +curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/mmdvm_hs_hat_fw.bin + +# Download STM32F10X_Lib (only for binary tools) +if [ ! -d "./STM32F10X_Lib/utils" ]; then + git clone https://github.com/juribeparada/STM32F10X_Lib +fi + +# Configure vars depending on OS +if [ $(uname -s) == "Linux" ]; then + DEV_USB_SER="/dev/ttyACM0" + if [ $(uname -m) == "x86_64" ]; then + echo "Linux 64-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash" + elif [ $(uname -m) == "armv7l" ]; then + echo "Raspberry Pi 3 detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + elif [ $(uname -m) == "armv6l" ]; then + echo "Raspberry Pi 2 or Pi Zero W detected" + DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash" + else + echo "Linux 32-bit detected" + DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash" + fi +fi + +if [ $(uname -s) == "Darwin" ]; then + echo "macOS detected" + DEV_USB_SER=$MAC_DEV_USB_SER + DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset" + DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util" + ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash" + STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash" +fi + +# Stop MMDVMHost process to free serial port +sudo killall MMDVMHost >/dev/null 2>&1 + +# Upload the firmware +eval sudo $STM32FLASH -v -w mmdvm_hs_hat_fw.bin -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0 +