SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By jeans_love
#32840
the PTX seems work and IRQ interrupt appears.But I can't get the IRQ interrupt on the PRX.Maybe 1/1000 i can find the IRQ ping goes to low,and read the correct data from FiFo.So i think it's weird and i can't get the condition when it happened.I don't konw what's wrong?
void RX_Mode(void)
{
NRF24L01_SPI_P1OUT &= ~NRF24L01_SPI_CE; //Idle ,No data transmit
SPI_RW_Reg(FLUSH_RX,0);
SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS, TX_ADR_LENGTH); // Writes TX_Address to nRF24L01
SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_LENGTH);//RX_Addr0
SPI_RW_Reg(WRITE_REG + EN_AA, 0x00); // disable Auto.Ack:Pipe0
SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01); // Enable Pipe0
SPI_RW_Reg(WRITE_REG + RF_CH, 92); // Select RF channel 40
SPI_RW_Reg(WRITE_REG + RX_PW_P0, TX_PLOAD_WIDTH); // Select same RX payload width as TX Payload width
SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x0f);
SPI_RW_Reg(WRITE_REG + CONFIG, 0x0f);
DelayMs(5);
NRF24L01_SPI_P1OUT |= NRF24L01_SPI_CE;
DelayMs(20);
}

void TX_Mode(void)
{
NRF24L01_SPI_P1OUT &= ~NRF24L01_SPI_CE; //Idle ,No data transmit
SPI_RW_Reg(WRITE_REG + SETUP_AW,0x02);
SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS, TX_ADR_LENGTH); // Writes TX_Address to nRF24L01
SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_LENGTH); // RX_Addr0 same as TX_Adr for Auto.Ack
SPI_Write_Buf(WR_TX_PLOAD, TX_PAYLOAD, TX_PLOAD_WIDTH); // Writes data to TX payload
SPI_RW_Reg(WRITE_REG + EN_AA, 0x00); // Enable Auto.Ack:Pipe0
SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01); // Enable Pipe0
SPI_RW_Reg(WRITE_REG + SETUP_RETR, 0x00); // 500μs + 86μs, 10 retrans
SPI_RW_Reg(WRITE_REG + RF_CH, 92); // Select RF channel 40
SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x0f); // TX_PWR:0dBm, Datarate:2Mbps, LNA:HCURR

SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e); // Set PWR_UP bit, enable CRC(2 bytes) & Prim:TX. MAX_RT & TX_DS enabled
DelayMs(2);
NRF24L01_SPI_P1OUT |= NRF24L01_SPI_CE;
DelayUs(30);
NRF24L01_SPI_P1OUT &= ~NRF24L01_SPI_CE;
}

hookups1534
viewtopic.php?t=6946&highlight=nrf24l01
just like this! :shock:
By lucicop
#32842
From a first view, I see that in RX you are disabling automatic ACK, and in TX you are enabling it. Enabling autoACK enables Enhanced Shockburst mode, which generates a different packet format, so you won't receive anything. You should have the same configuration for this register both at TX and RX.
By jeans_love
#32874
lucicop wrote:From a first view, I see that in RX you are disabling automatic ACK, and in TX you are enabling it. Enabling autoACK enables Enhanced Shockburst mode, which generates a different packet format, so you won't receive anything. You should have the same configuration for this register both at TX and RX.
sorry,wrong remark!it should be "disable auto ack"
By jeans_love
#32875
Oh!I forget "SPI_RW_Reg(WRITE_REG + SETUP_AW,0x02); " on PRX
Now it works well!