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?