diff --git a/Boards.h b/Boards.h index b534d39..a16da00 100644 --- a/Boards.h +++ b/Boards.h @@ -124,6 +124,7 @@ #define MODEL_FE 0xFE // Homebrew board, max 17dBm output power #define MODEL_FF 0xFF // Homebrew board, max 14dBm output power + #define BOARD_MESHPOE_S3 0xF1 // MeshPoE-S3 #define BOARD_MESHADVENTURER_S3 0xF2 // MeshAdventurer-S3 #define BOARD_AETHERNODE 0xF3 // Aethernode #define BOARD_MESHADVENTURER 0xF4 // MeshAdventurer @@ -253,6 +254,49 @@ const int pin_led_rx = 2; const int pin_led_tx = 4; + #elif BOARD_MODEL == BOARD_MESHPOE_S3 + #define IS_ESP32S3 true + #define HAS_DISPLAY true + #define HAS_NP true + #define HAS_BLUETOOTH false + #define HAS_BLE true + #define HAS_WIFI true + #define HAS_CONSOLE true + #define HAS_EEPROM true + #define HAS_BUSY true + #define HAS_INPUT true + #define HAS_TCXO true + #define MODEM SX1262 + #define DIO2_AS_RF_SWITCH true + #define HAS_RF_SWITCH_RX_TX false + #define HAS_LORA_LNA true + #define LORA_LNA_GAIN 30 + #define LORA_LNA_GVT 14 + + const int pin_cs = 39; + const int pin_sclk = 38; + const int pin_miso = 36; + const int pin_mosi = 37; + const int pin_busy = 34; + const int pin_reset = 35; + const int pin_dio = 33; + const int pin_txen = 43; + const int pin_rxen = 44; + const int pin_tcxo_enable = -1; + + const int pin_btn_usr1 = 40; + const int pin_np = 48; + + #if HAS_NP == false + #if defined(EXTERNAL_LEDS) + const int pin_led_rx = 48; + const int pin_led_tx = 48; + #else + const int pin_led_rx = 48; + const int pin_led_tx = 48; + #endif + #endif + #elif BOARD_MODEL == BOARD_MESHADVENTURER_S3 #define IS_ESP32S3 true #define HAS_DISPLAY true diff --git a/Display.h b/Display.h index 304eb7e..6d4b5f3 100644 --- a/Display.h +++ b/Display.h @@ -70,6 +70,11 @@ #define DISP_ADDR 0x3C #define SCL_OLED 22 #define SDA_OLED 11 +#elif BOARD_MODEL == BOARD_MESHPOE_S3 + #define DISP_RST -1 + #define DISP_ADDR 0x3C + #define SCL_OLED 1 + #define SDA_OLED 0 #elif BOARD_MODEL == BOARD_MESHADVENTURER_S3 #define DISP_RST -1 #define DISP_ADDR 0x3C diff --git a/Makefile b/Makefile index 51c4b9e..2cf2316 100644 --- a/Makefile +++ b/Makefile @@ -121,6 +121,9 @@ firmware-lora32_v21_tcxo: check_bt_buffers firmware-meshadventurer: check_bt_buffers arduino-cli compile --log --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=0xF4\"" +firmware-meshpoe_s3: check_bt_buffers + arduino-cli compile --log --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=0xF1\"" + firmware-meshadventurer_s3: check_bt_buffers arduino-cli compile --log --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=0xF2\"" @@ -185,6 +188,13 @@ upload-genericesp32: @sleep 3 python ./Release/esptool/esptool.py --chip esp32 --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 +upload-meshpoe_s3: + arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3 +# @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 + upload-meshadventurer_s3: arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3 # @sleep 1 @@ -574,6 +584,15 @@ release-genericesp32: check_bt_buffers zip --junk-paths ./Release/rnode_firmware_esp32_generic.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_esp32_generic.boot_app0 build/rnode_firmware_esp32_generic.bin build/rnode_firmware_esp32_generic.bootloader build/rnode_firmware_esp32_generic.partitions rm -r build +release-meshpoe_s3: check_bt_buffers + arduino-cli compile --fqbn esp32:esp32:esp32s3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0xF1\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_meshpoe_s3.boot_app0 + cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.bin build/rnode_firmware_meshpoe_s3.bin + cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_meshpoe_s3.bootloader + cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.partitions.bin build/rnode_firmware_meshpoe_s3.partitions + zip --junk-paths ./Release/rnode_firmware_meshpoe_s3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_meshpoe_s3.boot_app0 build/rnode_firmware_meshpoe_s3.bin build/rnode_firmware_meshpoe_s3.bootloader build/rnode_firmware_meshpoe_s3.partitions + rm -r build + release-meshadventurer_s3: check_bt_buffers arduino-cli compile --fqbn esp32:esp32:esp32s3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0xF2\"" cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_meshadventurer_s3.boot_app0 @@ -611,6 +630,16 @@ release-merged-diy_v1: check_bt_buffers cp build/rnode_firmware_diy_v1.merged.bin ./Release/rnode_firmware_diy_v1.merged.bin rm -r build +release-merged-meshadventurer: check_bt_buffers + 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=0xF4\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_meshadventurer.boot_app0 + cp build/esp32.esp32.esp32/RNode_Firmware.ino.bin build/rnode_firmware_meshadventurer.bin + cp build/esp32.esp32.esp32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_meshadventurer.bootloader + cp build/esp32.esp32.esp32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_meshadventurer.partitions + python ./Release/esptool/esptool.py --chip esp32 merge_bin -o build/rnode_firmware_meshadventurer.merged.bin --flash_mode dio --flash_freq 40m --flash_size 4MB 0x1000 build/rnode_firmware_meshadventurer.bootloader 0x8000 build/rnode_firmware_meshadventurer.partitions 0xe000 build/rnode_firmware_meshadventurer.boot_app0 0x10000 build/rnode_firmware_meshadventurer.bin + cp build/rnode_firmware_meshadventurer.merged.bin ./Release/rnode_firmware_meshadventurer.merged.bin + rm -r build + release-aethernode: check_bt_buffers 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/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_aethernode.boot_app0 diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index e1716cc..e966a40 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -135,7 +135,7 @@ void setup() { boot_seq(); #endif - #if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_MESHADVENTURER_S3 && BOARD_MODEL != BOARD_PROMICRO && BOARD_MODEL != BOARD_TECHO && BOARD_MODEL != BOARD_T3S3 && BOARD_MODEL != BOARD_TBEAM_S_V1 && BOARD_MODEL != BOARD_TBEAM_S_V3 && BOARD_MODEL != BOARD_HELTEC32_V4 + #if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_MESHPOE_S3 && BOARD_MODEL != BOARD_MESHADVENTURER_S3 && BOARD_MODEL != BOARD_PROMICRO && BOARD_MODEL != BOARD_TECHO && BOARD_MODEL != BOARD_T3S3 && BOARD_MODEL != BOARD_TBEAM_S_V1 && BOARD_MODEL != BOARD_TBEAM_S_V3 && BOARD_MODEL != BOARD_HELTEC32_V4 // Some boards need to wait until the hardware UART is set up before booting // the full firmware. In the case of the RAK4631 and Heltec T114, the line below will wait // until a serial connection is actually established with a master. Thus, it diff --git a/Release/rnode_firmware_diy_v1.merged.bin b/Release/rnode_firmware_meshadventurer.merged.bin similarity index 99% rename from Release/rnode_firmware_diy_v1.merged.bin rename to Release/rnode_firmware_meshadventurer.merged.bin index 2982e1a..fa26298 100644 Binary files a/Release/rnode_firmware_diy_v1.merged.bin and b/Release/rnode_firmware_meshadventurer.merged.bin differ diff --git a/Utilities.h b/Utilities.h index 2127475..d4748e5 100644 --- a/Utilities.h +++ b/Utilities.h @@ -347,6 +347,13 @@ uint8_t boot_vector = 0x00; void led_tx_off() { digitalWrite(pin_led_tx, LOW); } void led_id_on() { } void led_id_off() { } + #elif BOARD_MODEL == BOARD_MESHPOE_S3 + void led_rx_on() { digitalWrite(pin_led_rx, HIGH); } + void led_rx_off() { digitalWrite(pin_led_rx, LOW); } + void led_tx_on() { digitalWrite(pin_led_tx, HIGH); } + void led_tx_off() { digitalWrite(pin_led_tx, LOW); } + void led_id_on() { } + void led_id_off() { } #elif BOARD_MODEL == BOARD_MESHADVENTURER_S3 void led_rx_on() { digitalWrite(pin_led_rx, HIGH); } void led_rx_off() { digitalWrite(pin_led_rx, LOW); } @@ -1701,6 +1708,8 @@ bool eeprom_model_valid() { if (model == MODEL_FF) { #elif BOARD_MODEL == BOARD_GENERIC_ESP32 if (model == MODEL_FF || model == MODEL_FE) { + #elif BOARD_MODEL == BOARD_MESHPOE_S3 + if (model == MODEL_FF || model == MODEL_FE) { #elif BOARD_MODEL == BOARD_MESHADVENTURER_S3 if (model == MODEL_FF || model == MODEL_FE) { #elif BOARD_MODEL == BOARD_MESHADVENTURER diff --git a/sx126x.cpp b/sx126x.cpp index 737b039..36db5e1 100644 --- a/sx126x.cpp +++ b/sx126x.cpp @@ -125,7 +125,7 @@ bool sx126x::preInit() { pinMode(_ss, OUTPUT); digitalWrite(_ss, HIGH); - #if BOARD_MODEL == BOARD_T3S3 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_HELTEC32_V4 || BOARD_MODEL == BOARD_TDECK || BOARD_MODEL == BOARD_XIAO_S3 || BOARD_MODEL == BOARD_GENERIC_ESP32 || BOARD_MODEL == BOARD_MESHADVENTURER_S3 || BOARD_MODEL == BOARD_MESHADVENTURER || BOARD_MODEL == BOARD_DIY_V1 || BOARD_MODEL == BOARD_AETHERNODE + #if BOARD_MODEL == BOARD_T3S3 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_HELTEC32_V4 || BOARD_MODEL == BOARD_TDECK || BOARD_MODEL == BOARD_XIAO_S3 || BOARD_MODEL == BOARD_GENERIC_ESP32 || BOARD_MODEL == BOARD_MESHPOE_S3 || BOARD_MODEL == BOARD_MESHADVENTURER_S3 || BOARD_MODEL == BOARD_MESHADVENTURER || BOARD_MODEL == BOARD_DIY_V1 || BOARD_MODEL == BOARD_AETHERNODE SPI.begin(pin_sclk, pin_miso, pin_mosi, pin_cs); #elif BOARD_MODEL == BOARD_TECHO SPI.setPins(pin_miso, pin_sclk, pin_mosi); @@ -677,6 +677,8 @@ void sx126x::enableTCXO() { uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; #elif BOARD_MODEL == BOARD_GENERIC_ESP32 uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; + #elif BOARD_MODEL == BOARD_MESHPOE_S3 + uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; #elif BOARD_MODEL == BOARD_MESHADVENTURER_S3 uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; #elif BOARD_MODEL == BOARD_MESHADVENTURER