Since it seems that the standby() function cannot return, I added Serial.print() inside the standby() function. Please check which line it executes and stops at.
Oren_SX126x_PingPong.ino.zip (45.8 KB)
int16_t SX126x::standby() {
Serial.print(" standby() standbyXOSC="); Serial.println(standbyXOSC);
return(SX126x::standby(this->standbyXOSC ? RADIOLIB_SX126X_STANDBY_XOSC : RADIOLIB_SX126X_STANDBY_RC));
}
int16_t SX126x::standby(uint8_t mode, bool wakeup) {
Serial.print(" standby() mode="); Serial.print(mode); Serial.print(" wakeup="); Serial.println(wakeup);
Serial.println(" // set RF switch (if present)");
this->mod->setRfSwitchState(Module::MODE_IDLE);
if(wakeup) {
Serial.println(" // pull NSS low to wake up");
this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelLow);
}
uint8_t data[] = { mode };
Serial.println(" SPIwriteStream RADIOLIB_SX126X_CMD_SET_STANDBY");
return(this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_SET_STANDBY, data, 1));
}
08:49:22.792 → Master UID 535EE2F
08:49:22.792 → ******** verify=1
08:49:22.792 → // run the reset sequence
08:49:22.792 → // return immediately when verification is disabled
08:49:22.792 → // set mode to standby - SX126x often refuses first few commands after reset
08:49:22.792 → // try to set mode to standby
08:49:22.792 → standby() standbyXOSC=0
08:49:22.792 → standby() mode=0 wakeup=1
08:49:22.792 → // set RF switch (if present)
08:49:22.792 → // pull NSS low to wake up
08:49:22.792 → SPIwriteStream RADIOLIB_SX126X_CMD_SET_STANDBY
08:49:22.824 → // standby command failed, check timeout and try again
08:49:22.824 → // wait a bit to not spam the module
08:49:22.824 → while
08:49:22.824 → // try to set mode to standby
08:49:22.824 → standby() standbyXOSC=0
08:49:22.824 → standby() mode=0 wakeup=1
08:49:22.824 → // set RF switch (if present)
08:49:22.824 → // pull NSS low to wake up
08:49:22.824 → SPIwriteStream RADIOLIB_SX126X_CMD_SET_STANDBY
08:49:22.857 → // standby command successful
08:49:22.857 → **** return state
08:49:22.857 →
08:49:22.857 → ******** verify=1
08:49:22.857 → // run the reset sequence
08:49:22.857 → // return immediately when verification is disabled
08:49:22.857 → // set mode to standby - SX126x often refuses first few commands after reset
08:49:22.857 → // try to set mode to standby
08:49:22.857 → standby() standbyXOSC=0
08:49:22.857 → standby() mode=0 wakeup=1
08:49:22.857 → // set RF switch (if present)
08:49:22.857 → // pull NSS low to wake up
08:49:22.889 → SPIwriteStream RADIOLIB_SX126X_CMD_SET_STANDBY
08:49:22.889 → // standby command failed, check timeout and try again
08:49:22.889 → // wait a bit to not spam the module
08:49:22.889 → while
08:49:22.889 → // try to set mode to standby
08:49:22.889 → standby() standbyXOSC=0
08:49:22.889 → standby() mode=0 wakeup=1
08:49:22.889 → // set RF switch (if present)
08:49:22.889 → // pull NSS low to wake up
08:49:22.921 → SPIwriteStream RADIOLIB_SX126X_CMD_SET_STANDBY
08:49:22.921 → // standby command successful
08:49:22.921 → **** return state
08:49:22.921 →
08:49:22.921 → standby() standbyXOSC=0
08:49:22.921 → standby() mode=0 wakeup=1
08:49:22.921 → // set RF switch (if present)
08:49:22.921 → // pull NSS low to wake up
08:49:22.921 → SPIwriteStream RADIOLIB_SX126X_CMD_SET_STANDBY
08:49:22.921 → standby() standbyXOSC=0
08:49:22.921 → standby() mode=0 wakeup=1
08:49:22.921 → // set RF switch (if present)
08:49:22.954 → // pull NSS low to wake up
08:49:22.954 → SPIwriteStream RADIOLIB_SX126X_CMD_SET_STANDBY
08:49:22.987 → radio.begin() success!
08:49:22.987 → END of setup()