This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF24L01 Ack issue / tx giving max_rt error / PIC18F25K20

Hi,

I am having problem with setting up TX side of my project. It always giving me max_rt error if I am sending only once per cycle. 1 Cycle is every 30seconds. All working fine without ACK enabled, with ACK enabled all stops. Only few times I have managed to get rid of this error and it started transmitting and receiving, same code used and the only difference I have accidentally reapplied power to the radio module. Seen few topics already on the forums but answers mentioned there not helped me at all.

Power circuit is fine, with additional low pass filter, decoupling capacitors and etc,. The strange about this, that it transmits and receives ACK if I am transmitting more than once per cycle.

    for (a = 0; a < 2; a++)
    { 
        TransmitMessage2TheHub(); 
    }

But if I am transmitting only once it always sending MAX_RT error in response.

The code of transmission is here:

void Transmit_nRF24L01_TX( unsigned char *TX_Data )
{
unsigned char i, data, cmd;
unsigned char reply;
_asm clrwdt _endasm; 
SPI_CE = 0;
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0x00);                   // Read from CONFIG Register Address 0x00; R_REGISTER 000 00000 
SPI_nRF24L01_Send_Read(0xFF);                   // Read value from buffer
SPI_CSN = 1;  
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();     
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0x20);                   // Write to CONFIG Register Address 0x00; W_REGISTER 001 00000 
SPI_nRF24L01_Send_Read(0x0A);                   // Disable IRQ on TX & RX; Enable CRC; 1 Byte CRC scheme; Power Enable; Enable TX Mode 
SPI_CSN = 1; 
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();    
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0xB0);                   // W_TX_PAYLOAD_NO ACK; Used in TX mode. Disables AUTOACK on this specific packet.
for (i = 0; i < RF_PAYLOAD; i++)
{
	SPI_nRF24L01_Send_Read(TX_Data[i]);
}
SPI_CSN = 1;
Delay10KTCYx(1);
SPI_CE = 1;
Delay10KTCYx(35);
SPI_CE = 0;
SPI_CSN = 0;
reply = SPI_nRF24L01_Send_Read(0x07);                   // Read from Address 0x07;
SPI_CSN = 1; 
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop(); 
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0xE2);                   // FLUSH_RX - 1110 0010; Flush RX FIFO, used in RX mode
SPI_CSN = 1;   
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop(); 
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0xE1);                   // FLUSH_TX - 1110 0001; Flush TX FIFO, used in TX mode 
SPI_CSN = 1;   
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();  
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0x07);                   // Read from Address 0x07;
SPI_CSN = 1; 
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();  
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0x27);                   // Write to STATUS Register Address 0x07; W_REGISTER 001 00111
SPI_nRF24L01_Send_Read(0x7E);                   // Clear RX FIFO bit; Clear TX FIFO bit; Clear MAX number of retransmits bit; RX FIFO EMPTY; Available locations in TX FIFO
SPI_CSN = 1;  
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop(); 
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0x07);                    // Read from Address 0x07;
SPI_CSN = 1; 
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();    
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0x00);                   // Read from CONFIG Register Address 0x00; R_REGISTER 000 00000 
SPI_nRF24L01_Send_Read(0xFF);                   // Read value from buffer
SPI_CSN = 1;  
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();    
SPI_CSN = 0;
SPI_nRF24L01_Send_Read(0x20);                   // Write to CONFIG Register Address 0x00; W_REGISTER 001 00000 
SPI_nRF24L01_Send_Read(0x0A);                   // Disable  IRQ on TX& RX; Enable CRC; 1 Byte CRC scheme; Power Enable; Enable TX Mode 
SPI_CSN = 1; 
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop(); 
Delay1KTCYx(3);
SPI_CE = 1;                               }//Transmit_nRF24L01_TX( unsigned char *TX_Data )

Thank you in advance!

Parents
  • You need to enable DPL on both side so that the receive also know that the packet length is dynamic and it should check for the NOACK bit.

    Do you mean you transmit and then you disable the radio and then transmit again ?

    If you do that and don't change the content of each packet you send, the RX will think that it's a re-transmission (because PID doesn't change, content doesn't change) and ignore them.

    If you send 2 or more packets in a row, the PID will change, and the RX can recognize that it's a new packet.

Reply
  • You need to enable DPL on both side so that the receive also know that the packet length is dynamic and it should check for the NOACK bit.

    Do you mean you transmit and then you disable the radio and then transmit again ?

    If you do that and don't change the content of each packet you send, the RX will think that it's a re-transmission (because PID doesn't change, content doesn't change) and ignore them.

    If you send 2 or more packets in a row, the PID will change, and the RX can recognize that it's a new packet.

Children
No Data
Related