Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/mesh/STM32WLE5JCInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ bool STM32WLE5JCInterface::init()
RadioLibInterface::init();

// https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/main/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c
#if (!defined(_VARIANT_RAK3172_))
setTCXOVoltage(1.7);
#if defined(SX126X_DIO3_TCXO_VOLTAGE)
setTCXOVoltage(SX126X_DIO3_TCXO_VOLTAGE);
#endif

lora.setRfSwitchTable(rfswitch_pins, rfswitch_table);
Expand All @@ -29,6 +29,17 @@ bool STM32WLE5JCInterface::init()

int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage);

#if defined(TCXO_OPTIONAL)
// If a TCXO was requested but isn't actually populated (e.g. non-T RAK3172), retry on XTAL
if (res != RADIOLIB_ERR_NONE && res != RADIOLIB_ERR_CHIP_NOT_FOUND && tcxoVoltage > 0) {
LOG_WARN("STM32WLx init failed with TCXO Vref %fV (err %d), retrying without TCXO", tcxoVoltage, res);
setTCXOVoltage(0);
res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage);
if (res == RADIOLIB_ERR_NONE)
LOG_INFO("STM32WLx init success without TCXO (XTAL mode)");
}
#endif

LOG_INFO("STM32WLx init result %d", res);

LOG_INFO("Frequency set to %f", getFreq());
Expand Down
7 changes: 7 additions & 0 deletions variants/stm32/CDEBYTE_E77-MBL/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ Do not expect a working Meshtastic device with this target.
#define SERIAL_PRINT_PORT 1

#define EBYTE_E77_MBL

// LoRa
// Hardware varies by unit: SN >= 3202995 has a TCXO, older units have XTAL only -
// https://github.com/olliw42/mLRS-docu/blob/main/docs/EBYTE_E77_MBL.md
#define TCXO_OPTIONAL
#define SX126X_DIO3_TCXO_VOLTAGE 1.7

#endif
6 changes: 6 additions & 0 deletions variants/stm32/rak3172/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ Do not expect a working Meshtastic device with this target.
#define RAK3172
#define SERIAL_PRINT_PORT 1

// LoRa
// RAK3172: no TCXO, RAK3172-T: 3.0V TCXO -
// https://github.com/RAKWireless/RAK-STM32-RUI/blob/e5a28be8fab1a492bd9223dd425ca33a8a297d90/variants/WisDuo_RAK3172-T_Board/radio_conf.h#L91
#define TCXO_OPTIONAL
#define SX126X_DIO3_TCXO_VOLTAGE 3.0

#endif
4 changes: 4 additions & 0 deletions variants/stm32/wio-e5/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ Do not expect a working Meshtastic device with this target.

#define WIO_E5

// LoRa
// https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/163c05379b1805dd8f2c061d4557a69985acc953/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c#L94
#define SX126X_DIO3_TCXO_VOLTAGE 1.7

#endif