Hi all,
I have two NRF24LE1 devices, device_A for send data and device_B for receive data, the protocol data included in a 10-bytes length arrary(buffer).
In device_B 's codes, when received an RF frame, in RF_IRQ() of rf.c, it fisrt read the RF data and store them into Rx_buffer, then it set a global flag to 1 to indicate that new RF data has been received. In the meantime, the while loop in main.c check the flag whether equals to 1, if yes, then it will call RF_Handler() to process the RF data, such as light on one LED.
Now the problem is that while device_A periodically(1.5s interval each time) send RF frames, in most time the device_B can periodically light the LED, but not always. My colleagues and I have checked lots of factors and we are sure that 1)device_A can send frames correctly, we have one LED to indicate it; 2)device_B can receive the hardware level data correctly each time(in RF_IRQ()); 3)device_A and device_B are close to each other, about 1m without any walls;
We have another interesting founding that if we low-down the optimization level of Keil C51, the problem happened less than before, but still cannot eliminated(we have changed it to level-2, and to change to level-0 is not allowed cause of code size limitation). So, currently there are global variables: receive_rf_data_flag, and the Rx_buffer[10];
Could you please kindly give your ideas how to permanently eliminate this problem? Thanks in advance!
Best regards! Junma