I am trying to make this sample (CosaWirelessSender, and CosaWirelessReceiver) work. I wired a pair of NRF24 to 2 arduino Uno boards according to:
- @code
- NRF24L01P
- +------------+
- (GND)---------------1-|GND |
- (3V3)---------------2-|VCC |
- (D9)----------------3-|CE |
- (D10)---------------4-|CSN |
- (D13/SCK)-----------5-|SCK |
- (D11/MOSI)----------6-|MOSI |
- (D12/MISO)----------7-|MISO |
- (D2/EXT0)-----------8-|IRQ |
- +------------+
- @endcode
Made sure:
#define USE_NRF24L01P
in both CosaWirelessSender.ino, and CosaWirelessReceiver.ino
As it does not work the first try. Receiver has time out message, sender also has error message of -2 return on send(...) function. I checked the wiring, it is fine.
I would like to know where to investigate from here. I started on CosaWirelessSender, and saw the send is not successful and return code -2. What should check from here? Appreciate any hint.
A questions:
- If CosaWirelessSender is not running, CosaWirelessReceiver will keep time out, and this is correct behavior
int count = rf.recv(src, port, msg, sizeof(msg), TIMEOUT);
If CosaWirelessReceiver is not running, could the CosaWirelessSender send message or not? How the sender should behave?
I tried RF433 on CosaWirelessSender by #define USE_VWI. Send is always successful, regardless of if CosaWirelessReceiver running or not.
CosoWirelessSender.ino
int res = rf.send(dest, PAYLOAD_TYPE, &msg, sizeof(msg));
Got -2 returned. Try to figure out what to investigate.
Cosa Library:
NRF24L01P::send(uint8_t dest, uint8_t port, const iovec_t* vec)
....
// Failed to delivery
write(FLUSH_TX);
m_drops += 1;
return (-2);
}