I have the SparkFun RFM69 Breakout working on two Arduino Unos using this guide: https://learn.sparkfun.com/tutorials/rf … w-it-works
Now I want to add a third node using an Arduino Yun Generation 1, but I can only barely get it working.
One problem is that the header pins IO10-13 in the ATmega324U are not mapped to SPI. The only place I can access the SPI lines is from the ICSP header.
A second problem is that for SS I am using port 9 because for some reason IO 10 (the default SS on the RFM69 library) doesn’t work (even though this pin seems to be totally free on the Yun (i.e. nothing to do with SPI SS)).
Here is the schematic for the Yun: https://www.arduino.cc/en/uploads/Main/ … ematic.pdf
And this is the reference one for Uno: https://www.arduino.cc/en/uploads/Main/ … ematic.pdf
To solve that problem I just subclassed the lib like so:
RFM69_YUN.h
#include <RFM69.h>
#define RF69_SPI_CS_YUN 9
class RFM69_YUN : public RFM69 {
public:
RFM69_YUN(uint8_t slaveSelectPin=RF69_SPI_CS_YUN, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, uint8_t interruptNum=RF69_IRQ_NUM) :
RFM69(slaveSelectPin, interruptPin, isRFM69HW, interruptNum)
{
}
};
Using this works but everything is like in slow motion, not sure if it’s related to my class extension above (I don’t think so, but comments welcome!)
The problem seem to be that the code running on the ATmega32U is running so slow that radio.sendWithRetry is not able to receive the ACK. Here is some example debug output from both nodes. Node 1 is the Yun and Node 2 is a plain old Uno (FYR I have the same test between 2 Unos and ACK works perfectly):
Node 1 debug output
sending to node 2, message [HELLOW WORLD]
no ACK received
TX LED
sending to node 2, message [HELLO WORLD]
no ACK received
TX LED
sending to node 2, message [HELLO WORLD]
no ACK received
TX LED
Node 2 debug output
Node 2 ready
received from node 1, message [HELLOW WORLD], RSSI -25
ACK sent
received from node 1, message [HELLO WORLD], RSSI -32
ACK sent
received from node 1, message [HELLO WORLD], RSSI -25
ACK sent
received from node 1, message [HELLO WORLD], RSSI -20
ACK sent
I think the main reason is that it all seems to be running VERY slow on the ATmega32U. From the time I call radio.sendWithRetry from the YUN side, it takes about 1 second or more to see the LED on Node 2. I’m running the demo code from the RFM69 tutorial.
The main question is, does anyone have any idea why the code seems so slow on the ATmega32U? I have a guess that it’s something to do with SPI conflicting somehow but looking at the schematics it seems that only
TIA,
ALex