Arduino UNO + nRF24L01 + Ethernet shield do not work

Hi guys,

I started a basic sketch based on Maniac's Getting Started with nRF24L01+ on Arduino | maniacbug for using 2 nRF24L01 over Arduino UNO boards, they work just fine. But I can't get to work the transmitter over an Ethernet Shield.
The ethernet sketch is based on http://shanes.net/how-to-use-an-nrf24l01-rf24-with-an-arduino-ethernet-shield/
So the transmitter has an UNO, Ethernet Shield and the RF; compiled with the rf24_plus_softSPI library.
I tried compiling with rf24_plus_softSPI and rf24 Maniac's library, but they didn't work.

I compiled the transmitter as a Tx role

RF24 radio(6,7); //for arduino uno + ethernet shield

The serial monitor show this:

RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS 'T' to begin transmitting to the other node

STATUS			= 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1	= 0xffffffffff 0xffffffffff
RX_ADDR_P2-5	= 0xff 0xff 0xff 0xff
TX_ADDR			= 0xffffffffff
RX_PW_P0-6		= 0xff 0xff 0xff 0xff 0xff 0xff
EN_AA			= 0xff
EN_RXADDR		= 0xff
RF_SETUP	 	= 0xff
CONFIG		 	= 0xff
DYNPD/FEATURE	= 0xff 0xff
Data Rate	 	= 1MBPS
Model		 	= nRF24L01
CRC Length	 	= 16 bits
PA Power	 	= PA_HIGH
Now sending hola=021--...ok...Got response 4294967295, round-trip delay: 83
Now sending hola=021--...ok...Got response 4294967295, round-trip delay: 1092
Now sending hola=021--...ok...Got response 4294967295, round-trip delay: 2096
Now sending hola=021--...ok...Got response 4294967295, round-trip delay: 3098
Now sending hola=021--...ok...Got response 4294967295, round-trip delay: 4101

I don't know why it's ok sending because I turn off the receiver.

How can I get to work together UNO, Ethernet and RF? Or what is missing?

Notes:
-The Receiver stays like Manic's sketch, it doesn't have Ethernet.
-For this project, is ther any difference between Arduino UNO and Arduino UNO R3? The ethernet shield is over the Arduino UNO, I never tested the ethernet over UNO R3.

If more information is required, just let me know.

Thanks a lot,

Edgar L.

Hi, welcome to the forum.

As far as I know the Ethernet Shield can be combined with other SPI devices.
But you have to disable all chip selects before using any of the SPI devices. For the ethernet shield that is pin 4 (sd card) and pin 10 (W5100 ethernet chip), set them as output and high. And also the NRF24L01+ (pin 6 and 7), I don't know if they should be low or high to disable it.

When you do RF24 radio(6,7), the hardware SPI bus is also used.

After everything is disabled, you could test the Ethernet (with and without the RF connected) and the RF module (with and without the Ethernet shield connected).

Hi Peter,

I modified the code like this:

