From 6cdb4e4cf0940ac817fb49ef81f9e86acf561c43 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 19 Jan 2024 00:10:24 +0100 Subject: [PATCH] Initial support for SX1276/8 with TCXO --- Config.h | 7 +++++++ Makefile | 14 +++++++++++++- RNode_Firmware.ino | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Config.h b/Config.h index 07927f4..9ecc47d 100644 --- a/Config.h +++ b/Config.h @@ -91,6 +91,10 @@ #define HAS_PMU false #define HAS_NP false + #if defined(ENABLE_TCXO) + #define HAS_TCXO true + #endif + #if MCU_VARIANT == MCU_1284P const int pin_cs = 4; const int pin_reset = 3; @@ -192,6 +196,9 @@ const int pin_cs = 18; const int pin_reset = 23; const int pin_dio = 26; + #if HAS_TCXO == true + const int pin_tcxo_enable = 33; + #endif #if defined(EXTERNAL_LEDS) const int pin_led_rx = 15; const int pin_led_tx = 4; diff --git a/Makefile b/Makefile index 91cf74d..cf4aef1 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,9 @@ firmware-lora32_v21: firmware-lora32_v21_extled: arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DEXTERNAL_LEDS=true\"" +firmware-lora32_v21_tcxo: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DENABLE_TCXO=true\"" + firmware-heltec32_v2: arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\"" @@ -157,7 +160,7 @@ upload-featheresp32: release: release-all -release-all: console-site spiffs-image release-rnode release-mega2560 release-tbeam release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-hashes +release-all: console-site spiffs-image release-rnode release-mega2560 release-tbeam release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled firmware-lora32_v21_tcxo release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-hashes release-hashes: python ./release_hashes.py > ./Release/release.json @@ -230,6 +233,15 @@ release-lora32_v21_extled: zip --junk-paths ./Release/rnode_firmware_lora32v21_extled.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v21.boot_app0 build/rnode_firmware_lora32v21.bin build/rnode_firmware_lora32v21.bootloader build/rnode_firmware_lora32v21.partitions rm -r build +release-lora32_v21_tcxo: + arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DENABLE_TCXO=true\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v21.boot_app0 + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_lora32v21.bin + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_lora32v21.bootloader + cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_lora32v21.partitions + zip --junk-paths ./Release/rnode_firmware_lora32v21_tcxo.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v21.boot_app0 build/rnode_firmware_lora32v21.bin build/rnode_firmware_lora32v21.bootloader build/rnode_firmware_lora32v21.partitions + rm -r build + release-heltec32_v2: arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\"" cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v2.boot_app0 diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index 5339564..dcddb56 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -72,6 +72,11 @@ void setup() { pinMode(pin_led_tx, OUTPUT); #endif + #if HAS_TCXO == true + pinMode(pin_tcxo_enable, OUTPUT); + digitalWrite(pin_tcxo_enable, HIGH); + #endif + // Initialise buffers memset(pbuf, 0, sizeof(pbuf)); memset(cmdbuf, 0, sizeof(cmdbuf));