From b2c44a9022e868bff591f97a38df06ea9eb67641 Mon Sep 17 00:00:00 2001 From: Vdragon Date: Sat, 6 Jun 2026 22:15:47 +0200 Subject: [PATCH] boards: Add Ebyte Eora-HUB-900TB Ebyte LR1121 EoRa board --- boards/ebyte_eora-hub.json | 45 +++++++++ variants/ebyte_eora_hub/platformio.ini | 132 +++++++++++++++++++++++++ variants/ebyte_eora_hub/target.cpp | 100 +++++++++++++++++++ variants/ebyte_eora_hub/target.h | 29 ++++++ 4 files changed, 306 insertions(+) create mode 100644 boards/ebyte_eora-hub.json create mode 100644 variants/ebyte_eora_hub/platformio.ini create mode 100644 variants/ebyte_eora_hub/target.cpp create mode 100644 variants/ebyte_eora_hub/target.h diff --git a/boards/ebyte_eora-hub.json b/boards/ebyte_eora-hub.json new file mode 100644 index 0000000000..9340fa7dc9 --- /dev/null +++ b/boards/ebyte_eora-hub.json @@ -0,0 +1,45 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default.csv", + "memory_type": "qio_qspi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1", + "-DARDUINO_USB_MODE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32s3", + "variant": "esp32s3" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Ebyte EoRa-HUB-XXXTB Radio", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.cdebyte.com/products/EoRa-HUB-900TB", + "vendor": "Chengdu Ebyte Electronic Technology Co., Ltd" +} diff --git a/variants/ebyte_eora_hub/platformio.ini b/variants/ebyte_eora_hub/platformio.ini new file mode 100644 index 0000000000..9945aefba7 --- /dev/null +++ b/variants/ebyte_eora_hub/platformio.ini @@ -0,0 +1,132 @@ +[Ebyte_EoRa-HUB] +extends = esp32_base +board = ebyte_eora-hub +build_flags = + ${esp32_base.build_flags} + -I variants/ebyte_eora_hub + -D EBYTE_EORA_HUB + -D P_LORA_DIO_9=14 + -D P_LORA_DIO_1=14 + -D P_LORA_BUSY=13 + -D P_LORA_NSS=8 + -D P_LORA_RESET=12 + -D P_LORA_SCLK=9 + -D P_LORA_MISO=11 + -D P_LORA_MOSI=10 + -D P_LORA_TX_LED=35 + -D PIN_VBAT_READ=1 + -D PIN_USER_BTN=0 + -D PIN_BOARD_SDA=18 + -D PIN_BOARD_SCL=17 + -D PIN_OLED_RESET=21 + -D RADIO_CLASS=CustomLR1121 + -D WRAPPER_CLASS=CustomLR1121Wrapper + -D LORA_TX_POWER=22 + -D LR11X0_DIO_AS_RF_SWITCH=true + -D LR11X0_DIO3_TCXO_VOLTAGE=1.8 + -D RF_SWITCH_TABLE +build_src_filter = ${esp32_base.build_src_filter} + +<../variants/ebyte_eora_hub> +lib_deps = + ${esp32_base.lib_deps} + adafruit/Adafruit SSD1306 @ ^2.5.13 + +; === EByte EORA_HUB with LR1121 environments === +[env:Ebyte_EoRa-HUB_Repeater] +extends = Ebyte_EoRa-HUB +build_flags = + ${Ebyte_EoRa-HUB.build_flags} + -D DISPLAY_CLASS=SSD1306Display + -D ADVERT_NAME='"EORA_HUB-1121 Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=50 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${Ebyte_EoRa-HUB.build_src_filter} + + + +<../examples/simple_repeater> +lib_deps = + ${Ebyte_EoRa-HUB.lib_deps} + ${esp32_ota.lib_deps} + +[env:Ebyte_EoRa-HUB_terminal_chat] +extends = Ebyte_EoRa-HUB +build_flags = + ${Ebyte_EoRa-HUB.build_flags} + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${Ebyte_EoRa-HUB.build_src_filter} + +<../examples/simple_secure_chat/main.cpp> +lib_deps = + ${Ebyte_EoRa-HUB.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:Ebyte_EoRa-HUB_room_server] +extends = Ebyte_EoRa-HUB +build_flags = + ${Ebyte_EoRa-HUB.build_flags} + -D DISPLAY_CLASS=SSD1306Display + -D ADVERT_NAME='"EORA_S3-1121 Room"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D ROOM_PASSWORD='"hello"' +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${Ebyte_EoRa-HUB.build_src_filter} + + + +<../examples/simple_room_server> +lib_deps = + ${Ebyte_EoRa-HUB.lib_deps} + ${esp32_ota.lib_deps} + +[env:Ebyte_EoRa-HUB_companion_radio_usb] +extends = Ebyte_EoRa-HUB +build_flags = + ${Ebyte_EoRa-HUB.build_flags} + -I examples/companion_radio/ui-new + -D DISPLAY_CLASS=SSD1306Display + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 +; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 +; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 +build_src_filter = ${Ebyte_EoRa-HUB.build_src_filter} + + + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> +lib_deps = + ${Ebyte_EoRa-HUB.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:Ebyte_EoRa-HUB_companion_radio_ble] +extends = Ebyte_EoRa-HUB +build_flags = + ${Ebyte_EoRa-HUB.build_flags} + -I examples/companion_radio/ui-new + -D DISPLAY_CLASS=SSD1306Display + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D BLE_PIN_CODE=123456 + -D BLE_DEBUG_LOGGING=1 + -D OFFLINE_QUEUE_SIZE=256 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${Ebyte_EoRa-HUB.build_src_filter} + + + + + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> +lib_deps = + ${Ebyte_EoRa-HUB.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:Ebyte_EoRa-HUB_kiss_modem] +extends = Ebyte_EoRa-HUB +build_src_filter = ${Ebyte_EoRa-HUB.build_src_filter} + +<../examples/kiss_modem/> diff --git a/variants/ebyte_eora_hub/target.cpp b/variants/ebyte_eora_hub/target.cpp new file mode 100644 index 0000000000..11bcc239e4 --- /dev/null +++ b/variants/ebyte_eora_hub/target.cpp @@ -0,0 +1,100 @@ +#include +#include "target.h" + +ESP32Board board; + +#if defined(P_LORA_SCLK) + static SPIClass spi; + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_9, P_LORA_RESET, P_LORA_BUSY, spi); +#else + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_9, P_LORA_RESET, P_LORA_BUSY); +#endif + +WRAPPER_CLASS radio_driver(radio, board); + +ESP32RTCClock fallback_clock; +AutoDiscoverRTCClock rtc_clock(fallback_clock); +SensorManager sensors; + +#ifdef DISPLAY_CLASS + DISPLAY_CLASS display; + MomentaryButton user_btn(PIN_USER_BTN, 1000, true); +#endif + +#ifndef LORA_CR + #define LORA_CR 5 +#endif + +#ifdef RF_SWITCH_TABLE +static const uint32_t rfswitch_dios[Module::RFSWITCH_MAX_PINS] = { + RADIOLIB_LR11X0_DIO5, + RADIOLIB_LR11X0_DIO6, + RADIOLIB_NC, + RADIOLIB_NC, + RADIOLIB_NC +}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + { LR11x0::MODE_STBY, {LOW, LOW }}, + { LR11x0::MODE_RX, {LOW, HIGH }}, + { LR11x0::MODE_TX, {HIGH, HIGH }}, + { LR11x0::MODE_TX_HP, {HIGH, LOW }}, + { LR11x0::MODE_TX_HF, {LOW, LOW }}, + { LR11x0::MODE_GNSS, {LOW, LOW }}, + { LR11x0::MODE_WIFI, {LOW, LOW }}, + END_OF_MODE_TABLE, +}; +#endif + +bool radio_init() { + fallback_clock.begin(); + rtc_clock.begin(Wire); + +#ifdef LR11X0_DIO3_TCXO_VOLTAGE + float tcxo = LR11X0_DIO3_TCXO_VOLTAGE; +#else + float tcxo = 1.6f; +#endif + + spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI, P_LORA_NSS); + int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo); + if (status != RADIOLIB_ERR_NONE) { + Serial.print("ERROR: radio init failed: "); + Serial.println(status); + return false; + } + + radio.setCRC(2); + radio.explicitHeader(); + +#ifdef RF_SWITCH_TABLE + radio.setRfSwitchTable(rfswitch_dios, rfswitch_table); +#endif + +#ifdef RX_BOOSTED_GAIN + radio.setRxBoostedGainMode(RX_BOOSTED_GAIN); +#endif + + return true; +} + +uint32_t radio_get_rng_seed() { + return radio.random(0x7FFFFFFF); +} + +void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) { + radio.setFrequency(freq); + radio.setSpreadingFactor(sf); + radio.setBandwidth(bw); + radio.setCodingRate(cr); +} + +void radio_set_tx_power(uint8_t dbm) { + radio.setOutputPower(dbm); +} + +mesh::LocalIdentity radio_new_identity() { + RadioNoiseListener rng(radio); + return mesh::LocalIdentity(&rng); // create new random identity +} diff --git a/variants/ebyte_eora_hub/target.h b/variants/ebyte_eora_hub/target.h new file mode 100644 index 0000000000..1e7732263f --- /dev/null +++ b/variants/ebyte_eora_hub/target.h @@ -0,0 +1,29 @@ +#pragma once + +#define RADIOLIB_STATIC_ONLY 1 +#include +#include +#include +#include +#include +#include +#ifdef DISPLAY_CLASS + #include + #include +#endif + +extern ESP32Board board; +extern WRAPPER_CLASS radio_driver; +extern AutoDiscoverRTCClock rtc_clock; +extern SensorManager sensors; + +#ifdef DISPLAY_CLASS + extern DISPLAY_CLASS display; + extern MomentaryButton user_btn; +#endif + +bool radio_init(); +uint32_t radio_get_rng_seed(); +void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); +void radio_set_tx_power(uint8_t dbm); +mesh::LocalIdentity radio_new_identity();