Simplify SX126x variant configuration (#2813)

* Update SX126xInterface.cpp

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update SX126xInterface.cpp

* Update SX126xInterface.cpp

* Update variant.h

* Update variant.h

* trunk fmt

* trunk fmt

* Update variant.h

* trunk fmt

* trunk fmt

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update pins_arduino.h

* Update pins_arduino.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* trunk fmt

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* trunk fmt

* trunk fmt

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

Specify behavior

* Update variant.h

Maintain behavior

* trunk fmt

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

* Update variant.h

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
S5NC 2023-09-27 22:01:40 +01:00 committed by GitHub
parent 98290e5d7b
commit 4e3576ae48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 311 additions and 251 deletions

View File

@ -3,7 +3,8 @@
#include "error.h" #include "error.h"
#include "mesh/NodeDB.h" #include "mesh/NodeDB.h"
// Particular boards might define a different max power based on what their hardware can do // Particular boards might define a different max power based on what their hardware can do, default to max power output if not
// specified (may be dangerous if using external PA and SX126x power config forgotten)
#ifndef SX126X_MAX_POWER #ifndef SX126X_MAX_POWER
#define SX126X_MAX_POWER 22 #define SX126X_MAX_POWER 22
#endif #endif
@ -26,20 +27,23 @@ template <typename T> bool SX126xInterface<T>::init()
pinMode(SX126X_POWER_EN, OUTPUT); pinMode(SX126X_POWER_EN, OUTPUT);
#endif #endif
#ifndef SX126X_E22 // FIXME: correct logic to default to not using TCXO if no voltage is specified for SX126X_DIO3_TCXO_VOLTAGE
float tcxoVoltage = 0; // None - we use an XTAL #if !defined(SX126X_DIO3_TCXO_VOLTAGE)
float tcxoVoltage =
0; // "TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip." per
// https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.h#L471C26-L471C104
// (DIO3 is free to be used as an IRQ)
LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE not defined, not using DIO3 as TCXO reference voltage\n");
#else #else
// Use DIO3 to power tcxo per https://github.com/jgromes/RadioLib/issues/12#issuecomment-520695575 float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE;
float tcxoVoltage = 1.8; LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at %f V\n", SX126X_DIO3_TCXO_VOLTAGE);
// (DIO3 is not free to be used as an IRQ)
#endif #endif
// FIXME: May want to set depending on a definition, currently all SX126x variant files use the DC-DC regulator option
bool useRegulatorLDO = false; // Seems to depend on the connection to pin 9/DCC_SW - if an inductor DCDC? bool useRegulatorLDO = false; // Seems to depend on the connection to pin 9/DCC_SW - if an inductor DCDC?
RadioLibInterface::init(); RadioLibInterface::init();
if (power > SX126X_MAX_POWER) // Clamp power to maximum defined level
if (power == 0)
power = SX126X_MAX_POWER;
if (power > SX126X_MAX_POWER) // This chip has lower power limits than some
power = SX126X_MAX_POWER; power = SX126X_MAX_POWER;
limitPower(); limitPower();
@ -54,49 +58,50 @@ template <typename T> bool SX126xInterface<T>::init()
LOG_INFO("Bandwidth set to %f\n", bw); LOG_INFO("Bandwidth set to %f\n", bw);
LOG_INFO("Power output set to %d\n", power); LOG_INFO("Power output set to %d\n", power);
// current limit was removed from module' ctor // Overriding current limit
// override default value (60 mA) // (https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.cpp#L85) using
// value in SX126xInterface.h (currently 140 mA) It may or may not be neccessary, depending on how RadioLib functions, from
// SX1261/2 datasheet: OCP after setting DeviceSel with SetPaConfig(): SX1261 - 60 mA, SX1262 - 140 mA For the SX1268 the IC
// defaults to 140mA no matter the set power level, but RadioLib set it lower, this would need further checking Default values
// are: SX1262, SX1268: 0x38 (140 mA), SX1261: 0x18 (60 mA)
// FIXME: Not ideal to increase SX1261 current limit above 60mA as it can only transmit max 15dBm, should probably only do it
// if using SX1262 or SX1268
res = lora.setCurrentLimit(currentLimit); res = lora.setCurrentLimit(currentLimit);
LOG_DEBUG("Current limit set to %f\n", currentLimit); LOG_DEBUG("Current limit set to %f\n", currentLimit);
LOG_DEBUG("Current limit set result %d\n", res); LOG_DEBUG("Current limit set result %d\n", res);
#if defined(SX126X_E22) #ifdef SX126X_DIO2_AS_RF_SWITCH
// E22 Emulation explicitly requires DIO2 as RF switch, so set it to TRUE again for good measure. In case somebody defines LOG_DEBUG("Setting DIO2 as RF switch\n");
// SX126X_TX for an E22 Module bool dio2AsRfSwitch = true;
if (res == RADIOLIB_ERR_NONE) { #else
LOG_DEBUG("SX126X_E22 mode enabled. Setting DIO2 as RF Switch\n"); LOG_DEBUG("Setting DIO2 as not RF switch\n");
res = lora.setDio2AsRfSwitch(true); bool dio2AsRfSwitch = false;
}
#endif #endif
if (res == RADIOLIB_ERR_NONE) {
res = lora.setDio2AsRfSwitch(dio2AsRfSwitch);
}
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC) // If a pin isn't defined, we set it to RADIOLIB_NC, it is safe to always do external RF switching with RADIOLIB_NC as it has
// If SX126X_TXEN is connected to the MCU, we are manually controlling RX and TX. // no effect
// But lora.begin (called above) sets Dio2 as RF switch control, which is not true here, so set it back to false. #ifndef SX126X_RXEN
if (res == RADIOLIB_ERR_NONE) { #define SX126X_RXEN RADIOLIB_NC
LOG_DEBUG("SX126X_TXEN pin defined. Setting RF Switch: RXEN=%i, TXEN=%i\n", SX126X_RXEN, SX126X_TXEN); LOG_DEBUG("SX126X_RXEN not defined, defaulting to RADIOLIB_NC\n");
res = lora.setDio2AsRfSwitch(false);
lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
}
#elif defined(SX126X_RXEN) && (SX126X_RXEN != RADIOLIB_NC && defined(E22_TXEN_CONNECTED_TO_DIO2))
// Otherwise, if SX126X_RXEN is connected to the MCU, and E22_TXEN_CONNECTED_TO_DIO2 is defined, we are letting the
// E22 control RX and TX via DIO2. In this configuration, the E22's TXEN and DIO2 pins are connected to each other,
// but not to the MCU.
// However, we must still connect the E22's RXEN pin to the MCU, define SX126X_RXEN accordingly, and then call
// setRfSwitchPins, otherwise RX sensitivity (observed via RSSI) is greatly diminished.
LOG_DEBUG("SX126X_RXEN and E22_TXEN_CONNECTED_TO_DIO2 are defined; value of res: %d", res);
if (res == RADIOLIB_ERR_NONE) {
LOG_DEBUG("SX126X_TXEN is RADIOLIB_NC, but SX126X_RXEN and E22_TXEN_CONNECTED_TO_DIO2 are both defined; calling "
"lora.setRfSwitchPins.");
lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
}
#endif #endif
#ifndef SX126X_TXEN
#define SX126X_TXEN RADIOLIB_NC
LOG_DEBUG("SX126X_TXEN not defined, defaulting to RADIOLIB_NC\n");
#endif
if (res == RADIOLIB_ERR_NONE) {
LOG_DEBUG("Using MCU pin %i as RXEN and pin %i as TXEN to control RF switching\n", SX126X_RXEN, SX126X_TXEN);
lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
}
if (config.lora.sx126x_rx_boosted_gain) { if (config.lora.sx126x_rx_boosted_gain) {
uint16_t result = lora.setRxBoostedGainMode(true); uint16_t result = lora.setRxBoostedGainMode(true);
LOG_INFO("Set Rx Boosted Gain mode; result: %d\n", result); LOG_INFO("Set RX gain to boosted mode; result: %d\n", result);
} else { } else {
uint16_t result = lora.setRxBoostedGainMode(false); uint16_t result = lora.setRxBoostedGainMode(false);
LOG_INFO("Set Rx Power Saving Gain mode; result: %d\n", result); LOG_INFO("Set RX gain to power saving mode (boosted mode off); result: %d\n", result);
} }
#if 0 #if 0
@ -296,7 +301,7 @@ template <typename T> bool SX126xInterface<T>::sleep()
{ {
// Not keeping config is busted - next time nrf52 board boots lora sending fails tcxo related? - see datasheet // Not keeping config is busted - next time nrf52 board boots lora sending fails tcxo related? - see datasheet
// \todo Display actual typename of the adapter, not just `SX126x` // \todo Display actual typename of the adapter, not just `SX126x`
LOG_DEBUG("sx126x entering sleep mode (FIXME, don't keep config)\n"); LOG_DEBUG("SX126x entering sleep mode (FIXME, don't keep config)\n");
setStandby(); // Stop any pending operations setStandby(); // Stop any pending operations
// turn off TCXO if it was powered // turn off TCXO if it was powered

View File

@ -140,7 +140,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define SX126X_RESET (32 + 15) // LORA_RESET P1.15 #define SX126X_RESET (32 + 15) // LORA_RESET P1.15
#define SX126X_TXEN (32 + 13) // TXEN P1.13 NiceRF 868 dont use #define SX126X_TXEN (32 + 13) // TXEN P1.13 NiceRF 868 dont use
#define SX126X_RXEN (32 + 10) // RXEN P1.10 NiceRF 868 dont use #define SX126X_RXEN (32 + 10) // RXEN P1.10 NiceRF 868 dont use
#define SX126X_E22
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define PIN_GPS_EN (-1) #define PIN_GPS_EN (-1)
#define PIN_GPS_PPS (-1) // Pulse per second input from the GPS #define PIN_GPS_PPS (-1) // Pulse per second input from the GPS

View File

@ -23,7 +23,9 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY 10 #define SX126X_BUSY 10
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 // use DIO2 as RF switch
#define SX126X_DIO2_AS_RF_SWITCH // use DIO2 as RF switch
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define HAS_GPS 0 #define HAS_GPS 0
#undef GPS_RX_PIN #undef GPS_RX_PIN

View File

@ -43,7 +43,8 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_BUSY #define SX126X_BUSY LORA_BUSY
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif
// #define USE_SX1280 // #define USE_SX1280

View File

@ -33,8 +33,11 @@
#define LORA_DIO1 26 // IRQ for SX1262/SX1268 #define LORA_DIO1 26 // IRQ for SX1262/SX1268
#define LORA_DIO2 22 // BUSY for SX1262/SX1268 #define LORA_DIO2 22 // BUSY for SX1262/SX1268
#define LORA_TXEN NOT_A_PIN // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level // NOT_A_PIN is treated as RADIOLIB_NC due to how they are defined, best to use RADIOLIB_NC directly
#define LORA_RXEN 17 // Input - RF switch RX control, connecting external MCU IO, valid in high level #define LORA_TXEN RADIOLIB_NC // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level
// E22_TXEN_CONNECTED_TO_DIO2 wasn't defined, so RXEN wasn't controlled. Commented it out to maintain behavior, but shouldn't be.
// Need to comment out defining SX126X_RXEN as LORA_RXEN too
// #define LORA_RXEN 17 // Input - RF switch RX control, connecting external MCU IO, valid in high level
#undef RF95_NSS #undef RF95_NSS
#define RF95_NSS 16 #define RF95_NSS 16
#define SX126X_BUSY 22 #define SX126X_BUSY 22
@ -53,7 +56,7 @@
*/ */
// RX/TX for RFM95/SX127x // RX/TX for RFM95/SX127x
#define RF95_RXEN LORA_RXEN // #define RF95_RXEN LORA_RXEN
#define RF95_TXEN LORA_TXEN #define RF95_TXEN LORA_TXEN
// #define RF95_TCXO <GPIO#> // #define RF95_TCXO <GPIO#>
@ -61,7 +64,7 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_RXEN LORA_RXEN // #define SX126X_RXEN LORA_RXEN
#define SX126X_TXEN LORA_TXEN #define SX126X_TXEN LORA_TXEN
// supported modules list // supported modules list
@ -69,4 +72,5 @@
#define USE_SX1262 #define USE_SX1262
// #define USE_SX1268 // #define USE_SX1268
// #define USE_LLCC68 // #define USE_LLCC68
#define SX126X_E22 #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -37,8 +37,9 @@
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_RXEN 14 #define SX126X_RXEN 14
#define SX126X_TXEN RADIOLIB_NC #define SX126X_TXEN RADIOLIB_NC
#define E22_TXEN_CONNECTED_TO_DIO2 1 #define SX126X_DIO2_AS_RF_SWITCH
// Set lora.tx_power to 13 for Hydra or other E22 900M30S target due to PA // Set lora.tx_power to 13 for Hydra or other E22 900M30S target due to PA
#define SX126X_MAX_POWER 13 #define SX126X_MAX_POWER 13
#define SX126X_E22
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -52,5 +52,5 @@
#ifdef EBYTE_E22 #ifdef EBYTE_E22
// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch
// (which is the default for the sx1262interface code) // (which is the default for the sx1262interface code)
#define SX126X_E22 #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif

View File

@ -53,5 +53,5 @@
#ifdef EBYTE_E22 #ifdef EBYTE_E22
// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch
// (which is the default for the sx1262interface code) // (which is the default for the sx1262interface code)
#define SX126X_E22 #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif

View File

@ -105,7 +105,7 @@ extern "C" {
#ifdef EBYTE_E22 #ifdef EBYTE_E22
// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch
// (which is the default for the sx1262interface code) // (which is the default for the sx1262interface code)
#define SX126X_E22 #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -33,4 +33,5 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_BUSY #define SX126X_BUSY LORA_BUSY
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -33,4 +33,6 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -40,4 +40,6 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -59,4 +59,6 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -32,4 +32,6 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -88,6 +88,7 @@
#define BATTERY_PIN 3 #define BATTERY_PIN 3
#define ADC_MULTIPLIER 1.436 #define ADC_MULTIPLIER 1.436
#define SX126X_E22 // Not really an E22 but this board clones using DIO3 for tcxo control #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Not really an E22 but this board clones using DIO3 for tcxo control
#endif #endif

View File

@ -134,7 +134,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define SX126X_TXEN (31) #define SX126X_TXEN (31)
#define SX126X_POWER_EN \ #define SX126X_POWER_EN \
(15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino
#define SX126X_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define ST7735_RESET (11) // Output #define ST7735_RESET (11) // Output
#define ST7735_CS (12) #define ST7735_CS (12)

View File

@ -154,7 +154,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define SX126X_TXEN (31) #define SX126X_TXEN (31)
#define SX126X_POWER_EN \ #define SX126X_POWER_EN \
(15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino (15) // FIXME, see warning hre https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay/blob/master/LORA_RELAY_NRF52840.ino
#define SX126X_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// ST7565 SPI // ST7565 SPI
#define ST7735_RESET (11) // Output #define ST7735_RESET (11) // Output

View File

@ -42,7 +42,8 @@
// #define SX126X_DIO1 LORA_DIO1 // #define SX126X_DIO1 LORA_DIO1
// #define SX126X_BUSY LORA_BUSY // #define SX126X_BUSY LORA_BUSY
// #define SX126X_RESET LORA_RESET // #define SX126X_RESET LORA_RESET
//#define SX126X_E22 // #define SX126X_DIO2_AS_RF_SWITCH
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
// SX128X 2.4 Ghz LoRa module Not OK - RadioLib issue ? still to confirm // SX128X 2.4 Ghz LoRa module Not OK - RadioLib issue ? still to confirm
// #define USE_SX1280 // #define USE_SX1280

View File

@ -191,7 +191,9 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
// #define SX126X_TXEN (39) // #define SX126X_TXEN (39)
// #define SX126X_RXEN (37) // #define SX126X_RXEN (37)
#define SX126X_POWER_EN (37) #define SX126X_POWER_EN (37)
#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define PIN_GPS_RESET (34) // Must be P1.02 #define PIN_GPS_RESET (34) // Must be P1.02
// #define PIN_GPS_EN // #define PIN_GPS_EN

View File

@ -27,7 +27,9 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 // Not really an E22 // Not really an E22
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code) // code)
#endif #endif

View File

@ -27,7 +27,9 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 // Not really an E22 // Not really an E22
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code) // code)
#endif #endif

View File

@ -118,7 +118,9 @@ External serial flash W25Q16JV_IQ
// This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main CPU? // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main CPU?
#define SX126X_BUSY (32 + 11) #define SX126X_BUSY (32 + 11)
#define SX126X_RESET (32 + 15) #define SX126X_RESET (32 + 15)
#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// #define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...) // #define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...)

View File

@ -146,6 +146,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define SX126X_BUSY (32 + 4) // P1.04 #define SX126X_BUSY (32 + 4) // P1.04
#define SX126X_RESET (0 + 3) // P0.03 #define SX126X_RESET (0 + 3) // P0.03
#define SX126X_ANT_SW (32 + 10) // P1.10 #define SX126X_ANT_SW (32 + 10) // P1.10
#define SX126X_DIO2_AS_RF_SWITCH
// To debug via the segger JLINK console rather than the CDC-ACM serial device // To debug via the segger JLINK console rather than the CDC-ACM serial device
// #define USE_SEGGER // #define USE_SEGGER

View File

@ -20,5 +20,6 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
// HOPE RFM90 does not have a TCXO therefore not SX126X_E22 // HOPE RFM90 does not have a TCXO therefore not SX126X_E22
#endif #endif

View File

@ -138,7 +138,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
// #define SX126X_ANT_SW (32 + 10) // #define SX126X_ANT_SW (32 + 10)
#define SX126X_RXEN (22) #define SX126X_RXEN (22)
#define SX126X_TXEN (24) #define SX126X_TXEN (24)
#define SX126X_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// ERC12864-10 LCD // ERC12864-10 LCD
#define ERC12864_CS (32 + 4) #define ERC12864_CS (32 + 4)

View File

@ -158,7 +158,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define SX126X_RESET (0 + 17) #define SX126X_RESET (0 + 17)
#define SX126X_TXEN (0 + 24) #define SX126X_TXEN (0 + 24)
#define SX126X_RXEN (0 + 22) #define SX126X_RXEN (0 + 22)
#define SX126X_E22 // Not really an E22 but this board clones using DIO3 for tcxo control // Not really an E22 but this board clones using DIO3 for tcxo control
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// FIXME, to prevent burning out parts I've set the power level super low, because I don't have // FIXME, to prevent burning out parts I've set the power level super low, because I don't have
// an antenna wired up // an antenna wired up

View File

@ -81,4 +81,6 @@ static const uint8_t SCK = 33;
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_POWER_EN WB_IO3 #define SX126X_POWER_EN WB_IO3
#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8

View File

@ -48,5 +48,7 @@
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_POWER_EN 25 #define SX126X_POWER_EN 25
#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif

View File

@ -209,7 +209,9 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
// #define SX126X_TXEN (39) // #define SX126X_TXEN (39)
// #define SX126X_RXEN (37) // #define SX126X_RXEN (37)
#define SX126X_POWER_EN (37) #define SX126X_POWER_EN (37)
#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// enables 3.3V periphery like GPS or IO Module // enables 3.3V periphery like GPS or IO Module
#define PIN_3V3_EN (34) #define PIN_3V3_EN (34)

View File

@ -186,7 +186,9 @@ static const uint8_t SCK = PIN_SPI_SCK;
// #define SX126X_TXEN (39) // #define SX126X_TXEN (39)
// #define SX126X_RXEN (37) // #define SX126X_RXEN (37)
#define SX126X_POWER_EN (37) #define SX126X_POWER_EN (37)
#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// enables 3.3V periphery like GPS or IO Module // enables 3.3V periphery like GPS or IO Module
#define PIN_3V3_EN (34) #define PIN_3V3_EN (34)

View File

@ -155,7 +155,9 @@ static const uint8_t SCK = PIN_SPI_SCK;
// #define SX126X_TXEN (39) // #define SX126X_TXEN (39)
// #define SX126X_RXEN (37) // #define SX126X_RXEN (37)
#define SX126X_POWER_EN (37) #define SX126X_POWER_EN (37)
#define SX126X_E22 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// enables 3.3V periphery like GPS or IO Module // enables 3.3V periphery like GPS or IO Module
#define PIN_3V3_EN (34) #define PIN_3V3_EN (34)

View File

@ -53,5 +53,6 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif

View File

@ -51,5 +51,6 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif

View File

@ -27,9 +27,7 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
// #define SX126X_E22 // Not really an E22 #define SX126X_DIO2_AS_RF_SWITCH // Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch
// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code)
#define SX126X_MAX_POWER \ #define SX126X_MAX_POWER \
16 // Ensure the PA does not exceed the saturation output power. More 16 // Ensure the PA does not exceed the saturation output power. More
// Info:https://uniteng.com/wiki/doku.php?id=meshtastic:station#rf_design_-_lora_station_edition_g1 // Info:https://uniteng.com/wiki/doku.php?id=meshtastic:station#rf_design_-_lora_station_edition_g1

View File

@ -84,6 +84,8 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that // Not really an E22 but TTGO seems to be trying to clone that
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code) // code)

View File

@ -133,7 +133,9 @@ External serial flash WP25R1635FZUIL0
// CPU? // CPU?
#define SX126X_BUSY (0 + 17) #define SX126X_BUSY (0 + 17)
#define SX126X_RESET (0 + 25) #define SX126X_RESET (0 + 25)
#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that // Not really an E22 but TTGO seems to be trying to clone that
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code) // code)

View File

@ -63,6 +63,8 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that // Not really an E22 but TTGO seems to be trying to clone that
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for
// the sx1262interface code) // the sx1262interface code)

View File

@ -29,7 +29,9 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that // Not really an E22 but TTGO seems to be trying to clone that
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code) // code)
#endif #endif

View File

@ -28,7 +28,9 @@
#define SX126X_DIO1 LORA_DIO1 #define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2 #define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that // Not really an E22 but TTGO seems to be trying to clone that
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code) // code)
#endif #endif

View File

@ -44,7 +44,8 @@
#define SX126X_DIO1 33 #define SX126X_DIO1 33
#define SX126X_BUSY 34 #define SX126X_BUSY 34
#define SX126X_RESET LORA_RESET #define SX126X_RESET LORA_RESET
#define SX126X_E22 #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif
// per SX128x_Receive_Interrupt/utilities.h // per SX128x_Receive_Interrupt/utilities.h

View File

@ -125,7 +125,6 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define SX126X_TXEN RADIOLIB_NC #define SX126X_TXEN RADIOLIB_NC
#define SX126X_RXEN D7 #define SX126X_RXEN D7
#define E22_TXEN_CONNECTED_TO_DIO2
// ------------------------------ OR ------------------------------ // ------------------------------ OR ------------------------------
@ -141,7 +140,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
#ifdef EBYTE_E22 #ifdef EBYTE_E22
// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch // Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch
// (which is the default for the sx1262interface code) // (which is the default for the sx1262interface code)
#define SX126X_E22 #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif #endif
/* /*