nrf24l01 with mega

i have 4 nrf24l01 with uno working perfectly but when i use mega2560 instead of uno .....there is problem in reception and transmission ....

pins configuration are

MEGA 2560:
MISO -> 50
MOSI -> 51
SCK -> 52
CE -> 8
CSN -> 7
GND -> GND
VCC -> 3.3v

node1

#include "Arduino.h"
#include <SPI.h>
#include<RF24.h>
#include <MatrixMath.h>
//#include <Wire.h>
RF24 radio(7, 8);
byte addresses[][6] ={"1Node","2Node","3Node","4Node"};
float lm[1][1]={0.98};
float phi1[2][2]={
  {0.2,0.1},
  {0.3,0.2}
};

  
float gkk[2][1]={0.33,0.25};
float akk[1][2]={0.4,0.5};
float b1[2][2];

float phi0[2][2]={{0.5,0.6},{0.4,0.6}};
float phi2[2][2];
float b2[2][2]={{0,0},{0,0}};
float s[2][2];
float k[2][2];
float b3[2][2];
void setup() {
 
  {
    for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
 b1[i][j]={phi1[i][j]};
    }}}
  Serial.begin(9600);
  //Serial.println(("transmitter"));
  radio.begin();
  radio.setPALevel(RF24_PA_MIN);
  radio.setDataRate(RF24_2MBPS);
  radio.openWritingPipe(addresses[1]);
  radio.openReadingPipe(2,addresses[2]);
   radio.openReadingPipe(3,addresses[3]);
  Matrix.Multiply((float*)gkk, (float*)akk, 2, 1, 2, (float*)s);
  {
    for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
       k[i][j]={phi0[i][j]/lm[0][0]};
     
  }
}}
Matrix.Subtract((float*)k, (float*) s, 2, 2, (float*) phi2);
{
    for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
 b2[i][j]={phi2[i][j]};
    }}}
      
    }
    
void loop() {


 // (int o=0 ; o<1000 ; o++){
  //Serial.println(o); 
     unsigned long  StartTime = micros();
 //StartTime = 0;
  //StartTime = 0;

    
  Matrix.Multiply((float*)gkk, (float*)akk, 2, 1, 2, (float*)s);
  
  { 
  for (int i=0 ; i<2 ; i++){
 for (int j = 0; j < 2; j++ ) {
     k[i][j]={b1[i][j]/lm[0][0]};}

  
  }}
  
  Matrix.Subtract((float*)k, (float*) s, 2, 2, (float*) b3);
  //Matrix.Print((float*)b3, 2, 2, "b3");
  
{
    for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
 b1[i][j]={b2[i][j]};
    }}}
{
    for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
 b2[i][j]={b3[i][j]};
    }}}
    
    radio.stopListening();
    {
    for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
  if(radio.write(&b3[i][j], sizeof(float) )){
 }}}}
   { //Serial.println("b3[i][j]");
    for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
      
  Serial.println(b3[i][j]);
 
    }}}

 


{{  
  for (int j=0 ; j<2 ; j++){
     
radio.startListening();
radio.openReadingPipe(2,addresses[2]);
unsigned long started_waiting_at=millis();

    while (! radio.available()){
  if (millis()-started_waiting_at > 200) {
    Serial.println("no response recived");
    return;
  }
}
 radio.read(&akk[0][j], sizeof(float)); 
 Serial.print("akk "); 
 Serial.println(akk[0][j]); 
}}}

  //radio.startListening();



{{  
  for (int j=0 ; j<2 ; j++){
    radio.openReadingPipe(3,addresses[3]);
 unsigned long started_waiting_at=millis();

    while (! radio.available()){
  if (millis()-started_waiting_at >200) {
    Serial.println("no response recived");
    return;
  }
}
if(radio.available()){
 radio.read(&gkk[0][j], sizeof(float)); 
 Serial.print("gkk "); 
 Serial.println(gkk[0][j]);}
 }}} 
      unsigned long CurrentTime = micros();
unsigned long ElapsedTime = CurrentTime - StartTime;
Serial.print("ElapsedTime");
Serial.println(ElapsedTime); 
  }
