After I've change the RF_SETUP register (date rate or power) I've noticed the same problem with communication between Arduino and Rpi.
So, I remove the 3.3 V from Pi and plug it back. This is working every time.
Also sometime even the Rpi is sending and the Arduino is replaying back I've :
Now sending 3623408229...ok...Failed, response timed out.
Now sending 3623409445...ok...Failed, response timed out.
Now sending 3623410661...ok...Failed, response timed out.
In order to solve this you need to add a small delay (I've added 5ms) in the while loop.
This delay need to be bigger then 2ms (the time for radio.available to produce a valid output
Code: Select all
while ( ! radio.available() && ! timeout )
{
__msleep(5); //add a small delay to let radio.available to check payload
if (__millis() - started_waiting_at > 200 )
timeout = true;
}
Now with this setup:
Code: Select all
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0e1
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x23
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_LOW
Now sending 3624177587...ok...Got response 3624177587, round-trip delay: 34
Now sending 3624178624...ok...Got response 3624178624, round-trip delay: 33
Now sending 3624179660...ok...Got response 3624179660, round-trip delay: 34
Now sending 3624180697...ok...Got response 3624180697, round-trip delay: 33
Now sending 3624181733...ok...Got response 3624181733, round-trip delay: 33
Now sending 3624182769...ok...Got response 3624182769, round-trip delay: 34
Now sending 3624183806...ok...Got response 3624183806, round-trip delay: 33
I have a constant RTD with 33 or 34 ms.
Now is working also at 250kbs with RF_CONFIG 0x27 displaying PA_HIGH but is working
at PA_MAX (-0dBm). RTD 33ms. Nice.
Adding 5ms delay to let radio.available consuming the payload is fine for me.