From 9bff1582bdab7f55a7a320e88e9757a6ff18cb4f Mon Sep 17 00:00:00 2001 From: jgromes Date: Fri, 27 Dec 2024 16:25:52 +0000 Subject: [PATCH 1/3] [LR11x0] Use dummy SPI transfer for wakeup --- src/modules/LR11x0/LR11x0.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/LR11x0/LR11x0.cpp b/src/modules/LR11x0/LR11x0.cpp index 7b988371..a360b935 100644 --- a/src/modules/LR11x0/LR11x0.cpp +++ b/src/modules/LR11x0/LR11x0.cpp @@ -356,10 +356,9 @@ int16_t LR11x0::standby(uint8_t mode, bool wakeup) { this->mod->setRfSwitchState(Module::MODE_IDLE); if(wakeup) { - // pull NSS low for a while to wake up - this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelLow); - this->mod->hal->delay(1); - this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelHigh); + // send a NOP command - this pulls the NSS low to exit the sleep mode, + // while preventing interference with possible other SPI transactions + (void)this->mod->SPIwriteStream(RADIOLIB_LR11X0_CMD_NOP, NULL, 0, false, false); } uint8_t buff[] = { mode }; From ff387e93ad75af01fbe211e3dee23474ddd5f85e Mon Sep 17 00:00:00 2001 From: jgromes Date: Fri, 27 Dec 2024 16:25:59 +0000 Subject: [PATCH 2/3] [SX128x] Use dummy SPI transfer for wakeup --- src/modules/SX128x/SX128x.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/SX128x/SX128x.cpp b/src/modules/SX128x/SX128x.cpp index 21f6b21c..a86d82ab 100644 --- a/src/modules/SX128x/SX128x.cpp +++ b/src/modules/SX128x/SX128x.cpp @@ -480,8 +480,9 @@ int16_t SX128x::standby(uint8_t mode, bool wakeup) { this->mod->setRfSwitchState(Module::MODE_IDLE); if(wakeup) { - // pull NSS low to wake up - this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelLow); + // send a NOP command - this pulls the NSS low to exit the sleep mode, + // while preventing interference with possible other SPI transactions + (void)this->mod->SPIwriteStream(RADIOLIB_SX128X_CMD_NOP, NULL, 0, false, false); } uint8_t data[] = { mode }; From b2b4c9e0f73bd9d5a435b291ee27574ee9c2f69f Mon Sep 17 00:00:00 2001 From: jgromes Date: Fri, 27 Dec 2024 16:26:24 +0000 Subject: [PATCH 3/3] [SX126x] Use dummy SPI transfer for wakeup (#1364) --- src/modules/SX126x/SX126x.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 1d8c0801..31aa2aa3 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -467,8 +467,10 @@ int16_t SX126x::standby(uint8_t mode, bool wakeup) { this->mod->setRfSwitchState(Module::MODE_IDLE); if(wakeup) { - // pull NSS low to wake up - this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelLow); + // send a NOP command - this pulls the NSS low to exit the sleep mode, + // while preventing interference with possible other SPI transactions + // see https://github.com/jgromes/RadioLib/discussions/1364 + (void)this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_NOP, NULL, 0, false, false); } uint8_t data[] = { mode };