//}

node2

#include "Arduino.h"
#include <SPI.h>
#include<RF24.h>
#include <MatrixMath.h>
RF24 radio(7, 8);
byte addresses[][6] ={"1Node","2Node","3Node","4Node"};
float lm[1][1]={0.8};
float b3[2][2]={{0.3,0.5},{0.6,0.7}};
float sk[2][1]={0.5,0.6};
float l[1][2];
float akk[1][2];
float J[1][2];
float r[1][1];
float a[1][1]={1};
float d[1][1];
float gkk[1][2];
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setPALevel(RF24_PA_MIN);
  radio.setDataRate(RF24_2MBPS);
  //radio.openWritingPipe(addresses[0]);
  radio.openWritingPipe(addresses[2]);
  radio.openWritingPipe(addresses[3]);
  //radio.openWritingPipe(addresses[4]);
  radio.openReadingPipe(1,addresses[1]);
  radio.startListening();
  
}

void loop() {
  Matrix.Transpose((float*)sk,1,2,(float*)J);
  { 
    for (int i=0 ; i<1 ; i++){
    for (int j = 0; j < 2; j++ ) {
       l[i][j]={J[i][j]/lm[0][0]};
       
  //Serial.println("l");
    }}} 
Matrix.Multiply((float*)l, (float*)b3, 1, 2, 2, (float*)akk);
Matrix.Multiply((float*)akk, (float*)sk, 1, 2, 1, (float*)r);
Matrix.Add((float*)r, (float*) a, 1, 1, (float*) d);
{ 
    for (int i=0 ; i<1 ; i++){
    for (int j = 0; j < 2; j++ ) {
       gkk[i][j]={akk[i][j]/d[0][0]};
      
}}}
    
    radio.startListening();
    radio.openReadingPipe(1,addresses[1]);

unsigned long started_waiting_at=millis();

{
 for (int i=0 ; i<2 ; i++){
    for (int j = 0; j < 2; j++ ) {
       
float b3[i][j];
while (! radio.available()){
  if (millis()-started_waiting_at > 200) {
    Serial.println("no response recived");
    return;
  }
}
 radio.read(&b3[i][j], sizeof(float)); 
 
 Serial.print("b3[][] ");
 
 Serial.println(b3[i][j]); 
 
   }}}
 radio.stopListening();
 radio.openWritingPipe(addresses[2]);
 {
  {
   Serial.println("akk");
      for (int j=0 ; j<2 ; j++){
 radio.write(&akk[0][j], sizeof(float));
  Serial.println(akk[0][j]);
   }}
   radio.stopListening();
  radio.openWritingPipe(addresses[3]);
   { Serial.println("gkk");
   for (int j=0 ; j<2 ; j++){
    radio.write(&gkk[0][j], sizeof(float));
   Serial.println(gkk[0][j]);

  }}

  radio.startListening();
  
}
}

is rf24 library is comfortable with mega2560
plz help

and node4 node3 have same code just different piping

Start with something simple - i.e. without the complications of the matrix maths and the floats etc. Get the wireless stuff working before you add in your other code as the wireless part is hardest to debug.

Have a look at this Simple nRF24L01+ Tutorial. It should work with your pin allocations though it may be wiser to use pin 53 for CSN. And if you don't use pin 53 for CSN make sure it is set as OUTPUT.

I have recently got a Mega clone whose 3.3v pin won't drive the nRF24. My genuine Mega will.

...R

thank you robin its start talking after soldering 10uf capacitor with nrf24l01 three nodes are talking to each other 3rd node is also taking response from 4th node but 4th node is not receiving from 3rd any way thanks dear...sorry for bad english .....

ishtiaq:
thank you robin its start talking after soldering 10uf capacitor with nrf24l01 three nodes are talking to each other 3rd node is also taking response from 4th node but 4th node is not receiving from 3rd any way thanks dear...sorry for bad english .....

I presume you have some very simple example programs for test purposes - please post them.

...R

ok sir i will

ishtiaq:
ok sir i will

I'm just an ordinary guy like yourself. I am not a "sir"

...R