]> git.tnoah.ca Git - lora-radio.git/commitdiff
ESP32 adjustments
authorMark Qvist <mark@unsigned.io>
Sat, 10 Feb 2024 16:13:52 +0000 (17:13 +0100)
committerMark Qvist <mark@unsigned.io>
Sat, 10 Feb 2024 16:13:52 +0000 (17:13 +0100)
Boards.h
Config.h
Makefile
ROM.h
Release/console_image.bin
Utilities.h
sx126x.cpp
sx127x.cpp
sx128x.cpp

index 10544fb68e38329acbb5f0fd7ae4d1c98b287ce0..ffce6e95217582da0cdf178dc3fa12166136a3c8 100644 (file)
--- a/Boards.h
+++ b/Boards.h
         #define MODEM SX1262
       #elif BOARD_MODEL == BOARD_RNODE_NG_22
         #define MODEM SX1262
+        const int pin_cs = 7;
+        const int pin_sclk = 5;
+        const int pin_mosi = 6;
+        const int pin_miso = 3;
       #elif BOARD_MODEL == BOARD_GENERIC_NRF52
         #define MODEM SX1262
       #else
index 57255c9850e68e93088ca21adb2e38f932551752..ce7aaad10aaa0db91c4e33d1ba13ef80db901d69 100644 (file)
--- a/Config.h
+++ b/Config.h
                        #define HAS_NP true
                        #define HAS_SD false
             #define HAS_EEPROM true
-                       const int pin_cs = 7;
+            #define HAS_RF_SWITCH_RX_TX true
+            #define HAS_BUSY true
                        const int pin_reset = 8;
+            const int pin_rxen = 21;
                        const int pin_dio = 33;
+                       const int pin_busy = 34;
+
                        const int pin_np = 38;
                        const int pin_dac = 25;
                        const int pin_adc = 1;
index 2d2fb5abcccc21cd640b7d26f2e50cb82e05fffe..0b38bea2e3102f6cde2b09f18dd7c3e44e0eecf2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -168,7 +168,7 @@ upload-rnode_ng_22:
        @sleep 1
        rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware.ino.bin)
        @sleep 3
-       python ./Release/esptool/esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
+       python ./Release/esptool/esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 921600 --before hard_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
 
 upload-featheresp32:
        arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:featheresp32
@@ -184,18 +184,18 @@ upload-rak4630:
 
 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 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-all: console-site spiffs-image release-rnode 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
 
 release-rnode:
-       arduino-cli compile --fqbn unsignedio:avr:rnode -e --build-property "compiler.cpp.extra_flags=\"-DMODEM=0x01\""
+       arduino-cli compile --fqbn unsignedio:avr:rnode -e
        cp build/unsignedio.avr.rnode/RNode_Firmware.ino.hex Release/rnode_firmware.hex
        rm -r build
 
 release-tbeam:
-       arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DMODEM=0x01\""
+       arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam.boot_app0
        cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bin build/rnode_firmware_tbeam.bin
        cp build/esp32.esp32.t-beam/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_tbeam.bootloader
@@ -204,7 +204,7 @@ release-tbeam:
        rm -r build
 
 release-lora32_v10:
-       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=0x39\" \"-DMODEM=0x01\""
+       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=0x39\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_lora32v10.bin
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_lora32v10.bootloader
@@ -213,7 +213,7 @@ release-lora32_v10:
        rm -r build
 
 release-lora32_v20:
-       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=0x36\" \"-DMODEM=0x01\""
+       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=0x36\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_lora32v20.bin
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_lora32v20.bootloader
@@ -222,7 +222,7 @@ release-lora32_v20:
        rm -r build
 
 release-lora32_v21:
-       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\" \"-DMODEM=0x01\""
+       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\""
        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
@@ -231,7 +231,7 @@ release-lora32_v21:
        rm -r build
 
 release-lora32_v10_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=0x39\" \"-DEXTERNAL_LEDS=true\" \"-DMODEM=0x01\""
+       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=0x39\" \"-DEXTERNAL_LEDS=true\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_lora32v10.bin
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_lora32v10.bootloader
@@ -240,7 +240,7 @@ release-lora32_v10_extled:
        rm -r build
 
 release-lora32_v20_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=0x36\" \"-DEXTERNAL_LEDS=true\" \"-DMODEM=0x01\""
+       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=0x36\" \"-DEXTERNAL_LEDS=true\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_lora32v20.bin
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_lora32v20.bootloader
@@ -249,7 +249,7 @@ release-lora32_v20_extled:
        rm -r build
 
 release-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\" \"-DMODEM=0x01\""
+       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\""
        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
@@ -258,7 +258,7 @@ release-lora32_v21_extled:
        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\" \"-DMODEM=0x01\""
+       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
@@ -267,7 +267,7 @@ release-lora32_v21_tcxo:
        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\" \"-DMODEM=0x01\""
+       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
        cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bin build/rnode_firmware_heltec32v2.bin
        cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_heltec32v2.bootloader
@@ -276,7 +276,7 @@ release-heltec32_v2:
        rm -r build
 
 release-heltec32_v2_extled:
