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

NRF24L01+ PIPE

Hello,

My name is krishna, I have couple of NRF24L01+ modules,

I am trying to implement MultiCeiver in the NRF module. The problem is i am able to receive or transmit data through Pipe 0 and Pipe 1. But unable to communicate with the remaining Pipes.

 unsigned char TX_ADDRESS_P0[TX_ADR_WIDTH]= {0x78,0x78,0x78,0x78,0x78};	//
unsigned char RX_ADDRESS_P0[RX_ADR_WIDTH]= {0x78,0x78,0x78,0x78,0x78};	//

unsigned char TX_ADDRESS_P1[TX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF1};	//
unsigned char RX_ADDRESS_P1[RX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF1};	//

unsigned char TX_ADDRESS_P2[TX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0x01};	//
unsigned char RX_ADDRESS_P2[RX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0x01};	//

unsigned char TX_ADDRESS_P3[TX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF3};	//
unsigned char RX_ADDRESS_P3[RX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF3};	//

unsigned char TX_ADDRESS_P4[TX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF4};	//
unsigned char RX_ADDRESS_P4[RX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF4};	//

unsigned char TX_ADDRESS_P5[TX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF5};	//
unsigned char RX_ADDRESS_P5[RX_ADR_WIDTH]= {0xB3,0xB4,0xB5,0xB6,0xF5};	//


void init_NRF24L01(void)
{
        delay_us(100);
	PORT_RF_OUT clr BIT(CE);    // chip enable
	PORT_RF_OUT set BIT(CSN);   // Spi disable
	PORT_RF_OUT clr BIT(SCK);   // Spi clock line init high
	nRF24L01_SPI_RW_Reg(WRITE_REG + EN_AA, 0x3f);      // Turn on auto acknowledge
	nRF24L01_SPI_RW_Reg(WRITE_REG + SETUP_AW, 0x03);      // Address widht 5 bytes
	nRF24L01_SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x03);  //Enable data P0
	nRF24L01_SPI_RW_Reg(WRITE_REG + SETUP_RETR, 0x1a);  //500us + 86us, 10 retrans...
	nRF24L01_SPI_RW_Reg(WRITE_REG + RF_CH, 0);        // Chanel 0 ; RF = 2400 + RF_CH* (1or 2 M)
	nRF24L01_SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x04 | 0x06);   		// 1M, 0dbm (0x26 => 250kpbs, 0x07 => 1Mbps, 0x0F => 2Mbps)
	nRF24L01_SPI_RW_Reg(WRITE_REG + RX_PW_P0, RX_PLOAD_WIDTH); // Do rong data truyen 32 byte
        nRF24L01_SPI_RW_Reg(WRITE_REG + RX_PW_P1, RX_PLOAD_WIDTH); // Do rong data truyen 32 byte
        nRF24L01_SPI_RW_Reg(WRITE_REG + RX_PW_P2, RX_PLOAD_WIDTH); // Do rong data truyen 32 byte
        nRF24L01_SPI_RW_Reg(WRITE_REG + RX_PW_P3, RX_PLOAD_WIDTH); // Do rong data truyen 32 byte
        nRF24L01_SPI_RW_Reg(WRITE_REG + RX_PW_P4, RX_PLOAD_WIDTH); // Do rong data truyen 32 byte
        nRF24L01_SPI_RW_Reg(WRITE_REG + RX_PW_P5, RX_PLOAD_WIDTH); // Do rong data truyen 32 byte
	nRF24L01_SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS_P2, TX_ADR_WIDTH);    //
	nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, RX_ADDRESS_P0, RX_ADR_WIDTH); //
        nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P1, RX_ADDRESS_P1, RX_ADR_WIDTH); //
        nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P2, RX_ADDRESS_P2, RX_ADR_WIDTH); //
        nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P3, RX_ADDRESS_P3, RX_ADR_WIDTH); //
        nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P4, RX_ADDRESS_P4, RX_ADR_WIDTH); //
        nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P5, RX_ADDRESS_P5, RX_ADR_WIDTH); //
	nRF24L01_SPI_RW_Reg(WRITE_REG + CONFIG, 0x0);   		 // Enable CRC, 2 byte CRC, Send
	delay_ms(16);
}

this is the code i used to communicate but it is not working for Pipe2 to Pipe5. is there any mistakes in my code or i am add something in my code?

please help me.

Thanks a lot,

regards, Krishna.

  • Hi Krishna,

    Have you looked at how the address on Pipe 2 to 5 is configured in Figure 13 at section 7.6 in the nRF24L01p Product Spec?

    The address on those pipe share the same first 4 bytes with RX_ADDR_P1 and has only one unique byte.

    You would need to configure your TX to match with the address to be able to send to those pipe.

  • Hi Hung, First of all Thank you very much for reply,

    Have you looked at how the address on Pipe 2 to 5 is configured in Figure 13 at section 7.6 in the nRF24L01p Product Spec?

    Yes i looked that and i hope i did that, it is mentioned in the above code i posted.

    enter code here
    
    // for pipe 0
    void nRF24L01_TxPacket(unsigned char * tx_buf)
    {
    	PORT3_RF_OUT clr BIT(CE);	//Standby	
    	nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS_P0, TX_ADR_WIDTH); // Send Address
    	nRF24L01_SPI_Write_Buf(WR_TX_PLOAD, tx_buf, TX_PLOAD_WIDTH); 			 //send data
    //	nRF24L01_SPI_RW_Reg(WRITE_REG + CONFIG, 0x0C);   		 // Send Out
    	PORT3_RF_OUT set BIT(CE);
    	//delay_us(40);
            _NOP();
             _NOP();
    }
    
    
    
    // for pipe 1
    void nRF24L01_TxPacket(unsigned char * tx_buf)
    {
    	PORT3_RF_OUT clr BIT(CE);	//Standby	
    	nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P1, TX_ADDRESS_P1, TX_ADR_WIDTH); // Send Address
    	nRF24L01_SPI_Write_Buf(WR_TX_PLOAD, tx_buf, TX_PLOAD_WIDTH); 			 //send data
    //	nRF24L01_SPI_RW_Reg(WRITE_REG + CONFIG, 0x0C);   		 // Send Out
    	PORT3_RF_OUT set BIT(CE);
    	//delay_us(40);
            _NOP();
             _NOP();
    }
    
    
    
    // for pipe 2
    void nRF24L01_TxPacket(unsigned char * tx_buf)
    {
    	PORT3_RF_OUT clr BIT(CE);	//Standby	
    	nRF24L01_SPI_Write_Buf(WRITE_REG + RX_ADDR_P2, TX_ADDRESS_P2, TX_ADR_WIDTH); // Send Address
    	nRF24L01_SPI_Write_Buf(WR_TX_PLOAD, tx_buf, TX_PLOAD_WIDTH); 			 //send data
    //	nRF24L01_SPI_RW_Reg(WRITE_REG + CONFIG, 0x0C);   		 // Send Out
    	PORT3_RF_OUT set BIT(CE);
    	//delay_us(40);
            _NOP();
             _NOP();
    }
    

    and same for P3,P4 and P5.

    P0 and P1 working fine. But P2-5 was not working.

    Please check my code and let me what mistake i did?

    Thanks, Regards, Krishna.

  • No I don't think so. You can only write 1 byte to RX_ADDR_P2 as shown in page 60 in the spec. Try to write only 0x01 to RX_ADDR_P2.

Related