Hi,
I’m using an arduino to talk to two nrf24L01 boards, all colocated on a 5x7 proto board. I’m using this setup (as read from the registers):
Board: 1 (Receiver)
CONFIG= 1111
EN_AA= 1
RXADDR= 1
SETUP_AW= 11
RF_CH= 1010
RF SETUP= 1
OBSERVE_TX= 11 ← before I’ve sent data, so i think this is just junk
TX_ADDR= 10
RX_ADDR_P0= 10
FIFO_STATUS= 10001
++++++++++++++++++++++++++++++++++
Board: 2 (Transmitter)
CONFIG= 1110
EN_AA= 1
RXADDR= 1
SETUP_AW= 11
RF_CH= 1010
RF SETUP= 1
OBSERVE_TX= 11
TX_ADDR= 10
RX_ADDR_P0= 10
FIFO_STATUS= 1
I send data when I receive data, as notified by the IRQ (and send once before looping to start it all off.)
I’m trying to send 10 bytes: 0 1 2 3 4 5 6 7 8 9
What I get is: 40 40 0 0 1 1 2 2 3 3
I’m fairly confident I’m sending data because I increment the first byte of the data buffer every time I receive data, and so 0 0 increments to 1 1, 2 2, 3 3, etc.
Here’s my ISR:
void nrfProcessIRQ1( void ) {
// nrfSetCE( 1, LOW ); // disable receiver
// byte oldSREG = SREG;
// cli();
// store STATUS register contents to globals
rx_status = nrfReadReg ( 1 , STATUS);
tx_status = nrfReadReg ( 2 , STATUS);
if (rx_status & RX_DR) //Data Received?
{
nrfReceivePayload ( 1, nrfDataIn); //read from board 1 into DataIn
// flagRemoteDataReceived = 1;
flagRemoteDataReceived++;
nrfFlushRxBuf ( 1 ); //flush buffer of board 1
}
if (tx_status & MASK_TX_FIFO_FULL) nrfFlushTxBuf (2 );
if (tx_status & TX_DS) nrfFlushTxBuf ( 2 );
if (tx_status & MAX_RT) nrfFlushTxBuf ( 2 );
nrfWriteReg ( 1, WRITEreg + STATUS,MASK_IRQ_FLAGS); // clear ints
// nrfSetCE( 1, HIGH ); // Enable receiver
// SREG = oldSREG;
}
As you can see, I was trying to avoid further interrupts while servicing the IRQ, but they didn’t seem to have any effect.
I physically swapped the boards (made tx be rx) and get the same results.
Any ideas how I can be getting such odd doubling of data? The modules are 4 inches apart. I don’t know if this makes a difference.
Thanks,
Nate```