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

nrf24l01 multiple pipes

Dear Tech support,

I spend couple month with discovering your nice nrd24l01 chip. Most of the things working correctly, but till know I just used two modul as a single PTX and PRX for comunication on pipe 0. Now I wan't to use 3 ptx and one prx. I have red the documentation how I have to give the PTX addresses and the PRX adresses, I try to follow it but somehow It doesn't work. Now the only way to use more PTC with one PRX to use different frequence and change the PRX side the chanel during the listening/ receiving.

I use only 3 byte addresses. Lets see it first:

PTX2 Pipe 1 init not full only the relevant parts:

Code:

unsigned char TX_ADDRESS[3] ={11,11,22} ; unsigned char RX_ADDRESS[3] ={11,11,22} ; rf_write_register(RX_ADDR_P1,RX_ADDRESS,3 ); rf_write_register(TX_ADDR,TX_ADDRESS,3 ); rf_config_register(EN_RXADDR,1<<ERX_P1); v=0x03; rf_config_register(RX_PW_P1,v);

PTX1 Pipe 0 init not full only the relevant parts:

Code:

unsigned char TX_ADDRESS[3] ={11,11,11} ; unsigned char RX_ADDRESS[3] ={11,11,11} ; rf_write_register(RX_ADDR_P0,RX_ADDRESS,3 ); rf_write_register(TX_ADDR,TX_ADDRESS,3 ); rf_config_register(EN_RXADDR,1<<ERX_P0); v=0x03; rf_config_register(RX_PW_P0,v);

PRX Pipe init not full only the relevant parts:

Code:

unsigned char TX_ADDRESS[3] ={11,11,11} ; unsigned char RX_ADDRESS[3] ={11,11,11} ; unsigned char RX_ADDRESS_1 [3] ={11,11,22} ;

rf_write_register(RX_ADDR_P0,RX_ADDRESS,3 ); rf_write_register(RX_ADDR_P1,RX_ADDRESS_1,3 ); rf_write_register(TX_ADDR,TX_ADDRESS,3 ); rf_config_register(EN_RXADDR,1<<ERX_P0); v=0x03 ; rf_config_register(RX_PW_P0,v) ; rf_config_register(RX_PW_P1,v) ;

PRX receivig code only:

Code:

if (IRQ_source !=0 ) //van vett adat ? {

       data=rf_read_payload(3) ; 
     for(i=0;i<3;i++)
     {

uart_sendbyte(data[i]); }

     IRQ_source=0x00 ;

switch (data_pipe) { case 0: { uart_sendbyte(data_pipe); // send pipe number rf_config_register(EN_RXADDR,0x02); //P0 datapipe disable P1 datapipe enable break; } case 1: { uart_sendbyte(data_pipe); rf_config_register(EN_RXADDR,0x01); //P1 datapipe disable P0 datapipe enable break; } default : uart_sendbyte(data_pipe);

}

data_pipe is unsigned char variable global and read during interrupt rutin:

Code:

a=rf_read_register1(STATUS); data_pipe=a; data_pipe=data_pipe&0x0f; data_pipe=data_pipe>>1; //because upper 3 byte valid

My first question when I should enable the pipe 0 and pipe 1.

If I enabled both during initialization comunication never builded up. If I do it on this way the communication also never builded up.

What is the right methode for it?

Parents
  • Hi,

    On your PTX, TX_PIPE and RX_PIPE0 must be equal in order for auto-ACKing feature to work out-of-the-box.

    You can use the same addresses as you're using now, just make sure that PTX1 and PTX2 uses the configuration stated above.

    On the PRX, you do not need to set PIPE0 equal to TX_PIPE. Just set something like this: Pipe0: 0x11,0x11,0x11 Pipe1: 0x11,0x11,0x22 ... Pipe4: 0x25 Pipe5: 0x26

    Note that Pipes 2 to 5 are only one byte deep, as they take the base set in Pipe1. If you look at the datasheet, page 40. Also note that the LSByte in each pipe must be unique.

    Best regards Håkon

  • On the PRX side, the hardware will handle the auto-ACKing, so there's no need to manually update this register (unless you're clearing 'PRIM_RX' in CONFIG-register and becoming a PTX device). You do not need to disable any pipes on the PRX when receiving on multiple pipes. The nRF will give you details on which pipe the payload came from (RX_P_NO in STATUS register). What you'll have to do is to make sure that you check the FIFO_STATUS to see if there's more than one payload in the FIFO.

    Best regards Håkon

Reply
  • On the PRX side, the hardware will handle the auto-ACKing, so there's no need to manually update this register (unless you're clearing 'PRIM_RX' in CONFIG-register and becoming a PTX device). You do not need to disable any pipes on the PRX when receiving on multiple pipes. The nRF will give you details on which pipe the payload came from (RX_P_NO in STATUS register). What you'll have to do is to make sure that you check the FIFO_STATUS to see if there's more than one payload in the FIFO.

    Best regards Håkon

Children
No Data
Related