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!

  • Hi Jev,

    I'm not so familiar with the nRF24L01 , but have you enabled DPL, Dynamic payload length ? on both side ? Do you receive any TX_DS on the PTX ? (and the PRX if you do ack payload ?)

  • Hung Bui,

    I have tried both DPL enabled and disabled with no luck, at the minute DPL is enabled. Why it should be enabled on both sides? As one works as transmitter another side as receiver only (not taking in account ACK) TX_DC is received only when two messages send one after another. If one packet sent no TX_DS received.

  • 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.

  • Hung Bui ,

    Yes, DPL enabled on both ends. Yes, Radio powered only for a moment. Everytime it is powered it going through configuration routine and then transmission with some delays before and after. So, instead of putting to sleep, I am disconnect the power to radio module as I found even in sleep the module ( nRF24L01 with PA LNA) consumes quite a lot of current (around 1mA) for my application.

    Oh, I see... yes, I am sending same packet twice, but loading it to buffer every time I am transmitting.

    [code]

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

    [/code]

    So if i am replacing a < 2 with a < 1, it transmits ones and receives max_rt error

  • Have you made sure you set CE = 0 or set PWR_UP = 0 before you cut the power ? Could be that the 16Mhz crystal still running.

    My suggestion is to keep sending (more than 2 time) before you switch mode or doing anything else, just try sending continuously, just for testing. Try to change the content of the data on every packet.

Related