-       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\" \"-DEXTERNAL_LEDS=true\" \"-DMODEM=0x01\""
+       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\" \"-DEXTERNAL_LEDS=true\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v2.boot_app0
        cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bin build/rnode_firmware_heltec32v2.bin
        cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_heltec32v2.bootloader
@@ -285,7 +285,7 @@ release-heltec32_v2_extled:
        rm -r build
 
 release-rnode_ng_20:
-       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=0x40\" \"-DMODEM=0x01\""
+       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=0x40\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_ng20.boot_app0
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_ng20.bin
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_ng20.bootloader
@@ -294,7 +294,7 @@ release-rnode_ng_20:
        rm -r build
 
 release-rnode_ng_21:
-       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=0x41\" \"-DMODEM=0x01\""
+       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=0x41\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_ng21.boot_app0
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bin build/rnode_firmware_ng21.bin
        cp build/esp32.esp32.ttgo-lora32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_ng21.bootloader
@@ -302,8 +302,17 @@ release-rnode_ng_21:
        zip --junk-paths ./Release/rnode_firmware_ng21.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_ng21.boot_app0 build/rnode_firmware_ng21.bin build/rnode_firmware_ng21.bootloader build/rnode_firmware_ng21.partitions
        rm -r build
 
+release-rnode_ng_22:
+       arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\""
+       cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_ng22.boot_app0
+       cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.bin build/rnode_firmware_ng22.bin
+       cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_ng22.bootloader
+       cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.partitions.bin build/rnode_firmware_ng22.partitions
+       zip --junk-paths ./Release/rnode_firmware_ng22.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_ng22.boot_app0 build/rnode_firmware_ng22.bin build/rnode_firmware_ng22.bootloader build/rnode_firmware_ng22.partitions
+       rm -r build
+
 release-featheresp32:
-       arduino-cli compile --fqbn esp32:esp32:featheresp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\" \"-DMODEM=0x01\""
+       arduino-cli compile --fqbn esp32:esp32:featheresp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_featheresp32.boot_app0
        cp build/esp32.esp32.featheresp32/RNode_Firmware.ino.bin build/rnode_firmware_featheresp32.bin
        cp build/esp32.esp32.featheresp32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_featheresp32.bootloader
@@ -312,7 +321,7 @@ release-featheresp32:
        rm -r build
 
 release-genericesp32:
-       arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\" \"-DMODEM=0x01\""
+       arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\""
        cp ~/.arduino15/packages/esp32/hardware/esp32/2.0.*/tools/partitions/boot_app0.bin build/rnode_firmware_esp32_generic.boot_app0
        cp build/esp32.esp32.esp32/RNode_Firmware.ino.bin build/rnode_firmware_esp32_generic.bin
        cp build/esp32.esp32.esp32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_esp32_generic.bootloader
diff --git a/ROM.h b/ROM.h
index 1f9616817fe9e77848d5561d059cfc3193ff399e..78e8b08f34c76cd5874599fc6bef20282c340ba6 100644 (file)
--- a/ROM.h
+++ b/ROM.h
@@ -25,6 +25,8 @@
        #define PRODUCT_T32_20 0xB0
        #define PRODUCT_T32_21 0xB1
        #define PRODUCT_H32_V2 0xC0
+       #define MODEL_A1 0xA1
+       #define MODEL_A6 0xA6
        #define MODEL_A4 0xA4
        #define MODEL_A9 0xA9
        #define MODEL_A3 0xA3
@@ -48,7 +50,7 @@
        #define ADDR_MODEL     0x01
        #define ADDR_HW_REV    0x02
        #define ADDR_SERIAL    0x03
-       #define ADDR_MADE          0x07
+       #define ADDR_MADE      0x07
        #define ADDR_CHKSUM        0x0B
        #define ADDR_SIGNATURE 0x1B
        #define ADDR_INFO_LOCK 0x9B
