LowPowerLab / RFM69

RFM69 library for RFM69W, RFM69HW, RFM69CW, RFM69HCW (semtech SX1231, SX1231H)
GNU General Public License v3.0
778 stars 381 forks source link

RFM69::initialize returning "false" TRUE #187

Closed kythre closed 1 year ago

kythre commented 1 year ago

RFM69::initialize is returning true on a completely bare Arduino Nano. Tried it on two separate Nanos with generic code as below. loop() runs as expected


#include <RFM69.h>    //get it here: https://www.github.com/lowpowerlab/rfm69
#include <RFM69_ATC.h>//get it here: https://github.com/lowpowerlab/RFM69
#include <SPI.h>      //included with Arduino IDE (www.arduino.cc)
#include <SPIFlash.h> //get it here: https://www.github.com/lowpowerlab/spiflash

RFM69_ATC radio;

void setup() {
  Serial.begin(115200);
  Serial.println("START!");

  Serial.println("Initializing radio...");

  if (!radio.initialize(RF69_915MHZ,123,200))
    Serial.println("radio.init() FAIL");
  else
    Serial.println("radio.init() SUCCESS");

  radio.enableAutoPower(-80);
}

void loop() {
  Serial.println("Loop");
  delay(1000);
}
LowPowerLab commented 1 year ago

@kythre Thanks, it seems to be intermittent (the SUCCESS vs FAIL with no module). There is no definite check if the module responds the way it should, so I added the missing checks and it should now be resolved.

kythre commented 1 year ago

awesome, thank you for the quick update. from some quick googling, it looks like those checks are just to check that SPI (and the requisite wiring) is working. is that correct?

LowPowerLab commented 1 year ago

The checks are to ensure that what is written to a certain set of registers is the same as what can be read back from those same registers.