diff --git a/eastmesh-docs/boards.md b/eastmesh-docs/boards.md index edc52c84..cbbaf652 100644 --- a/eastmesh-docs/boards.md +++ b/eastmesh-docs/boards.md @@ -101,6 +101,7 @@ If you are deciding between otherwise similar boards, these target-level setting | ThinkNode_M5 | default | 22 dBm cfg | ADC batt | | | WHY2025_badge | default | 22 dBm cfg | none | | | Xiao_C6 | default | 22 dBm cfg | none | RF switch | +| Xiao_S3_LoRa2021F33-2G4 | default | 22 dBm cfg | ADC batt | RF switch | | Xiao_S3_WIO | default | 22 dBm cfg | none | RF switch | \* These targets use a PA or RF front-end, so effective output can be much higher than the configured `LORA_TX_POWER`. @@ -145,6 +146,7 @@ This table includes all observer targets currently defined in `variants/eastmesh | ThinkNode_M5 | ESP32S3 | 512 KB | No | 4 MB | SX1262 | E-paper (GxEPD) | ✅ | | | WHY2025_badge | ESP32C6 | 512 KB | No | 4 MB | SX1262 | None | | | | Xiao_C6 | ESP32C6 | 512 KB | No | 4 MB | SX1262 | None | | | +| Xiao_S3_LoRa2021F33-2G4 | ESP32S3 | 512 KB | No | 8 MB | LR2021 | None | | | | Xiao_S3_WIO | ESP32S3 | 512 KB | No | 8 MB | SX1262 | None | ✅ | | SD notes: @@ -180,6 +182,7 @@ These are the Wi-Fi companion targets that rely on the companion app as the prim | ----------- | ------- | ------ | ----- | ----- | ------ | --- | | Heltec_WSL3 | ESP32S3 | 512 KB | No | 8 MB | SX1262 | ✅ | | RAK_3112 | ESP32S3 | 512 KB | No | 8 MB | SX1262 | ✅ | +| Xiao_S3_LoRa2021F33-2G4 | ESP32S3 | 512 KB | No | 8 MB | LR2021 | | | Xiao_S3_WIO | ESP32S3 | 512 KB | No | 8 MB | SX1262 | ✅ | ## Practical Picks diff --git a/eastmesh-docs/local-builds.md b/eastmesh-docs/local-builds.md index d2cbb221..caf8e335 100644 --- a/eastmesh-docs/local-builds.md +++ b/eastmesh-docs/local-builds.md @@ -121,6 +121,7 @@ Tbeam_SX1262_repeater_observer Tbeam_SX1276_repeater_observer WHY2025_badge_repeater_observer Xiao_C6_repeater_observer +Xiao_S3_LoRa2021F33-2G4_repeater_observer Xiao_S3_WIO_repeater_observer ``` @@ -175,6 +176,7 @@ Station_G2_companion_radio_wifi T_Beam_S3_Supreme_SX1262_companion_radio_wifi ThinkNode_M2_companion_radio_wifi ThinkNode_M5_companion_radio_wifi +Xiao_S3_LoRa2021F33-2G4_companion_radio_wifi Xiao_S3_WIO_companion_radio_wifi ``` diff --git a/variants/eastmesh/platformio.ini b/variants/eastmesh/platformio.ini index 9bf79b18..e9ca49d3 100644 --- a/variants/eastmesh/platformio.ini +++ b/variants/eastmesh/platformio.ini @@ -1511,3 +1511,43 @@ build_flags = -UMQTT_DEBUG build_src_filter = ${env:Xiao_S3_WIO_repeater_observer.build_src_filter} + + +[env:Xiao_S3_LoRa2021F33-2G4_repeater_observer] +extends = Xiao_S3_LoRa2021F33-2G4 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + +<../examples/simple_repeater/*.cpp> + + + + +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -D ADVERT_NAME='"XiaoS3 LR2021 Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=50 + -D WITH_MQTT_UPLINK=1 + -D MQTT_DEBUG=1 + -D WIFI_SSID='"myssid"' + -D WIFI_PWD='"mypwd"' + -D MQTT_DEFAULT_IATA='"UNSET"' + -D CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=1 +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + ${esp32_ota.lib_deps} + +[env:Xiao_S3_LoRa2021F33-2G4_repeater_observer_espnow] +extends = env:Xiao_S3_LoRa2021F33-2G4_repeater_observer +build_flags = + ${env:Xiao_S3_LoRa2021F33-2G4_repeater_observer.build_flags} + -D WITH_ESPNOW_BRIDGE=1 +build_src_filter = ${env:Xiao_S3_LoRa2021F33-2G4_repeater_observer.build_src_filter} + + + +[env:Xiao_S3_LoRa2021F33-2G4_repeater_observer_mqtt_bridge] +extends = env:Xiao_S3_LoRa2021F33-2G4_repeater_observer +build_flags = + ${env:Xiao_S3_LoRa2021F33-2G4_repeater_observer.build_flags} + -D WITH_MQTT_BRIDGE=1 + -UMQTT_DEBUG +build_src_filter = ${env:Xiao_S3_LoRa2021F33-2G4_repeater_observer.build_src_filter} + + diff --git a/variants/xiao_s3_LoRa2021F33-2G4/XiaoS3Board.h b/variants/xiao_s3_LoRa2021F33-2G4/XiaoS3Board.h new file mode 100644 index 00000000..696b6eb2 --- /dev/null +++ b/variants/xiao_s3_LoRa2021F33-2G4/XiaoS3Board.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include + +class XiaoS3Board : public ESP32Board { +public: + XiaoS3Board() { } + + const char* getManufacturerName() const override { + return "Xiao S3 LoRa2021F33-2G4"; + } +}; diff --git a/variants/xiao_s3_LoRa2021F33-2G4/platformio.ini b/variants/xiao_s3_LoRa2021F33-2G4/platformio.ini new file mode 100644 index 00000000..f9ef4ad4 --- /dev/null +++ b/variants/xiao_s3_LoRa2021F33-2G4/platformio.ini @@ -0,0 +1,184 @@ +; Xiao ESP32-S3 + NiceRF LoRa2021F33-2G4 (Semtech LR2021 dual-band). +; Pin map and RF switch table from dkmr27/MeshCore variants/xiao_s3_LoRa2021F33-2G4. + +[Xiao_S3_LoRa2021F33-2G4] +extends = esp32_base +board = seeed_xiao_esp32s3 +board_check = true +board_build.mcu = esp32s3 +build_flags = ${esp32_base.build_flags} + ${sensor_base.build_flags} + -I variants/xiao_s3_LoRa2021F33-2G4 + -UENV_INCLUDE_GPS + -D SEEED_XIAO_S3 + -D PIN_VBAT_READ=1 ; D0 + -D P_LORA_DIO_1=2 ; D1 this is IRQ and is DIO9 on LR2021 + -D P_LORA_NSS=5 ; D4 + -D P_LORA_RESET=3 ; D2 + -D P_LORA_BUSY=4 ; D3 + -D P_LORA_SCLK=7 ; D8 + -D P_LORA_MISO=8 ; D9 + -D P_LORA_MOSI=9 ; D10 + -D PIN_USER_BTN=-1 ; NC + -D PIN_STATUS_LED=21 ; Orange user led, LOW=On + -D PIN_BOARD_SDA=D6 ; D6=43 + -D PIN_BOARD_SCL=D7 ; D7=44 + -D USE_LR2021 + -D RADIO_CLASS=CustomLR2021 + -D WRAPPER_CLASS=CustomLR2021Wrapper + -D LORA_TX_POWER=22 + -D LR2021_IRQ_DIO=9 + -D LR2021_TCXO_VOLTAGE=3.3 + -D RF_SWITCH_TABLE +build_src_filter = ${esp32_base.build_src_filter} + +<../variants/xiao_s3_LoRa2021F33-2G4> + + +lib_deps = + ${esp32_base.lib_deps} + ${sensor_base.lib_deps} + +[env:Xiao_S3_LoRa2021F33-2G4_repeater] +extends = Xiao_S3_LoRa2021F33-2G4 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + +<../examples/simple_repeater/*.cpp> +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -D ADVERT_NAME='"Xiao S3 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 +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + ${esp32_ota.lib_deps} + +[env:Xiao_S3_LoRa2021F33-2G4_repeater_bridge_espnow] +extends = Xiao_S3_LoRa2021F33-2G4 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + + + +<../examples/simple_repeater/*.cpp> +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -D ADVERT_NAME='"ESPNow Bridge"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=50 + -D WITH_ESPNOW_BRIDGE=1 +; -D BRIDGE_DEBUG=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + ${esp32_ota.lib_deps} + +[env:Xiao_S3_LoRa2021F33-2G4_room_server] +extends = Xiao_S3_LoRa2021F33-2G4 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + +<../examples/simple_room_server> +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -D ADVERT_NAME='"Xiao S3 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 +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + ${esp32_ota.lib_deps} + +[env:Xiao_S3_LoRa2021F33-2G4_companion_radio_ble] +extends = Xiao_S3_LoRa2021F33-2G4 +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -I examples/companion_radio/ui-new + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D BLE_PIN_CODE=123456 + -D DISPLAY_CLASS=SSD1306Display + -D OFFLINE_QUEUE_SIZE=256 +; -D BLE_DEBUG_LOGGING=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + + + + + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + densaugeo/base64 @ ~1.4.0 + adafruit/Adafruit SSD1306 @ ^2.5.13 + +[env:Xiao_S3_LoRa2021F33-2G4_companion_radio_usb] +extends = Xiao_S3_LoRa2021F33-2G4 +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -I examples/companion_radio/ui-new + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D DISPLAY_CLASS=SSD1306Display + -D OFFLINE_QUEUE_SIZE=256 + -D ENABLE_USB_INTERFACE +; -D BLE_DEBUG_LOGGING=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + + + + + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + densaugeo/base64 @ ~1.4.0 + adafruit/Adafruit SSD1306 @ ^2.5.13 + +[env:Xiao_S3_LoRa2021F33-2G4_companion_radio_wifi] +extends = Xiao_S3_LoRa2021F33-2G4 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + + + + + + + +<../examples/companion_radio/*.cpp> +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -I examples/companion_radio/ui-new + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D OFFLINE_QUEUE_SIZE=256 + -D WIFI_DEBUG_LOGGING=1 + -D WIFI_SSID='"myssid"' + -D WIFI_PWD='"password"' + ; -D BLE_DEBUG_LOGGING=1 + ; -D MESH_PACKET_LOGGING=1 + ; -D MESH_DEBUG=1 +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:Xiao_S3_LoRa2021F33-2G4_sensor] +extends = Xiao_S3_LoRa2021F33-2G4 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + +<../examples/simple_sensor> +build_flags = + ${Xiao_S3_LoRa2021F33-2G4.build_flags} + -D ADVERT_NAME='"Xiao S3 Sensor"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +lib_deps = + ${Xiao_S3_LoRa2021F33-2G4.lib_deps} + ${esp32_ota.lib_deps} + +[env:Xiao_S3_LoRa2021F33-2G4_kiss_modem] +extends = Xiao_S3_LoRa2021F33-2G4 +build_src_filter = ${Xiao_S3_LoRa2021F33-2G4.build_src_filter} + +<../examples/kiss_modem/> diff --git a/variants/xiao_s3_LoRa2021F33-2G4/target.cpp b/variants/xiao_s3_LoRa2021F33-2G4/target.cpp new file mode 100644 index 00000000..24e0c542 --- /dev/null +++ b/variants/xiao_s3_LoRa2021F33-2G4/target.cpp @@ -0,0 +1,68 @@ +#include +#include "target.h" + +XiaoS3Board board; + +#if defined(P_LORA_SCLK) + static SPIClass spi; + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); +#else + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); +#endif + +WRAPPER_CLASS radio_driver(radio, board); + +ESP32RTCClock fallback_clock; +AutoDiscoverRTCClock rtc_clock(fallback_clock); +EnvironmentSensorManager sensors; + +#ifdef DISPLAY_CLASS + DISPLAY_CLASS display; + MomentaryButton user_btn(PIN_USER_BTN, 1000, true); +#endif + +#ifdef RF_SWITCH_TABLE +static const uint32_t rfswitch_dios[] = { + RADIOLIB_LR2021_DIO5, + RADIOLIB_LR2021_DIO6, + RADIOLIB_LR2021_DIO7, + RADIOLIB_LR2021_DIO8, + RADIOLIB_NC +}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // Mode DIO5 DIO6 DIO7 DIO8 + { LR2021::MODE_STBY, { LOW, LOW, LOW, LOW } }, + { LR2021::MODE_RX, { LOW, LOW, LOW, LOW } }, + { LR2021::MODE_TX, { LOW, HIGH, LOW, LOW } }, + { LR2021::MODE_RX_HF, { HIGH, LOW, HIGH, LOW } }, + { LR2021::MODE_TX_HF, { LOW, LOW, HIGH, HIGH } }, + END_OF_MODE_TABLE, +}; +#endif + +bool radio_init() { + fallback_clock.begin(); + rtc_clock.begin(Wire); + pinMode(21, INPUT); + pinMode(48, OUTPUT); + +#if defined(P_LORA_SCLK) + int err = radio.std_init(&spi); + if (err != 1) return err; +#else + int err = radio.std_init(); + if (err != 1) return err; +#endif + +#ifdef RF_SWITCH_TABLE + radio.setRfSwitchTable(rfswitch_dios, rfswitch_table); +#endif + + return true; +} + +mesh::LocalIdentity radio_new_identity() { + RadioNoiseListener rng(radio); + return mesh::LocalIdentity(&rng); // create new random identity +} diff --git a/variants/xiao_s3_LoRa2021F33-2G4/target.h b/variants/xiao_s3_LoRa2021F33-2G4/target.h new file mode 100644 index 00000000..0c4a0469 --- /dev/null +++ b/variants/xiao_s3_LoRa2021F33-2G4/target.h @@ -0,0 +1,27 @@ +#pragma once + +#define RADIOLIB_STATIC_ONLY 1 +#include +#include +#include +#include +#include +#include +#ifdef DISPLAY_CLASS + #include + #include +#endif +#include "XiaoS3Board.h" + +extern XiaoS3Board board; +extern WRAPPER_CLASS radio_driver; +extern AutoDiscoverRTCClock rtc_clock; +extern EnvironmentSensorManager sensors; + +#ifdef DISPLAY_CLASS + extern DISPLAY_CLASS display; + extern MomentaryButton user_btn; +#endif + +bool radio_init(); +mesh::LocalIdentity radio_new_identity();