index 271d7c11fc0a811049c5075625ad35cfcec66393..b02795a1e0ad17ea0938693d5c3841f5b5b22e29 100644 (file)
Binary files a/Release/console_image.bin and b/Release/console_image.bin differ
index b93e70e4d498b9abcb3ec5e0af9c74fc3e467d6b..df39762a9e1abad7ddd25079fcff354e9bbc80af 100644 (file)
@@ -1034,9 +1034,11 @@ int getTxPower() {
 
 void setTXPower() {
        if (radio_online) {
+               if (model == MODEL_A1) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
                if (model == MODEL_A2) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
                if (model == MODEL_A3) LoRa->setTxPower(lora_txp, PA_OUTPUT_RFO_PIN);
                if (model == MODEL_A4) LoRa->setTxPower(lora_txp, PA_OUTPUT_RFO_PIN);
+               if (model == MODEL_A6) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
                if (model == MODEL_A7) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
                if (model == MODEL_A8) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
                if (model == MODEL_A9) LoRa->setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
@@ -1252,6 +1254,8 @@ bool eeprom_model_valid() {
        if (model == MODEL_A3 || model == MODEL_A8) {
        #elif BOARD_MODEL == BOARD_RNODE_NG_21
        if (model == MODEL_A2 || model == MODEL_A7) {
+       #elif BOARD_MODEL == BOARD_RNODE_NG_22
+       if (model == MODEL_A1 || model == MODEL_A6) {
        #elif BOARD_MODEL == BOARD_HMBRW
        if (model == MODEL_FF || model == MODEL_FE) {
        #elif BOARD_MODEL == BOARD_TBEAM
index 4324e69eff5adbb7d8ebe937ab9aa0103acddcd8..6389a76720179c93cc1efb0f68a69c663aa01ab0 100644 (file)
@@ -5,6 +5,7 @@
 // Obviously still under the MIT license.
 
 #include "sx126x.h"
+#include "Boards.h"
 
 #define MCU_1284P 0x91
 #define MCU_2560  0x92
@@ -29,7 +30,9 @@
 #endif
 
 #if MCU_VARIANT == MCU_ESP32
-  #include "soc/rtc_wdt.h"
+  #if MCU_VARIANT == MCU_ESP32 and !defined(CONFIG_IDF_TARGET_ESP32S3)
+    #include "soc/rtc_wdt.h"
+  #endif
   #define ISR_VECT IRAM_ATTR
 #else
   #define ISR_VECT
 #define XTAL_FREQ_6X (double)32000000
 #define FREQ_DIV_6X (double)pow(2.0, 25.0)
 #define FREQ_STEP_6X (double)(XTAL_FREQ_6X / FREQ_DIV_6X)
-extern SPIClass spiModem;
-#define SPI spiModem
+
+#if defined(NRF52840_XXAA)
+  extern SPIClass spiModem;
+  #define SPI spiModem
+#endif
 
 extern SPIClass SPI;
 
@@ -120,24 +126,34 @@ bool sx126x::preInit() {
   // set SS high
   digitalWrite(_ss, HIGH);
   
-  SPI.begin();
+  Serial.println("SPI INIT");
+  #if BOARD_MODEL == BOARD_RNODE_NG_22
+    SPI.begin(pin_sclk, pin_miso, pin_mosi, pin_cs);
+  #else
+    SPI.begin();
+  #endif
+  Serial.println("DONE");
 
   // check version (retry for up to 2 seconds)
   long start = millis();
   uint8_t syncmsb;
   uint8_t synclsb;
+  Serial.println("TRYING REGISTER READ");
   while (((millis() - start) < 2000) && (millis() >= start)) {
       syncmsb = readRegister(REG_SYNC_WORD_MSB_6X);
       synclsb = readRegister(REG_SYNC_WORD_LSB_6X);
       if ( uint16_t(syncmsb << 8 | synclsb) == 0x1424 || uint16_t(syncmsb << 8 | synclsb) == 0x4434) {
+          Serial.println("CORRECT VALUE RETURNED");
           break;
       }
       delay(100);
   }
   if ( uint16_t(syncmsb << 8 | synclsb) != 0x1424 && uint16_t(syncmsb << 8 | synclsb) != 0x4434) {
+      Serial.println("REG READ FAILED");
       return false;
   }
 
+  Serial.println("MODEM PREINIT SUCCESS");
   _preinit_done = true;
   return true;
 }
index f0ae16efcc3cb2347384c657480fd712500d6713..403808dfd79fc9df1f4ba175663e3e9e1d3a0404 100644 (file)
@@ -5,6 +5,7 @@
 // Obviously still under the MIT license.
 
 #include "sx127x.h"
+#include "Boards.h"
 
 #define MCU_1284P 0x91
 #define MCU_2560  0x92
@@ -29,7 +30,9 @@
 #endif
 
 #if MCU_VARIANT == MCU_ESP32
-  #include "soc/rtc_wdt.h"
+  #if MCU_VARIANT == MCU_ESP32 and !defined(CONFIG_IDF_TARGET_ESP32S3)
+    #include "soc/rtc_wdt.h"
+  #endif
   #define ISR_VECT IRAM_ATTR
 #else
   #define ISR_VECT
index 17e07751d77c1377da79998f7bb1d06e2f96de7a..759b73a08f1ad3aea36eb9de78361f0b91bb346d 100644 (file)
@@ -5,6 +5,7 @@
 // Obviously still under the MIT license.
 
 #include "sx128x.h"
+#include "Boards.h"
 
 #define MCU_1284P 0x91
 #define MCU_2560  0x92
@@ -29,7 +30,9 @@
 #endif
 
 #if MCU_VARIANT == MCU_ESP32
-  #include "soc/rtc_wdt.h"
+  #if MCU_VARIANT == MCU_ESP32 and !defined(CONFIG_IDF_TARGET_ESP32S3)
+    #include "soc/rtc_wdt.h"
+  #endif
   #define ISR_VECT IRAM_ATTR
 #else
   #define ISR_VECT
 #define FREQ_DIV_8X (double)pow(2.0, 18.0)
 #define FREQ_STEP_8X (double)(XTAL_FREQ_8X / FREQ_DIV_8X)
 
-extern SPIClass spiModem;
-#define SPI spiModem
+#if defined(NRF52840_XXAA)
+  extern SPIClass spiModem;
+  #define SPI spiModem
+#endif
 
 extern SPIClass SPI;