LowPowerLab Forum

Hardware support => RF - Range - Antennas - RFM69 library => Topic started by: DonpK on October 12, 2016, 09:18:34 AM

Title: RFM69 Library Questions
Post by: DonpK on October 12, 2016, 09:18:34 AM
I've been  trying to get two Arduino boards connected to two RFM69HCW radios to both transmit and receiver to and from each other. I've been working this sparkfun/RFM69HCW_Breakout example, https://github.com/sparkfun/RFM69HCW_Breakout/blob/master/Libraries/Arduino/RFM69/examples/SFE_RFM69HCW_example/SFE_RFM69HCW_example.ino (https://github.com/sparkfun/RFM69HCW_Breakout/blob/master/Libraries/Arduino/RFM69/examples/SFE_RFM69HCW_example/SFE_RFM69HCW_example.ino) which is described on this sparkfun page https://learn.sparkfun.com/tutorials/rfm69hcw-hookup-guide#running-the-example-code (https://learn.sparkfun.com/tutorials/rfm69hcw-hookup-guide#running-the-example-code)

One Arduino is the Mega2560 and the other is a Pro Mini. I have gotten both boards and radios to communicate with each other, with one pair serving as a transmitter and the other as a receiver. However, when I run the SFE_RFM69HCW_example, both boards appear to transmit okay, but the message is not received by the other board and radio

One thing I've noticed is that the interrupt 0 pin on the Mega2560, which I believe is Pin 21, is different from the pin given in the example library, Pin 2. Where should I make the change in the RFM69.h library to reflect the correct Mega2560 INT0 pin or can I make that change in the example sketch?

I'm new to the RFM69, so any troubleshooting tips would be appreciated
Title: Re: RFM69 Library Questions
Post by: Felix on October 12, 2016, 12:53:03 PM
You'd need a new section for mega2560 to define the IRQ number and pin number associated with that IRQ.
Totally made this up on the fly:

Code: [Select]
#elif defined(__AVR_ATmega2560__)
  #define RF69_IRQ_PIN          21
  #define RF69_IRQ_NUM          0 
#else
  #define RF69_IRQ_PIN          2
  #define RF69_IRQ_NUM          0 
#endif
Title: Re: RFM69 Library Questions
Post by: DonpK on October 12, 2016, 03:44:57 PM
Thanks Felix.

I added your suggestion to the .h file, actually just

#elif defined(__AVR_ATmega2560__)
  #define RF69_IRQ_PIN          21
  #define RF69_IRQ_NUM          0 

since the #else part was already there.

I'm afraid it did not help. The sketch seems to run alright up until this line:
  radio.send(TONODEID, sendbuffer, sendlength);
and then it stops. The receiving radio shows nothing received and it's impossible to try to send any more text unless the Mega2560 is reset. I've checked the receiving Node ID which TONODEID should contain and that's correct.

Title: Re: RFM69 Library Questions
Post by: Felix on October 12, 2016, 04:14:16 PM
.h