SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By hartatak62
#191462
Hello everyone! I've been scouring the internet for days and haven't come up with a solution yet, so I'm hoping someone here has some ideas. I'm making a wireless liquid level monitoring system and want to use the HopeRF RFM69HCW modules for this project. However, for reasons I won't go into here, I need to use the Intel Curie module. Since it's only available on the Arduino 101 board at this point, that means I need to make Arduino 101 and RFM69HCW talk to each other over SPI. I have no trouble getting this to work with a pair of Arduino Pro Minis, but I cannot for the life of me get the 101 to work with the RFM69's.

I've quadruple-checked the pins and I'm certain that I can use the 101's GPIO or ICSP headers for SPI communication, and have tried both. I'm using the SFE_RFM69HCW_example sketch that Sparkfun makes available for use with the breakout boards they sell. The sketch loads into the board without any issues, and appears to run properly on the 101. But there's no communication between radios.

My current theory is that the 101 is so much faster than the other Arduino boards that the SPI library was written for that the clock pin is toggling too fast for the RFM69 to keep up with. So then the fix would be to slow down the SPI clock. I have no idea how to do that though. Some of the methods like SPI.setClockDivider are no longer supported. It appears that the change has to be done in SPISettings with SPI.beginTransaction() but since this is using the SPI library I'm not sure where to find those (I've looked).

So there it is. I can't get the Arduino 101 to communicate with the RFM69HCW over SPI. If anyone knows of a way to fix this I'd LOVE to hear it. Thank you!!
By hartatak62
#191464
Update: I have gotten the 101 to transmit through the RFM69HCW! It still won't receive, but I edited the RFM69.cpp file in the RFM69 library to change SPI.setClockDivider(SPI_CLOCK_DIV2); to SPI.setClockDivider(SPI_CLOCK_DIV8);. This slows down the SPI clock significantly (half the processor clock speed slowed down to 1/8 the processor clock speed), allowing the RFM69 to understand the SPI communication. There's still something else wrong, but at least I've got 1-way communication working now. I'd still love any help people might be able to offer make this work better.
By hartatak62
#191471
Another Update: After more research I've finally figured out why I could transmit but not receive. The radios were outputting an interrupt signal that wasn't being received by the 101. As it turns out, Arduino changed the Interrupt numbers to match the Interrupt pins on "new boards with high performances processors," starting with the Arduino Due. The RFM69 Library hasn't been updated to work this way. It's set to use Interrupt Number 0, which it expects to be on pin 2. But now Interrupt Number 0 is on pin 0, and Interrupt 2 is on pin 2. So I edited RFM69.h to change the Interrupt Number to the Interrupt Pin (since I'll be using pin 2).
_interruptNum = interruptNum;
which is now
_interruptNum = interruptPin;

This works for the Arduino Due, Zero, MKR1000, and 101. But it won’t work for the Uno, Leonardo, or pretty much any other Arduino boards since they’ll look for InterruptNum 0 on interruptPin 2. Find more info about 2/3 of the way down the page here: https://www.arduino.cc/en/Reference/AttachInterrupt

Hopefully this helps somebody. I am very happy to finally have full 2-way communication between Arduino 101 boards using my HopeRF RFM69HCW radio modules!
#191972
I have been running into a similar problem - 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_Br ... xample.ino which is described on this sparkfun page https://learn.sparkfun.com/tutorials/rf ... ample-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 what you point out, 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?
#191981
According to the document that hartatak62 provided, the Mega256 Int0 is NOT on pine 21:
Code: Select all
Board              int.0   int.1   int.2   int.3   int.4   int.5 
Uno, Ethernet        2       3         
Mega2560             2       3       21      20      19     18 
32u4 based 
  (Leonardo, Micro)  3       2       0       1        7   
Due, Zero, MKR1000, 101       (interrupt number = pin number )
#191985
My reason for using the Mega2560 Pin 21 for the INT0 connection was this document https://www.arduino.cc/en/Hacking/PinMapping2560. If you scroll down to the table and look at Pin 43, the Pin Name is PD0 ( SCL/INT0 ) and the Mapped Pin Name is Digital pin 21 (SCL). There is also a discussion on the Arduino Forum of this topic http://forum.arduino.cc/index.php?topic=416021.0

I tried running the sketch where the Mega2560 is the transmitter and the Pro Mini is the receiver and using both Pin 2 and Pin 21 on the 2560 seem to work okay. However I still can't get the SFE_RFM69HCW_example sketch where both Arduino Mega2560 with one radio and the Pro Mini with another radio both are supposed to transmit and receive from each other.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]