I added Serial.print() to SX126x.cpp for debugging purposes and ran it. Please compare your results with the serial monitor results. You should be able to see where it is hanging up.
You should be able to run it by uploading the attached hex file.
Oren_SX126x_PingPong.ino.zip (45.5 KB)
int16_t SX126x::reset(bool verify) {
int16_t state;
Serial.print("******** verify="); Serial.println(verify);
Serial.println("// run the reset sequence");
this->mod->hal->pinMode(this->mod->getRst(), this->mod->hal->GpioModeOutput);
this->mod->hal->digitalWrite(this->mod->getRst(), this->mod->hal->GpioLevelLow);
this->mod->hal->delay(1);
this->mod->hal->digitalWrite(this->mod->getRst(), this->mod->hal->GpioLevelHigh);
Serial.println("// return immediately when verification is disabled");
if(!verify) {
Serial.println("**** return verify"); Serial.println();
return(RADIOLIB_ERR_NONE);
}
Serial.println("// set mode to standby - SX126x often refuses first few commands after reset");
RadioLibTime_t start = this->mod->hal->millis();
while(true) {
Serial.println("// try to set mode to standby");
// int16_t state = standby();
state = standby();
if(state == RADIOLIB_ERR_NONE) {
Serial.println("// standby command successful");
Serial.println("**** return state"); Serial.println();
return(RADIOLIB_ERR_NONE);
}
Serial.println("// standby command failed, check timeout and try again");
if(this->mod->hal->millis() - start >= 1000) {
Serial.println("// timed out, possibly incorrect wiring");
Serial.println("**** return timer"); Serial.println();
return(state);
}
Serial.println("// wait a bit to not spam the module");
Serial.println("while");
this->mod->hal->delay(10);
}
Serial.println("**** return reset()");
Serial.print("-------- "); Serial.println(state); Serial.println();
}
08:06:39.858 -> Master UID 535EE2F
08:06:39.858 -> ******** verify=1
08:06:39.858 -> // run the reset sequence
08:06:39.858 -> // return immediately when verification is disabled
08:06:39.858 -> // set mode to standby - SX126x often refuses first few commands after reset
08:06:39.858 -> // try to set mode to standby
08:06:39.858 -> // standby command failed, check timeout and try again
08:06:39.858 -> // wait a bit to not spam the module
08:06:39.858 -> while
08:06:39.890 -> // try to set mode to standby
08:06:39.890 -> // standby command successful
08:06:39.890 -> **** return state
08:06:39.890 ->
08:06:39.890 -> ******** verify=1
08:06:39.890 -> // run the reset sequence
08:06:39.890 -> // return immediately when verification is disabled
08:06:39.890 -> // set mode to standby - SX126x often refuses first few commands after reset
08:06:39.890 -> // try to set mode to standby
08:06:39.890 -> // standby command failed, check timeout and try again
08:06:39.922 -> // wait a bit to not spam the module
08:06:39.922 -> while
08:06:39.922 -> // try to set mode to standby
08:06:39.922 -> // standby command successful
08:06:39.922 -> **** return state
08:06:39.922 ->
08:06:39.954 -> radio.begin() success!
08:06:39.954 -> END of setup()