rf2401 problem with mega 2560

2/3/12 nRF24L01 problems with mega2560
Bajdi,

Anyone have any ideas how I can improve this?

You're not using the "resistors / voltage dividers" on the data or clock pins to adjust for the 5v logic are you?
see below from earlier forum topic "Problem with Nrf24L01+ and arduino mega." (Carynx was using the mirf library, but similair problem.)

"Had the same problem using the resistors / voltage dividers! If you connect the nrf2410 direct to the mega 2560 problem seems to be fixed. The fault seems to be on pin 5 [should be pin 52] SCK when you use resistors / voltage dividers! "

Your 80% time outs with TX on the mega would be an improvement for me. While my mega2560 has TX to the uno, the mega always times out and never received any TXs.
That is, the MEGA2560 never gets an ok ping back from GettingStarted.pde's ok = radio.write(...)

Recently I've rewired the test circuits back to where I was when I gave up. The nano to nano (using a nano instead of the uno now) is still working fine in both RX and TX. The mega2560 to nano has the mega2560 timing out still.

I'm using radio(CE,CSN), RF24 radio(49,53) also, seems convenient.
My understanding is, in SPI that CE and CSN are both user assignable. This tests out when using working the nano to nano configuration.
Although, if mega's SS pin 53 is not used for CSN, then the mega's SS pin 53 still needs to be output or at least HIGH input. This keeps the mega2560 from becoming a slave (LOW input).
The MOSI(pin 51 mega), MISO (pin 50 mega) and SCK (clock pin 52 mega) are hardwired into the ATmel chip.

Some good docs for the arduino hardware SPI's stuff below.
http://atmel.com/dyn/resources/prod_documents/doc2585.pdf

I'm thinking about connecting the different systems with just a SPI connection, thus elimating the rf24 factor to see which side the problem is on, RF24 lib or SPI lib.

Let me know if you come up with a solution.

Well I got it working after trying lots of things. I found a solution but it's a bit weird. When I connect the RF24 module to my Mega 2560 and take the 3,3V from my lab power supply it works... 100% response rate. My Mega 2560 is a Chinese clone, maybe it has bad 3,3 voltage circuit, I don't know. But it works :slight_smile:
I found this out because I have 4 RF24 modules, 2 small ones with the antenna on the board and 2 big ones with preamp and amp and external antenna. The big ones draw quite a lot of current and you must power them from a separate power supply. I first tested the 2 small ones and ran in to the above problems. After a lot of head scratching I thought that maybe I had a bad module so I connected the 2 big ones and used external power, they worked. I then tried the 2 small ones using the same power supply and they suddenly worked like they should. I then removed the external power supply from the one connected to my Uno and that also worked. When I removed the external power from the one connected to the Mega 2560 and used the 3,3V from the Mega it stopped working, switching back to the external power supply everything was back ok. Weird things... On my Uno and Duemilanove I can use the internal 3,3V but not on the Mega 2560.

Badji,
Thanks much, for your solution. I first used a extra nano's 3.3v to power the mega's nRf24L01 and it worked fine. Next I removed the extra nano voltage supply and put a Tantalum capacitor 4.5uF across the mega's 3.3v and it worked fine. Good design principles pays off.

That's very interesting, I'll definitely try that.

I do confirm the same issue and same solution as Azar3 had: tried tons of wiring, coding, red eyes etc. And got them working enough fine only when I plugged in external power adaptor to Mega board. One week of wasting time :frowning: Finally I may continue.

Hi,

I verified that I'm having the same problem with a couple of Mega's - the RF24 works fine when connect it to the Mega2560 and I power it from an Uno, but not when it's powered from the Mega directly. I would not have found that without your post, so thanks for that!

Azar3 - you said "Next I removed the extra nano voltage supply and put a Tantalum capacitor 4.5uF across the mega's 3.3v and it worked fine." Can you elaborate? Where does the capacitor go exactly - between the Mega's 3.3v and gnd?

Also, I measured the voltage output from the mega's 3.3 pin with a multimeter, and was surprised to see that it was a completely steady 3.30 volts. I guess there's something wrong with the voltage that doesn't get picked up by the multimeter?

Remko

Hi, first, thanks for sharing all your problems and solutions, it helped me fixing my problem! Thanks!

