From ef16e431af979538327967944df56af7e727675b Mon Sep 17 00:00:00 2001 From: jgromes Date: Thu, 21 Nov 2024 20:09:05 +0100 Subject: [PATCH] [LR11x0] Disable DIO11 for GNSS only (#1275) --- src/modules/LR11x0/LR11x0.cpp | 7 +++++-- src/modules/LR11x0/LR11x0.h | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/LR11x0/LR11x0.cpp b/src/modules/LR11x0/LR11x0.cpp index 6891cd59..7b988371 100644 --- a/src/modules/LR11x0/LR11x0.cpp +++ b/src/modules/LR11x0/LR11x0.cpp @@ -129,6 +129,8 @@ int16_t LR11x0::beginGNSS(uint8_t constellations, float tcxoVoltage) { state = this->clearErrors(); RADIOLIB_ASSERT(state); + // set GNSS flag to reserve DIO11 for LF clock + this->gnss = true; state = this->configLfClock(RADIOLIB_LR11X0_LF_BUSY_RELEASE_DISABLED | RADIOLIB_LR11X0_LF_CLK_XOSC); RADIOLIB_ASSERT(state); @@ -2066,6 +2068,7 @@ int16_t LR11x0::modSetup(float tcxoVoltage, uint8_t modem) { this->mod->spiConfig.stream = true; this->mod->spiConfig.parseStatusCb = SPIparseStatus; this->mod->spiConfig.checkStatusCb = SPIcheckStatus; + this->gnss = false; // try to find the LR11x0 chip - this will also reset the module at least once if(!LR11x0::findChip(this->chipType)) { @@ -2452,7 +2455,7 @@ int16_t LR11x0::setDioIrqParams(uint32_t irq1, uint32_t irq2) { } int16_t LR11x0::setDioIrqParams(uint32_t irq) { - return(setDioIrqParams(irq, 0)); + return(setDioIrqParams(irq, this->gnss ? 0 : irq)); } int16_t LR11x0::clearIrq(uint32_t irq) { @@ -2463,7 +2466,7 @@ int16_t LR11x0::clearIrq(uint32_t irq) { } int16_t LR11x0::configLfClock(uint8_t setup) { - return(this->SPIcommand(RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK, true, &setup, 1)); + return(this->SPIcommand(RADIOLIB_LR11X0_CMD_CONFIG_LF_CLOCK, true, &setup, 1)); } int16_t LR11x0::setTcxoMode(uint8_t tune, uint32_t delay) { diff --git a/src/modules/LR11x0/LR11x0.h b/src/modules/LR11x0/LR11x0.h index 9ee985d5..42685a9f 100644 --- a/src/modules/LR11x0/LR11x0.h +++ b/src/modules/LR11x0/LR11x0.h @@ -33,7 +33,7 @@ #define RADIOLIB_LR11X0_CMD_SET_DIO_AS_RF_SWITCH (0x0112) #define RADIOLIB_LR11X0_CMD_SET_DIO_IRQ_PARAMS (0x0113) #define RADIOLIB_LR11X0_CMD_CLEAR_IRQ (0x0114) -#define RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK (0x0116) +#define RADIOLIB_LR11X0_CMD_CONFIG_LF_CLOCK (0x0116) #define RADIOLIB_LR11X0_CMD_SET_TCXO_MODE (0x0117) #define RADIOLIB_LR11X0_CMD_REBOOT (0x0118) #define RADIOLIB_LR11X0_CMD_GET_VBAT (0x0119) @@ -281,7 +281,7 @@ #define RADIOLIB_LR11X0_IRQ_ALL (0x1BF80FFCUL) // 31 0 all interrupts #define RADIOLIB_LR11X0_IRQ_NONE (0x00UL << 0) // 31 0 no interrupts -// RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK +// RADIOLIB_LR11X0_CMD_CONFIG_LF_CLOCK #define RADIOLIB_LR11X0_LF_CLK_RC (0x00UL << 0) // 1 0 32.768 kHz source: RC oscillator #define RADIOLIB_LR11X0_LF_CLK_XOSC (0x01UL << 0) // 1 0 crystal oscillator #define RADIOLIB_LR11X0_LF_CLK_EXT (0x02UL << 0) // 1 0 external signal on DIO11 @@ -1828,6 +1828,7 @@ class LR11x0: public PhysicalLayer { float dataRateMeasured = 0; uint8_t wifiScanMode = 0; + bool gnss = false; int16_t modSetup(float tcxoVoltage, uint8_t modem); static int16_t SPIparseStatus(uint8_t in);