This commit is contained in:
Ben Meadors 2024-08-20 07:08:42 -05:00
parent ee9e46ec92
commit d404a49336
2 changed files with 27 additions and 26 deletions

View File

@ -911,34 +911,34 @@ void setup()
#if defined(USE_SX1262) && !defined(ARCH_PORTDUINO) && defined(TCXO_OPTIONAL) #if defined(USE_SX1262) && !defined(ARCH_PORTDUINO) && defined(TCXO_OPTIONAL)
if (!rIf) { if (!rIf) {
// Try using the specified TCXO voltage // Try using the specified TCXO voltage
rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
if (!rIf->init()) { if (!rIf->init()) {
LOG_WARN("Failed to find SX1262 radio with TCXO using DIO3 reference voltage at %f V\n", tcxoVoltage); LOG_WARN("Failed to find SX1262 radio with TCXO using DIO3 reference voltage at %f V\n", tcxoVoltage);
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
tcxoVoltage = 0; // if it fails, set the TCXO voltage to zero for the next attempt tcxoVoltage = 0; // if it fails, set the TCXO voltage to zero for the next attempt
} else { } else {
LOG_INFO("SX1262 Radio init succeeded, using "); LOG_INFO("SX1262 Radio init succeeded, using ");
LOG_WARN("SX1262 Radio with TCXO"); LOG_WARN("SX1262 Radio with TCXO");
LOG_INFO(", reference voltage at %f V\n", tcxoVoltage); LOG_INFO(", reference voltage at %f V\n", tcxoVoltage);
radioType = SX1262_RADIO; radioType = SX1262_RADIO;
} }
} }
if (!rIf) { if (!rIf) {
// If specified TCXO voltage fails, attempt to use DIO3 as a reference instea // If specified TCXO voltage fails, attempt to use DIO3 as a reference instea
rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
if (!rIf->init()) { if (!rIf->init()) {
LOG_WARN("Failed to find SX1262 radio with XTAL using DIO3 reference voltage at %f V\n", tcxoVoltage); LOG_WARN("Failed to find SX1262 radio with XTAL using DIO3 reference voltage at %f V\n", tcxoVoltage);
delete rIf; delete rIf;
rIf = NULL; rIf = NULL;
tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if it fails, set the TCXO voltage back for the next radio search tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if it fails, set the TCXO voltage back for the next radio search
} else { } else {
LOG_INFO("SX1262 Radio init succeeded, using "); LOG_INFO("SX1262 Radio init succeeded, using ");
LOG_WARN("SX1262 Radio with XTAL"); LOG_WARN("SX1262 Radio with XTAL");
LOG_INFO(", reference voltage at %f V\n", tcxoVoltage); LOG_INFO(", reference voltage at %f V\n", tcxoVoltage);
radioType = SX1262_RADIO; radioType = SX1262_RADIO;
} }
} }
#endif #endif

View File

@ -131,7 +131,8 @@ NRF52 PRO MICRO PIN ASSIGNMENT
// #define SX126X_MAX_POWER 8 set this if using a high-power board! // #define SX126X_MAX_POWER 8 set this if using a high-power board!
/* /*
On the SX1262, DIO3 sets the voltage for an external TCXO, if one is present. If one is not present, use TCXO_OPTIONAL to try both settings. On the SX1262, DIO3 sets the voltage for an external TCXO, if one is present. If one is not present, use TCXO_OPTIONAL to try both
settings.
| Mfr | Module | TCXO | RF Switch | Notes | | Mfr | Module | TCXO | RF Switch | Notes |
| ---------- | ---------------- | ---- | --------- | -------------------------------------------- | | ---------- | ---------------- | ---- | --------- | -------------------------------------------- |
@ -149,7 +150,7 @@ On the SX1262, DIO3 sets the voltage for an external TCXO, if one is present. If
*/ */
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define TCXO_OPTIONAL // make it so that the firmware can try both TCXO and XTAL #define TCXO_OPTIONAL // make it so that the firmware can try both TCXO and XTAL
extern float tcxoVoltage; // make this available everywhere extern float tcxoVoltage; // make this available everywhere
#ifdef __cplusplus #ifdef __cplusplus