Although i am not using an mega 2560 (yet) i could not get the nrf24l01+ modules to run for quit a time. I used an Arduino UNO r1 and a homebuilt minimalDuino107 clone (slightly modified).

I tried the RF24 GetteingStarted sketch, it was possible to configure moudles, but sending did not work, had always "failed" to send, even though somtimes it received the correct values. Long story short, the problem was the 3.3V power supply. It did not work on the UNO but on the homebuilt version (i used a 33uF elko cap as 3.3Voutput cap). I looked at the voltage with a scope and found a lot of noise at the power line! (on both, but the UNO was really bad)

So what solved my problem: just solder a 100nF ceramic cap across the gnd and 3.3v pins direct on the nrf24l01+ modules!
with the cap in place, noise at the power line really went down and it worked perfect!

So thanks a lot for the thread and the solution with the cap!
btw @remko yes i also measured with a multimeter it seems stable, but have a closer look with a scope...

remko:
....
Where does the capacitor go exactly - between the Mega's 3.3v and gnd?
..
Remko

Remko
Yes. between the Mega's 3.3v and gnd?
The + connection on the capacitor to +3.3v mega's source.
The - on capacitor to ground.
The capacitor connections are best closer to the radio's power inputs in general.
The capacitor then supplements and filters the source supply (mega's 3.3V).

Hope this helps.
azar3

This is the third time this thread subject has come up in the past 3 month 's with nFR24XX radio's and the culprit has always been a missing cap on the mega 3V3 source C13 on the mega is a 1uF MLM ceramic capacitor connected from pin 5 (3V3 source) of the LP2954-33DBVR to ground. I would highly recommend 100 to 220 uF bypass capacitors if you are more than 3 - 4 inches away from the board.. I use 47u on the 3V3 source as it comes up on the shield that uses 3V3 and 10u at every use of the 3V3 source (radio) the only place that the Rev 3 2560 boards use the 3V3 source is as the reference voltage for the Ext/USB power switch/control comparator. The other half of the LM358 is used as the pin 13 light driver.
C13 at 1uF is just fine for the comparator bias bypass capacitor but fails miserably when any more current is drawn from the 3V3 source, I found mine by using an analog scope.. a Tektronics 2213 showed about 3/4's of a volt of noise riding on the 3V3 source. If the BOD in the radio is working you might well be resetting your radio with the noise on the power supply.
Bypass capacitors are good engineering, like magic bullets and many devices might work without them but not all will and none are truly reliable working 'well' or not. Sometimes engineers leave them off of the diagram unless they are real special. Every Engineer is aware of the consequences and symptoms of not using them assumeing that others know the importance of them and to add them in the final design and that encourages some to say that they are un-necessary and a waste of good money.
After 50 years of doing this stuff. I still forget from time to time and the results are always similar. inexplicably erratic behavior, One day it works fine the next not at all and on another..half of the time, sometimes the front half and sometimes the rear half.

Bob

Thank you all, in my case (Mega Fundino Chinese) was enough filter capacitor 100nF between 3.3V and GND.

Greetings folks,
I've spent almost 12 hours trying to get two NRF24's "using an UNO & a MEGA-2560" talking to each other when I stumbled upon the power issue topic considering the Mega boards. Here's a screen shot showing the 3.3v power lines on the UNO "Blue trace" and the Mega "Yellow trace":

UNO

and the MEGA

Apparently these RF modules are quite sensitive to how clean your voltage line is and a stable supply waveform seems to be essential for proper functioning.
I'll mention the various methods I tried to overcome this issue and their impact in case it helps anyone:
-Tried adding decoupling capacitors starting from as low as 100nf up to 10uf---> Minimal improvement of the waveform shape but it didn't work.
-Tried powering the MEGA from an external power source---> No effect on the waveform so it didn't work either.
-Used an external bench supply to power up the RF module on the MEGA side --->Bob's your uncle, works like charm.
-Used an arduino Due 3.3v rail ---> Worked as well.

So in conclusion:
-It was the crappy Mega's 3.3v line that was problematic as you folks mentioned earlier. I have an original Mega that I bought off arduino's site.
-The Due's 3.3v line isn't that clean & seems to be border-line"I'll post the waveform when I've time".
-Overall the UNO's 3.3v waveform is the cleanest & most stable one.

This issue gave me all sorts of funny & unexpected output on the terminal while running the examples of the RF24 library.

I hope the 3.3v rail can be improved in future revisions on both the Mega & the Due as this can be a serious limiting factor for sensors & modules working off the 3.3v supply.

Cheers.

I know this is an old thread however it seems to be referenced quite a bit - I thought I'd share my experiences here...

I have two Nano v3.0 (chinese) plus an Uno (real one), and two nRF24L01+ modules with aerials. I am using the RF24 library. I have been testing using the 'pingpair' example.

Like many others, I spent days fiddling with these things. I got erratic behaviour, usually just one packet recieved by one unit but the reply not seen by the other etc etc. After lots of googling and much reading of the datasheet (datasheet?? it's a datanovel!), putting endless debug prints in the library, I decided that it must be the power supply, as the library worked OK for so many others.

I tried all different combinations of Arduinos, RF units, onboard power (3.3v and 5v with regulator), offboard power supplies (again 3.3v/5v), all with different value caps. The only change in the behaviour of the units was that sometimes they would not work at all.

Eventually I ran the 'scanner' example, and found that one radio unit was picking up my home wifi, while the other showed all zeros. I started again with the capacitors on the unit that was showing zeros - starting from 10nF and working up.

1.5uF was the magic capacitor, for a radio unit running off onboard 5v on a Nano, with a 3.3v regulator (cap going across the legs of the regulator) - I am looking at two serial monitors showing soothing send/recieve confirmations, and I am at peace.

The other unit is running off an Uno with an external 3.3v supply and a 0.1uF capacitor this is also working fine. Have not tested with the other Nano.

For those still fighting this - get a bigger capacitor.

I learned a lot but I'm glad it's over.

B

Hi,

Would you have an address for the download of the driver for Arduino Mega and the rf2401, the site I go to seems not to have the zipped driver at https://github.com/maniacbug/RF24/downloads.

I have been trying to get the code for communication to work by downloading each one of the files, with no success.

thanks in advance.
Peter
support@killarneynet.co.za

HI,

Can anyone please point me to where to download the driver for nRF2424L01 driver, seems the URL https://github.com/maniacbug/RF24/downloads has no download available.

Thank you in advance, I hope someone gets this message.

The download link is on this page:

Here is the direct link:
https://github.com/maniacbug/RF24/archive/master.zip

-transfinite

Hi

Can not thank you enough :slight_smile: transfinite, its 04h30 in South Africa and I'm digging into my holiday project.

Thanks and chat again.

Morning,

I have successfully downloaed and followed the instructions from Getting Started with nRF24L01+ on Arduino | maniacbug, but appear to be getting lots of compile errors, I'm guessing that the compiler Arduino 1.0.5 is NOT the correct compiler.

I have attached errors if any one can suggest what compiler I should be using, I would appreciate it as I have not found much support on the errors from Google or Arduino.

Thank you
Peter

ErrorsForGettingStarted.txt (8.6 KB)

I have absolutely no problems with the RF24 library and Arduino 1.0.5 IDE. Compiles without errors on my system. You sure that you have installed the right way? http://arduino.cc/en/Guide/Libraries

I'we tried to get the nRF24L01+ to work with Aduino Uno and a Arduino Mega 2560 :o
Iwe studied several pinouts and all reporting the same, but i got the Mega working whit this setup:

nRF24N01+ Mega 2560

GND GND
VCC 3.3
MISO 50
MOSI 51
SCK 52
CE 9
CSN 10

The differense for me was changing pin [53] to [10], the csn Line. Orginal i only got the message:
"Got payload 4294967295...Sent response."

This turnes out to be, as "el_supremo" said:

In hexadecimal 4294967295 is FFFFFFFF which means that the device is always reading ones which suggests that you haven't got it wired up correctly.

Lib RF24 returning 4294967295 for everything from nRF24L01

Second thing to mention is, when I got the boards up running, to get the sample sketch from RF24 lib "GettingStarted". i needet to set the board to Transmit by pressing "T", then set it back to PingPong by pressing "R". Then the pingpong was functional.