nrf24l01 radios + RF24 library + Ethernet shield do not work together

test done... I used the 10uf electrolytic capacitor, but unfortunately it did not solve my problem.

When I do not plug the ethernet shield, everything works fine. When plug it on the arduino, the radio stops working =(

Any other idea?

Hello! I have used these around 1 year no problems

Having following Arduino (clone) 1280 <--> NRF24L01:
51: MOSI
GND: GND
52: SCK
50: MISO
48: CE
49: CSN
3V: VCC
GND: GND
Pin6 is connected to 433Mhz transmitter
Pin22 has thermometers (2pcs)
w5100 network board is normally attached to default pins of 1280, not yet any other problems than this is slow...

But I have problems with 433Mhz receiver:
Pin5 is connected to 433Mhz receiver (not used but just connected, sometimes Arduino hangs), receiver is 5v.
Also tried to connect 433Mhz receiver to Pin2 (interrupt 0), but same not good results. So not using receiver currently,just transmitter

Edit: oh, I noticed now you are using UNO, not mega

I've found people saying that used the nrf24l01 radio + rf24 library with ethernet shield, but it is hard to believe, since I've been trying all suggestions but with no success.

The only thing that I have in mind now is that I can try another library other than the RF24 that does not use the ICSP pins.

Have you disconnected the nRF from pin 10, as stated in an earlier post.

The RF24 radio(6,7) means you should be using pin 6 for CE and pin 7 for CSN.

How exactly are you connecting, as a later post mentions pin 4?

The ethernet shield will use 10 as CS, then they share 11, 12, 13 for SPI

I have used thes together successfully and I am still doing, although I am now using ENC28J60 ethernet boards instead if the W5100 based shields.

Hi tack,

I am not using the pin 4. Another user just suggested me to set pin 4 as HIGH in order to disable the SDcard of the shield. (by the way, my shield does not have sdcard embeeded)

I am using the pins 6 and 7 for CE and CSN pins.

I am sure I am not wiring the nrf14l01 incorrectly, because everything works ok when I do not plug the ethernet shield.

So, the scenario is the following:
When I have my arduino UNO only with the nrf24l01 connected in the ports 6, 7 (for CE and CSN), 11,12 and 13, everything works fine.
But when I plug the ethernet shield, the radio stops working.
In my tests, I did not change the sketch, so I do not initialize the ethernet shield, I just plug the shield... nothing else.

Do you used any trick to make the shield and the radios working together? (e.g., using some capacitor with the radio, or setting port 10 as HIGH).

Thanks!

I've dropped you a PM for your email to send you an old sketch I had when using Arduino Uno with a Wiznet based Ethernet Shield for testing.

It might also be a good idea to post some pictures/diagrams of your connections and your code for people to look over.

Hi everyone,

tack sent me a code which was working fine with him, but it did not work for me when stacking the ethernet shield.

I think my problem is a hardware incompatibility, because I've done tons of tests.

I've found the information below on the oficial site of the freetronics (Stacking Arduino Shields | Freetronics)

"One little catch is with Ethernet shields based on the Wiznet W5100 chipset, which includes the official Ethernet shield and many third-party shields. The W5100 has a design flaw that causes it to maintain control of the SPI bus even when another device has been selected, making it very tricky to combine the official Ethernet shield with other shields that use SPI."

My next test needs to be using an official arduino ethernet shield. (currently, I am using the Seeed Studio Ethernet Shield v1.1.)

"One little catch is with Ethernet shields based on the Wiznet W5100 chipset, which includes the official Ethernet shield and many third-party shields. The W5100 has a design flaw that causes it to maintain control of the SPI bus even when another device has been selected, making it very tricky to combine the official Ethernet shield with other shields that use SPI."

That is not true. It works well with other SPI devices. I use it a lot with the SD card. The major problem is not disabling all SPI devices before starting the begin() functions for those devices.

currently, I am using the Seeed Studio Ethernet Shield v1.1.

Is that an ENC28j60 IC?

Hi SuferTim, seems like you are the specialist :grin:
I have the same problems. Without the 5100 it works fine. Clear settings on the nRF24L01. Exactly as I set them.
If I plug in the ethernet card, that works fine. But the nRf24L01 sends out garbled output from its registers.

STATUS           = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1     = 0x0000000080 0x1111112188
RX_ADDR_P2-5     = 0x00 0xff 0xff 0xff
TX_ADDR          = 0xffffffffff
RX_PW_P0-6       = 0x00 0x00 0x00 0x80 0x00 0x00
EN_AA            = 0x00
EN_RXADDR        = 0xff
RF_CH            = 0xff
RF_SETUP         = 0x00
CONFIG           = 0x00
DYNPD/FEATURE    = 0x80 0x00
Data Rate        = 1MBPS
Model            = nRF24L01
CRC Length       = 16 bits
PA Power         = PA_MIN

Barry Emons demo
server is at 192.168.0.200

I measured the voltage on the 3.3V with my fluke and it showed an exact 3.3V. I I'll try a scope tomorrow. But it is strange.

Seems like I had to move the CSN pin to pin 53. I thought I could use any pin for CSN and CE. Put (on my Mega2560) CE on pin 40, and CSN on pin 53. and got it working.
Getting the right response etc.
So up to the next challenge :slight_smile: connect up to 25 or more devices to 1 sender/receiver.

Just to insure I understand your setup, how did you start the RF24 library with that pin setup? Did you use this?

RF24 radio(40,53);

yep.
Seems like the CSN pin is pretty picky....

If you tried other pins for the CSN pin and it didn't work, then you move it to the default slave select pin for the Mega and it does work, that would appear to be a bug in the RF24 library. The CSN pin should work on about any digital pin. ??

edit: Let me change that earlier statement so it is correct.

"One little catch is with Ethernet RF24 shields based on the Wiznet W5100 RF24 chipset, which includes the official Ethernet shield and many third-party shields. The W5100 RF24 has a design library flaw that causes it to maintain control of the SPI bus even when another device has been selected, making it very tricky to combine the official Ethernet shield RF24 with other shields that use SPI."

Hi Tim
I still have to recheck with CSN on another pin. If so, it would certainly help. A software bug is easier to fix than a hardware one :slight_smile:

In my current setup I have a mega2560 with the W5100 ethernet and a nRF24L01+ as motherstation. 2 Uno's each with a nRF24L01+. The all share the same address for reading and another for writing. In the message I send, there is a device ID so that the right device can respond and it works great :slight_smile:
Now time to build an app in Appcelerator to replace the webbrowser :slight_smile:

jackbarxiao:
Voltage Regulator Chip.

Of the Arduino? Then why does it not work if I move the CE pin to another location?

By some stupid error I broke the Mega2560 so I had to fall back on the Uno. And of course the W5100 and the nrf24L01 did not like to cooperate. So I did the following:
Changed the nrf24L01 library to use DigitalIO(= SoftSPI)
And this worked great. code changes:
in rf24.h I added

#include <DigitalIO.h>
const uint8_t SOFT_SPI_MISO_PIN = 16;
const uint8_t SOFT_SPI_MOSI_PIN = 15;
const uint8_t SOFT_SPI_SCK_PIN  = 14;

and in the class declaration:

<class RF24
{
private:
	SoftSPI<SOFT_SPI_MISO_PIN, SOFT_SPI_MOSI_PIN, SOFT_SPI_SCK_PIN, SPI_MODE> spi;

in rf24.cpp
Change SPI. into spi.

and comment out the following lines

#ifdef ARDUINO
//  spi.setBitOrder(MSBFIRST);
//  spi.setDataMode(SPI_MODE0);
//  spi.setClockDivider(SPI_CLOCK_DIV4);
#endif

Not the final solution yet, but now it always works :slight_smile:

If it could help , i noticed the Nrf+Eth problem also with the other MIRF library. I think i found the mistery cause in the CSN pin. If i unplug it, everything works fine. So weird

Hi All,

first of all, the problem is very well presented by danielcugler, but I see no last response of problem solved after having the last solution from nicoverduin.
Last message from SurferTim, "That is not true. It works well with other SPI devices.", I expected to see the arguments, the solution and the prove that it is not true, but nothing...

I face same delicate problem, my NRF24L01 is connected at arduino Mega2560 which has already RTC shield attached for clock, addressable sensor temperature and DHT22 sensor beside the "wonderful" shield W5100 which should also use SD card for data log. I'm still stuck in NRF24 not working because of this SPI share, even if I used software to disable D10 and D4 I still see no radio communication. I mention that radio is working well without W5100 shield.

I have to try the last solution mentioned by nicoverduin and to confirm if this is also a solution for me. The subject is very delicate and this should be a solution from producer not from customer tries

Thank you,

Ok, so here is the solution tested and working for me. Inspiration is from SurferTim wich works great.
I defined a subroutine for each shield I want to activate, as below:

void Activate_NRF24(){
  // disable SD SPI
   pinMode(4, OUTPUT);
   digitalWrite(4, HIGH);

   // disable w5100 SPI
   pinMode(10, OUTPUT);
   digitalWrite(10, HIGH);
   
   // enable NRF24
   pinMode(9, OUTPUT);
   digitalWrite(9, LOW);

}

where D9 is the CSN for NRF24.

or for working with SD

void Activate_SD(){
  // enable SD SPI
   pinMode(4, OUTPUT);
   digitalWrite(4, LOW);

   // disable w5100 SPI
   pinMode(10, OUTPUT);
   digitalWrite(10, HIGH);
   
   // disable NRF24
   pinMode(9, OUTPUT);
   digitalWrite(9, HIGH);

}

Then with the subroutine whenever and wherever it is necessary just call it. This means just one shield active at a time.
I tested and works great. I'm interest now in send/receive at about 10 minutes intervals.