can't get nRF24L01 module to work on MEGA 2560

Hi Arduinos!

everything connected and setup is just like here :

one wifi module on mega and another atmega 328p on breadbord. (both works fine when using blink sketch of other).
but when I upload “getting started” sketch with RF24 Library they do not seem each other!
I have tried switching modules between boarduino and mega but no luck.Again Mega reports that nRF24L01 have zeroes as tx and rx address. (images attached)

Is there any workaround for this?

PS. A heard about power supply to be the issue so I built complete separate 3,3v supply just for modules,All voltages measured are fine.I have checked wiring mode than times :astonished:

Kind Regards

mega.bmp (1.77 MB)

atega.bmp (1.75 MB)

I would connect the CE and CSN connections to D9 and D10 on the Mega and try the same code you used on the other Arduino.

You might want to set D10 to OUTPUT and HIGH in your setup function on the Mega before calling any of the RF24 functions.

void setup() {
  pinMode(10, OUTPUT);

  // rest of your setup stuff

edit: Connect the other SPI data lines to D50 to D52 as described for the Mega.

thank you very much!

I have found a two problems : 1) in mega sketch i should change from RF24 radio(9,10); to RF24 radio(9,53); that's why mega didn't see the modules parameters 2) because i built a completely separate supply for modules i forgot that they have to have common ground! after i wired grounds together , everything works great!

thank you SufferTim for posting here anyway.

Kind regards

Or you could have moved the SS connection to D10 and left the code as it is.

RF24 radio(9,10);

That way the sketch would have been compatible with a Mega and an Uno without the need to modify that setting. Only the SPI data lines (MISO, MOSI, and SCK) would be relocated.

Thanks again!