void setup(void)
{
  
  //config the pins to disable spi for ethernet
  pinMode(4, OUTPUT); 
  pinMode(10, OUTPUT); 
  digitalWrite(4, HIGH);
  digitalWrite(10, HIGH);
  //config the pins to disable spi for rf
  pinMode(6, OUTPUT); 
  pinMode(7, OUTPUT); 
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  //...

I tried both HIGH and LOW for 6-7 pins, same result. The result was this:

STATUS			= 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0 
RX_ADDR_P0-1	= 0x0000000000 0x0000000000
RX_ADDR_P2-5	= 0x00 0x00 0x00 0x00
TX_ADDR			= 0x0000000000
RX_PW_P0-6		= 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA			= 0x00
EN_RXADDR		= 0x00
RF_SETUP	 	= 0x00
CONFIG		 	= 0x00
DYNPD/FEATURE	= 0x00 0x00
Data Rate	 	= 1MBPS
Model		 	= nRF24L01
CRC Length	 	= Disabled
PA Power	 	= PA_MIN
Now sending hola=021--...failed.
Failed, response timed out.
Now sending hola=021--...failed.
Failed, response timed out.

I tested the RF with the Ethernet in all cases.

Thanks for answering and Happy New Year

Edgar

I'm sorry, but I don't know !

Do you still use a SoftSPI ? With the pins at (for example) A0, A1, A2 ?
Or is this all hardware SPI ?

Hi,
I've been digging and found this MatHertels WebLog: Using the SPI bus with Ethernet, SD-card and NRF24L01 and other slave devices together
Unfortunately I'm software engineer, I don't have full background in electronic so I've got lost with your question. Sorry.

It seems that Hertel's blog gives some directions, it would take some time to me studying it.

If there's any ideas, still are welcome. Thanks.

I'm successfully using the nrf24L01 modules with an ethernet W5100 shield on an ATMega2560. I'm using the radiohead library and reliable messages. I did have to up the timeout time and retry count to 500 ms and 4 retries. But I have very few errors after doing it. My mods to the example program are in bold.

// nrf24_reliable_datagram_client.pde
// -- mode: C++ --
// Example sketch showing how to create a simple addressed, reliable messaging client
// with the RHReliableDatagram class, using the RH_NRF24 driver to control a NRF24 radio.
// It is designed to work with the other example nrf24_reliable_datagram_server
// Tested on Uno with Sparkfun WRL-00691 NRF24L01 module
// Tested on Teensy with Sparkfun WRL-00691 NRF24L01 module
// Tested on Anarduino Mini (Anarduino Mini Details) with RFM73 module
// Tested on Arduino Mega with Sparkfun WRL-00691 NRF25L01 module

#include <RHReliableDatagram.h>
#include <RH_NRF24.h>
#include <SPI.h>

#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

// Singleton instance of the radio driver
RH_NRF24 driver(8, 53); // for ATMega2560
// RH_NRF24 driver(8, 7); // For RFM73 on Anarduino Mini

// Class to manage message delivery and receipt, using the driver declared above
RHReliableDatagram manager(driver, CLIENT_ADDRESS);

void setup()
{
Serial.begin(9600);
if (!manager.init())
Serial.println("init failed");
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
** manager.setRetries(4); // reduced errors**
** manager.setTimeout(500); // reduced errors**
}

uint8_t data[] = "Hello World!";
// Dont put this on the stack:
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];

void loop()
{
Serial.println("Sending to nrf24_reliable_datagram_server");

// Send a message to manager_server
if (manager.sendtoWait(data, sizeof(data), SERVER_ADDRESS))
{
// Now wait for a reply from the server
uint8_t len = sizeof(buf);
uint8_t from;
if (manager.recvfromAckTimeout(buf, &len, 2000, &from))
{
Serial.print("got reply from : 0x");
Serial.print(from, HEX);
Serial.print(": ");
Serial.println((char*)buf);
}
else
{
Serial.println("No reply, is nrf24_reliable_datagram_server running?");
}
}
else
Serial.println("sendtoWait failed");
delay(500);
}

Hi m

I've been working on your idea and this is what I did:

  1. I found the library and I compiled the nrf24_reliable_datagram_server in the receiver, there's a led to see any incoming data.

  2. Based on http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo I wired the Mega + nRF24 (no ethernet), first CE at 8; it didn't work. Then it tryed with CE at 9, so I changed the code like this:

RH_NRF24 driver(9, 53);
  1. Mega + Ethernet + nRF24, no results. I added these lines in setup() function (after manager.init() call)
  pinMode(10, OUTPUT);
  pinMode(4, OUTPUT);
  digitalWrite(10, HIGH);   
  digitalWrite(4, HIGH);

In all cases the message was:

Sending to nrf24_reliable_datagram_server
sendtoWait failed
Sending to nrf24_reliable_datagram_server
sendtoWait failed

The receiver (arduino uno) was wired according to http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo "Arduino Pin for
RH_NRF24 RadioHead Library"

I've seen many post that say there's some power issue, I haven't use any capacitor so far.
I tried the basic example from Maniacs and it worked fine with no capacitor, so I never added it.

I don't know what's missing.

Thanks