Strange problem with NRF20L01

timing problem with NRF24 radio
Today at 02:22:02 pm
Hi folks,
i have got a strange behaviour usind a NRF24L01 module and had'nt found the reason.
Following code works and prints every 125mS information about the current time pointers.

void loop(void)
 //**** Scheduler, generates 8 slices@125mS (0..7) and within each slice, 125 millislices (0..124) ****

 // Forming millislice number
 milliSlice = millis() % 125UL; //We make a modulo division with the milliseconds.
 //The result will be directly the expected milliSlice value, that behaves like a chainsaw between 0..124
 if (millisMemory > milliSlice) //We trigger on the falling edge of the chainsaw.
   //============== Running every 125mS ================
   unsigned long start_time = micros();  
   // ok = radio.write( &start_time, sizeof(unsigned long));
   unsigned long end_time = micros(); 
   Serial.println(end_time - start_time);
 } // end 125mS
 millisMemory = milliSlice; // Comparison value to detect the falling edge.
} //end Loop.

If you uncomment the "radio line":

   ok = radio.write( &start_time, sizeof(unsigned long));
   // delayMicroseconds(1560);

and comment the delay a line behind, it will not work, the light d13 will stay lit forever (indicates Radio activity) and nothing is sent to serial.

The "radio.write..." line, placed outside that if statement, takes about 1560 μS to execute.

You need to post the complete program.

What RF24 library are you using?

Have you got wireless communication working properly in another program?

Simple nRF24L01+ Tutorial

Could probably define or redefine variables, such as milliSlice and weird words like that. Use labels that are more intuitive, and less ambiguous.

Now... millisMemory ... what is that one? And is it defined properly in the code? Is it pre-initialised to some value? Or does it need to be pre-initialised to some value?

Also.... in the code.... milliSlice appears to be a variable that stores a current value of time.

And.... toward the end of the code, you make millisMemory become equal to milliSlice

And then at the top of the code, you have if (millisMemory > milliSlice)

Maybe need to make sure all these variables and their values are laid out in the correct order - that's if they're currently not ordered properly.

And.... instead of millisMemory ... maybe store_time might be more intuitive. And current_time instead of milliSlice (etc)?